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
<?php
namespace Push7SubscribeButtoon\SocialBuzz;
require_once dirname( __FILE__ ) . '/class.base.php';
class SocialWithThumb extends Base {
public function enqueue_scripts() {
if ( is_singular() ) {
wp_enqueue_style( 'push7-custom-button' );
wp_add_inline_style( 'push7-custom-button', $this->get_css() );
wp_enqueue_script( 'push7-subscribe-button' );
}
}
public function get_template() {
return sprintf( '<div class="push7-sb-sbz-with-thumb" id="push7-sb-sbz"><div class="push7-sb-sbz-with-thumb-thumbnail"></div><div class="push7-sb-sbz-with-thumb-subscribe">%s</div></div>',
sprintf(
'<p>%s</p><div class="push7ssb-subscribe">%s</div>'
, \Push7_Subscribe_Button_Options::get_options()->social_buzz_message,
\Push7_Subscribe_Button::get_official_button( \Push7_Subscribe_Button::get_appid_inc_official(), 'r' )
)
);
}
private function get_css() {
if ( has_post_thumbnail() && ! post_password_required() ) {
$thumb = esc_url( get_the_post_thumbnail_url( null, 'push7ssb-sbz-thumbnail' ) );
} elseif ( has_site_icon() ) {
$thumb = esc_url( get_site_icon_url() );
} else {
$thumb = '';
}
return <<<EOI
.push7-sb-sbz-with-thumb {
background-image: url({$thumb});
}
.push7-sb-sbz-with-thumb-subscribe {
background-color: rgba(43,43,43, 0.7);
color: #ffffff;
}
@media only screen and (min-width : 415px) {
.push7-sb-sbz-with-thumb-thumbnail {
background-image: url({$thumb});
}
.push7-sb-sbz-with-thumb-subscribe {
background-color: rgba(43,43,43, 1);
}
}
EOI;
}
}