Esempio n. 1
0
function essbis_load_scripts_styles()
{
    global $essbis_options;
    if (false == essbis_plugin_active_for_current_request()) {
        return;
    }
    wp_enqueue_style('essbis-styles', ESSBIS_Constants::get_plugin_url() . 'assets/css/styles.css', array(), ESSBIS_Constants::get_version());
    wp_enqueue_script('essbis-main', ESSBIS_Constants::get_plugin_url() . 'assets/js/essbis.js', array('jquery'), ESSBIS_Constants::get_version(), false);
    $options_copy = $essbis_options;
    //update module info for current request
    $active_modules = array();
    foreach (ESSBImageShare()->get_module_manager()->get_modules() as $module_name => $module) {
        $use_module = $module->is_active();
        if ($use_module && $module instanceof iESSBIS_Activateable_Module) {
            $use_module = $module->use_for_current_request();
        }
        if ($use_module) {
            $active_modules[] = $module_name;
        }
    }
    $options_copy['main']['activeModules'] = $active_modules;
    //hide settings for modules that don't need to copy them
    foreach (ESSBImageShare()->get_module_manager()->get_modules() as $module_name => $module) {
        if ($module->copy_settings_to_js() == false) {
            $options_copy[$module_name] = null;
        }
    }
    //print_r($options_copy);
    $js_settings = array('modules' => $options_copy, 'buttonSets' => essbis_button_set_get_for_js(), 'themes' => essbis_theme_get_for_js());
    wp_localize_script('essbis-main', 'ESSBISSettings', $js_settings);
}
Esempio n. 2
0
function essbis_plugin_active_for_current_request()
{
    $result = false;
    //loop through active modules
    $activateable_modules = ESSBImageShare()->get_module_manager()->get_activateable_modules();
    foreach ($activateable_modules as $module_name => $module) {
        $result = $result || $module->use_for_current_request();
    }
    return apply_filters('essbis_plugin_active_for_current_request', $result);
}
Esempio n. 3
0
function essbis_content_filter($content)
{
    if (is_feed() || false == essbis_plugin_active_for_current_request()) {
        return $content;
    }
    $active_modules = ESSBImageShare()->get_module_manager()->get_active_modules();
    foreach ($active_modules as $module_name => $module) {
        $content = $module->content_filter($content);
    }
    return $content;
}
Esempio n. 4
0
            }
            $essb_image_options = ESSBSocialImageShareOptions::get_instance();
            $essbis_options = $essb_image_options->sis_options;
            //load custom post types
            //load widgets
            //load everything else
            require_once ESSBIS_Constants::get_plugin_dir() . 'includes/misc_functions.php';
            require_once ESSBIS_Constants::get_plugin_dir() . 'includes/scripts.php';
            require_once ESSBIS_Constants::get_plugin_dir() . 'includes/content.php';
        }
        public function get_module_manager()
        {
            return $this->module_manager;
        }
    }
}
// End if class_exists check
function ESSBImageShare()
{
    return ESSBImageShare::instance();
}
// Get ESSBImageShare Running
ESSBImageShare();
add_filter('body_class', 'essbis_class_names');
function essbis_class_names($classes)
{
    // add 'class-name' to the $classes array
    $classes[] = 'essbis_site';
    // return the $classes array
    return $classes;
}