本文整理汇总了PHP中wpgrade::config方法的典型用法代码示例。如果您正苦于以下问题:PHP wpgrade::config方法的具体用法?PHP wpgrade::config怎么用?PHP wpgrade::config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpgrade
的用法示例。
在下文中一共展示了wpgrade::config方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* You may set the pager configuration value to either page or paged to
* switch the pagination from showing post listings to showing post
* segments.
*
* @param mixed query
* @param array configuration
*/
function __construct($query, $conf = null)
{
if ($conf === null) {
$conf = array();
}
$this->query = $query;
$config = wpgrade::config();
$config_defaults = $config['pagination'];
// the pager determines what we're paginating (ie. "paged" for listing
// of posts, and "page" for post parts)
if (isset($conf['pager'])) {
$this->pager = $conf['pager'];
} else {
if (isset($config_defaults['pager'])) {
$this->pager = $config_defaults['pager'];
} else {
// no pager configuration entry
// fallback to listing pagination
if (is_front_page() && is_page()) {
$this->pager = 'page';
} else {
$this->pager = 'paged';
}
}
}
$this->conf = wpgrade::merge($config_defaults, $conf);
}
示例2: wpgrade_callback_enqueue_theme_resources
function wpgrade_callback_enqueue_theme_resources()
{
$themeconfiguration = wpgrade::config();
// Scripts registers, localization and enqueues
// --------------------------------------------
// auto-enqueue
foreach ($themeconfiguration['resources']['auto-enqueue-scripts'] as $stylename) {
wp_enqueue_script($stylename);
}
// auto-localize
foreach ($themeconfiguration['resources']['auto-localize-scripts'] as $stylename => $script) {
// allow child themes to remove the localization
if ($script !== null) {
// localize the theme_name, we are gonna need it
if ($stylename === 'wpgrade-main-scripts') {
$script['theme_name'] = wpgrade::shortname();
}
foreach ($script as $key => $data) {
wp_localize_script($stylename, $key, $data);
}
}
}
// Style registers and enqueues
// ----------------------------
// auto-enqueue registered styles
foreach ($themeconfiguration['resources']['auto-enqueue-styles'] as $stylename) {
wp_enqueue_style($stylename);
}
}
示例3: instance
static function instance($reinitialize = false)
{
if (self::$instance == null || $reinitialize) {
$config = wpgrade::config();
self::$instance = new WPGradeOptions($config['theme-options']);
}
return self::$instance;
}
示例4: wpGrade_Redux
// Dynamically load in all classes
// -------------------------------
# Loading convention: if it's a PHP file it's loaded, the shorter the path
# the higher the priority
$classpath = $basepath . 'classes' . DIRECTORY_SEPARATOR;
wpgrade::require_all($classpath);
// Setup Option Drivers
// --------------------
if (wpgrade::confoption('wpml_separate_options', false)) {
$wpgrade_redux = new wpGrade_Redux();
}
// the handler is the main object responsible for managing the drivers
wpgrade::options_handler(new WPGradeOptions());
# [!!] driver priority works like a LIFO stack, last in = highest priority
// register basic configuration driver
$config = wpgrade::config();
wpgrade::options()->add_optiondriver(new WPGradeOptionDriver_Config($config['theme-options']));
// we register redux as option driver via a resolver
function wpgrade_callback_bootstrap_redux_instance($redux)
{
$reduxdriver = new WPGradeOptionDriver_Redux($redux);
wpgrade::options()->add_optiondriver($reduxdriver);
}
wpgrade::register_resolver('redux-instance', 'wpgrade_callback_bootstrap_redux_instance');
// Plugins & Resolvable Dependencies
// ---------------------------------
require wpgrade::themefilepath(wpgrade::confoption('theme-adminpanel-path', 'theme-content/admin-panel') . '/bootstrap' . EXT);
// Hooks
// -----
get_template_part('wpgrade-core/hooks');
// Upgrade Notifier
示例5: wpgrade_callbacks_setup_shortcodes_plugin
/**
* ...
*/
function wpgrade_callbacks_setup_shortcodes_plugin()
{
$current_options = get_option('wpgrade_shortcodes_list');
$config = wpgrade::config();
$shortcodes = $config['shortcodes'];
// create an array with shortcodes which are needed by the
// current theme
if ($current_options) {
$diff_added = array_diff($shortcodes, $current_options);
$diff_removed = array_diff($current_options, $shortcodes);
if ((!empty($diff_added) || !empty($diff_removed)) && is_admin()) {
update_option('wpgrade_shortcodes_list', $shortcodes);
}
} else {
// there is no current shortcodes list
update_option('wpgrade_shortcodes_list', $shortcodes);
}
// we need to remember the prefix of the metaboxes so it can be used
// by the shortcodes plugin
$current_prefix = get_option('wpgrade_metaboxes_prefix');
if (empty($current_prefix)) {
update_option('wpgrade_metaboxes_prefix', wpgrade::prefix());
}
}