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


PHP filter_get_all_installed函数代码示例

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


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

示例1: admin_settingpage

 $temp = new admin_settingpage('commonfiltersettings', get_string('commonfiltersettings', 'admin'));
 if ($ADMIN->fulltree) {
     $cachetimes = array(604800 => get_string('numdays', '', 7), 86400 => get_string('numdays', '', 1), 43200 => get_string('numhours', '', 12), 10800 => get_string('numhours', '', 3), 7200 => get_string('numhours', '', 2), 3600 => get_string('numhours', '', 1), 2700 => get_string('numminutes', '', 45), 1800 => get_string('numminutes', '', 30), 900 => get_string('numminutes', '', 15), 600 => get_string('numminutes', '', 10), 540 => get_string('numminutes', '', 9), 480 => get_string('numminutes', '', 8), 420 => get_string('numminutes', '', 7), 360 => get_string('numminutes', '', 6), 300 => get_string('numminutes', '', 5), 240 => get_string('numminutes', '', 4), 180 => get_string('numminutes', '', 3), 120 => get_string('numminutes', '', 2), 60 => get_string('numminutes', '', 1), 30 => get_string('numseconds', '', 30), 0 => get_string('no'));
     $items = array();
     $items[] = new admin_setting_configselect('cachetext', get_string('cachetext', 'admin'), get_string('configcachetext', 'admin'), 60, $cachetimes);
     $items[] = new admin_setting_configselect('filteruploadedfiles', get_string('filteruploadedfiles', 'admin'), get_string('configfilteruploadedfiles', 'admin'), 0, array('0' => get_string('none'), '1' => get_string('allfiles'), '2' => get_string('htmlfilesonly')));
     $items[] = new admin_setting_configcheckbox('filtermatchoneperpage', get_string('filtermatchoneperpage', 'admin'), get_string('configfiltermatchoneperpage', 'admin'), 0);
     $items[] = new admin_setting_configcheckbox('filtermatchonepertext', get_string('filtermatchonepertext', 'admin'), get_string('configfiltermatchonepertext', 'admin'), 0);
     foreach ($items as $item) {
         $item->set_updatedcallback('reset_text_filters_cache');
         $temp->add($item);
     }
 }
 $ADMIN->add('filtersettings', $temp);
 $activefilters = filter_get_globally_enabled();
 $filternames = filter_get_all_installed();
 foreach ($filternames as $filterpath => $strfiltername) {
     if (file_exists("{$CFG->dirroot}/{$filterpath}/filtersettings.php")) {
         $settings = new admin_settingpage('filtersetting' . str_replace('/', '', $filterpath), $strfiltername, 'moodle/site:config', !isset($activefilters[$filterpath]));
         if ($ADMIN->fulltree) {
             include "{$CFG->dirroot}/{$filterpath}/filtersettings.php";
         }
         $ADMIN->add('filtersettings', $settings);
     }
 }
 $catname = get_string('portfolios', 'portfolio');
 $manage = get_string('manageportfolios', 'portfolio');
 $url = "{$CFG->wwwroot}/{$CFG->admin}/portfolio.php";
 $ADMIN->add('modules', new admin_category('portfoliosettings', $catname, empty($CFG->enableportfolios)));
 // jump through hoops to do what we want
 $temp = new admin_settingpage('manageportfolios', get_string('manageportfolios', 'portfolio'));
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:plugins.php

示例2: xmldb_main_upgrade


//.........这里部分代码省略.........
        $table->add_key('contextid', XMLDB_KEY_FOREIGN, array('contextid'), 'context', array('id'));
        /// Adding indexes to table filter_active
        $table->add_index('contextid-filter', XMLDB_INDEX_UNIQUE, array('contextid', 'filter'));
        /// Conditionally launch create table for filter_active
        if (!$dbman->table_exists($table)) {
            $dbman->create_table($table);
        }
        /// Main savepoint reached
        upgrade_main_savepoint(true, 2009040300);
    }
    if ($oldversion < 2009040301) {
        /// Define table filter_config to be created
        $table = new xmldb_table('filter_config');
        /// Adding fields to table filter_config
        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
        $table->add_field('filter', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null);
        $table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
        $table->add_field('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
        $table->add_field('value', XMLDB_TYPE_TEXT, 'small', null, null, null, null);
        /// Adding keys to table filter_config
        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
        $table->add_key('contextid', XMLDB_KEY_FOREIGN, array('contextid'), 'context', array('id'));
        /// Adding indexes to table filter_config
        $table->add_index('contextid-filter-name', XMLDB_INDEX_UNIQUE, array('contextid', 'filter', 'name'));
        /// Conditionally launch create table for filter_config
        if (!$dbman->table_exists($table)) {
            $dbman->create_table($table);
        }
        /// Main savepoint reached
        upgrade_main_savepoint(true, 2009040301);
    }
    if ($oldversion < 2009040302) {
        /// Transfer current settings from $CFG->textfilters
        $disabledfilters = filter_get_all_installed();
        if (empty($CFG->textfilters)) {
            $activefilters = array();
        } else {
            $activefilters = explode(',', $CFG->textfilters);
        }
        $syscontext = get_context_instance(CONTEXT_SYSTEM);
        $sortorder = 1;
        foreach ($activefilters as $filter) {
            filter_set_global_state($filter, TEXTFILTER_ON, $sortorder);
            $sortorder += 1;
            unset($disabledfilters[$filter]);
        }
        foreach ($disabledfilters as $filter => $notused) {
            filter_set_global_state($filter, TEXTFILTER_DISABLED, $sortorder);
            $sortorder += 1;
        }
        /// Main savepoint reached
        upgrade_main_savepoint(true, 2009040302);
    }
    if ($oldversion < 2009040600) {
        /// Ensure that $CFG->stringfilters is set.
        if (empty($CFG->stringfilters)) {
            if (!empty($CFG->filterall)) {
                set_config('stringfilters', $CFG->textfilters);
            } else {
                set_config('stringfilters', '');
            }
        }
        set_config('filterall', !empty($CFG->stringfilters));
        unset_config('textfilters');
        /// Main savepoint reached
        upgrade_main_savepoint(true, 2009040600);
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:67,代码来源:upgrade.php

示例3: search

 /**
  * Searches all installed filters for specified filter
  *
  * @param string $query The filter(string) to search for
  * @param string $query
  */
 public function search($query)
 {
     global $CFG;
     if ($result = parent::search($query)) {
         return $result;
     }
     $found = false;
     $filternames = filter_get_all_installed();
     $textlib = textlib_get_instance();
     foreach ($filternames as $path => $strfiltername) {
         if (strpos($textlib->strtolower($strfiltername), $query) !== false) {
             $found = true;
             break;
         }
         list($type, $filter) = explode('/', $path);
         if (strpos($filter, $query) !== false) {
             $found = true;
             break;
         }
     }
     if ($found) {
         $result = new stdClass();
         $result->page = $this;
         $result->settings = array();
         return array($this->name => $result);
     } else {
         return array();
     }
 }
开发者ID:raymondAntonio,项目名称:moodle,代码行数:35,代码来源:adminlib.php

示例4: get_plugins

    public static function get_plugins($type, $typerootdir, $typeclass) {
        global $CFG, $DB;

        $filters = array();

        // get the list of filters from both /filter and /mod location
        $installed = filter_get_all_installed();

        foreach ($installed as $filterlegacyname => $displayname) {
            $plugin                 = new $typeclass();
            $plugin->type           = $type;
            $plugin->typerootdir    = $typerootdir;
            $plugin->name           = self::normalize_legacy_name($filterlegacyname);
            $plugin->rootdir        = $CFG->dirroot . '/' . $filterlegacyname;
            $plugin->displayname    = $displayname;

            $plugin->load_disk_version();
            $plugin->load_db_version();
            $plugin->load_required_main_version();
            $plugin->init_is_standard();

            $filters[$plugin->name] = $plugin;
        }

        $globalstates = self::get_global_states();

        if ($DB->get_manager()->table_exists('filter_active')) {
            // if we're upgrading from 1.9, the table does not exist yet
            // if it does, make sure that all installed filters are registered
            $needsreload  = false;
            foreach (array_keys($installed) as $filterlegacyname) {
                if (!isset($globalstates[self::normalize_legacy_name($filterlegacyname)])) {
                    filter_set_global_state($filterlegacyname, TEXTFILTER_DISABLED);
                    $needsreload = true;
                }
            }
            if ($needsreload) {
                $globalstates = self::get_global_states(true);
            }
        }

        // make sure that all registered filters are installed, just in case
        foreach ($globalstates as $name => $info) {
            if (!isset($filters[$name])) {
                // oops, there is a record in filter_active but the filter is not installed
                $plugin                 = new $typeclass();
                $plugin->type           = $type;
                $plugin->typerootdir    = $typerootdir;
                $plugin->name           = $name;
                $plugin->rootdir        = $CFG->dirroot . '/' . $info->legacyname;
                $plugin->displayname    = $info->legacyname;

                $plugin->load_db_version();

                if (is_null($plugin->versiondb)) {
                    // this is a hack to stimulate 'Missing from disk' error
                    // because $plugin->versiondisk will be null !== false
                    $plugin->versiondb = false;
                }

                $filters[$plugin->name] = $plugin;
            }
        }

        return $filters;
    }
开发者ID:nutanrajmalanai,项目名称:moodle,代码行数:66,代码来源:pluginlib.php

示例5: get_plugins

 public static function get_plugins($type, $typerootdir, $typeclass)
 {
     global $CFG, $DB;
     $filters = array();
     // get the list of filters in /filter location
     $installed = filter_get_all_installed();
     foreach ($installed as $name => $displayname) {
         $plugin = new $typeclass();
         $plugin->type = $type;
         $plugin->typerootdir = $typerootdir;
         $plugin->name = $name;
         $plugin->rootdir = "{$CFG->dirroot}/filter/{$name}";
         $plugin->displayname = $displayname;
         $plugin->load_disk_version();
         $plugin->load_db_version();
         $plugin->load_required_main_version();
         $plugin->init_is_standard();
         $filters[$plugin->name] = $plugin;
     }
     // Do not mess with filter registration here!
     $globalstates = self::get_global_states();
     // make sure that all registered filters are installed, just in case
     foreach ($globalstates as $name => $info) {
         if (!isset($filters[$name])) {
             // oops, there is a record in filter_active but the filter is not installed
             $plugin = new $typeclass();
             $plugin->type = $type;
             $plugin->typerootdir = $typerootdir;
             $plugin->name = $name;
             $plugin->rootdir = "{$CFG->dirroot}/filter/{$name}";
             $plugin->displayname = $name;
             $plugin->load_db_version();
             if (is_null($plugin->versiondb)) {
                 // this is a hack to stimulate 'Missing from disk' error
                 // because $plugin->versiondisk will be null !== false
                 $plugin->versiondb = false;
             }
             $filters[$plugin->name] = $plugin;
         }
     }
     return $filters;
 }
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:42,代码来源:pluginlib.php

示例6: filter_set_applies_to_strings

/**
 * Sets whether a particular active filter should be applied to all strings by
 * format_string, or just used by format_text.
 *
 * @param string $filter The filter name, for example 'tex'.
 * @param boolean $applytostrings if true, this filter will apply to format_string
 *      and format_text, when it is enabled.
 */
function filter_set_applies_to_strings($filter, $applytostrings)
{
    $stringfilters = filter_get_string_filters();
    $prevfilters = $stringfilters;
    $allfilters = filter_get_all_installed();
    if ($applytostrings) {
        $stringfilters[$filter] = $filter;
    } else {
        unset($stringfilters[$filter]);
    }
    // Remove missing filters.
    foreach ($stringfilters as $filter) {
        if (!isset($allfilters[$filter])) {
            unset($stringfilters[$filter]);
        }
    }
    if ($prevfilters != $stringfilters) {
        set_config('stringfilters', implode(',', $stringfilters));
        set_config('filterall', !empty($stringfilters));
    }
}
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:29,代码来源:filterlib.php

示例7: search

    /**
     * Searches all installed filters for specified filter
     *
     * @param string $query The filter(string) to search for
     * @param string $query
     */
    public function search($query) {
        global $CFG;
        if ($result = parent::search($query)) {
            return $result;
        }

        $found = false;
        $filternames = filter_get_all_installed();
        foreach ($filternames as $path => $strfiltername) {
            if (strpos(core_text::strtolower($strfiltername), $query) !== false) {
                $found = true;
                break;
            }
            if (strpos($path, $query) !== false) {
                $found = true;
                break;
            }
        }

        if ($found) {
            $result = new stdClass;
            $result->page = $this;
            $result->settings = array();
            return array($this->name => $result);
        } else {
            return array();
        }
    }
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:34,代码来源:adminlib.php

示例8: populate_test_database

function populate_test_database($syscontext, $numcategories, $numcourses, $nummodules, $numoverrides, $numconfigs)
{
    global $DB, $OUTPUT;
    set_time_limit(600);
    $syscontext->id = $DB->insert_record('context', $syscontext);
    // Category contexts.
    $categoryparents = array($syscontext);
    $categories = array();
    for ($i = 0; $i < $numcategories; $i++) {
        $context = insert_context(CONTEXT_COURSECAT, $i, $categoryparents[array_rand($categoryparents)]);
        $categoryparents[] = $context;
        $categories[$context->id] = $context;
    }
    echo $OUTPUT->notification('Created ' . $numcategories . ' course category contexts.', 'notifysuccess');
    flush();
    // Course contexts.
    $courses = array();
    for ($i = 0; $i < $numcourses; $i++) {
        $context = insert_context(CONTEXT_COURSE, $i, $categories[array_rand($categories)]);
        $courses[$context->id] = $context;
    }
    echo $OUTPUT->notification('Created ' . $numcourses . ' course contexts.', 'notifysuccess');
    flush();
    // Activities contexts.
    $mods = array();
    $prog = new progress_bar('modbar', 500, true);
    $transaction = $DB->start_delegated_transaction();
    for ($i = 0; $i < $nummodules; $i++) {
        $context = insert_context(CONTEXT_MODULE, $i, $courses[array_rand($courses)]);
        $mods[$context->id] = $context;
        if ($i % 50) {
            $prog->update($i, $nummodules, '');
        }
    }
    $transaction->allow_commit();
    echo $OUTPUT->notification('Created ' . $nummodules . ' module contexts.', 'notifysuccess');
    flush();
    $contexts = $categories + $courses + $mods;
    // Global settings.
    $installedfilters = filter_get_all_installed();
    $counts = array(TEXTFILTER_DISABLED => 0, TEXTFILTER_OFF => 0, TEXTFILTER_ON => 0);
    foreach ($installedfilters as $filter => $notused) {
        $state = array_rand($counts);
        filter_set_global_state($filter, $state);
        $counts[$state]++;
    }
    echo $OUTPUT->notification('Set global setting: ' . $counts[TEXTFILTER_DISABLED] . ' disabled, ' . $counts[TEXTFILTER_OFF] . ' off and ' . $counts[TEXTFILTER_ON] . ' on.', 'notifysuccess');
    flush();
    // Local overrides.
    $localstates = array(TEXTFILTER_OFF => 0, TEXTFILTER_ON => 0);
    $prog = new progress_bar('locbar', 500, true);
    $transaction = $DB->start_delegated_transaction();
    for ($i = 0; $i < $numoverrides; $i++) {
        filter_set_local_state(array_rand($installedfilters), array_rand($contexts), array_rand($localstates));
        if ($i % 50) {
            $prog->update($i, $numoverrides, '');
        }
    }
    $transaction->allow_commit();
    echo $OUTPUT->notification('Set ' . $numoverrides . ' local overrides.', 'notifysuccess');
    flush();
    // Local config.
    $variablenames = array('frog' => 0, 'toad' => 0, 'elver' => 0, 'eft' => 0, 'tadpole' => 0);
    $prog = new progress_bar('confbar', 500, true);
    $transaction = $DB->start_delegated_transaction();
    for ($i = 0; $i < $numconfigs; $i++) {
        filter_set_local_config(array_rand($installedfilters), array_rand($contexts), array_rand($variablenames), random_string(rand(20, 40)));
        if ($i % 50) {
            $prog->update($i, $numconfigs, '');
        }
    }
    $transaction->allow_commit();
    echo $OUTPUT->notification('Set ' . $numconfigs . ' local configs.', 'notifysuccess');
    flush();
}
开发者ID:nigeldaley,项目名称:moodle,代码行数:75,代码来源:filtersettingsperformancetester.php

示例9: restore_write_local_filter_settings

/**
 * Write any per-context filter settings from the backup XML to the DB.
 * @param object $restore the restore we are part of.
 * @param object $data sata loaded from the XML.
 * @param object $newmodcontext the restored context object.
 */
function restore_write_local_filter_settings($restore, $data, $newcontext)
{
    if (filter_context_may_have_filter_settings($newcontext)) {
        return;
    }
    $installedfilters = filter_get_all_installed();
    if (!isset($data->filteractives)) {
        $data->filteractives = array();
    }
    foreach ($data->filteractives as $filter => $state) {
        if (isset($installedfilters[$filter])) {
            filter_set_local_state($filter, $newcontext->id, $state);
        }
    }
    if (!isset($data->filterconfigs)) {
        $data->filterconfigs = array();
    }
    foreach ($data->filterconfigs as $fc) {
        if (isset($installedfilters[$fc->filter])) {
            filter_set_local_config($fc->filter, $newcontext->id, $fc->name, $fc->value);
        }
    }
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:29,代码来源:restorelib.php

示例10: xmldb_main_upgrade


//.........这里部分代码省略.........
        $table->add_key('contextid', XMLDB_KEY_FOREIGN, array('contextid'), 'context', array('id'));
        /// Adding indexes to table filter_active
        $table->add_index('contextid-filter', XMLDB_INDEX_UNIQUE, array('contextid', 'filter'));
        /// Conditionally launch create table for filter_active
        if (!$dbman->table_exists($table)) {
            $dbman->create_table($table);
        }
        /// Main savepoint reached
        upgrade_main_savepoint($result, 2009040300);
    }
    if ($result && $oldversion < 2009040301) {
        /// Define table filter_config to be created
        $table = new xmldb_table('filter_config');
        /// Adding fields to table filter_config
        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
        $table->add_field('filter', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null);
        $table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
        $table->add_field('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
        $table->add_field('value', XMLDB_TYPE_TEXT, 'small', null, null, null, null);
        /// Adding keys to table filter_config
        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
        $table->add_key('contextid', XMLDB_KEY_FOREIGN, array('contextid'), 'context', array('id'));
        /// Adding indexes to table filter_config
        $table->add_index('contextid-filter-name', XMLDB_INDEX_UNIQUE, array('contextid', 'filter', 'name'));
        /// Conditionally launch create table for filter_config
        if (!$dbman->table_exists($table)) {
            $dbman->create_table($table);
        }
        /// Main savepoint reached
        upgrade_main_savepoint($result, 2009040301);
    }
    if ($result && $oldversion < 2009040302) {
        /// Transfer current settings from $CFG->textfilters
        $disabledfilters = filter_get_all_installed();
        if (empty($CFG->textfilters)) {
            $activefilters = array();
        } else {
            $activefilters = explode(',', $CFG->textfilters);
        }
        $syscontext = get_context_instance(CONTEXT_SYSTEM);
        $sortorder = 1;
        foreach ($activefilters as $filter) {
            filter_set_global_state($filter, TEXTFILTER_ON, $sortorder);
            $sortorder += 1;
            unset($disabledfilters[$filter]);
        }
        foreach ($disabledfilters as $filter => $notused) {
            filter_set_global_state($filter, TEXTFILTER_DISABLED, $sortorder);
            $sortorder += 1;
        }
        /// Main savepoint reached
        upgrade_main_savepoint($result, 2009040302);
    }
    if ($result && $oldversion < 2009040600) {
        /// Ensure that $CFG->stringfilters is set.
        if (empty($CFG->stringfilters)) {
            if (!empty($CFG->filterall)) {
                set_config('stringfilters', $CFG->textfilters);
            } else {
                set_config('stringfilters', '');
            }
        }
        set_config('filterall', !empty($CFG->stringfilters));
        unset_config('textfilters');
        /// Main savepoint reached
        upgrade_main_savepoint($result, 2009040600);
开发者ID:ajv,项目名称:Offline-Caching,代码行数:67,代码来源:upgrade.php


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