本文整理汇总了PHP中Source类的典型用法代码示例。如果您正苦于以下问题:PHP Source类的具体用法?PHP Source怎么用?PHP Source使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Source类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: readParameters
/**
* @see Page::readParameters
*/
public function readParameters()
{
// if there is no user logged in try to get valid logindata
if (!WCF::getUser()->userID && function_exists('getallheaders')) {
if (!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['PHP_AUTH_PW'])) {
$this->authenticate();
} else {
$this->user = new UserSession(null, null, $_SERVER['PHP_AUTH_USER']);
if (!$this->user->checkPassword($_SERVER['PHP_AUTH_PW'])) {
$this->authenticate();
}
}
} else {
$this->user = WCF::getUser();
}
$sourceID = 0;
if (isset($_REQUEST['sourceID'])) {
$sourceID = $_REQUEST['sourceID'];
}
if (isset($_REQUEST['type'])) {
$this->type = StringUtil::trim($_REQUEST['type']);
}
if (!in_array($this->type, $this->validTypes)) {
throw new IllegalLinkException();
}
$this->source = new Source($sourceID);
if (!$this->source->sourceID) {
throw new IllegalLinkException();
}
if (!$this->source->hasAccess($this->user)) {
throw new PermissionDeniedException();
}
}
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:36,代码来源:UpdateServerPage.class.php
示例2: build
/**
* Build the project
* @return void
*/
public function build()
{
$source = new Source($this->_source);
foreach ($source->getFiles() as $file) {
$this->copyFile(str_replace($this->_source, '', $file));
}
}
开发者ID:nimbles,项目名称:Framework,代码行数:11,代码来源:Builder.php
示例3: forecast
/**
* @access public
* @return void
* @depricated
*/
public function forecast()
{
if ($this->_validateRequest() !== False) {
$this->_populate($this->input->post());
$source = new Source($this->_request);
echo json_encode($source->gatherForecast());
exit;
}
}
开发者ID:kukua,项目名称:kukua-dashboard,代码行数:14,代码来源:Sensordata.php
示例4: create
/**
* @param Source $source
* @param $position
* @param $description
* @return Exception
*/
public static function create(Source $source, $position, $description)
{
$location = $source->getLocation($position);
$syntaxError = new self("Syntax Error {$source->name} ({$location->line}:{$location->column}) {$description}\n\n" . self::highlightSourceAtLocation($source, $location));
$syntaxError->source = $source;
$syntaxError->position = $position;
$syntaxError->location = $location;
return $syntaxError;
}
开发者ID:rtuin,项目名称:graphql-php,代码行数:15,代码来源:Exception.php
示例5: readObjects
/**
* @see DatabaseObjectList::readObjects()
*/
public function readObjects()
{
$sql = "SELECT\t\t" . (!empty($this->sqlSelects) ? $this->sqlSelects . ',' : '') . "\n\t\t\t\t\tsource.*\n\t\t\tFROM\t\tpb" . PB_N . "_source source\n\t\t\t" . $this->sqlJoins . "\n\t\t\t" . (!empty($this->sqlConditions) ? "WHERE " . $this->sqlConditions : '') . "\n\t\t\t" . (!empty($this->sqlOrderBy) ? "ORDER BY " . $this->sqlOrderBy : '');
$result = WCF::getDB()->sendQuery($sql, $this->sqlLimit, $this->sqlOffset);
while ($row = WCF::getDB()->fetchArray($result)) {
$source = new Source(null, $row);
if (!$this->hasAccessCheck || $source->hasAccess()) {
$this->sources[] = $source;
}
}
}
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:14,代码来源:SourceList.class.php
示例6: setup_edit
function setup_edit()
{
$l = new Source();
$l->setFromRequest();
$ret = $l;
if ($l->source_id != '' && $l->source_id > 0) {
$dao = getSourceDAO();
$dao->getSources($l);
if ($l->numResults > 0) {
$ret = $l->results[0];
}
}
return $ret;
}
开发者ID:redbugz,项目名称:rootstech2013,代码行数:14,代码来源:editForm.php
示例7: readParameters
/**
* @see Page::readParameters()
*/
public function readParameters()
{
$sourceID = 0;
if (isset($_GET['sourceID'])) {
$sourceID = $_GET['sourceID'];
}
$this->source = new Source($sourceID);
if (!$this->source->sourceID) {
throw new IllegalLinkException();
}
if (!$this->source->hasAccess()) {
throw new PermissionDeniedException();
}
}
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:17,代码来源:SourceViewPage.class.php
示例8: readParameters
/**
* @see Action::readParameters()
*/
public function readParameters()
{
parent::readParameters();
if (isset($_POST['filename'])) {
$this->filename = StringUtil::trim($_POST['filename']);
}
if (isset($_POST['saveSelection'])) {
$this->saveSelection = true;
}
if (isset($_POST['sourceID'])) {
$this->sourceID = intval($_POST['sourceID']);
}
if (isset($_POST['wcfSetupResource'])) {
$this->wcfSetupResource = StringUtil::trim($_POST['wcfSetupResource']);
// override package name if building WCFSetup
$this->filename = 'pn';
}
$this->source = new Source($this->sourceID);
if (!$this->source->sourceID) {
throw new IllegalLinkException();
}
if (!$this->source->hasAccess()) {
throw new PermissionDeniedException();
}
// read selected resources
$this->readPackageSelection();
// handle current directory resource
$sourceData = WCF::getSession()->getVar('source' . $this->source->sourceID);
if ($sourceData === null) {
throw new SystemException('Resource directory missing');
}
$sourceData = unserialize($sourceData);
$this->directory = $sourceData['directory'];
}
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:37,代码来源:BuildPackageAction.class.php
示例9: withAuthors
public function withAuthors()
{
if ($this->id) {
$this->authors = Source::getInstance()->getAllAuthors($this->id);
}
return $this;
}
开发者ID:krivov,项目名称:testBookCatalog,代码行数:7,代码来源:Book.php
示例10: __construct
public function __construct($type, $args)
{
parent::__construct($type, $args);
if (!isset($args['db-name'])) {
throw new Exception('DB Source requires a db-name to be set');
}
}
开发者ID:sickhye,项目名称:mysql-dbcompare,代码行数:7,代码来源:Source.php
示例11: getSqlStatement
private static function getSqlStatement($manual)
{
$bulk = array(array(null, Source::get_by_shortName('MDN'), '2007-09-15'), array(null, Source::get_by_shortName('Petro-Sedim'), null), array(null, Source::get_by_shortName('GTA'), null), array(null, Source::get_by_shortName('DCR2'), null), array(null, Source::get_by_shortName('DOR'), null), array(User::get_by_nick('siveco'), null, null), array(User::get_by_nick('RACAI'), null, null));
$conditions = array();
foreach ($bulk as $tuple) {
$parts = array();
if ($tuple[0]) {
$parts[] = "(userId = {$tuple[0]->id})";
}
if ($tuple[1]) {
$parts[] = "(sourceId = {$tuple[1]->id})";
}
if ($tuple[2]) {
$parts[] = "(left(from_unixtime(createDate), 10) = '{$tuple[2]}')";
}
$conditions[] = '(' . implode(' and ', $parts) . ')';
}
$clause = '(' . implode(' or ', $conditions) . ')';
if ($manual) {
$clause = "not {$clause}";
}
$statusClause = util_isModerator(PRIV_VIEW_HIDDEN) ? sprintf("status in (%d,%d)", ST_ACTIVE, ST_HIDDEN) : sprintf("status = %d", ST_ACTIVE);
$query = "select nick, count(*) as NumDefinitions, sum(length(internalRep)) as NumChars, max(createDate) as Timestamp \n from Definition, User \n where userId = User.id \n and {$statusClause}\n and {$clause} group by nick";
return $query;
}
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:25,代码来源:TopEntry.php
示例12: __construct
/**
* Create Sass source associated with given string
*
* @param $context Context Context
* @param $source string Sass source code
* @param $modifiedTime int Last modified time (unix timestamp)
* @param $humanName string|null Human-readable description (used for debugging)
*/
public function __construct(Context $context, $source, $modifiedTime, $humanName = null)
{
parent::__construct($context);
$this->rawSource = $source;
$this->rawModifiedTime = $modifiedTime;
$this->humanName = $humanName;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:15,代码来源:StringSource.class.php
示例13: getSqlStatement
private static function getSqlStatement($manual)
{
/*
* nick source (short) createDate 1:ratio (3-> 33%, 4 -> 25%)
*/
$bulk = array(array(null, "MDN '00", " = '2007-09-15'", null), array(null, 'Petro-Sedim', null, null), array(null, 'GTA', null, null), array(null, 'DCR2', null, null), array(null, 'DOR', null, null), array('raduborza', 'DOOM 2', " > '2013-01-01'", 4), array(null, 'DRAM', null, null), array('siveco', null, null, null), array('RACAI', null, null, null));
$conditions = array();
foreach ($bulk as $tuple) {
$parts = array();
if ($tuple[0]) {
$user = User::get_by_nick($tuple[0]);
$parts[] = "(userId = {$user->id})";
}
if ($tuple[1]) {
$src = Source::get_by_shortName($tuple[1]);
$parts[] = "(sourceId = {$src->id})";
}
if ($tuple[2]) {
$parts[] = "(left(from_unixtime(createDate), 10)" . $tuple[2] . ")";
}
if ($tuple[3]) {
$parts[] = "(Definition.id%{$tuple[3]}!=0)";
}
$conditions[] = '(' . implode(' and ', $parts) . ')';
}
$clause = '(' . implode(' or ', $conditions) . ')';
if ($manual) {
$clause = "not {$clause}";
}
$statusClause = util_isModerator(PRIV_VIEW_HIDDEN) ? sprintf("status in (%d,%d)", ST_ACTIVE, ST_HIDDEN) : sprintf("status = %d", ST_ACTIVE);
$query = "select nick, count(*) as NumDefinitions, sum(length(internalRep)) as NumChars, max(createDate) as Timestamp \n from Definition, User \n where userId = User.id \n and {$statusClause}\n and {$clause} group by nick";
return $query;
}
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:33,代码来源:TopEntry.php
示例14: convertTree
/**
* Convert a tree produced by the tree editor to the format used by loadTree.
* We need this in case validation fails and we cannot save the tree, so we need to display it again.
**/
static function convertTree($meanings)
{
$meaningStack = array();
$results = array();
foreach ($meanings as $tuple) {
$row = array();
$m = $tuple->id ? self::get_by_id($tuple->id) : Model::factory('Meaning')->create();
$m->internalRep = $tuple->internalRep;
$m->htmlRep = AdminStringUtil::htmlize($m->internalRep, 0);
$m->internalEtymology = $tuple->internalEtymology;
$m->htmlEtymology = AdminStringUtil::htmlize($m->internalEtymology, 0);
$m->internalComment = $tuple->internalComment;
$m->htmlComment = AdminStringUtil::htmlize($m->internalComment, 0);
$row['meaning'] = $m;
$row['sources'] = Source::loadByIds(StringUtil::explode(',', $tuple->sourceIds));
$row['tags'] = MeaningTag::loadByIds(StringUtil::explode(',', $tuple->meaningTagIds));
$row['relations'] = Relation::loadRelatedLexems($tuple->relationIds);
$row['children'] = array();
if ($tuple->level) {
$meaningStack[$tuple->level - 1]['children'][] =& $row;
} else {
$results[] =& $row;
}
$meaningStack[$tuple->level] =& $row;
unset($row);
}
return $results;
}
开发者ID:florinp,项目名称:dexonline,代码行数:32,代码来源:Meaning.php
示例15: addDigg
public function addDigg($feedId, $uid)
{
$data["feedid"] = $feedId;
$data["uid"] = $uid;
$data["uid"] = !$data["uid"] ? Ibos::app()->user->uid : $data["uid"];
if (!$data["uid"]) {
$this->addError("addDigg", "未登录不能赞");
return false;
}
$isExit = $this->getIsExists($feedId, $uid);
if ($isExit) {
$this->addError("addDigg", "你已经赞过");
return false;
}
$data["ctime"] = time();
$res = $this->add($data);
if ($res) {
$feed = Source::getSourceInfo("feed", $feedId);
Feed::model()->updateCounters(array("diggcount" => 1), "feedid = " . $feedId);
Feed::model()->cleanCache($feedId);
$user = User::model()->fetchByUid($uid);
$config["{user}"] = $user["realname"];
$config["{sourceContent}"] = StringUtil::filterCleanHtml($feed["source_body"]);
$config["{sourceContent}"] = str_replace("◆", "", $config["{sourceContent}"]);
$config["{sourceContent}"] = StringUtil::cutStr($config["{sourceContent}"], 34);
$config["{url}"] = $feed["source_url"];
$config["{content}"] = Ibos::app()->getController()->renderPartial("application.modules.message.views.remindcontent", array("recentFeeds" => Feed::model()->getRecentFeeds()), true);
Notify::model()->sendNotify($feed["uid"], "message_digg", $config);
UserUtil::updateCreditByAction("diggweibo", $uid);
UserUtil::updateCreditByAction("diggedweibo", $feed["uid"]);
}
return $res;
}
开发者ID:AxelPanda,项目名称:ibos,代码行数:33,代码来源:FeedDigg.php
示例16: refresh_cache
/**
* Static function to refresh src_org_cache from src_org
*
* @param Source|src_id|src_uuid $source
* @return int number of rows cached
*/
public static function refresh_cache($source)
{
$conn = AIR2_DBManager::get_master_connection();
// get the src_id
$src_id;
if (is_numeric($source)) {
$src_id = $source;
} elseif (is_string($source)) {
$q = 'select src_id from source where src_uuid = ?';
$src_id = $conn->fetchOne($q, array($source), 0);
} elseif (is_object($source)) {
$src_id = $source->src_id;
}
// sanity!
if (!$src_id) {
Carper::carp("Source !exists");
return;
}
// delete all src_org_cache recs for this source
$conn->execute("delete from src_org_cache where soc_src_id = {$src_id}");
// array of org_id => status
$org_status = Source::get_authz_status($src_id);
// bulk-insert
$vals = array();
foreach ($org_status as $org_id => $status) {
$vals[] = "({$src_id},{$org_id},'{$status}')";
}
if (count($vals)) {
$vals = implode(',', $vals);
$stmt = "insert into src_org_cache (soc_src_id, soc_org_id, soc_status)";
$conn->execute("{$stmt} values {$vals}");
}
return count($vals);
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:40,代码来源:SrcOrgCache.php
示例17: actionIndex
public function actionIndex()
{
$shareInfo["sid"] = intval(EnvUtil::getRequest("sid"));
$shareInfo["stable"] = StringUtil::filterCleanHtml(EnvUtil::getRequest("stable"));
$shareInfo["initHTML"] = StringUtil::filterDangerTag(EnvUtil::getRequest("initHTML"));
$shareInfo["curid"] = StringUtil::filterCleanHtml(EnvUtil::getRequest("curid"));
$shareInfo["curtable"] = StringUtil::filterCleanHtml(EnvUtil::getRequest("curtable"));
$shareInfo["module"] = StringUtil::filterCleanHtml(EnvUtil::getRequest("module"));
$shareInfo["isrepost"] = intval(EnvUtil::getRequest("isrepost"));
if (empty($shareInfo["stable"]) || empty($shareInfo["sid"])) {
echo "类型和资源ID不能为空";
exit;
}
if (!($oldInfo = Source::getSourceInfo($shareInfo["stable"], $shareInfo["sid"], false, $shareInfo["module"]))) {
echo "此信息不可以被转发";
exit;
}
empty($shareInfo["module"]) && ($shareInfo["module"] = $oldInfo["module"]);
if (empty($shareInfo["initHTML"]) && !empty($shareInfo["curid"])) {
if ($shareInfo["curid"] != $shareInfo["sid"] && $shareInfo["isrepost"] == 1) {
$curInfo = Source::getSourceInfo($shareInfo["curtable"], $shareInfo["curid"], false, "weibo");
$userInfo = $curInfo["source_user_info"];
$shareInfo["initHTML"] = " //@" . $userInfo["realname"] . ":" . $curInfo["source_content"];
$shareInfo["initHTML"] = str_replace(array("\n", "\r"), array("", ""), $shareInfo["initHTML"]);
}
}
$shareInfo["shareHtml"] = !empty($oldInfo["shareHtml"]) ? $oldInfo["shareHtml"] : "";
$data = array("shareInfo" => $shareInfo, "oldInfo" => $oldInfo);
$this->renderPartial("index", $data);
}
开发者ID:AxelPanda,项目名称:ibos,代码行数:30,代码来源:ShareController.php
示例18: execute
/**
* @see Action::execute()
*/
public function execute()
{
// call execute event
parent::execute();
if ($this->source->enableCheckout && $this->checkoutRepository) {
// load scm driver
$className = ucfirst(Source::validateSCM($this->source->scm));
// check out repository
require_once WCF_DIR . 'lib/system/scm/' . $className . '.class.php';
call_user_func(array($className, 'checkout'), $this->source->url, $this->source->sourceDirectory, array('username' => $this->source->username, 'password' => $this->source->password));
// set revision
$revision = $this->source->getHeadRevision();
$this->source->update(null, null, null, null, null, null, null, $revision);
}
// rebuild package data if requested
if ($this->rebuildPackageData) {
require_once PB_DIR . 'lib/system/package/PackageHelper.class.php';
PackageHelper::readPackages($this->source);
}
// call executed event
$this->executed();
// forward
HeaderUtil::redirect('index.php?page=SourceView&sourceID=' . $this->source->sourceID . SID_ARG_2ND_NOT_ENCODED);
exit;
}
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:28,代码来源:CheckoutAction.class.php
示例19: _make_linguistic_object
public function _make_linguistic_object($fieldsAndValues)
{
$logger = Logger::getLogger('LinguisticObjects.makeLinguisticObject');
$logger->debug("\$fieldsAndValues= " . print_r($fieldsAndValues, TRUE));
$type = $fieldsAndValues['type'];
$logger->debug("type= {$type}");
$obj = NULL;
if ($type == 'n' || $type == 'a' || $type == 'e' || $type == 'c') {
$obj = new NounRoot($fieldsAndValues);
array_push(self::$rootIDs, $obj->id());
} elseif ($type == 'v') {
$obj = new VerbRoot($fieldsAndValues);
array_push(self::$rootIDs, $obj->id());
} elseif ($type == 's') {
$obj = new Source($fieldsAndValues);
array_push(self::$sourceIDs, $obj->id());
} elseif ($type == 'sn' || $type == 'sv' || $type == 'q') {
$obj = new Suffix($fieldsAndValues);
array_push(self::$affixIDs, $obj->id());
} elseif ($type == 'tn') {
$obj = new NounEnding($fieldsAndValues);
array_push(self::$affixIDs, $obj->id());
} elseif ($type == 'tv') {
$obj = new VerbEnding($fieldsAndValues);
array_push(self::$affixIDs, $obj->id());
} elseif ($type == 'vw') {
$obj = new VerbWord($fieldsAndValues);
self::$verbWords[$object->getVerb()] = $obj;
} elseif ($type == 'pr') {
$obj = new Pronoun($fieldsAndValues);
array_push(self::$rootIDs, $obj->id());
} elseif ($type == 'pd' || $type == 'ad') {
$obj = new Demonstrative($fieldsAndValues);
array_push(self::$rootIDs, $obj->id());
$roots = explode(' ', $obj->get_root());
foreach ($roots as $a_root) {
$newFieldsAndValues = $fieldsAndValues;
$newFieldsAndValues['morpheme'] = $a_root;
$newFieldsAndValues['root'] = $a_root;
$new_obj = new Demonstrative($newFieldsAndValues);
array_push(self::$rootIDs, $new_obj->id());
}
} else {
$logger->debug("type '{$type}' not supported yet");
}
return $obj;
}
开发者ID:nrc-cnrc,项目名称:InuktitutToolkit,代码行数:47,代码来源:InuktitutLinguisticModel.php
示例20: get_id_from_gedcom
static function &getInstance($data, $simple = true)
{
global $gedcom_record_cache, $GEDCOM, $pgv_changes;
if (is_array($data)) {
$ged_id = $data['ged_id'];
$pid = $data['xref'];
} else {
$ged_id = get_id_from_gedcom($GEDCOM);
$pid = $data;
}
// Check the cache first
if (isset($gedcom_record_cache[$pid][$ged_id])) {
return $gedcom_record_cache[$pid][$ged_id];
}
// Look for the record in the database
if (!is_array($data)) {
$data = fetch_source_record($pid, $ged_id);
// If we didn't find the record in the database, it may be remote
if (!$data && strpos($pid, ':')) {
list($servid, $remoteid) = explode(':', $pid);
$service = ServiceClient::getInstance($servid);
if ($service) {
// TYPE will be replaced with the type from the remote record
$data = $service->mergeGedcomRecord($remoteid, "0 @{$pid}@ TYPE\n1 RFN {$pid}", false);
}
}
// If we didn't find the record in the database, it may be new/pending
if (!$data && PGV_USER_CAN_EDIT && isset($pgv_changes[$pid . '_' . $GEDCOM])) {
$data = find_updated_record($pid);
$fromfile = true;
}
// If we still didn't find it, it doesn't exist
if (!$data) {
return null;
}
}
// Create the object
$object = new Source($data, $simple);
if (!empty($fromfile)) {
$object->setChanged(true);
}
// Store it in the cache
$gedcom_record_cache[$object->xref][$object->ged_id] =& $object;
//-- also store it using its reference id (sid:pid and local gedcom for remote links)
$gedcom_record_cache[$pid][$ged_id] =& $object;
return $object;
}
开发者ID:bitweaver,项目名称:phpgedview,代码行数:47,代码来源:class_source.php
注:本文中的Source类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论