本文整理汇总了PHP中Options::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Options::getAll方法的具体用法?PHP Options::getAll怎么用?PHP Options::getAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options::getAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateFiles
protected function updateFiles()
{
Cli::pinfo("Update Files");
foreach (array("composer.json", "index.php", "setup") as $file) {
Cli::pinfo(" * Update {$file}");
$content = file_get_contents(getcwd() . DIRECTORY_SEPARATOR . $file);
foreach (Options::getAll() as $key => $val) {
$content = str_replace("@{$key}@", $val, $content);
}
$content = str_replace("@DATE@", date("r"), $content);
$gitignore = trim(file_get_contents($this->getDir() . DIRECTORY_SEPARATOR . "project" . DIRECTORY_SEPARATOR . ".gitignore"));
$content = str_replace("@EXCLUDES@", "\"" . implode(explode("\n", $gitignore), "\", \"") . "\"", $content);
file_put_contents(getcwd() . DIRECTORY_SEPARATOR . $file, $content);
}
}
示例2: init
/**
* Plugin initialization callback.
*
* @global WP $wp
*
* @uses apply_filters()
* @uses load_plugin_textdomain()
* @uses load_textdomain()
* @uses trailingslashit()
*/
public function init()
{
global $wp;
$domain = static::SLUG;
$locale = \apply_filters('plugin_locale', \get_locale(), 'wp-cas-server');
\load_textdomain($domain, \trailingslashit(WP_LANG_DIR) . $domain . '/' . $domain . '-' . $locale . '.mo');
\load_plugin_textdomain($domain, FALSE, basename(\plugin_dir_path(dirname(__FILE__))) . '/languages/');
if (!Options::getAll()) {
Options::setDefaults();
}
$wp->add_query_var(static::QUERY_VAR_ROUTE);
$this->addRewriteRules();
}
示例3: validateSettings
/**
* Validates and updates CAS server plugin settings.
*
* @param array $input Unvalidated input arguments when settings are updated.
*
* @return array Validated plugin settings to be saved in the database.
*
* @since 1.1.0
*/
public function validateSettings($input)
{
$options = Options::getAll();
$options['attributes'] = (array) $input['attributes'];
return $options;
}
示例4: cf_options
public function cf_options($keys = null)
{
if ($keys == null) {
$keys = array();
foreach (Options::getAll() as $key => $val) {
if (substr($key, -5) == "_PATH") {
$keys[] = $key;
}
}
}
$options = array();
foreach (Options::getAll() as $key => $val) {
if (in_array($key, $keys)) {
$options[strtolower($key)] = $val;
}
}
if (Session::Has(Session::rights_key)) {
$options["rights"] = Session::Get(Session::rights_key);
} else {
$options["rights"] = array();
}
if (Session::Has(AbstractLogin::userid)) {
$options["user"] = Session::Get(AbstractLogin::userid);
} else {
$options["user"] = false;
}
foreach (Plugins::dispatchAll("cf_options") as $opt) {
$options = array_merge($options, $opt);
}
echo json_encode($options);
}