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


PHP Plugins::provided方法代码示例

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


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

示例1: get_import

 /**
  * Handles GET requests for the import page.
  */
 public function get_import()
 {
     // First check for plugins that provide troublseome features
     $features_present = Plugins::provided();
     $troublemakers = array();
     $bad_features = array('ping', 'pingback', 'spamcheck');
     $unwanted_features = array_intersect_key($features_present, array_flip($bad_features));
     array_walk($unwanted_features, function ($item, $key) use(&$troublemakers) {
         foreach ($item as $current) {
             if (!in_array($current, $troublemakers)) {
                 $troublemakers[] = $current;
             }
         }
     });
     if (count($troublemakers)) {
         $troublemakers = implode(', ', $troublemakers);
         $msg = _t('Plugins that conflict with importing are active. To prevent undesirable consequences, please de-activate the following plugins until the import is finished: ') . '<br>';
         $msg .= $troublemakers;
         $this->theme->conflicting_plugins = $msg;
         Session::error($msg);
     }
     // Now get on with creating the page
     $importer = isset($_POST['importer']) ? $_POST['importer'] : '';
     $stage = isset($_POST['stage']) ? $_POST['stage'] : '1';
     $step = isset($_POST['step']) ? $_POST['step'] : '1';
     //		$this->theme->enctype = Plugins::filter( 'import_form_enctype', 'application/x-www-form-urlencoded', $importer, $stage, $step );
     // filter to get registered importers
     $importers = Plugins::filter('import_names', array());
     // filter to get the output of the current importer, if one is running
     if ($importer == '') {
         $output = $this->get_form($importers, $importer);
     } else {
         $output = Plugins::filter('import_stage', '', $importer, $stage, $step);
     }
     $this->theme->importer = $importer;
     $this->theme->stage = $stage;
     $this->theme->step = $step;
     $this->theme->importers = $importers;
     $this->theme->output = $output;
     $this->display('import');
 }
开发者ID:habari,项目名称:system,代码行数:44,代码来源:adminimporthandler.php

示例2: validate_theme

 /**
  * Ensure that a theme meets requirements for activation/preview
  * @static
  * @param string $theme_dir the directory of the theme
  * @return bool True if the theme meets all requirements
  */
 public static function validate_theme($theme_dir)
 {
     $all_themes = Themes::get_all_data();
     // @todo Make this a closure in php 5.3
     $theme_names = Utils::array_map_field($all_themes, 'name');
     $theme_data = $all_themes[$theme_dir];
     $ok = true;
     if (isset($theme_data['info']->parent) && !in_array((string) $theme_data['info']->parent, $theme_names)) {
         Session::error(_t('This theme requires the parent theme named "%s" to be present prior to activation.', array($theme_data['info']->parent)));
         $ok = false;
     }
     if (isset($theme_data['info']->requires)) {
         $provided = Plugins::provided();
         foreach ($theme_data['info']->requires->feature as $requirement) {
             if (!isset($provided[(string) $requirement])) {
                 Session::error(_t('This theme requires the feature "<a href="%2$s">%1$s</a>" to be present prior to activation.', array((string) $requirement, $requirement['url'])));
                 $ok = false;
             }
         }
     }
     return $ok;
 }
开发者ID:wwxgitcat,项目名称:habari,代码行数:28,代码来源:themes.php


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