Push7 SubscribeButton
  • Namespace
  • Class
  • Tree
  • Hooks

Namespaces

  • None
  • Push7SubscribeButtoon
    • Admin
    • SocialBuzz

Classes

  • Push7_Subscribe_Button
  • Push7_Subscribe_Button_Options
  • Push7_Subscribe_Button_Widget
  • Push7SB_Jetpack
  • Push7SubscribeButtoon\Admin\Admin
  • Push7SubscribeButtoon\SocialBuzz\Base
  • Push7SubscribeButtoon\SocialBuzz\SocialSimple
  • Push7SubscribeButtoon\SocialBuzz\SocialWithThumb
  • Share_Push7
  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

/**
 * SocialBuzz Base Module for extend
 *
 * @package Push7_Subscribe_Button
 * @since 0.0.1-dev
 */

namespace Push7SubscribeButtoon\SocialBuzz;

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

/**
 * Created by IntelliJ IDEA.
 * User: hina
 * Date: 2016/02/18
 * Time: 3:40
 */

/**
 * Class Base
 * @subpackage Push7SubscribeButtoon\SocialBuzz
 * @since 0.0.1-dev
 */
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();
    }

    /**
     * Filter to the_content
     *
     * @param string $content
     *
     * @return string
     * @since 0.0.1-dev
     */
    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;
        }

        /**
         * Filter button template after content like social-buzz
         *
         * @param string $template
         * @param Base $button
         *
         * @since 0.0.1-dev
         * @global \WP_Post $post
         */
        $content .= apply_filters( 'push7_sb_sb_template', $this->get_template(), $this );

        return $content;


    }

    /**
     * @return void
     * @since 0.0.1-dev
     */
    abstract public function enqueue_scripts();

    /**
     * @return string
     * @since 0.0.1-dev
     */
    abstract public function get_template();


    /**
     * register actions
     *
     * @since 0.0.1-dev
     */
    protected function add_actions() {
        /**
         * Push7 Social Buzz Module priority
         *
         * @param int $priority Social Buzz Module current Priority (default 14)
         */
        $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' ) );

    }

    /**
     * on Header
     *
     * @since 0.0.1-dev
     */
    public function display_head() {
    }

    /**
     * on Footer
     *
     * @since 0.0.1-dev
     */
    public function display_footer() {
    }
}
Push7 SubscribeButton API documentation generated by ApiGen