当前位置: 首页>>代码示例>>PHP>>正文


PHP Finder::instance方法代码示例

本文整理汇总了PHP中Finder::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Finder::instance方法的具体用法?PHP Finder::instance怎么用?PHP Finder::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Finder的用法示例。


在下文中一共展示了Finder::instance方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: set_filename

 public function set_filename($file)
 {
     // set find_file's one-time-only search paths
     \Finder::instance()->flash($this->request_paths);
     $is_pjax = Input::server('HTTP_X_PJAX') or Input::get('_pjax');
     // Check if this request is being made by PJAX
     if ($is_pjax) {
         $pjax_file = explode('.', $file);
         $pjax_file = $pjax_file[0] . Config::get('pjax.file', '-pjax');
         // locate the pjax view file
         if (($path = \Finder::search('views', $pjax_file, '.' . $this->extension, false, false)) !== false) {
             $this->pjax_file_loaded = true;
         } else {
             // PJAX file not found, carry on looking for normal view file
             if (($path = \Finder::search('views', $file, '.' . $this->extension, false, false)) === false) {
                 throw new \FuelException('The requested view could not be found: ' . \Fuel::clean_path($file));
             }
         }
         Log::info('Pjax\\View::forge - loaded WITH PJAX: ' . $path);
     } else {
         // locate the view file
         if (($path = \Finder::search('views', $file, '.' . $this->extension, false, false)) === false) {
             throw new \FuelException('The requested view could not be found: ' . \Fuel::clean_path($file));
         }
         Log::info('Pjax\\View::forge - loaded WITHOUT PJAX: ' . $path);
     }
     // Store the file path locally
     $this->file_name = $path;
     return $this;
 }
开发者ID:rcrowe,项目名称:fuel-pjax,代码行数:30,代码来源:view.php

示例2: process_form

 private function process_form()
 {
     $domain = Request::getPost('domain');
     if (strlen($domain) < 1) {
         return;
     }
     $this->set_body('form_success', true);
     $url = CrawlerURL::instance($domain);
     $domain = $url->getDomain();
     $link = "{$domain}/";
     $domainObject = Finder::instance('Domain')->setNameFilter($domain)->getDomain();
     if (!$domainObject) {
         $domainObject = Mutator::instance('Domain', 'Create')->setData($domain)->execute();
     }
     $linkObject = Finder::instance('Link')->setNameFilter($link)->getLink();
     if (!$linkObject) {
         $linkObject = Mutator::instance('Link', 'Create')->setData($link)->execute();
     }
     $crawlSiteQueueObject = Finder::instance('CrawlSiteQueue')->setDomainFilter($domainObject->getID())->setStatusFilter(CrawlSiteQueue::$IS_UNCRAWLED)->getCrawlSiteQueue();
     if (!$crawlSiteQueueObject) {
         Mutator::instance('CrawlSiteQueue', 'Create')->setData($domainObject, CrawlSiteQueue::$IS_UNCRAWLED)->execute();
     }
     $crawlPageQueueObject = Finder::instance('CrawlPageQueue')->setDomainFilter($domainObject->getID())->setLinkFilter($linkObject->getID())->setStatusFilter(CrawlPageQueue::$IS_UNCRAWLED)->getCrawlPageQueue();
     if (!$crawlPageQueueObject) {
         Mutator::instance('CrawlPageQueue', 'Create')->setData($domainObject, $linkObject, CrawlPageQueue::$IS_UNCRAWLED)->execute();
     }
 }
开发者ID:jacobemerick,项目名称:crawler,代码行数:27,代码来源:HomeController.class.inc.php

示例3: getDomain

 public function getDomain()
 {
     if (!isset($this->domain)) {
         $domain = Finder::instance('Domain')->setNameFilter($this->site)->getDomain();
         if (!$domain) {
             trigger_error("CrawlerSite tried to pull an invalid domain {$this->site}!");
         }
         $this->domain = $domain;
     }
     return $this->domain;
 }
开发者ID:jacobemerick,项目名称:crawler,代码行数:11,代码来源:CrawlerSite.class.inc.php

示例4: set_filename

 /**
  * Sets the view filename.
  *
  *     $view->set_filename($file);
  *
  * @param   string  view filename
  * @return  View
  * @throws  FuelException
  */
 public function set_filename($file)
 {
     // set find_file's one-time-only search paths
     \Finder::instance()->flash($this->request_paths);
     // locate the view file
     if (($path = \Finder::search('views', $file, '.' . $this->extension, false, false)) === false) {
         throw new \FuelException('The requested view could not be found: ' . \Fuel::clean_path($file));
     }
     // Store the file path locally
     $this->file_name = $path;
     return $this;
 }
开发者ID:quickpacket,项目名称:noclayer,代码行数:21,代码来源:view.php

示例5: unload

 /**
  * Unloads a package from the stack.
  *
  * @param string $pacakge
  *        	The package name
  * @return void
  */
 public static function unload($package)
 {
     \Finder::instance()->remove_path(static::$packages[$package]);
     unset(static::$packages[$package]);
 }
开发者ID:vienbk91,项目名称:fuelphp17,代码行数:12,代码来源:package.php

示例6: finish

 /**
  * Cleans up Fuel execution, ends the output buffering, and outputs the
  * buffer contents.
  *
  * @access public
  * @return void
  */
 public static function finish()
 {
     if (\Config::get('caching', false)) {
         \Finder::instance()->write_cache('FuelFileFinder');
     }
     if (static::$profiling and !static::$is_cli and !\Input::is_ajax()) {
         // Grab the output buffer and flush it, we will rebuffer later
         $output = ob_get_clean();
         $headers = headers_list();
         $show = true;
         foreach ($headers as $header) {
             if (stripos($header, 'content-type') === 0 and stripos($header, 'text/html') === false) {
                 $show = false;
             }
         }
         if ($show) {
             \Profiler::mark('End of Fuel Execution');
             if (preg_match("|</body>.*?</html>|is", $output)) {
                 $output = preg_replace("|</body>.*?</html>|is", '', $output);
                 $output .= \Profiler::output();
                 $output .= '</body></html>';
             } else {
                 $output .= \Profiler::output();
             }
         }
         // Restart the output buffer and send the new output
         ob_start();
         echo $output;
     }
 }
开发者ID:vienbk91,项目名称:fuelphp17,代码行数:37,代码来源:fuel.php

示例7: gatherPathData

 public function gatherPathData()
 {
     $this->output['paths'] = \Finder::instance()->paths();
     $this->output['pathTotals'] = array('count' => count($this->output['paths']));
 }
开发者ID:SainsburysTests,项目名称:sainsburys,代码行数:5,代码来源:phpquickprofiler.php

示例8: _discover_tasks

 /**
  * Find all of the task classes in the system and use reflection to discover the
  * commands we can call.
  *
  * @return array $taskname => array($taskmethods)
  **/
 protected static function _discover_tasks()
 {
     $result = array();
     $files = \Finder::instance()->list_files('tasks');
     if (count($files) > 0) {
         foreach ($files as $file) {
             $task_name = str_replace('.php', '', basename($file));
             $class_name = '\\Fuel\\Tasks\\' . $task_name;
             require $file;
             $reflect = new \ReflectionClass($class_name);
             // Ensure we only pull out the public methods
             $methods = $reflect->getMethods(\ReflectionMethod::IS_PUBLIC);
             $result[$task_name] = array();
             if (count($methods) > 0) {
                 foreach ($methods as $method) {
                     strpos($method->name, '_') !== 0 and $result[$task_name][] = $method->name;
                 }
             }
         }
     }
     return $result;
 }
开发者ID:ClixLtd,项目名称:pccupload,代码行数:28,代码来源:refine.php

示例9: save

 public function save()
 {
     $domain = Finder::instance('Domain')->setNameFilter($this->crawlerURL->getDomain())->getDomain();
     if (!isset($domain)) {
         $domain = Mutator::instance('Domain', 'Create')->setData($this->crawlerURL->getDomain())->execute();
     }
     $link = Finder::instance('Link')->setNameFilter($this->crawlerURL->getAbsoluteURL())->getLink();
     if (!isset($link)) {
         $link = Mutator::instance('Link', 'Create')->setData($this->crawlerURL->getAbsoluteURL())->execute();
     }
     $metaTitle = Finder::instance('MetaTitle')->setNameFilter($this->getMetaTitle())->getMetaTitle();
     if (!isset($metaTitle)) {
         $metaTitle = Mutator::instance('MetaTitle', 'Create')->setData($this->getMetaTitle())->execute();
     }
     $metaDescription = Finder::instance('MetaDescription')->setNameFilter($this->getMetaDescription())->getMetaDescription();
     if (!isset($metaDescription)) {
         $metaDescription = Mutator::instance('MetaDescription', 'Create')->setData($this->getMetaDescription())->execute();
     }
     $contentPage = Finder::instance('ContentPage')->setNameFilter($this->getContentPage())->getContentPage();
     if (!isset($contentPage)) {
         $contentPage = Mutator::instance('ContentPage', 'Create')->setData($this->getContentPage())->execute();
     }
     $page = Finder::instance('Page')->setDomainFilter($domain->getID())->setLinkFilter($link->getID())->setMetaTitleFilter($metaTitle->getID())->setMetaDescriptionFilter($metaDescription->getID())->setMetaRedirectFilter($this->hasMetaRedirect())->setContentPageFilter($contentPage->getID())->setHTTPCodeFilter($this->getHTTPCode())->getPage();
     if (!isset($page)) {
         $page = Mutator::instance('Page', 'Create')->setData($domain, $link, $metaTitle, $metaDescription, $this->hasMetaRedirect(), $contentPage, $this->getHTTPCode(), $this->getDateAccessed())->execute();
     }
     $this->page = $page;
     foreach ($this->getContentH1s() as $contentH1) {
         $contentH1Object = Finder::instance('ContentH1')->setNameFilter($contentH1)->getContentH1();
         if (!isset($contentH1Object)) {
             $contentH1Object = Mutator::instance('ContentH1', 'Create')->setData($contentH1)->execute();
         }
         $pageContentH1Map = Mutator::instance('PageContentH1Map', 'Create')->setData($page, $contentH1Object)->execute();
     }
     foreach ($this->getContentImages() as $image) {
         $contentImageSource = Finder::instance('ContentImageSource')->setNameFilter($image->source)->getContentImageSource();
         if (!isset($contentImageSource)) {
             $contentImageSource = Mutator::instance('ContentImageSource', 'Create')->setData($image->source)->execute();
         }
         $pageContentImageSourceMap = Finder::instance('PageContentImageSourceMap')->setPageFilter($page->getID())->setContentImageSourceFilter($contentImageSource->getID())->getPageContentImageSourceMap();
         if (!$pageContentImageSourceMap) {
             $pageContentImageSourceMap = Mutator::instance('PageContentImageSourceMap', 'Create')->setData($page, $contentImageSource)->execute();
         }
         if (strlen($image->alternate_text) > 0) {
             $contentImageAlternateText = Finder::instance('ContentImageAlternateText')->setNameFilter($image->alternate_text)->getContentImageAlternateText();
             if (!isset($contentImageAlternateText)) {
                 $contentImageAlternateText = Mutator::instance('ContentImageAlternateText', 'Create')->setData($image->alternate_text)->execute();
             }
             $contentImageSourceContentImageAlternateTextMap = Finder::instance('ContentImageSourceContentImageAlternateTextMap')->setContentImageSourceFilter($contentImageSource->getID())->setContentImageAlternateTextFilter($contentImageAlternateText->getID())->getContentImageSourceContentImageAlternateTextMap();
             if (!isset($contentImageSourceContentImageAlternateTextMap)) {
                 $contentImageSourceContentImageAlternateTextMap = Mutator::instance('ContentImageSourceContentImageAlternateTextMap', 'Create')->setData($contentImageSource, $contentImageAlternateText)->execute();
             }
         }
     }
     foreach ($this->get_links() as $crawlerLink) {
         if (!$crawlerLink->isContentLink()) {
             continue;
         }
         $link = Finder::instance('Link')->setNameFilter($crawlerLink->getAbsoluteURL())->getLink();
         if (!isset($link)) {
             $link = Mutator::instance('Link', 'Create')->setData($crawlerLink->getAbsoluteURL())->execute();
         }
         $host = $domain->getName();
         $host = str_replace('http://', '', $host);
         $pageLinkMap = Finder::instance('PageLinkMap')->setPageFilter($page->getID())->setLinkFilter($link->getID())->setInternalLinkFilter($crawlerLink->isInternalLink($host))->getPageLinkMap();
         if (!$pageLinkMap) {
             $pageLinkMap = Mutator::instance('PageLinkMap', 'Create')->setData($page, $link, $crawlerLink->isInternalLink($host))->execute();
         }
     }
     foreach ($this->getMetaKeywords() as $metaKeyword) {
         $keyword = Finder::instance('MetaKeyword')->setNameFilter($metaKeyword)->getMetaKeyword();
         if (!isset($keyword)) {
             $keyword = Mutator::instance('MetaKeyword', 'Create')->setData($metaKeyword)->execute();
         }
         $pageKeywordMap = Finder::instance('PageMetaKeywordMap')->setPageFilter($page->getID())->setMetaKeywordFilter($keyword->getID())->getPageMetaKeywordMap();
         if (!$pageKeywordMap) {
             $pageKeywordMap = Mutator::instance('PageMetaKeywordMap', 'Create')->setData($page, $keyword)->execute();
         }
     }
 }
开发者ID:jacobemerick,项目名称:crawler,代码行数:80,代码来源:CrawlerPage.class.inc.php

示例10: set_filename

 /**
  * Sets the view filename.
  *
  *     $view->set_filename($file);
  *
  * @param   string  view filename
  * @return  View
  * @throws  FuelException
  */
 public function set_filename($file)
 {
     // strip the extension from it
     $pathinfo = pathinfo($file);
     if (!empty($pathinfo['extension'])) {
         $this->extension = $pathinfo['extension'];
         $file = substr($file, 0, strlen($this->extension) * -1 - 1);
     }
     // set find_file's one-time-only search paths
     \Finder::instance()->flash($this->request_paths);
     // locate the view file
     if (($path = \Finder::search('views', $file, '.' . $this->extension, false, false)) === false) {
         throw new \FuelException('The requested view could not be found: ' . \Fuel::clean_path($file) . '.' . $this->extension);
     }
     // Store the file path locally
     $this->file_name = $path;
     return $this;
 }
开发者ID:socialskeptic,项目名称:sainsburys,代码行数:27,代码来源:view.php

示例11: get_paths

 /**
  * Returns the array of currently loaded search paths.
  *
  * @return  array  the array of paths
  */
 public static function get_paths()
 {
     logger(\Fuel::L_WARNING, 'This method is deprecated.  Please use a Finder::instance()->paths() instead.', __METHOD__);
     return \Finder::instance()->paths();
 }
开发者ID:phabos,项目名称:fuel-core,代码行数:10,代码来源:fuel.php


注:本文中的Finder::instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。