當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Source類代碼示例

本文整理匯總了PHP中Source的典型用法代碼示例。如果您正苦於以下問題:PHP Source類的具體用法?PHP Source怎麽用?PHP Source使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Source類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的Source類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。