pinterest.php
101 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Dummy Pinterest addon used for UI demo |
| 5 | */ |
| 6 | |
| 7 | namespace PixelYourSite; |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; // Exit if accessed directly. |
| 11 | } |
| 12 | |
| 13 | class Pinterest extends Settings implements Pixel { |
| 14 | |
| 15 | private static $_instance = null; |
| 16 | |
| 17 | public static function instance() { |
| 18 | |
| 19 | if ( is_null( self::$_instance ) ) { |
| 20 | self::$_instance = new self(); |
| 21 | } |
| 22 | |
| 23 | return self::$_instance; |
| 24 | |
| 25 | } |
| 26 | |
| 27 | public function __construct() { |
| 28 | add_action( 'pys_admin_pixel_ids', array( $this, 'renderPixelIdField') ); |
| 29 | } |
| 30 | |
| 31 | public function enabled() { |
| 32 | return false; |
| 33 | } |
| 34 | |
| 35 | public function configured() { |
| 36 | return false; |
| 37 | } |
| 38 | |
| 39 | public function getPixelIDs() { |
| 40 | return array(); |
| 41 | } |
| 42 | |
| 43 | public function getPixelOptions() { |
| 44 | return array(); |
| 45 | } |
| 46 | |
| 47 | public function getEventData( $eventType, $args = null ) { |
| 48 | return false; |
| 49 | } |
| 50 | |
| 51 | public function outputNoScriptEvents() {} |
| 52 | |
| 53 | public function render_switcher_input( $key, $collapse = false, $disabled = false, $default = false) { |
| 54 | //@todo: review |
| 55 | |
| 56 | $attr_name = "pys[pinterest][$key]"; |
| 57 | $attr_id = 'pys_pinterest_' . $key; |
| 58 | |
| 59 | ?> |
| 60 | |
| 61 | <div class="custom-switch disabled"> |
| 62 | <input type="checkbox" name="<?php esc_attr_e( $attr_name ); ?>" value="1" disabled="disabled" |
| 63 | id="<?php esc_attr_e( $attr_id ); ?>" class="custom-switch-input"> |
| 64 | <label class="custom-switch-btn" for="<?php esc_attr_e( $attr_id ); ?>"></label> |
| 65 | </div> |
| 66 | |
| 67 | <?php |
| 68 | } |
| 69 | |
| 70 | public function renderCustomEventOptions( $event ) {} |
| 71 | |
| 72 | public function renderAddonNotice() { |
| 73 | echo ' <a href="https://www.pixelyoursite.com/pinterest-tag?utm_source=pys-free-plugin&utm_medium=pinterest-badge&utm_campaign=requiere-free-add-on" target="_blank" class="badge badge-pill badge-pinterest">Requires paid add-on <i class="fa fa-external-link" aria-hidden="true"></i></a>'; |
| 74 | } |
| 75 | |
| 76 | public function renderPixelIdField() { |
| 77 | ?> |
| 78 | <div class="row align-items-center"> |
| 79 | <div class="col-2 py-4"> |
| 80 | <img class="tag-logo" src="<?php echo PYS_FREE_URL; ?>/dist/images/pinterest-square-small.png"> |
| 81 | </div> |
| 82 | <div class="col-10"> |
| 83 | Add the Pinterest tag with our <a href="https://www.pixelyoursite.com/pinterest-tag?utm_source=pixelyoursite-free-plugin&utm_medium=plugin&utm_campaign=free-plugin-ids" |
| 84 | target="_blank">Paid addon</a>. |
| 85 | </div> |
| 86 | </div> |
| 87 | <hr> |
| 88 | |
| 89 | <?php |
| 90 | } |
| 91 | |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * @return Pinterest |
| 96 | */ |
| 97 | function Pinterest() { |
| 98 | return Pinterest::instance(); |
| 99 | } |
| 100 | |
| 101 | Pinterest(); |