Exemplo n.º 1
0
 function __construct()
 {
     $this->prefix = apply_filters('minqueue_prefix', $this->prefix);
     $this->options = minqueue_get_options();
     $this->admin_notices = new MinQueue_Admin_Notices($this->prefix);
     add_action('admin_menu', array($this, 'admin_menu'));
     add_action('admin_init', array($this, 'admin_init'));
     add_action('admin_notices', array($this, 'display_admin_notices'), 1);
     add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
 }
Exemplo n.º 2
0
/**
 * Process Styles
 *
 * @return null
 */
function minqueue_styles()
{
    if (is_admin()) {
        return;
    }
    $options = minqueue_get_options();
    // Styles
    if (isset($options['styles_method']) && 'disabled' !== $options['styles_method']) {
        foreach ($options['styles_manual'] as $key => $queue) {
            if (!empty($queue)) {
                $styles[$key] = new MinQueue_Styles((array) $queue);
                $styles[$key]->minify();
            }
        }
    }
}
Exemplo n.º 3
0
/**
 * Output a <li>s of a list of assets for use in the helper
 *
 * @param  array  $asset_list list of handles to display
 * @param  boolean $scripts   whether minifying scripts. If false, minifyling styles.
 * @return null outputs <li> for each handle.
 */
function minqueue_helper_list($asset_list, $scripts = true)
{
    global $minified_deps, $wp_scripts, $wp_styles;
    $options = minqueue_get_options();
    if ($scripts) {
        $class =& $wp_scripts;
    } else {
        $class =& $wp_styles;
    }
    foreach ($asset_list as $handle) {
        // Don't show minified scripts.
        if (0 === strpos($handle, 'minqueue')) {
            continue;
        }
        $classes = array();
        $classes['group'] = 'minqueue-group-' . (isset($class->registered[$handle]->extra['group']) ? $class->registered[$handle]->extra['group'] : 0);
        if (array_key_exists($handle, $minified_deps[get_class($class)])) {
            $classes['minified'] = 'minqueue-minified';
        }
        $checked = false;
        foreach ($options['WP_Scripts' == get_class($class) ? 'scripts_manual' : 'styles_manual'] as $queue) {
            if (!$checked) {
                $checked = in_array($handle, $queue);
            }
        }
        $disabled = !is_user_logged_in() || !current_user_can('manage_options') ? true : false;
        printf('<li class="%s" title="%s"><span class="minqueue-icon">%s</span>%s</li>', implode(' ', array_map('sanitize_html_class', $classes)), esc_attr(implode(', ', $class->registered[$handle]->deps)), $checked ? '&#10004;' : '&bull;', esc_html($handle));
    }
}