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


PHP Utils::isAdminPlugin方法代碼示例

本文整理匯總了PHP中Grav\Common\Utils::isAdminPlugin方法的典型用法代碼示例。如果您正苦於以下問題:PHP Utils::isAdminPlugin方法的具體用法?PHP Utils::isAdminPlugin怎麽用?PHP Utils::isAdminPlugin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Grav\Common\Utils的用法示例。


在下文中一共展示了Utils::isAdminPlugin方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: isAdmin

 /**
  * Determine if this is running under the admin
  *
  * @return bool
  */
 public function isAdmin()
 {
     return Utils::isAdminPlugin();
 }
開發者ID:indigo423,項目名稱:blog.no42.org,代碼行數:9,代碼來源:Plugin.php

示例2: header

 /**
  * Gets and Sets the header based on the YAML configuration at the top of the .md file
  *
  * @param  object|array $var a YAML object representing the configuration for the file
  *
  * @return object      the current YAML configuration
  */
 public function header($var = null)
 {
     if ($var) {
         $this->header = (object) $var;
         // Update also file object.
         $file = $this->file();
         if ($file) {
             $file->header((array) $var);
         }
         // Force content re-processing.
         $this->id(time() . md5($this->filePath()));
     }
     if (!$this->header) {
         $file = $this->file();
         if ($file) {
             // Set some options
             $file->settings(['native' => true, 'compat' => true]);
             try {
                 $this->raw_content = $file->markdown();
                 $this->frontmatter = $file->frontmatter();
                 $this->header = (object) $file->header();
                 if (!Utils::isAdminPlugin()) {
                     // Process frontmatter with Twig if enabled
                     if (Grav::instance()['config']->get('system.pages.frontmatter.process_twig') === true) {
                         $this->processFrontmatter();
                     }
                     // If there's a `frontmatter.yaml` file merge that in with the page header
                     // note page's own frontmatter has precedence and will overwrite any defaults
                     $frontmatter_file = $this->path . '/' . $this->folder . '/frontmatter.yaml';
                     if (file_exists($frontmatter_file)) {
                         $frontmatter_data = (array) Yaml::parse(file_get_contents($frontmatter_file));
                         $this->header = (object) array_replace_recursive($frontmatter_data, (array) $this->header);
                     }
                 }
             } catch (ParseException $e) {
                 $file->raw(Grav::instance()['language']->translate(['FRONTMATTER_ERROR_PAGE', $this->slug(), $file->filename(), $e->getMessage(), $file->raw()]));
                 $this->raw_content = $file->markdown();
                 $this->frontmatter = $file->frontmatter();
                 $this->header = (object) $file->header();
             }
             $var = true;
         }
     }
     if ($var) {
         if (isset($this->header->slug)) {
             $this->slug($this->header->slug);
         }
         if (isset($this->header->routes)) {
             $this->routes = (array) $this->header->routes;
         }
         if (isset($this->header->title)) {
             $this->title = trim($this->header->title);
         }
         if (isset($this->header->language)) {
             $this->language = trim($this->header->language);
         }
         if (isset($this->header->template)) {
             $this->template = trim($this->header->template);
         }
         if (isset($this->header->menu)) {
             $this->menu = trim($this->header->menu);
         }
         if (isset($this->header->routable)) {
             $this->routable = (bool) $this->header->routable;
         }
         if (isset($this->header->visible)) {
             $this->visible = (bool) $this->header->visible;
         }
         if (isset($this->header->redirect)) {
             $this->redirect = trim($this->header->redirect);
         }
         if (isset($this->header->external_url)) {
             $this->external_url = trim($this->header->external_url);
         }
         if (isset($this->header->order_dir)) {
             $this->order_dir = trim($this->header->order_dir);
         }
         if (isset($this->header->order_by)) {
             $this->order_by = trim($this->header->order_by);
         }
         if (isset($this->header->order_manual)) {
             $this->order_manual = (array) $this->header->order_manual;
         }
         if (isset($this->header->dateformat)) {
             $this->dateformat($this->header->dateformat);
         }
         if (isset($this->header->date)) {
             $this->date($this->header->date);
         }
         if (isset($this->header->markdown_extra)) {
             $this->markdown_extra = (bool) $this->header->markdown_extra;
         }
         if (isset($this->header->taxonomy)) {
//.........這裏部分代碼省略.........
開發者ID:indigo423,項目名稱:blog.no42.org,代碼行數:101,代碼來源:Page.php


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