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


PHP wpgrade类代码示例

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


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

示例1: wpgrade_callback_enqueue_dynamic_css

function wpgrade_callback_enqueue_dynamic_css()
{
    $style_query = array();
    //		if (wpgrade::option('main_color')) {
    //			$main_color = wpgrade::option('main_color');
    //			$main_color = str_replace('#', '', $main_color);
    //			$style_query['color'] = $main_color;
    //		}
    if (wpgrade::option('use_google_fonts')) {
        add_action('wp_head', 'wpgrade_callback_load_google_fonts');
        $fonts_array = array('google_titles_font', 'google_second_font', 'google_nav_font', 'google_body_font');
        foreach ($fonts_array as $font) {
            $the_font = wpgrade::get_the_typo($font);
            //				var_dump($the_font);
            if (!empty($the_font)) {
                $style_query['fonts'][$font] = $the_font;
            }
        }
    }
    //		if (wpgrade::option('portfolio_text_color')) {
    //			$port_color = wpgrade::option('portfolio_text_color');
    //			$port_color = str_replace('#', '', $port_color);
    //			$style_query['port_color'] = $port_color;
    //		}
    if (wpgrade::option('inject_custom_css') == 'file') {
        wp_enqueue_style('wpgrade-custom-style', get_template_directory_uri() . '/theme-content/css/custom.css');
    }
}
开发者ID:qhuit,项目名称:Tournesol,代码行数:28,代码来源:dynamic-css.php

示例2: render_content

 /**
  * A custom render for sliders in customizer panel
  */
 public function render_content()
 {
     $field = search_multi($this->ReduxFramework->sections, 'id', $this->option_key);
     // the key is always unique so there will be only one
     $field = $field[0];
     if (!isset($field['name_suffix'])) {
         $field['name_suffix'] = "";
     }
     if (!isset($field['default'])) {
         $field['default'] = array();
     }
     $field['custom_data'] = $this->get_link();
     $field_class = 'ReduxFramework_customizer_background';
     if (!class_exists($field_class)) {
         $class_file = apply_filters('redux-typeclass-load', '/inc/fields/background/field_background.php', $field_class);
         if ($class_file === '/inc/fields/background/field_background.php') {
             /** @noinspection PhpIncludeInspection */
             require_once wpgrade::corepath() . 'vendor/redux3/' . $class_file;
         }
     }
     $value = wpgrade::option($field['id'], $field['default']);
     // get wordpress default labels
     $this->json['button_labels'] = array('select' => __('Select Image'), 'change' => __('Change Image'), 'remove' => __('Remove'), 'default' => __('Default'), 'placeholder' => __('No image selected'), 'frame_title' => __('Select Image'), 'frame_button' => __('Choose Image'));
     if (class_exists($field_class) && method_exists($field_class, 'render')) {
         $field_object = new $field_class($field, $value, $this->ReduxFramework);
         //				$enqueue->enqueue();
         echo "<label>" . "<span class=\"customize-control-title\">" . $field['title'] . "</span>" . "</label>";
         //				echo '<div class="redux-container-'. $this->type . '" >';
         echo $field_object->render();
         //				echo '<div>';
     }
 }
开发者ID:pwzCypher,项目名称:wp-push,代码行数:35,代码来源:background.php

示例3: wpgrade_update_notifier_latest_theme_version

/**
 * Get the remote XML file contents and return its data (Version
 * and Changelog). Uses the cached version if available and inside the time
 * interval defined
 */
function wpgrade_update_notifier_latest_theme_version($interval)
{
    $notifier_file_url = wpgrade::updade_notifier_xml();
    $db_cache_field = 'notifier-cache-' . wpgrade::shortname();
    $db_cache_field_last_updated = 'notifier-cache-last-updated-' . wpgrade::shortname();
    $last = get_option($db_cache_field_last_updated);
    $now = time();
    // check the cache
    if (!$last || $now - $last > $interval) {
        // cache doesn't exist, or is old, so refresh it
        $res = wp_remote_get($notifier_file_url);
        $cache = wp_remote_retrieve_body($res);
        if ($cache) {
            // we got good results
            update_option($db_cache_field, $cache);
            update_option($db_cache_field_last_updated, time());
        }
        // read from the cache file
        $notifier_data = get_option($db_cache_field);
    } else {
        // cache file is fresh enough, so read from it
        $notifier_data = get_option($db_cache_field);
    }
    // Let's see if the $xml data was returned as we expected it to.
    // If it didn't, use the default 1.0 as the latest version so that we don't have problems when the remote server hosting the XML file is down
    if (strpos((string) $notifier_data, '<notifier>') === false) {
        $notifier_data = '<?xml version="1.0" encoding="UTF-8"?><notifier><latest>1.0</latest><changelog></changelog></notifier>';
    }
    // Load the remote XML data into a variable and return it
    $xml = simplexml_load_string($notifier_data);
    return $xml;
}
开发者ID:pwzCypher,项目名称:wp-push,代码行数:37,代码来源:helpers.php

示例4: render_content

 public function render_content()
 {
     $field = search_multi($this->ReduxFramework->sections, 'id', $this->option_key);
     // the key is always unique so there will be only one
     $field = $field[0];
     if (!isset($field['name_suffix'])) {
         $field['name_suffix'] = "";
     }
     if (!isset($field['default'])) {
         $field['default'] = array();
     }
     $field['custom_data'] = $this->get_link();
     $field_class = 'ReduxFramework_customizer_checkbox';
     if (!class_exists($field_class)) {
         $class_file = apply_filters('redux-typeclass-load', '/inc/fields/checkbox/field_checkbox.php', $field_class);
         if ($class_file === 'inc/fields/checkbox/field_checkbox.php') {
             /*  for PRO users! - * @noinspection PhpIncludeInspection */
             require_once wpgrade::corepath() . 'vendor/redux3/' . $class_file;
         }
     }
     $value = wpgrade::option($field['id'], 0);
     if (class_exists($field_class) && method_exists($field_class, 'render')) {
         $enqueue = new $field_class($field, $value, $this->ReduxFramework);
         //				$enqueue->enqueue();
         echo "<label>" . "<span class=\"customize-control-title\">" . $field['title'] . "</span>" . "</label>";
         echo '<div class="redux-container-' . $this->type . '">';
         echo $enqueue->render();
         echo '<div>';
     }
 }
开发者ID:qhuit,项目名称:Tournesol,代码行数:30,代码来源:checkbox.php

示例5: wpgrade_callback_geting_active

/**
 * Theme activation hook
 */
function wpgrade_callback_geting_active()
{
    /**
     * Get the config from /config/activation.php
     */
    $activation_settings = array();
    if (file_exists(wpgrade::themepath() . 'config/activation' . EXT)) {
        $activation_settings = (include wpgrade::themepath() . 'config/activation' . EXT);
    }
    /**
     * Make sure pixlikes has the right settings
     */
    if (isset($activation_settings['pixlikes-settings'])) {
        $pixlikes_settings = $activation_settings['pixlikes-settings'];
        update_option('pixlikes_settings', $pixlikes_settings);
    }
    /**
     * Create custom post types, taxonomies and metaboxes
     * These will be taken by pixtypes plugin and converted in their own options
     */
    if (isset($activation_settings['pixtypes-settings'])) {
        $pixtypes_conf_settings = $activation_settings['pixtypes-settings'];
        $types_options = get_option('pixtypes_themes_settings');
        if (empty($types_options)) {
            $types_options = array();
        }
        $theme_key = wpgrade::shortname() . '_pixtypes_theme';
        $types_options[$theme_key] = $pixtypes_conf_settings;
        update_option('pixtypes_themes_settings', $types_options);
    }
    /**
     * http://wordpress.stackexchange.com/questions/36152/flush-rewrite-rules-not-working-on-plugin-deactivation-invalid-urls-not-showing
     */
    delete_option('rewrite_rules');
}
开发者ID:pwzCypher,项目名称:wp-push,代码行数:38,代码来源:activation-hooks.php

示例6: setup

 protected function setup()
 {
     // the boring defaults that are ommited in the wpgrade-config.php
     // configuration for clarity and bravity, and also because some require
     // extensive logic handling
     $defaults = array('base' => str_replace(999999999, '%#%', esc_url(get_pagenum_link(999999999))), 'format' => $this->pager_format($this->pager), 'current' => max(1, get_query_var($this->pager)), 'total' => $this->query->max_num_pages, 'formatter' => null, 'prev_next' => true, 'sorted_paging' => false, 'order' => 'desc', 'show_all' => false, 'end_size' => 1, 'mid_size' => 2, 'add_args' => false, 'add_fragment' => null);
     $conf = wpgrade::merge($defaults, $this->conf);
     # we're filling in prev_text and next_text seperatly to avoid
     # requesting the translation when not required
     if (empty($conf['prev_text'])) {
         $conf['prev_text'] = __('&laquo; Previous', 'rosa_txtd');
     } else {
         // exists; translate
         $conf['prev_text'] = __($conf['prev_text'], 'rosa_txtd');
     }
     if (empty($conf['next_text'])) {
         $conf['next_text'] = __('Next &raquo;', 'rosa_txtd');
     } else {
         // exists; translate
         $conf['next_text'] = __($conf['next_text'], 'rosa_txtd');
     }
     // is the pager sorted?
     if ($conf['sorted_paging'] && $conf['order'] == 'asc') {
         $temp = $conf['prev_text'];
         $conf['prev_text'] = $conf['next_text'];
         $conf['next_text'] = $temp;
     }
     return $conf;
 }
开发者ID:pwzCypher,项目名称:wp-push,代码行数:29,代码来源:WPGradePaginationFormatter.php

示例7: wpgrade_register_custom_menus

function wpgrade_register_custom_menus()
{
    add_theme_support('menus');
    $menus = wpgrade::confoption('import_nav_menu');
    foreach ($menus as $key => $value) {
        register_nav_menu($key, $value);
    }
}
开发者ID:pwzCypher,项目名称:wp-push,代码行数:8,代码来源:menus.php

示例8: instance

 static function instance($reinitialize = false)
 {
     if (self::$instance == null || $reinitialize) {
         $config = wpgrade::config();
         self::$instance = new WPGradeOptions($config['theme-options']);
     }
     return self::$instance;
 }
开发者ID:qhuit,项目名称:Tournesol,代码行数:8,代码来源:WPGradeOptions.php

示例9: wpgrade_clean_static_files

function wpgrade_clean_static_files()
{
    if (wpgrade::option('remove_parameters_from_static_res')) {
        add_filter('the_generator', 'wpgrade_remove_version_info');
        add_filter('script_loader_src', 'wpgrade_remove_script_version', 15, 1);
        add_filter('style_loader_src', 'wpgrade_remove_script_version', 15, 1);
    }
}
开发者ID:pwzCypher,项目名称:wp-push,代码行数:8,代码来源:pagespeed-optimizations.php

示例10: wpgrade_callback_load_woocommerce_assets

function wpgrade_callback_load_woocommerce_assets()
{
    global $woocommerce;
    if (!wpgrade::option('enable_woocommerce_support', '0')) {
        return;
    }
    wp_enqueue_style('wpgrade-woocommerce', get_template_directory_uri() . '/assets/css/woocommerce.css', array('woocommerce-general'), wpgrade::cachebust_string(wpgrade::themefilepath('assets/css/woocommerce.css')));
}
开发者ID:qhuit,项目名称:Tournesol,代码行数:8,代码来源:woocommerce.php

示例11: wpgrade_callback_inlined_custom_style

function wpgrade_callback_inlined_custom_style()
{
    ob_start();
    include wpgrade::corepartial('inline-custom-css' . EXT);
    $custom_css = ob_get_clean();
    $style = 'wpgrade-main-style';
    wp_add_inline_style($style, $custom_css);
}
开发者ID:qhuit,项目名称:Tournesol,代码行数:8,代码来源:inline-custom-style.php

示例12: __construct

 function __construct()
 {
     $widget_ops = array('classname' => 'widget--latest-comments', 'description' => __('The latest comments', 'rosa_txtd'));
     parent::__construct('recent-comments', wpgrade::themename() . ' ' . __('Latest Comments', 'rosa_txtd'), $widget_ops);
     $this->alt_option_name = 'widget_recent_comments';
     add_action('comment_post', array($this, 'flush_widget_cache'));
     add_action('transition_comment_status', array($this, 'flush_widget_cache'));
 }
开发者ID:qhuit,项目名称:Tournesol,代码行数:8,代码来源:wpgrade_latest_comments.php

示例13: remove_customizer_controls

function remove_customizer_controls($wp_customize)
{
    $sections = wpgrade::get_redux_arg('remove_customizer_sections');
    if (!empty($sections) && is_array($sections)) {
        foreach ($sections as $key => $section) {
            $wp_customize->remove_section($section);
        }
    }
}
开发者ID:qhuit,项目名称:Tournesol,代码行数:9,代码来源:redux-extend.php

示例14: wpGrade_ajax_import_widgets

 function wpGrade_ajax_import_widgets()
 {
     $response = array('what' => 'import_widgets', 'action' => 'import_submit', 'id' => 'true');
     // check if user is allowed to save and if its his intention with
     // a nonce check
     if (function_exists('check_ajax_referer')) {
         check_ajax_referer('wpGrade_nonce_import_demo_widgets');
     }
     require_once wpgrade::themefilepath('inc/import/import-demo-widgets' . EXT);
     $response = new WP_Ajax_Response($response);
     $response->send();
 }
开发者ID:pwzCypher,项目名称:wp-push,代码行数:12,代码来源:callbacks.php

示例15: get_gallery_ids

 /**
  * Get the gallery of the global post
  * @required global $post this should be called inside a loop
  * @return array $ids
  */
 function get_gallery_ids($key = '')
 {
     global $post;
     $prefix = '';
     if (class_exists('wpgrade')) {
         $prefix = wpgrade::prefix();
     }
     $ids = get_post_meta($post->ID, $prefix . $key, true);
     if (!empty($ids)) {
         $ids = explode(',', $ids);
     }
     return $ids;
 }
开发者ID:ksingh812,项目名称:epb,代码行数:18,代码来源:class-pix-query.php


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