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 
<?php

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


/**
 * Created by IntelliJ IDEA.
 * User: hina
 * Date: 2016/02/15
 * Time: 1:15
 */

/**
 * Class Share_Push7
 *
 * Push7 for Jetpack Share button
 */
class Share_Push7 extends Sharing_Source {

    /**
     * @var string shortname
     * @since 0.0.1-dev
     */
    public $shortname = 'push7';

    /**
     * Share_Push7 constructor.
     *
     * @param $id
     * @param array $settings
     * @since 0.0.1-dev
     */
    public function __construct( $id, array $settings ) {
        parent::__construct( $id, $settings );

        if ( 'official' == $this->button_style ) {
            $this->smart = true;
        } else {
            $this->smart = false;
        }
    }


    /**
     * Sharing source name
     *
     * @return string
     * @since 0.0.1-dev
     */
    public function get_name() {
        return _x( 'Push Notification', 'as sharing source', 'simple-push-subscribe-button' );
    }

    /**
     * @return bool
     * @since 0.0.1-dev
     */
    public function has_custom_button_style() {
        return $this->smart;
    }

    /**
     * Get Button for front
     *
     * @param $post WP_Post
     * @since 0.0.1-dev
     *
     * @return string
     */
    public function get_display( $post ) {
        if ( $this->smart ) {
            return Push7_Subscribe_Button::get_official_button( Push7_Subscribe_Button::get_appid_inc_official() );
        } else {
            return $this->get_link(
                'about:blank',
                /**
                 * Filter Push7 Share Button title text
                 *
                 * @param string $text
                 * @since 0.0.1-dev
                 */
                apply_filters( 'push7_sb_share_title', _x( 'Subscribe', 'share to', 'simple-push-subscribe-button' ) ),
                /**
                 * Filter Push7 Share Button description
                 *
                 * @param string $description
                 * @since 0.0.1-dev
                 */
                apply_filters( 'push7_sb_share_description', __( 'Click to subscribe push notification with Push7', 'simple-push-subscribe-button' ) ),
                'appid=' . Push7_Subscribe_Button::get_appid_inc_official(), 'sharing-push7-' . $post->ID
            );
        }
    }

    public function display_header() {
        if ( ! $this->smart ) {
            wp_enqueue_style( 'push7-custom-button' );
        }
    }

    /**
     * Footer action
     * @since 0.0.1-dev
     */
    public function display_footer() {
        if ( $this->smart ) {
            wp_enqueue_script( 'push7-subscribe-button' );
        } else {
            wp_enqueue_script( 'push7-custom-button' );
            $this->js_dialog( $this->shortname );
        }
    }
}
Push7 SubscribeButton API documentation generated by ApiGen