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


PHP core_component::get_plugin_list_with_file方法代码示例

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


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

示例1: run

 public function run($command)
 {
     global $CFG;
     $data = $CFG->dataroot . '/tool_composer';
     $composerfile = $data . '/composer.json';
     if (!is_writable($data)) {
         throw new \moodle_exception('notwritable');
     }
     if (!file_exists($data)) {
         mkdir($data, $CFG->directorypermissions, true);
     }
     $vendordir = $data . '/vendor';
     $autoloadphp = '$CFG->dataroot . \'tool_composer/vendor/autoload.php\'';
     if ($this->installincodebase) {
         $vendordir = $CFG->dirroot . '/lib/vendor';
         $autoloadphp = '$CFG->dirroot . \'/lib/vendor/autoload.php\'';
     }
     $composer = new \stdClass();
     $composer->require = ['wikimedia/composer-merge-plugin' => '^1.3'];
     $include = [];
     foreach (\core_component::get_plugin_types() as $type => $dir) {
         $plugins = \core_component::get_plugin_list_with_file($type, 'composer.json');
         foreach ($plugins as $pluginname => $filepath) {
             // Ignore this plugin
             if ($type == 'tool' && $pluginname == 'composer') {
                 continue;
             }
             $include[] = $filepath;
             // Overwrite the autoload files if necessary
             $autoload = dirname($filepath) . '/vendor/autoload.php';
             if (file_exists($autoload)) {
                 if (!is_writable($autoload)) {
                     throw new \moodle_exception('notwritable');
                 }
                 // Back up the file if we haven't done so already.
                 if (!file_exists($autoload . '.bak')) {
                     file_put_contents($autoload . '.bak', file_get_contents($autoload));
                 }
                 file_put_contents($autoload, '<?php require_once ' . $autoloadphp . ';');
             }
         }
     }
     $composer->extra = (object) ['merge-plugin' => (object) ['include' => $include]];
     file_put_contents($composerfile, json_encode($composer));
     putenv('COMPOSER=' . $composerfile);
     putenv('COMPOSER_VENDOR_DIR=' . $vendordir);
     if ($this->installincodebase) {
         // Allow us to install Moodle plugins into the codebase
         chdir($CFG->dirroot);
     }
     // TODO: We may want to force --no-dev here for install / update
     passthru('composer --no-interaction ' . $command);
 }
开发者ID:micaherne,项目名称:moodle-tool_composer,代码行数:53,代码来源:manager.php

示例2: 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

示例3: 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 (core_component::get_plugin_list_with_file('workshopeval', 'lib.php', false) as $eval => $evalpath) {
         $evals[$eval] = get_string('pluginname', 'workshopeval_' . $eval);
     }
     return $evals;
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:13,代码来源:locallib.php

示例4: get_plugins_with_function

/**
 * Get a list of all the plugins that define a certain API function in a certain file.
 *
 * @param string $function the part of the name of the function after the
 *      frankenstyle prefix. e.g 'hook' if you are looking for functions with
 *      names like report_courselist_hook.
 * @param string $file the name of file within the plugin that defines the
 *      function. Defaults to lib.php.
 * @param bool $include Whether to include the files that contain the functions or not.
 * @return array with [plugintype][plugin] = functionname
 */
function get_plugins_with_function($function, $file = 'lib.php', $include = true)
{
    global $CFG;
    $cache = \cache::make('core', 'plugin_functions');
    // Including both although I doubt that we will find two functions definitions with the same name.
    // Clearning the filename as cache_helper::hash_key only allows a-zA-Z0-9_.
    $key = $function . '_' . clean_param($file, PARAM_ALPHA);
    if ($pluginfunctions = $cache->get($key)) {
        // Checking that the files are still available.
        foreach ($pluginfunctions as $plugintype => $plugins) {
            $allplugins = \core_component::get_plugin_list($plugintype);
            foreach ($plugins as $plugin => $fullpath) {
                // Cache might be out of sync with the codebase, skip the plugin if it is not available.
                if (empty($allplugins[$plugin])) {
                    unset($pluginfunctions[$plugintype][$plugin]);
                    continue;
                }
                $fileexists = file_exists($allplugins[$plugin] . DIRECTORY_SEPARATOR . $file);
                if ($include && $fileexists) {
                    // Include the files if it was requested.
                    include_once $allplugins[$plugin] . DIRECTORY_SEPARATOR . $file;
                } else {
                    if (!$fileexists) {
                        // If the file is not available any more it should not be returned.
                        unset($pluginfunctions[$plugintype][$plugin]);
                    }
                }
            }
        }
        return $pluginfunctions;
    }
    $pluginfunctions = array();
    // To fill the cached. Also, everything should continue working with cache disabled.
    $plugintypes = \core_component::get_plugin_types();
    foreach ($plugintypes as $plugintype => $unused) {
        // We need to include files here.
        $pluginswithfile = \core_component::get_plugin_list_with_file($plugintype, $file, true);
        foreach ($pluginswithfile as $plugin => $notused) {
            $fullfunction = $plugintype . '_' . $plugin . '_' . $function;
            $pluginfunction = false;
            if (function_exists($fullfunction)) {
                // Function exists with standard name. Store, indexed by frankenstyle name of plugin.
                $pluginfunction = $fullfunction;
            } else {
                if ($plugintype === 'mod') {
                    // For modules, we also allow plugin without full frankenstyle but just starting with the module name.
                    $shortfunction = $plugin . '_' . $function;
                    if (function_exists($shortfunction)) {
                        $pluginfunction = $shortfunction;
                    }
                }
            }
            if ($pluginfunction) {
                if (empty($pluginfunctions[$plugintype])) {
                    $pluginfunctions[$plugintype] = array();
                }
                $pluginfunctions[$plugintype][$plugin] = $pluginfunction;
            }
        }
    }
    $cache->set($key, $pluginfunctions);
    return $pluginfunctions;
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:74,代码来源:moodlelib.php

示例5: get_plugin_list_with_function

/**
 * Get a list of all the plugins of a given type that define a certain API function
 * in a certain file. The plugin component names and function names are returned.
 *
 * @param string $plugintype the type of plugin, e.g. 'mod' or 'report'.
 * @param string $function the part of the name of the function after the
 *      frankenstyle prefix. e.g 'hook' if you are looking for functions with
 *      names like report_courselist_hook.
 * @param string $file the name of file within the plugin that defines the
 *      function. Defaults to lib.php.
 * @return array with frankenstyle plugin names as keys (e.g. 'report_courselist', 'mod_forum')
 *      and the function names as values (e.g. 'report_courselist_hook', 'forum_hook').
 */
function get_plugin_list_with_function($plugintype, $function, $file = 'lib.php')
{
    $pluginfunctions = array();
    $pluginswithfile = core_component::get_plugin_list_with_file($plugintype, $file, true);
    foreach ($pluginswithfile as $plugin => $notused) {
        $fullfunction = $plugintype . '_' . $plugin . '_' . $function;
        if (function_exists($fullfunction)) {
            // Function exists with standard name. Store, indexed by frankenstyle name of plugin.
            $pluginfunctions[$plugintype . '_' . $plugin] = $fullfunction;
        } else {
            if ($plugintype === 'mod') {
                // For modules, we also allow plugin without full frankenstyle but just starting with the module name.
                $shortfunction = $plugin . '_' . $function;
                if (function_exists($shortfunction)) {
                    $pluginfunctions[$plugintype . '_' . $plugin] = $shortfunction;
                }
            }
        }
    }
    return $pluginfunctions;
}
开发者ID:riawarra,项目名称:moodle,代码行数:34,代码来源:moodlelib.php

示例6: 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 = core_component::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:eamador,项目名称:moodle-course-custom-fields,代码行数:22,代码来源:locallib.php

示例7: get_plugin_list_with_file

/**
 * Get a list of all the plugins of a given type that contain a particular file.
 *
 * @param string $plugintype the type of plugin, e.g. 'mod' or 'report'.
 * @param string $file the name of file that must be present in the plugin.
 *      (e.g. 'view.php', 'db/install.xml').
 * @param bool $include if true (default false), the file will be include_once-ed if found.
 * @return array with plugin name as keys (e.g. 'forum', 'courselist') and the path
 *      to the file relative to dirroot as value (e.g. "$CFG->dirroot/mod/forum/view.php").
 * @deprecated since 2.6
 * @see core_component::get_plugin_list_with_file()
 */
function get_plugin_list_with_file($plugintype, $file, $include = false)
{
    debugging('get_plugin_list_with_file() is deprecated, please use core_component::get_plugin_list_with_file() instead.', DEBUG_DEVELOPER);
    return core_component::get_plugin_list_with_file($plugintype, $file, $include);
}
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:17,代码来源:deprecatedlib.php

示例8: initialise


//.........这里部分代码省略.........
             }
             // 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);
             if (!empty($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 (core_component::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
         /** @var navigation_node $node */
         if ($node->key !== 'home' && !$node->has_children() && !$node->isactive) {
             $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:achocoza,项目名称:moodle26,代码行数:101,代码来源:navigationlib.php

示例9: test_get_plugin_list_with_file

 public function test_get_plugin_list_with_file()
 {
     $this->resetAfterTest(true);
     // No extra reset here because core_component reset automatically.
     $expected = array();
     $reports = core_component::get_plugin_list('report');
     foreach ($reports as $name => $fulldir) {
         if (file_exists("{$fulldir}/lib.php")) {
             $expected[] = $name;
         }
     }
     // Test cold.
     $list = core_component::get_plugin_list_with_file('report', 'lib.php', false);
     $this->assertEquals($expected, array_keys($list));
     // Test hot.
     $list = core_component::get_plugin_list_with_file('report', 'lib.php', false);
     $this->assertEquals($expected, array_keys($list));
     // Test with include.
     $list = core_component::get_plugin_list_with_file('report', 'lib.php', true);
     $this->assertEquals($expected, array_keys($list));
     // Test missing.
     $list = core_component::get_plugin_list_with_file('report', 'idontexist.php', true);
     $this->assertEquals(array(), array_keys($list));
 }
开发者ID:alexandru-elisei,项目名称:moodle,代码行数:24,代码来源:component_test.php

示例10: local_codesniffer_get_ignores

/**
 * Get a list of folders to ignores.
 *
 * @param string $extraignorelist optional comma separated list of substring matching paths to ignore.
 * @return array of paths.
 */
function local_codesniffer_get_ignores($extraignorelist = '')
{
    global $CFG;
    $files = array();
    // XML files to be processed.
    $paths = array();
    // Absolute paths to be excluded.
    $files['core'] = $CFG->libdir . DIRECTORY_SEPARATOR . '/thirdpartylibs.xml';
    // This one always exists.
    // With MDL-42148, for 2.6 and upwards, the general 'thirdpartylibs.xml' file
    // has been split so any plugin with dependencies can have its own. In order to
    // keep master compatibility with older branches we are doing some
    // conditional coding here.
    if (file_exists($CFG->dirroot . '/' . $CFG->admin . '/' . 'thirdpartylibs.php')) {
        // New behavior, distributed XML files, let's look for them.
        $plugintypes = core_component::get_plugin_types();
        foreach ($plugintypes as $type => $ignored) {
            $plugins = core_component::get_plugin_list_with_file($type, 'thirdpartylibs.xml', false);
            foreach ($plugins as $plugin => $path) {
                $files[$type . '_' . $plugin] = $path;
            }
        }
    }
    // Let's extract all the paths from the XML files.
    foreach ($files as $file) {
        $base = realpath(dirname($file));
        $thirdparty = simplexml_load_file($file);
        foreach ($thirdparty->xpath('/libraries/library/location') as $location) {
            $location = substr($base, strlen($CFG->dirroot)) . '/' . $location;
            // This was happening since ages ago, leading to incorrect excluded
            // paths like: "/lib/theme/bootstrapbase/less/bootstrap", so we try
            // reducing it. Note this does not affect 2.6 and up, where all
            // locations are relative to their xml file so this problem cannot happen.
            if (!file_exists(dirname($CFG->dirroot . DIRECTORY_SEPARATOR . $location))) {
                // Only if it starts with '/lib'.
                if (strpos($location, DIRECTORY_SEPARATOR . 'lib') === 0) {
                    $candidate = substr($location, strlen(DIRECTORY_SEPARATOR . 'lib'));
                    // Only modify the original location if the candidate exists.
                    if (file_exists(dirname($CFG->dirroot . DIRECTORY_SEPARATOR . $candidate))) {
                        $location = $candidate;
                    }
                }
            }
            // Accept only correct paths from XML files.
            if (file_exists(dirname($CFG->dirroot . DIRECTORY_SEPARATOR . $location))) {
                $paths[] = preg_quote(local_codechecker_clean_path($location));
            } else {
                debugging("Processing {$file} for exclussions, incorrect {$location} path found. Please fix it");
            }
        }
    }
    // Manually add our own pear stuff to be excluded.
    $paths[] = preg_quote(local_codechecker_clean_path('/local/codechecker' . DIRECTORY_SEPARATOR . 'pear'));
    // Changed in PHP_CodeSniffer 1.4.4 and upwards, so we apply the
    // same here: Paths go to keys and mark all them as 'absolute'.
    $finalpaths = array();
    foreach ($paths as $pattern) {
        $finalpaths[$pattern] = 'absolute';
    }
    // Let's add any substring matching path passed in $extraignorelist.
    if ($extraignorelist) {
        $extraignorearr = explode(',', $extraignorelist);
        foreach ($extraignorearr as $extraignore) {
            $extrapath = trim($extraignore);
            $finalpaths[$extrapath] = 'absolute';
        }
    }
    return $finalpaths;
}
开发者ID:marcusgreen,项目名称:moodle-local_codechecker,代码行数:75,代码来源:locallib.php

示例11: get_mods_with_viewed_event

 /**
  * Get all modules that triggers a course_module_viewed event
  *
  * @return array of mod names
  */
 public static function get_mods_with_viewed_event()
 {
     global $DB;
     $mods = \core_component::get_plugin_list_with_file('mod', 'classes/event/course_module_viewed.php');
     return array_keys($mods);
 }
开发者ID:ninelanterns,项目名称:scaffold-enrol_auto,代码行数:11,代码来源:helper.php

示例12: environment_check

/**
 * This function will check for everything (DB, PHP and PHP extensions for now)
 * returning an array of environment_result objects.
 *
 * @global object
 * @param string $version xml version we are going to use to test this server
 * @param int $env_select one of ENV_SELECT_NEWER | ENV_SELECT_DATAROOT | ENV_SELECT_RELEASE decide xml to use.
 * @return environment_results[] array of results encapsulated in one environment_result object
 */
function environment_check($version, $env_select)
{
    global $CFG;
    if ($env_select != ENV_SELECT_NEWER and $env_select != ENV_SELECT_DATAROOT and $env_select != ENV_SELECT_RELEASE) {
        throw new coding_exception('Incorrect value of $env_select parameter');
    }
    /// Normalize the version requested
    $version = normalize_version($version);
    $results = array();
    //To store all the results
    /// Only run the moodle versions checker on upgrade, not on install
    if (!empty($CFG->version)) {
        $results[] = environment_check_moodle($version, $env_select);
    }
    $results[] = environment_check_unicode($version, $env_select);
    $results[] = environment_check_database($version, $env_select);
    $results[] = environment_check_php($version, $env_select);
    if ($result = environment_check_pcre_unicode($version, $env_select)) {
        $results[] = $result;
    }
    $phpext_results = environment_check_php_extensions($version, $env_select);
    $results = array_merge($results, $phpext_results);
    $phpsetting_results = environment_check_php_settings($version, $env_select);
    $results = array_merge($results, $phpsetting_results);
    $custom_results = environment_custom_checks($version, $env_select);
    $results = array_merge($results, $custom_results);
    // Always use the plugin directory version of environment.xml,
    // add-on developers need to keep those up-to-date with future info.
    foreach (core_component::get_plugin_types() as $plugintype => $unused) {
        foreach (core_component::get_plugin_list_with_file($plugintype, 'environment.xml') as $pluginname => $unused) {
            $plugin = $plugintype . '_' . $pluginname;
            $result = environment_check_database($version, $plugin);
            if ($result->error_code != NO_VERSION_DATA_FOUND and $result->error_code != NO_DATABASE_SECTION_FOUND and $result->error_code != NO_DATABASE_VENDORS_FOUND) {
                $result->plugin = $plugin;
                $results[] = $result;
            }
            $result = environment_check_php($version, $plugin);
            if ($result->error_code != NO_VERSION_DATA_FOUND and $result->error_code != NO_PHP_SECTION_FOUND and $result->error_code != NO_PHP_VERSION_FOUND) {
                $result->plugin = $plugin;
                $results[] = $result;
            }
            $pluginresults = environment_check_php_extensions($version, $plugin);
            foreach ($pluginresults as $result) {
                if ($result->error_code != NO_VERSION_DATA_FOUND and $result->error_code != NO_PHP_EXTENSIONS_SECTION_FOUND) {
                    $result->plugin = $plugin;
                    $results[] = $result;
                }
            }
            $pluginresults = environment_check_php_settings($version, $plugin);
            foreach ($pluginresults as $result) {
                if ($result->error_code != NO_VERSION_DATA_FOUND) {
                    $result->plugin = $plugin;
                    $results[] = $result;
                }
            }
            $pluginresults = environment_custom_checks($version, $plugin);
            foreach ($pluginresults as $result) {
                if ($result->error_code != NO_VERSION_DATA_FOUND) {
                    $result->plugin = $plugin;
                    $results[] = $result;
                }
            }
        }
    }
    return $results;
}
开发者ID:Keneth1212,项目名称:moodle,代码行数:75,代码来源:environmentlib.php

示例13: find_all_amd_modules

 /**
  * Scan the source for AMD modules and return them all.
  *
  * The expected location for amd modules is:
  *  <componentdir>/amd/src/modulename.js
  *
  * @param boolean $debug If true, returns the paths to the original (unminified) source files.
  * @return array $files An array of mappings from module names to file paths.
  */
 public static function find_all_amd_modules($debug = false)
 {
     global $CFG;
     $jsdirs = array();
     $jsfiles = array();
     $dir = $CFG->libdir . '/amd';
     if (!empty($dir) && is_dir($dir)) {
         $jsdirs['core'] = $dir;
     }
     $subsystems = core_component::get_core_subsystems();
     foreach ($subsystems as $subsystem => $dir) {
         if (!empty($dir) && is_dir($dir . '/amd')) {
             $jsdirs['core_' . $subsystem] = $dir . '/amd';
         }
     }
     $plugintypes = core_component::get_plugin_types();
     foreach ($plugintypes as $type => $dir) {
         $plugins = core_component::get_plugin_list_with_file($type, 'amd', false);
         foreach ($plugins as $plugin => $dir) {
             if (!empty($dir) && is_dir($dir)) {
                 $jsdirs[$type . '_' . $plugin] = $dir;
             }
         }
     }
     foreach ($jsdirs as $component => $dir) {
         $srcdir = $dir . '/build';
         if ($debug) {
             $srcdir = $dir . '/src';
         }
         if (!is_dir($srcdir) || !is_readable($srcdir)) {
             // This is probably an empty amd directory without src or build.
             // Skip it - RecursiveDirectoryIterator fatals if the directory is not readable as an iterator.
             continue;
         }
         $items = new RecursiveDirectoryIterator($srcdir);
         foreach ($items as $item) {
             $extension = $item->getExtension();
             if ($extension === 'js') {
                 $filename = str_replace('.min', '', $item->getBaseName('.js'));
                 // We skip lazy loaded modules.
                 if (strpos($filename, '-lazy') === false) {
                     $modulename = $component . '/' . $filename;
                     $jsfiles[$modulename] = $item->getRealPath();
                 }
             }
             unset($item);
         }
         unset($items);
     }
     return $jsfiles;
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:60,代码来源:requirejs.php

示例14: admin_externalpage_setup

 * List of 3rd party libs used in moodle and all plugins.
 *
 * @package   admin
 * @copyright 2013 Petr Skoda {@link http://skodak.org}
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once '../config.php';
require_once $CFG->libdir . '/adminlib.php';
require_once $CFG->libdir . '/tablelib.php';
admin_externalpage_setup('thirdpartylibs');
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('thirdpartylibs', 'core_admin'));
$files = array('core' => "{$CFG->libdir}/thirdpartylibs.xml");
$plugintypes = core_component::get_plugin_types();
foreach ($plugintypes as $type => $ignored) {
    $plugins = core_component::get_plugin_list_with_file($type, 'thirdpartylibs.xml', false);
    foreach ($plugins as $plugin => $path) {
        $files[$type . '_' . $plugin] = $path;
    }
}
$table = new html_table();
$table->head = array(get_string('thirdpartylibrary', 'core_admin'), get_string('version'), get_string('thirdpartylibrarylocation', 'core_admin'), get_string('license'));
$table->align = array('left', 'left', 'left', 'left');
$table->id = 'thirdpartylibs';
$table->attributes['class'] = 'admintable generaltable';
$table->data = array();
foreach ($files as $component => $xmlpath) {
    $xml = simplexml_load_file($xmlpath);
    foreach ($xml as $lib) {
        $base = realpath(dirname($xmlpath));
        $location = substr($base, strlen($CFG->dirroot)) . '/' . $lib->location;
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:thirdpartylibs.php

示例15: defined

 * @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';
// First get a list of quiz reports with there own settings pages. If there none,
// we use a simpler overall menu structure.
$reports = core_component::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;
}
core_collator::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 = core_component::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;
}
core_collator::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');
if ($ADMIN->fulltree) {
    // Introductory explanation that all the settings are defaults for the add quiz form.
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:settings.php


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