/** * Setup frontend functionality for WordPress * * @return none * @since 3.0.0.0 */ function __construct() { Shadowbox::__construct(); // Only add these actions when we have options in the database // This allows for selecting to delete options from the admin page if (!empty($this->options)) { add_action('init', array(&$this, 'styles'), 7); add_action('init', array(&$this, 'scripts'), 8); if ($this->get_option('smartLoad') == 'false') { add_action('wp_footer', array(&$this, 'configure'), 21); } // Automatically add Shadowbox to links if ($this->is_automatic('any')) { if ($this->get_option('smartLoad') == 'false') { add_filter('the_content', array(&$this, 'add_attr_to_link'), 12, 2); } else { add_filter('the_posts', array(&$this, 'process_posts_early'), 10, 2); } add_filter('wp_get_attachment_link', array(&$this, 'add_attr_to_link'), 12, 2); } // If we are automating for images make sure we link directly to the attachment if ($this->is_automatic('img')) { add_filter('attachment_link', array(&$this, 'attachment_direct_linkage'), 10, 2); } if (!function_exists('get_admin_url')) { add_filter('admin_url', array(&$this, 'admin_url_scheme')); } } }
/** * Setup backend functionality in WordPress * * @return none * @since 3.0.0.0 */ function __construct() { Shadowbox::__construct(); if (version_compare($this->get_option('version'), $this->dbversion, '!=') && !empty($this->options)) { $this->check_upgrade(); } // Full path and plugin basename of the main plugin file $this->plugin_file = dirname(dirname(__FILE__)) . '/shadowbox-js.php'; $this->plugin_basename = plugin_basename($this->plugin_file); // ajax hooks so that we can build/output shadowbox.js add_action('wp_ajax_shadowboxjs', array(&$this, 'build_shadowbox')); add_action('wp_ajax_nopriv_shadowboxjs', array(&$this, 'build_shadowbox')); add_action('wp_ajax_getshadowboxsrc', array(&$this, 'ajax_get_src')); // Load localizations if available load_plugin_textdomain('shadowbox-js', false, 'shadowbox-js/localization'); // Activation hook register_activation_hook($this->plugin_file, array(&$this, 'init')); // Whitelist options add_action('admin_init', array(&$this, 'register_settings')); // Activate the options page add_action('admin_menu', array(&$this, 'add_page')); add_filter('explain_nonce_getshadowboxcreds', 'nonce_oops'); add_filter('explain_nonce_getshadowboxsrc', 'nonce_oops'); if (get_option('shadowbox-js-missing-src')) { add_action('admin_notices', array(&$this, 'missing_src_notice')); } }