PluginProbe
Ever Compare – Products Compare Plugin for WooCommerce / 1.0.0
Ever Compare – Products Compare Plugin for WooCommerce v1.0.0
1.3.7 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 trunk 1.0.0 1.0.1 1.0.2 All 31 releases
ever-compare / includes / classes / Frontend / Shortcode.php

Shortcode.php in Ever Compare – Products Compare Plugin for WooCommerce 1.0.0, at includes/classes/Frontend/Shortcode.php

59 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace EverCompare\Frontend;
3
4 /**
5 * Shortcode handler class
6 */
7 class Shortcode {
8
9 /**
10 * [$_instance]
11 * @var null
12 */
13 private static $_instance = null;
14
15 /**
16 * [instance] Initializes a singleton instance
17 * @return [Base]
18 */
19 public static function instance() {
20 if ( is_null( self::$_instance ) ) {
21 self::$_instance = new self();
22 }
23 return self::$_instance;
24 }
25
26 /**
27 * Initializes the class
28 */
29 function __construct() {
30 add_shortcode( 'evercompare_button', [ $this, 'button_shortcode' ] );
31 add_shortcode( 'evercompare_table', [ $this, 'table_shortcode' ] );
32 }
33
34 /**
35 * [button_shortcode] Compare Button Shortcode callable function
36 * @param [type] $atts
37 * @param string $content
38 * @return [HTML]
39 */
40 public function button_shortcode( $atts, $content = '' ){
41 wp_enqueue_style( 'evercompare-frontend' );
42 wp_enqueue_script( 'evercompare-frontend' );
43 return Manage_Compare::instance()->add_to_compare_btn();
44 }
45
46 /**
47 * [table_shortcode] Compare table shortcode callable function
48 * @param [type] $atts
49 * @param string $content
50 * @return [HTML]
51 */
52 public function table_shortcode( $atts, $content = '' ){
53 wp_enqueue_style( 'evercompare-frontend' );
54 wp_enqueue_script( 'evercompare-frontend' );
55 return Manage_Compare::instance()->compare_table_shortcode();
56 }
57
58 }
59