當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。