/** * This function is called when the plugin gets activated. Sets default * Options to the database */ public static function on_activate() { $o = get_option('arv_fb24_opt', array()); $def = arvlbSHARED::getDefaults(); if (empty($o)) { update_option('arv_fb24_opt', $def); } return; }
/** * Add all scripts required on the front-end */ public function addScript() { $o = $this->options; if (is_front_page() && !empty($o['display_on_homepage']) || is_archive() && !empty($o['display_on_archive']) || is_single() && !empty($o['display_on_post']) || is_page() && !empty($o['display_on_page'])) { wp_register_style('arevico_scsfbcss', plugins_url('includes/front/scs/scs.css', __FILE__)); wp_enqueue_style('arevico_scsfbcss'); wp_register_script('arevico_scsfb', plugins_url('includes/front/scs/scs.js', __FILE__), array('jquery')); wp_enqueue_script('arevico_scsfb'); wp_register_script('arevico_scsfb_launch', plugins_url('includes/front/js/launch.js', __FILE__), array('jquery')); wp_enqueue_script('arevico_scsfb_launch'); wp_localize_script('arevico_scsfb_launch', 'lb_l_ret', arvlbSHARED::normalize($o)); } }
function __construct() { parent::__construct('arv_fb24_opt', arvlbSHARED::getDefaults()); }
/** * Add all scripts required on the front-end */ public function addScript() { $o = $this->options; if (is_front_page() && !empty($o['display_on_homepage']) || is_archive() && !empty($o['display_on_archive']) || is_single() && !empty($o['display_on_post']) || is_page() && !empty($o['display_on_page']) || !empty($_GET['lightbox'])) { add_action('wp_footer', array($this, 'add_footer')); if (empty($o['performance'])) { add_action('wp_head', array($this, "scompat_head"), -999); } //lower order corresponds with earlier execution wp_register_style('arevico_scsfbcss', plugins_url('includes/front/scs/scs.css', __FILE__)); wp_enqueue_style('arevico_scsfbcss'); wp_register_script('arevico_scsfb', plugins_url('includes/front/scs/scs.js', __FILE__), array('jquery')); wp_enqueue_script('arevico_scsfb'); wp_register_script('arevico_scsfb_launch', plugins_url('includes/front/js/launch.js', __FILE__), array('jquery')); wp_enqueue_script('arevico_scsfb_launch'); wp_localize_script('arevico_scsfb_launch', 'lb_l_ret', arvlbSHARED::normalize($o)); } }