1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
<?php
namespace Push7SubscribeButtoon\SocialBuzz;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
abstract class Base {
private static $instances = array();
public static function get_instance() {
$name = get_called_class();
if ( ! isset( self::$instances[ $name ] ) ) {
self::$instances[ $name ] = new $name;
}
return self::$instances[ $name ];
}
private function __construct() {
$this->add_actions();
}
final function the_content( $content ) {
global $wp_current_filter;
if ( ! is_singular() || in_array( 'get_the_excerpt', (array) $wp_current_filter ) ) {
return $content;
}
if ( ! in_array( get_post_type(), \Push7_Subscribe_Button_Options::get_options()->social_buzz_posttype ) ) {
return $content;
}
if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
return $content;
}
$content .= apply_filters( 'push7_sb_sb_template', $this->get_template(), $this );
return $content;
}
abstract public function enqueue_scripts();
abstract public function get_template();
protected function add_actions() {
$priority = (int) apply_filters( 'push7_sb_sb_priority', 14 );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_action( 'wp_head', array( $this, 'display_head' ) );
add_filter( 'the_content', array( $this, 'the_content' ), $priority );
add_action( 'wp_footer', array( $this, 'display_footer' ) );
}
public function display_head() {
}
public function display_footer() {
}
}