コード例 #1
0
 public function init_shortcodes()
 {
     $includes = array('class-review-shortcode', 'class-table-shortcode', 'class-reviews-list-shortcode', 'class-rating-stars-shortcode');
     foreach ($includes as $file) {
         include_once 'includes/' . $file . '.php';
     }
     $review_shortcode = RWP_Review_Shortcode::get_instance();
     $table_shortcode = RWP_Table_Shortcode::get_instance();
     $reviews_list_shortcode = RWP_Reviews_List_Shortcode::get_instance();
     $reviews_list_shortcode = RWP_Reviews_List_Shortcode::get_instance();
     $rating_stars_shortcode = RWP_Rating_Stars_Shortcode::get_instance();
     // Add WP filter for automatic shortcodes
     add_filter('the_content', array($this, 'filter_content'));
 }
コード例 #2
0
 function localize_script($hook)
 {
     if ('post.php' == $hook || 'post-new.php' == $hook) {
         $reviews = get_post_meta(get_the_ID(), $this->reviews_meta_key, true);
         $tables = get_post_meta(get_the_ID(), $this->tables_meta_key, true);
         $content = array('reviews' => array(), 'tables' => array(), 'msg' => __('Insert a review or a table', $this->plugin_slug));
         if (!empty($reviews)) {
             foreach ($reviews as $r) {
                 $content['reviews'][] = $r;
             }
         }
         if (!empty($tables)) {
             foreach ($tables as $t) {
                 $content['tables'][] = $t;
             }
         }
         wp_localize_script($this->plugin_slug . '-admin-script', 'rwpTinyMCEContent', $content);
         wp_localize_script($this->plugin_slug . '-admin-script', 'rwpRlForm', RWP_Reviews_List_Shortcode::get_form());
     }
 }
コード例 #3
0
 public static function get_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }