/** * Initializes the options to be used by the top-rated TinyMCE popup dialog * * @author Leo Fajardo (@leorw) * @since 2.4.1 */ function init_toprated_shortcode_settings() { $extensions = ratingwidget()->GetExtensions(); $bbpress_installed = function_exists('is_bbpress'); $buddypress_installed = function_exists('is_buddypress'); $woocommerce_installed = isset($extensions['woocommerce']); // Initialize the maximum items allowed. if ($this->fs->is_plan_or_trial__premium_only('professional')) { $max_item_count = 50; } else { $max_item_count = 11; } $max_items = array(); for ($count = 1; $count <= $max_item_count; $count++) { if ($count === $max_item_count) { if (!$this->fs->is_plan_or_trial__premium_only('professional')) { $max_items['upgrade'] = __rw('upgrade_top-rated-table'); break; } } $max_items[$count] = (string) $count; } // Initialize the available types $types = array('pages' => __rw('pages'), 'posts' => __rw('posts')); if ($woocommerce_installed) { $types['products'] = __rw('products'); } if ($bbpress_installed) { $types['forum_posts'] = __rw('topics'); } if ($bbpress_installed || $buddypress_installed) { $types['users'] = __rw('users'); } $rw_toprated_options = array('fields' => array('max_items' => $max_items, 'types' => $types), 'upgrade_url' => $this->fs->get_upgrade_url(), 'bbpress_installed' => $bbpress_installed, 'buddypress_installed' => $buddypress_installed, 'woocommerce_installed' => $woocommerce_installed); ?> <script> RW_TOPRATED_OPTIONS = <?php echo json_encode($rw_toprated_options); ?> ; </script> <?php }
/** * Initializes the options to be used by the top-rated TinyMCE popup dialog * * @author Leo Fajardo (@leorw) * @since 2.4.1 */ public function init_toprated_shortcode_settings() { $extensions = ratingwidget()->GetExtensions(); $bbpress_installed = function_exists('is_bbpress'); $buddypress_installed = function_exists('is_buddypress'); $woocommerce_installed = isset($extensions['woocommerce']); $max_item_count = 11; $max_items = array(); for ($count = 1; $count <= $max_item_count; $count++) { if ($count === $max_item_count) { $max_items['upgrade'] = __('Upgrade to Professional for 50 Items', WP_RW__ID); break; } $max_items[$count] = (string) $count; } // Initialize the available types $types = array('pages' => __('Pages', WP_RW__ID), 'posts' => __('Posts', WP_RW__ID)); if ($woocommerce_installed) { $types['products'] = __('Products', WP_RW__ID); } if ($bbpress_installed) { $types['forum_posts'] = __('Topics', WP_RW__ID); } if ($bbpress_installed || $buddypress_installed) { $types['users'] = __('Users', WP_RW__ID); } $rw_toprated_options = array('fields' => array('max_items' => $max_items, 'types' => $types), 'upgrade_url' => $this->fs->get_upgrade_url(), 'bbpress_installed' => $bbpress_installed, 'buddypress_installed' => $buddypress_installed, 'woocommerce_installed' => $woocommerce_installed); ?> <script> RW_TOPRATED_OPTIONS = <?php echo json_encode($rw_toprated_options); ?> ; </script> <?php }