Esempio n. 1
0
function hocwp_recommended_plugins()
{
    $required = hocwp_get_theme_required_plugins();
    $defaults = array('required' => $required, 'recommended' => array('wordpress-seo', 'wp-super-cache', 'wp-optimize', 'wp-external-links', 'syntaxhighlighter', 'akismet', 'google-analytics-for-wordpress', 'updraftplus'));
    return apply_filters('hocwp_recommended_plugins', $defaults);
}
function hocwp_setup_theme_admin_notice_required_plugins()
{
    $required_plugins = hocwp_get_theme_required_plugins();
    if (hocwp_array_has_value($required_plugins)) {
        $active_plugins = get_option('active_plugins');
        $missing_required = false;
        if (!hocwp_array_has_value($active_plugins)) {
            $missing_required = true;
        } else {
            $not_active = array();
            foreach ($required_plugins as $slug) {
                if ('woocommerce' == $slug && hocwp_wc_installed()) {
                    continue;
                }
                $install = false;
                foreach ($active_plugins as $basename) {
                    $tmp = basename(dirname($basename));
                    if ($tmp == $slug) {
                        $install = true;
                    }
                }
                if (!$install) {
                    $not_active[] = $slug;
                }
            }
            if (hocwp_array_has_value($not_active)) {
                $missing_required = true;
            }
        }
        if ($missing_required) {
            $admin_url = admin_url('admin.php');
            $admin_url = add_query_arg(array('page' => 'hocwp_recommended_plugin', 'tab' => 'required'), $admin_url);
            hocwp_admin_notice(array('text' => sprintf(__('Please install the required plugins for your theme. You can <a href="%s">click here</a> to see the list of required plugins for this theme.', 'hocwp-theme'), $admin_url), 'error' => true));
        }
    }
}