当前位置: 首页>>代码示例>>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;未经允许,请勿转载。