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


PHP get_plugin_list_with_file函数代码示例

本文整理汇总了PHP中get_plugin_list_with_file函数的典型用法代码示例。如果您正苦于以下问题:PHP get_plugin_list_with_file函数的具体用法?PHP get_plugin_list_with_file怎么用?PHP get_plugin_list_with_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: load_choices

 public function load_choices()
 {
     if (is_array($this->choices)) {
         return true;
     }
     $this->choices = array('mathjax' => get_string('settingmathsdisplay_mathjax', 'qtype_stack'));
     // Remove this if statement once we no longer need to support Moodle 2.5.x.
     if (class_exists('core_component') && method_exists('core_component', 'get_plugin_list_with_file')) {
         $filters = core_component::get_plugin_list_with_file('filter', 'filter.php');
     } else {
         $filters = get_plugin_list_with_file('filter', 'filter.php');
     }
     if (array_key_exists('tex', $filters)) {
         $this->choices['tex'] = get_string('settingmathsdisplay_tex', 'qtype_stack');
     }
     if (array_key_exists('maths', $filters)) {
         $this->choices['maths'] = get_string('settingmathsdisplay_maths', 'qtype_stack');
     }
     return true;
 }
开发者ID:sowirepo,项目名称:moodle-qtype_stack,代码行数:20,代码来源:settingslib.php

示例2: initialise


//.........这里部分代码省略.........
                 // for the front page.
                 break;
             }
             $course = $this->page->course;
             if ($this->show_categories() && !$ismycourse) {
                 $this->load_all_categories($course->category, $showcategories);
             }
             // Load the course associated with the user into the navigation
             $coursenode = $this->load_course($course);
             // If the course wasn't added then don't try going any further.
             if (!$coursenode) {
                 $canviewcourseprofile = false;
                 break;
             }
             // If the user is not enrolled then we only want to show the
             // course node and not populate it.
             if (!can_access_course($course)) {
                 $coursenode->make_active();
                 $canviewcourseprofile = false;
                 break;
             }
             $this->add_course_essentials($coursenode, $course);
             $sections = $this->load_course_sections($course, $coursenode);
             break;
     }
     // Look for all categories which have been loaded
     if ($showcategories) {
         $categories = $this->find_all_of_type(self::TYPE_CATEGORY);
         if (count($categories) !== 0) {
             $categoryids = array();
             foreach ($categories as $category) {
                 $categoryids[] = $category->key;
             }
             list($categoriessql, $params) = $DB->get_in_or_equal($categoryids, SQL_PARAMS_NAMED);
             $params['limit'] = !empty($CFG->navcourselimit) ? $CFG->navcourselimit : 20;
             $sql = "SELECT cc.id, COUNT(c.id) AS coursecount\n                          FROM {course_categories} cc\n                          JOIN {course} c ON c.category = cc.id\n                         WHERE cc.id {$categoriessql}\n                      GROUP BY cc.id\n                        HAVING COUNT(c.id) > :limit";
             $excessivecategories = $DB->get_records_sql($sql, $params);
             foreach ($categories as &$category) {
                 if (array_key_exists($category->key, $excessivecategories) && !$this->can_add_more_courses_to_category($category)) {
                     $url = new moodle_url('/course/category.php', array('id' => $category->key));
                     $category->add(get_string('viewallcourses'), $url, self::TYPE_SETTING);
                 }
             }
         }
     } else {
         if ((!empty($CFG->navshowallcourses) || empty($mycourses)) && !$this->can_add_more_courses_to_category($this->rootnodes['courses'])) {
             $this->rootnodes['courses']->add(get_string('viewallcoursescategories'), new moodle_url('/course/index.php'), self::TYPE_SETTING);
         }
     }
     // Load for the current user
     $this->load_for_user();
     if ($this->page->context->contextlevel >= CONTEXT_COURSE && $this->page->context->instanceid != $SITE->id && $canviewcourseprofile) {
         $this->load_for_user(null, true);
     }
     // Load each extending user into the navigation.
     foreach ($this->extendforuser as $user) {
         if ($user->id != $USER->id) {
             $this->load_for_user($user);
         }
     }
     // Give the local plugins a chance to include some navigation if they want.
     foreach (get_plugin_list_with_file('local', 'lib.php', true) as $plugin => $file) {
         $function = "local_{$plugin}_extends_navigation";
         $oldfunction = "{$plugin}_extends_navigation";
         if (function_exists($function)) {
             // This is the preferred function name as there is less chance of conflicts
             $function($this);
         } else {
             if (function_exists($oldfunction)) {
                 // We continue to support the old function name to ensure backwards compatability
                 $oldfunction($this);
             }
         }
     }
     // Remove any empty root nodes
     foreach ($this->rootnodes as $node) {
         // Dont remove the home node
         if ($node->key !== 'home' && !$node->has_children()) {
             $node->remove();
         }
     }
     if (!$this->contains_active_node()) {
         $this->search_for_active_node();
     }
     // If the user is not logged in modify the navigation structure as detailed
     // in {@link http://docs.moodle.org/dev/Navigation_2.0_structure}
     if (!isloggedin()) {
         $activities = clone $this->rootnodes['site']->children;
         $this->rootnodes['site']->remove();
         $children = clone $this->children;
         $this->children = new navigation_node_collection();
         foreach ($activities as $child) {
             $this->children->add($child);
         }
         foreach ($children as $child) {
             $this->children->add($child);
         }
     }
     return true;
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:101,代码来源:navigationlib.php

示例3: require_once

require_once($CFG->dirroot . '/mod/quiz/lib.php');
require_once($CFG->dirroot . '/mod/quiz/settingslib.php');

// First get a list of quiz reports with there own settings pages. If there none,
// we use a simpler overall menu structure.
$reports = get_plugin_list_with_file('quiz', 'settings.php', false);
$reportsbyname = array();
foreach ($reports as $report => $reportdir) {
    $strreportname = get_string($report . 'report', 'quiz_'.$report);
    $reportsbyname[$strreportname] = $report;
}
collatorlib::ksort($reportsbyname);

// First get a list of quiz reports with there own settings pages. If there none,
// we use a simpler overall menu structure.
$rules = get_plugin_list_with_file('quizaccess', 'settings.php', false);
$rulesbyname = array();
foreach ($rules as $rule => $ruledir) {
    $strrulename = get_string('pluginname', 'quizaccess_' . $rule);
    $rulesbyname[$strrulename] = $rule;
}
collatorlib::ksort($rulesbyname);

// Create the quiz settings page.
if (empty($reportsbyname) && empty($rulesbyname)) {
    $pagetitle = get_string('modulename', 'quiz');
} else {
    $pagetitle = get_string('generalsettings', 'admin');
}
$quizsettings = new admin_settingpage('modsettingquiz', $pagetitle, 'moodle/site:config');
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:30,代码来源:settings.php

示例4: get_plugin_list_with_class

/**
 * Get a list of all the plugins of a given type that define a certain class
 * in a certain file. The plugin component names and class names are returned.
 *
 * @param string $plugintype the type of plugin, e.g. 'mod' or 'report'.
 * @param string $class the part of the name of the class after the
 *      frankenstyle prefix. e.g 'thing' if you are looking for classes with
 *      names like report_courselist_thing. If you are looking for classes with
 *      the same name as the plugin name (e.g. qtype_multichoice) then pass ''.
 * @param string $file the name of file within the plugin that defines the class.
 * @return array with frankenstyle plugin names as keys (e.g. 'report_courselist', 'mod_forum')
 *      and the class names as values (e.g. 'report_courselist_thing', 'qtype_multichoice').
 */
function get_plugin_list_with_class($plugintype, $class, $file)
{
    if ($class) {
        $suffix = '_' . $class;
    } else {
        $suffix = '';
    }
    $pluginclasses = array();
    foreach (get_plugin_list_with_file($plugintype, $file, true) as $plugin => $notused) {
        $classname = $plugintype . '_' . $plugin . $suffix;
        if (class_exists($classname)) {
            $pluginclasses[$plugintype . '_' . $plugin] = $classname;
        }
    }
    return $pluginclasses;
}
开发者ID:nmicha,项目名称:moodle,代码行数:29,代码来源:moodlelib.php

示例5: available_evaluators_list

 /**
  * Returns the list of available grading evaluation methods
  *
  * @return array of (string)name => (string)localized title
  */
 public static function available_evaluators_list()
 {
     $evals = array();
     foreach (get_plugin_list_with_file('workshopeval', 'lib.php', false) as $eval => $evalpath) {
         $evals[$eval] = get_string('pluginname', 'workshopeval_' . $eval);
     }
     return $evals;
 }
开发者ID:vinoth4891,项目名称:clinique,代码行数:13,代码来源:locallib.php

示例6: initialise


//.........这里部分代码省略.........
             if (!$coursenode) {
                 $canviewcourseprofile = false;
                 break;
             }
             // If the user is not enrolled then we only want to show the
             // course node and not populate it.
             if (!can_access_course($course)) {
                 $coursenode->make_active();
                 $canviewcourseprofile = false;
                 break;
             }
             $this->add_course_essentials($coursenode, $course);
             // Load the course sections into the page
             $this->load_course_sections($course, $coursenode, null, $cm);
             $activity = $coursenode->find($cm->id, navigation_node::TYPE_ACTIVITY);
             // Finally load the cm specific navigaton information
             $this->load_activity($cm, $course, $activity);
             // Check if we have an active ndoe
             if (!$activity->contains_active_node() && !$activity->search_for_active_node()) {
                 // And make the activity node active.
                 $activity->make_active();
             }
             break;
         case CONTEXT_USER:
             if ($issite) {
                 // The users profile information etc is already loaded
                 // for the front page.
                 break;
             }
             $course = $this->page->course;
             // Load the course associated with the user into the navigation
             $coursenode = $this->add_course($course, false, self::COURSE_CURRENT);
             // If the course wasn't added then don't try going any further.
             if (!$coursenode) {
                 $canviewcourseprofile = false;
                 break;
             }
             // If the user is not enrolled then we only want to show the
             // course node and not populate it.
             if (!can_access_course($course)) {
                 $coursenode->make_active();
                 $canviewcourseprofile = false;
                 break;
             }
             $this->add_course_essentials($coursenode, $course);
             $this->load_course_sections($course, $coursenode);
             break;
     }
     // Load for the current user
     $this->load_for_user();
     if ($this->page->context->contextlevel >= CONTEXT_COURSE && $this->page->context->instanceid != $SITE->id && $canviewcourseprofile) {
         $this->load_for_user(null, true);
     }
     // Load each extending user into the navigation.
     foreach ($this->extendforuser as $user) {
         if ($user->id != $USER->id) {
             $this->load_for_user($user);
         }
     }
     // Give the local plugins a chance to include some navigation if they want.
     foreach (get_plugin_list_with_file('local', 'lib.php', true) as $plugin => $file) {
         $function = "local_{$plugin}_extends_navigation";
         $oldfunction = "{$plugin}_extends_navigation";
         if (function_exists($function)) {
             // This is the preferred function name as there is less chance of conflicts
             $function($this);
         } else {
             if (function_exists($oldfunction)) {
                 // We continue to support the old function name to ensure backwards compatibility
                 debugging("Deprecated local plugin navigation callback: Please rename '{$oldfunction}' to '{$function}'. Support for the old callback will be dropped after the release of 2.4", DEBUG_DEVELOPER);
                 $oldfunction($this);
             }
         }
     }
     // Remove any empty root nodes
     foreach ($this->rootnodes as $node) {
         // Dont remove the home node
         if ($node->key !== 'home' && !$node->has_children()) {
             $node->remove();
         }
     }
     if (!$this->contains_active_node()) {
         $this->search_for_active_node();
     }
     // If the user is not logged in modify the navigation structure as detailed
     // in {@link http://docs.moodle.org/dev/Navigation_2.0_structure}
     if (!isloggedin()) {
         $activities = clone $this->rootnodes['site']->children;
         $this->rootnodes['site']->remove();
         $children = clone $this->children;
         $this->children = new navigation_node_collection();
         foreach ($activities as $child) {
             $this->children->add($child);
         }
         foreach ($children as $child) {
             $this->children->add($child);
         }
     }
     return true;
 }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:navigationlib.php

示例7: get_store_plugin_summaries

 /**
  * Returns an array of information about plugins, everything a renderer needs.
  * @return array
  */
 public static function get_store_plugin_summaries()
 {
     $return = array();
     $plugins = get_plugin_list_with_file('cachestore', 'lib.php', true);
     foreach ($plugins as $plugin => $path) {
         $class = 'cachestore_' . $plugin;
         $return[$plugin] = array('name' => get_string('pluginname', 'cachestore_' . $plugin), 'requirementsmet' => $class::are_requirements_met(), 'instances' => 0, 'modes' => array(cache_store::MODE_APPLICATION => $class::get_supported_modes() & cache_store::MODE_APPLICATION, cache_store::MODE_SESSION => $class::get_supported_modes() & cache_store::MODE_SESSION, cache_store::MODE_REQUEST => $class::get_supported_modes() & cache_store::MODE_REQUEST), 'supports' => array('multipleidentifiers' => $class::get_supported_features() & cache_store::SUPPORTS_MULTIPLE_IDENTIFIERS, 'dataguarantee' => $class::get_supported_features() & cache_store::SUPPORTS_DATA_GUARANTEE, 'nativettl' => $class::get_supported_features() & cache_store::SUPPORTS_NATIVE_TTL, 'nativelocking' => in_array('cache_is_lockable', class_implements($class)), 'keyawareness' => array_key_exists('cache_is_key_aware', class_implements($class))), 'canaddinstance' => $class::can_add_instance() && $class::are_requirements_met());
     }
     $instance = cache_config::instance();
     $stores = $instance->get_all_stores();
     foreach ($stores as $store) {
         $plugin = $store['plugin'];
         if (array_key_exists($plugin, $return)) {
             $return[$plugin]['instances']++;
         }
     }
     return $return;
 }
开发者ID:Burick,项目名称:moodle,代码行数:22,代码来源:locallib.php

示例8: add_admin_assign_plugin_settings

    /**
     * This function adds plugin pages to the navigation menu
     *
     * @static
     * @param string $subtype - The type of plugin (submission or feedback)
     * @param part_of_admin_tree $admin - The handle to the admin menu
     * @param admin_settingpage $settings - The handle to current node in the navigation tree
     * @param stdClass $module - The handle to the current module
     * @return None
     */
    static function add_admin_assign_plugin_settings($subtype, part_of_admin_tree $admin, admin_settingpage $settings, stdClass $module) {
        global $CFG;

        $plugins = get_plugin_list_with_file($subtype, 'settings.php', false);
        $pluginsbyname = array();
        foreach ($plugins as $plugin => $plugindir) {
            $pluginname = get_string('pluginname', $subtype . '_'.$plugin);
            $pluginsbyname[$pluginname] = $plugin;
        }
        ksort($pluginsbyname);

        foreach ($pluginsbyname as $pluginname => $plugin) {
            $settings = new admin_settingpage($subtype . '_'.$plugin,
                    $pluginname, 'moodle/site:config', !$module->visible);
            if ($admin->fulltree) {
                $shortsubtype = substr($subtype, strlen('assign'));
                include($CFG->dirroot . "/mod/assign/$shortsubtype/$plugin/settings.php");
            }

            $admin->add($subtype . 'plugins', $settings);
        }

    }
开发者ID:nicusX,项目名称:moodle,代码行数:33,代码来源:adminlib.php

示例9: defined

 *
 * @package    mod
 * @subpackage quiz
 * @copyright  2010 Petr Skoda
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */


defined('MOODLE_INTERNAL') || die();

require_once($CFG->dirroot . '/mod/quiz/lib.php');
require_once($CFG->dirroot . '/mod/quiz/settingslib.php');

// First get a list of quiz reports with there own settings pages. If there none,
// we use a simpler overall menu structure.
$reports = get_plugin_list_with_file('quiz', 'settings.php', false);
$reportsbyname = array();
foreach ($reports as $report => $reportdir) {
    $strreportname = get_string($report . 'report', 'quiz_'.$report);
    $reportsbyname[$strreportname] = $report;
}
ksort($reportsbyname);

// Create the quiz settings page.
if (empty($reportsbyname)) {
    $pagetitle = get_string('modulename', 'quiz');
} else {
    $pagetitle = get_string('generalsettings', 'admin');
}
$quizsettings = new admin_settingpage('modsettingquiz', $pagetitle, 'moodle/site:config');
开发者ID:JP-Git,项目名称:moodle,代码行数:30,代码来源:settings.php

示例10: max

$count = max($count, 0);
admin_externalpage_setup('cachetestperformance');
$applicationtable = new html_table();
$applicationtable->head = array(get_string('plugin', 'cache'), get_string('result', 'cache'), get_string('set', 'cache'), get_string('gethit', 'cache'), get_string('getmiss', 'cache'), get_string('delete', 'cache'));
$applicationtable->data = array();
$sessiontable = clone $applicationtable;
$requesttable = clone $applicationtable;
$application = cache_definition::load_adhoc(cache_store::MODE_APPLICATION, 'cache', 'applicationtest');
$session = cache_definition::load_adhoc(cache_store::MODE_SESSION, 'cache', 'sessiontest');
$request = cache_definition::load_adhoc(cache_store::MODE_REQUEST, 'cache', 'requesttest');
$strinvalidplugin = new lang_string('invalidplugin', 'cache');
$strunsupportedmode = new lang_string('unsupportedmode', 'cache');
$struntestable = new lang_string('untestable', 'cache');
$strtested = new lang_string('tested', 'cache');
$strnotready = new lang_string('storenotready', 'cache');
foreach (get_plugin_list_with_file('cachestore', 'lib.php', true) as $plugin => $path) {
    $class = 'cachestore_' . $plugin;
    $plugin = get_string('pluginname', 'cachestore_' . $plugin);
    if (!class_exists($class) || !method_exists($class, 'initialise_test_instance') || !$class::are_requirements_met()) {
        $applicationtable->data[] = array($plugin, $strinvalidplugin, '-', '-', '-', '-');
        $sessiontable->data[] = array($plugin, $strinvalidplugin, '-', '-', '-', '-');
        $requesttable->data[] = array($plugin, $strinvalidplugin, '-', '-', '-', '-');
        continue;
    }
    if (!$class::is_supported_mode(cache_store::MODE_APPLICATION)) {
        $applicationtable->data[] = array($plugin, $strunsupportedmode, '-', '-', '-', '-');
    } else {
        $store = $class::initialise_test_instance($application);
        if ($store === false) {
            $applicationtable->data[] = array($plugin, $struntestable, '-', '-', '-', '-');
        } else {
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:31,代码来源:testperformance.php


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