/** * Set class properties and register hooks. * * @uses Webcomic::$dir * @uses Webcomic::$url * @uses Webcomic::$config * @uses Webcomic::init() * @uses Webcomic::log_ipn() * @uses Webcomic::wp_head() * @uses Webcomic::twitter_oauth() * @uses Webcomic::save_transcript() * @uses Webcomic::dynamic_defaults() * @uses Webcomic::webcomic_redirect() * @uses Webcomic::setup_theme() * @uses Webcomic::the_post() * @uses Webcomic::pre_get_posts() * @uses Webcomic::buffer_alert() * @uses Webcomic::wp_enqueue_scripts() * @uses Webcomic::tweet_webcomic() * @uses Webcomic::request() * @uses Webcomic::get_term() * @uses Webcomic::the_posts() * @uses Webcomic::get_terms() * @uses Webcomic::body_class() * @uses Webcomic::post_class() * @uses Webcomic::get_the_terms() * @uses Webcomic::post_type_link() * @uses Webcomic::pre_option_template() * @uses Webcomic::template_include() * @uses Webcomic::the_content_feed() * @uses Webcomic::wp_get_object_terms() * @uses Webcomic::extra_theme_headers() * @uses Webcomic::pre_option_stylesheet() * @uses Webcomic::wp_get_attachment_image_attributes() * @uses Webcomic::loop_end() * @uses Webcomic::loop_start() * @uses Webcomic::the_excerpt() * @uses Webcomic::the_content() * @uses Webcomic::integrate_sort_asc() * @uses WebcomicWidget * @uses WebcomicShortcode */ public function __construct() { self::$dir = plugin_dir_path(__FILE__); self::$url = plugin_dir_url(__FILE__); self::$config = get_option("webcomic_options"); if (self::$config and version_compare(self::$config['version'], '4x', '>=')) { add_action('init', array($this, 'init')); add_action('init', array($this, 'log_ipn')); add_action('wp_head', array($this, 'wp_head'), 1); add_action('init', array($this, 'twitter_oauth')); add_action('wp_loaded', array($this, 'wp_loaded')); add_action('init', array($this, 'save_transcript')); add_action('init', array($this, 'dynamic_defaults')); add_action('init', array($this, 'webcomic_redirect')); add_action('setup_theme', array($this, 'setup_theme')); add_action('the_post', array($this, 'the_post'), 10, 1); add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1); add_action('webcomic_buffer_alert', array($this, 'buffer_alert')); add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts')); add_action('transition_post_status', array($this, 'tweet_webcomic'), 10, 3); add_filter('request', array($this, 'request'), 10, 1); add_filter('get_term', array($this, 'get_term'), 10, 2); add_filter('the_posts', array($this, 'the_posts'), 10, 2); add_filter('get_terms', array($this, 'get_terms'), 10, 3); add_filter('body_class', array($this, 'body_class'), 10, 2); add_filter('post_class', array($this, 'post_class'), 10, 3); add_filter('get_the_terms', array($this, 'get_the_terms'), 10, 3); add_action('post_type_link', array($this, 'post_type_link'), 10, 4); add_filter('pre_option_template', array($this, 'pre_option_template')); add_filter('template_include', array($this, 'template_include'), 10, 1); add_filter('the_content_feed', array($this, 'the_content_feed'), 10, 1); add_filter('pre_option_stylesheet', array($this, 'pre_option_stylesheet')); add_filter('wp_get_object_terms', array($this, 'wp_get_object_terms'), 10, 4); add_filter('extra_theme_headers', array($this, 'extra_theme_headers'), 10, 1); add_filter('wp_get_attachment_image_attributes', array($this, 'wp_get_attachment_image_attributes'), 10, 2); if (self::$config['integrate']) { add_action('loop_end', array($this, 'loop_end'), 10, 1); add_action('loop_start', array($this, 'loop_start'), 10, 1); add_action('the_excerpt', array($this, 'the_excerpt'), 10, 1); add_action('the_content', array($this, 'the_content'), 10, 1); add_action('pre_get_posts', array($this, 'integrate_sort_asc'), 10, 1); } require_once self::$dir . '-/php/tags.php'; require_once self::$dir . '-/php/widgets.php'; new WebcomicWidget(); require_once self::$dir . '-/php/shortcodes.php'; new WebcomicShortcode(); } }