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