function render()
    {
        ?>
			<div id='debug-bar-php'>
				<?php 
        fs_require_template('/debug/api-calls.php');
        ?>
				<br>
				<?php 
        fs_require_template('/debug/scheduled-crons.php');
        ?>
				<br>
				<?php 
        fs_require_template('/debug/logger.php');
        ?>
			</div>
		<?php 
    }
Exemplo n.º 2
0
 /**
  * Displays a license activation dialog box when the user clicks on the "Activate License"
  * or "Change License" link on the plugins
  * page.
  *
  * @author Leo Fajardo (@leorw)
  * @since  1.1.9
  */
 function _add_license_activation_dialog_box()
 {
     $vars = array('slug' => $this->_slug);
     fs_require_template('forms/license-activation.php', $vars);
     fs_require_template('forms/resend-key.php', $vars);
 }
Exemplo n.º 3
0
            }
            ?>
					</td>
				<?php 
        }
        ?>
				</tr>
				<?php 
        $odd = !$odd;
    }
    ?>
		</tbody>
		</table>
		</div>
		</div>
	<?php 
}
?>

	<?php 
$fs->do_action('after_account_details');
?>
	</div>
	</div>
	</div>
	</div>
	</div>
<?php 
$params = array('page' => 'account', 'module_id' => $fs->get_id(), 'module_slug' => $slug, 'module_version' => $fs->get_plugin_version());
fs_require_template('powered-by.php', $params);
Exemplo n.º 4
0
			 * Sends the add-on information to the server for further processing.
			 */
			function sendData(extraDetails) {
				var data = {
					action: 'rw-addon-request',
					_n: '<?php 
echo wp_create_nonce('rw_send_addon_request');
?>
',
					addon_key: $('li.rw-addon.active').attr('data-idx')
				};

				if ( extraDetails ) {
					$.extend(data, extraDetails);
				}

				var ajaxUrl = '<?php 
echo admin_url('admin-ajax.php');
?>
';
				$.ajax({
					url: ajaxUrl,
					data: data
				});
			}
		})(jQuery);
	</script>
</div>
<?php 
fs_require_template('powered-by.php');
 /**
  * Handle all_admin_notices by printing the admin messages stacked in the queue.
  *
  * @author Vova Feldman (@svovaf)
  * @since  1.0.4
  *
  */
 function _all_admin_notices_hook()
 {
     $notice_type = 'all_admin_notices';
     if (!isset($this->_admin_messages[$notice_type]) || !is_array($this->_admin_messages[$notice_type])) {
         return;
     }
     foreach ($this->_admin_messages[$notice_type] as $id => $msg) {
         fs_require_template('all-admin-notice.php', $msg);
     }
 }
Exemplo n.º 6
0
        /**
         * To get a list of all custom user defined posts:
         *
         *       get_post_types(array('public'=>true,'_builtin' => false))
         */
        public function SettingsPage()
        {
            RWLogger::LogEnterence('SettingsPage');
            // Must check that the user has the required capability.
            if (!current_user_can('manage_options')) {
                wp_die(__rw('no-sufficient-permissions'));
            }
            global $plugin_page;
            // Variables for the field and option names
            $rw_form_hidden_field_name = 'rw_form_hidden_field_name';
            $settings_data = array();
            $selected_key = 'dummy';
            if ($plugin_page === $this->GetMenuSlug('buddypress') && $this->IsBuddyPressInstalled()) {
                $settings_data = array('activity-blog-posts' => array('tab' => __rw('activity-blog-posts'), 'class' => 'new-blog-post', 'options' => WP_RW__ACTIVITY_BLOG_POSTS_OPTIONS, 'align' => WP_RW__ACTIVITY_BLOG_POSTS_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__ACTIVITY_BLOG_POSTS_ALIGN], 'excerpt' => false, 'show_align' => true), 'activity-blog-comments' => array('tab' => __rw('activity-blog-comments'), 'class' => 'new-blog-comment', 'options' => WP_RW__ACTIVITY_BLOG_COMMENTS_OPTIONS, 'align' => WP_RW__ACTIVITY_BLOG_COMMENTS_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__ACTIVITY_BLOG_COMMENTS_ALIGN], 'excerpt' => false, 'show_align' => true), 'activity-updates' => array('tab' => __rw('activity-updates'), 'class' => 'activity-update', 'options' => WP_RW__ACTIVITY_UPDATES_OPTIONS, 'align' => WP_RW__ACTIVITY_UPDATES_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__ACTIVITY_UPDATES_ALIGN], 'excerpt' => false, 'show_align' => true), 'activity-comments' => array('tab' => __rw('activity-comments'), 'class' => 'activity-comment', 'options' => WP_RW__ACTIVITY_COMMENTS_OPTIONS, 'align' => WP_RW__ACTIVITY_COMMENTS_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__ACTIVITY_COMMENTS_ALIGN], 'excerpt' => false, 'show_align' => true), 'users' => array('tab' => __rw('user-profiles'), 'class' => 'user', 'options' => WP_RW__USERS_OPTIONS, 'align' => WP_RW__USERS_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__USERS_ALIGN], 'excerpt' => false, 'show_align' => false));
                $selected_key = isset($_GET['rating']) ? $_GET['rating'] : 'activity-blog-posts';
                if (!isset($settings_data[$selected_key])) {
                    $selected_key = 'activity-blog-posts';
                }
            } else {
                if ($plugin_page === $this->GetMenuSlug('bbpress') && $this->IsBBPressInstalled()) {
                    $settings_data = array('forum-posts' => array('tab' => __rw('forum-posts'), 'class' => 'forum-post', 'options' => WP_RW__FORUM_POSTS_OPTIONS, 'align' => WP_RW__FORUM_POSTS_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__FORUM_POSTS_ALIGN], 'excerpt' => false, 'show_align' => true), 'activity-forum-posts' => array('tab' => __rw('activity-forum-posts'), 'class' => 'new-forum-post', 'options' => WP_RW__ACTIVITY_FORUM_POSTS_OPTIONS, 'align' => WP_RW__ACTIVITY_FORUM_POSTS_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__ACTIVITY_FORUM_POSTS_ALIGN], 'excerpt' => false, 'show_align' => true), 'users' => array('tab' => __rw('user-profiles'), 'class' => 'user', 'options' => WP_RW__USERS_OPTIONS, 'align' => WP_RW__USERS_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__USERS_ALIGN], 'excerpt' => false, 'show_align' => false));
                    $selected_key = isset($_GET['rating']) ? $_GET['rating'] : 'forum-posts';
                    if (!isset($settings_data[$selected_key])) {
                        $selected_key = 'forum-posts';
                    }
                } else {
                    if ($plugin_page === $this->GetMenuSlug('user')) {
                        $settings_data = array('users-posts' => array('tab' => __rw('posts'), 'class' => 'user-post', 'options' => WP_RW__USERS_POSTS_OPTIONS, 'align' => WP_RW__USERS_POSTS_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__USERS_POSTS_ALIGN], 'excerpt' => false, 'show_align' => false), 'users-pages' => array('tab' => __rw('pages'), 'class' => 'user-page', 'options' => WP_RW__USERS_PAGES_OPTIONS, 'align' => WP_RW__USERS_PAGES_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__USERS_PAGES_ALIGN], 'excerpt' => false, 'show_align' => false), 'users-comments' => array('tab' => __rw('comments'), 'class' => 'user-comment', 'options' => WP_RW__USERS_COMMENTS_OPTIONS, 'align' => WP_RW__USERS_COMMENTS_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__USERS_COMMENTS_ALIGN], 'excerpt' => false, 'show_align' => false));
                        if ($this->IsBuddyPressInstalled()) {
                            $settings_data['users-activity-updates'] = array('tab' => __rw('activity-updates'), 'class' => 'user-activity-update', 'options' => WP_RW__USERS_ACTIVITY_UPDATES_OPTIONS, 'align' => WP_RW__USERS_ACTIVITY_UPDATES_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__USERS_ACTIVITY_UPDATES_ALIGN], 'excerpt' => false, 'show_align' => false);
                            $settings_data['users-activity-comments'] = array('tab' => __rw('activity-comments'), 'class' => 'user-activity-comment', 'options' => WP_RW__USERS_ACTIVITY_COMMENTS_OPTIONS, 'align' => WP_RW__USERS_ACTIVITY_COMMENTS_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__USERS_ACTIVITY_COMMENTS_ALIGN], 'excerpt' => false, 'show_align' => false);
                            if ($this->IsBBPressInstalled()) {
                                $settings_data['users-forum-posts'] = array('tab' => __rw('forum-posts'), 'class' => 'user-forum-post', 'options' => WP_RW__USERS_FORUM_POSTS_OPTIONS, 'align' => WP_RW__USERS_FORUM_POSTS_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__USERS_FORUM_POSTS_ALIGN], 'excerpt' => false, 'show_align' => false);
                            }
                        }
                        $selected_key = isset($_GET['rating']) ? $_GET['rating'] : 'users-posts';
                        if (!isset($settings_data[$selected_key])) {
                            $selected_key = 'users-posts';
                        }
                    } else {
                        $is_extension = false;
                        foreach ($this->_extensions as $ext) {
                            if ($plugin_page !== $this->GetMenuSlug($ext->GetSlug())) {
                                continue;
                            }
                            $is_extension = true;
                            $settings_data = $ext->GetSettings();
                            $selected_key = isset($_GET['rating']) && isset($settings_data[$_GET['rating']]) ? $_GET['rating'] : $this->GetFirstKey($settings_data);
                        }
                        if (!$is_extension) {
                            $settings_data = array('blog-posts' => array('tab' => __rw('blog-posts'), 'class' => 'blog-post', 'options' => WP_RW__BLOG_POSTS_OPTIONS, 'align' => WP_RW__BLOG_POSTS_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__BLOG_POSTS_ALIGN], 'excerpt' => true, 'show_align' => true), 'front-posts' => array('tab' => __rw('front-page-posts'), 'class' => 'front-post', 'options' => WP_RW__FRONT_POSTS_OPTIONS, 'align' => WP_RW__FRONT_POSTS_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__FRONT_POSTS_ALIGN], 'excerpt' => false, 'show_align' => true), 'comments' => array('tab' => __rw('comments'), 'class' => 'comment', 'options' => WP_RW__COMMENTS_OPTIONS, 'align' => WP_RW__COMMENTS_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__COMMENTS_ALIGN], 'excerpt' => false, 'show_align' => true), 'pages' => array('tab' => __rw('pages'), 'class' => 'page', 'options' => WP_RW__PAGES_OPTIONS, 'align' => WP_RW__PAGES_ALIGN, 'default_align' => $this->_OPTIONS_DEFAULTS[WP_RW__PAGES_ALIGN], 'excerpt' => false, 'show_align' => true));
                            $selected_key = isset($_GET['rating']) ? $_GET['rating'] : 'blog-posts';
                            if (!isset($settings_data[$selected_key])) {
                                $selected_key = 'blog-posts';
                            }
                        }
                    }
                }
            }
            $rw_current_settings = $settings_data[$selected_key];
            // Some alias.
            $rw_class = $rw_current_settings['class'];
            $is_blog_post = 'blog-post' === $rw_current_settings['class'];
            $item_with_category = in_array($rw_current_settings['class'], array('blog-post', 'front-post', 'comment'));
            // Visibility list must be loaded anyway.
            $this->_visibilityList = $this->GetOption(WP_RW__VISIBILITY_SETTINGS);
            if ($item_with_category) {
                // Categories Availability list must be loaded anyway.
                $this->categories_list = $this->GetOption(WP_RW__CATEGORIES_AVAILABILITY_SETTINGS);
            }
            // Availability list must be loaded anyway.
            $this->availability_list = $this->GetOption(WP_RW__AVAILABILITY_SETTINGS);
            $this->custom_settings_enabled_list = $this->GetOption(WP_RW__CUSTOM_SETTINGS_ENABLED);
            $this->custom_settings_list = $this->GetOption(WP_RW__CUSTOM_SETTINGS);
            $this->multirating_settings_list = $this->GetOption(WP_RW__MULTIRATING_SETTINGS);
            // Accumulated user ratings support.
            if ('users' === $selected_key && $this->IsBBPressInstalled()) {
                $rw_is_user_accumulated = $this->GetOption(WP_RW__IS_ACCUMULATED_USER_RATING);
            }
            // Comment "Reviews" mode support.
            if ('comments' === $selected_key) {
                $comment_ratings_mode_settings = $this->get_comment_ratings_mode_settings();
                $comment_ratings_mode = $comment_ratings_mode_settings->comment_ratings_mode;
            }
            // Reset categories.
            $rw_categories = array();
            // See if the user has posted us some information
            // If they did, this hidden field will be set to 'Y'
            if (isset($_POST[$rw_form_hidden_field_name]) && $_POST[$rw_form_hidden_field_name] == 'Y') {
                // Set settings into save mode.
                $this->settings->SetSaveMode();
                /* Multi-rating options.
                   ---------------------------------------------------------------------------------------------------------------*/
                if (isset($_POST['multi_rating'])) {
                    $multi_rating = $_POST['multi_rating'];
                    if (count($multi_rating['criteria']) > 3) {
                        $multi_rating['criteria'] = array_splice($multi_rating['criteria'], 0, 3);
                    }
                    // Unset empty labels
                    foreach ($multi_rating['criteria'] as $criteria_id => $criteria) {
                        $criteria_label = isset($criteria['label']) ? trim($criteria['label']) : '';
                        if (empty($criteria_label)) {
                            unset($multi_rating['criteria'][$criteria_id]['label']);
                        }
                    }
                    // Retrieve the current multi-rating options
                    if (!isset($this->multirating_settings_list)) {
                        $this->multirating_settings_list = new stdClass();
                    }
                    $multirating_options = $this->multirating_settings_list->{$rw_class};
                    // Save the new criteria IDs and labels
                    $multirating_options->criteria = $multi_rating['criteria'];
                    // Save the summary label
                    $summary_label = isset($multi_rating['summary_label']) ? trim($multi_rating['summary_label']) : '';
                    if (!empty($summary_label)) {
                        $multirating_options->summary_label = $summary_label;
                    } else {
                        unset($multirating_options->summary_label);
                    }
                    // Save the state of the Show Summary Rating option
                    $multirating_options->show_summary_rating = isset($multi_rating['show_summary_rating']) ? true : false;
                    // Save the updated multi-rating options
                    if (!isset($this->multirating_settings_list)) {
                        $this->multirating_settings_list = new stdClass();
                    }
                    $this->multirating_settings_list->{$rw_class} = $multirating_options;
                    $this->SetOption(WP_RW__MULTIRATING_SETTINGS, $this->multirating_settings_list);
                }
                /* Widget align options.
                   ---------------------------------------------------------------------------------------------------------------*/
                $rw_show_rating = isset($_POST['rw_show']) ? true : false;
                $rw_align = !$rw_show_rating ? new stdClass() : $rw_current_settings['default_align'];
                if ($rw_show_rating && isset($_POST['rw_align'])) {
                    $align = explode(' ', $_POST['rw_align']);
                    if (is_array($align) && count($align) == 2) {
                        if (in_array($align[0], array('top', 'bottom')) && in_array($align[1], array('left', 'center', 'right'))) {
                            $rw_align->ver = $align[0];
                            $rw_align->hor = $align[1];
                        }
                    }
                }
                $this->SetOption($rw_current_settings['align'], $rw_align);
                /* Rating-Widget options.
                   ---------------------------------------------------------------------------------------------------------------*/
                $rw_options = json_decode(preg_replace('/\\%u([0-9A-F]{4})/i', '\\u$1', urldecode(stripslashes($_POST['rw_options']))));
                if (null !== $rw_options) {
                    $this->SetOption($rw_current_settings['options'], $rw_options);
                }
                /* Availability settings.
                   ---------------------------------------------------------------------------------------------------------------*/
                $rw_availability = isset($_POST['rw_availability']) ? max(0, min(2, (int) $_POST['rw_availability'])) : 0;
                $this->availability_list->{$rw_class} = $rw_availability;
                $this->SetOption(WP_RW__AVAILABILITY_SETTINGS, $this->availability_list);
                if ($item_with_category) {
                    /* Categories Availability settings.
                       ---------------------------------------------------------------------------------------------------------------*/
                    $rw_categories = isset($_POST['rw_categories']) && is_array($_POST['rw_categories']) ? $_POST['rw_categories'] : array();
                    if (!isset($this->categories_list)) {
                        $this->categories_list = new stdClass();
                    }
                    $this->categories_list->{$rw_class} = in_array('-1', $rw_categories) ? array('-1') : $rw_categories;
                    $this->SetOption(WP_RW__CATEGORIES_AVAILABILITY_SETTINGS, $this->categories_list);
                }
                // Accumulated user ratings support.
                if ('users' === $selected_key && $this->IsBBPressInstalled() && isset($_POST['rw_accumulated_user_rating'])) {
                    $rw_is_user_accumulated = 'true' == (in_array($_POST['rw_accumulated_user_rating'], array('true', 'false')) ? $_POST['rw_accumulated_user_rating'] : 'true');
                    $this->SetOption(WP_RW__IS_ACCUMULATED_USER_RATING, $rw_is_user_accumulated);
                }
                // Comment ratings mode
                if ('comments' === $selected_key && isset($_POST['rw_comment_review_mode'])) {
                    $comment_ratings_mode = $_POST['rw_comment_review_mode'];
                    // Save the new comment ratings mode.
                    $comment_ratings_mode_settings = $this->get_comment_ratings_mode_settings();
                    $comment_ratings_mode_settings->comment_ratings_mode = $comment_ratings_mode;
                    $this->SetOption(WP_RW__DB_OPTION_IS_ADMIN_COMMENT_RATINGS_SETTINGS, $comment_ratings_mode_settings);
                }
                /* Visibility settings
                   ---------------------------------------------------------------------------------------------------------------*/
                $rw_visibility = isset($_POST['rw_visibility']) ? max(0, min(2, (int) $_POST['rw_visibility'])) : 0;
                $rw_visibility_exclude = isset($_POST['rw_visibility_exclude']) ? $_POST['rw_visibility_exclude'] : '';
                $rw_visibility_include = isset($_POST['rw_visibility_include']) ? $_POST['rw_visibility_include'] : '';
                $rw_custom_settings_enabled = isset($_POST['rw_custom_settings_enabled']) ? true : false;
                if (!isset($this->custom_settings_enabled_list)) {
                    $this->custom_settings_enabled_list = new stdClass();
                }
                $this->custom_settings_enabled_list->{$rw_class} = $rw_custom_settings_enabled;
                $this->SetOption(WP_RW__CUSTOM_SETTINGS_ENABLED, $this->custom_settings_enabled_list);
                $rw_custom_settings = isset($_POST['rw_custom_settings']) ? $_POST['rw_custom_settings'] : '';
                if (!isset($this->custom_settings_list)) {
                    $this->custom_settings_list = new stdClass();
                }
                $this->custom_settings_list->{$rw_class} = $rw_custom_settings;
                $this->SetOption(WP_RW__CUSTOM_SETTINGS, $this->custom_settings_list);
                if (!isset($this->_visibilityList)) {
                    $this->_visibilityList = new stdClass();
                }
                if (!isset($this->_visibilityList->{$rw_class})) {
                    $this->_visibilityList->{$rw_class} = new stdClass();
                }
                $this->_visibilityList->{$rw_class}->selected = $rw_visibility;
                $this->_visibilityList->{$rw_class}->exclude = self::IDsCollectionToArray($rw_visibility_exclude);
                $this->_visibilityList->{$rw_class}->include = self::IDsCollectionToArray($rw_visibility_include);
                $this->SetOption(WP_RW__VISIBILITY_SETTINGS, $this->_visibilityList);
                ?>
					<div class="updated"><p><strong><?php 
                _erw('settings-successfully-saved');
                ?>
</strong>
						</p></div>
				<?php 
            } else {
                /* Get rating alignment.
                   ---------------------------------------------------------------------------------------------------------------*/
                $rw_align = $this->GetOption($rw_current_settings['align']);
                /* Get show on excerpts option.
                   ---------------------------------------------------------------------------------------------------------------*/
                // Already loaded.
                /* Get rating options.
                   ---------------------------------------------------------------------------------------------------------------*/
                $rw_options = $this->GetOption($rw_current_settings['options']);
            }
            $rw_language_str = isset($rw_options->lng) ? $rw_options->lng : WP_RW__DEFAULT_LNG;
            if (!isset($this->_visibilityList->{$rw_class})) {
                $this->_visibilityList->{$rw_class} = new stdClass();
                $this->_visibilityList->{$rw_class}->selected = 0;
                $this->_visibilityList->{$rw_class}->exclude = '';
                $this->_visibilityList->{$rw_class}->include = '';
            }
            $rw_visibility_settings = $this->_visibilityList->{$rw_class};
            if (!isset($this->availability_list->{$rw_class})) {
                $this->availability_list->{$rw_class} = 0;
            }
            $rw_availability_settings = $this->availability_list->{$rw_class};
            if ($item_with_category) {
                if (!isset($this->categories_list->{$rw_class})) {
                    $this->categories_list->{$rw_class} = array(-1);
                }
                $rw_categories = $this->categories_list->{$rw_class};
            }
            if (!isset($this->custom_settings_enabled_list->{$rw_class})) {
                $this->custom_settings_enabled_list->{$rw_class} = false;
            }
            $rw_custom_settings_enabled = $this->custom_settings_enabled_list->{$rw_class};
            if (!isset($this->custom_settings_list->{$rw_class})) {
                $this->custom_settings_list->{$rw_class} = '';
            }
            $rw_custom_settings = $this->custom_settings_list->{$rw_class};
            $dictionary = array('DUMMY');
            $dir = $hor = 'dummy';
            require_once WP_RW__PLUGIN_DIR . "/languages/{$rw_language_str}.php";
            require_once WP_RW__PLUGIN_DIR . '/lib/defaults.php';
            require_once WP_RW__PLUGIN_DIR . '/lib/def_settings.php';
            global $DEFAULT_OPTIONS;
            rw_set_language_options($DEFAULT_OPTIONS, $dictionary, $dir, $hor);
            $theme_font_size_set = false;
            $theme_line_height_set = false;
            $rating_font_size_set = isset($rw_options->advanced) && isset($rw_options->advanced->font) && isset($rw_options->advanced->font->size);
            $rating_line_height_set = isset($rw_options->advanced) && isset($rw_options->advanced->layout) && isset($rw_options->advanced->layout->lineHeight);
            $def_options = $DEFAULT_OPTIONS;
            if (isset($rw_options->theme) && $rw_options->theme !== '') {
                require_once WP_RW__PLUGIN_DIR . '/themes/dir.php';
                global $RW_THEMES;
                if (!isset($rw_options->type)) {
                    $rw_options->type = isset($RW_THEMES['star'][$rw_options->theme]) ? 'star' : 'nero';
                }
                if (isset($RW_THEMES[$rw_options->type][$rw_options->theme])) {
                    $theme = array('DUMMY');
                    require WP_RW__PLUGIN_DIR . '/themes/' . $RW_THEMES[$rw_options->type][$rw_options->theme]['file'];
                    $theme_font_size_set = isset($theme['options']->advanced) && isset($theme['options']->advanced->font) && isset($theme['options']->advanced->font->size);
                    $theme_line_height_set = isset($theme['options']->advanced) && isset($theme['options']->advanced->layout) && isset($theme['options']->advanced->layout->lineHeight);
                    // Enrich theme options with defaults.
                    $def_options = rw_enrich_options1($theme['options'], $DEFAULT_OPTIONS);
                }
            }
            // Enrich rating options with calculated default options (with theme reference).
            $rw_options = rw_enrich_options1($rw_options, $def_options);
            // If font size and line height isn't explicitly specified on rating
            // options or rating's theme, updated theme correspondingly
            // to rating size.
            if (isset($rw_options->size)) {
                $SIZE = strtoupper($rw_options->size);
                if (!$rating_font_size_set && !$theme_font_size_set) {
                    global $DEF_FONT_SIZE;
                    if (!isset($rw_options->advanced)) {
                        $rw_options->advanced = new stdClass();
                    }
                    if (!isset($rw_options->advanced->font)) {
                        $rw_options->advanced->font = new stdClass();
                    }
                    $rw_options->advanced->font->size = $DEF_FONT_SIZE->{$SIZE};
                }
                if (!$rating_line_height_set && !$theme_line_height_set) {
                    global $DEF_LINE_HEIGHT;
                    if (!isset($rw_options->advanced)) {
                        $rw_options->advanced = new stdClass();
                    }
                    if (!isset($rw_options->advanced->layout)) {
                        $rw_options->advanced->layout = new stdClass();
                    }
                    $rw_options->advanced->layout->lineHeight = $DEF_LINE_HEIGHT->{$SIZE};
                }
            }
            $rw_languages = $this->languages;
            $this->settings->rating_type = $selected_key;
            $this->settings->options = $rw_options;
            $this->settings->languages = $rw_languages;
            $this->settings->language_str = $rw_language_str;
            $this->settings->categories = $rw_categories;
            $this->settings->availability = $rw_availability_settings;
            $this->settings->visibility = $rw_visibility_settings;
            $this->settings->form_hidden_field_name = $rw_form_hidden_field_name;
            $this->settings->custom_settings_enabled = $rw_custom_settings_enabled;
            $this->settings->custom_settings = $rw_custom_settings;
            // Accumulated user ratings support.
            if ('users' === $selected_key && $this->IsBBPressInstalled()) {
                $this->settings->is_user_accumulated = $rw_is_user_accumulated;
            } else {
                if ('comments' === $selected_key) {
                    // Comment ratings mode support
                    $this->settings->comment_ratings_mode = $comment_ratings_mode;
                }
            }
            ?>
				<div class="wrap rw-dir-ltr rw-wp-container">
					<h2 class="nav-tab-wrapper rw-nav-tab-wrapper">
						<?php 
            foreach ($settings_data as $key => $settings) {
                ?>
							<a href="<?php 
                echo esc_url(add_query_arg(array('rating' => $key, 'message' => false)));
                ?>
"
							   class="nav-tab<?php 
                if ($settings_data[$key] == $rw_current_settings) {
                    echo ' nav-tab-active';
                }
                ?>
"><?php 
                echo $settings['tab'];
                ?>
</a>
						<?php 
            }
            ?>
					</h2>

					<form method="post" action="">
						<div id="poststuff">
							<div id="rw_wp_set">
								<?php 
            rw_require_once_view('preview.php');
            ?>
								<div class="has-sidebar has-right-sidebar">
									<div class="has-sidebar-content">
										<div class="postbox rw-body">
											<?php 
            $enabled = isset($rw_align->ver);
            ?>
											<div style="padding: 10px;">
												<label for="rw_show">
													<input id="rw_show" type="checkbox" name="rw_show"
													       value="true"<?php 
            if ($enabled) {
                echo ' checked="checked"';
            }
            ?>
 onclick="RWM_WP.enable(this);"/> Enable
													for <?php 
            echo $rw_current_settings['tab'];
            ?>
												</label>
												<?php 
            if (true === $rw_current_settings['show_align']) {
                ?>
														<div class="rw-post-rating-align"<?php 
                if (!$enabled) {
                    echo ' style="display: none;"';
                }
                ?>
>
															<?php 
                $vers = array('top', 'bottom');
                $hors = array('left', 'center', 'right');
                ?>
															<select>
																<?php 
                foreach ($vers as $ver) {
                    foreach ($hors as $hor) {
                        $checked = false;
                        if ($enabled) {
                            $checked = $ver == $rw_align->ver && $hor == $rw_align->hor;
                        }
                        ?>
																			<option
																				value="<?php 
                        echo $ver . ' ' . $hor;
                        ?>
"<?php 
                        if ($checked) {
                            echo ' selected="selected"';
                        }
                        ?>
><?php 
                        echo ucwords($ver) . ' ' . ucwords($hor);
                        ?>
</option>
																		<?php 
                    }
                }
                ?>
															</select>
															<input id="rw_align" name="rw_align" type="hidden"
															       value="<?php 
                echo $rw_align->ver . ' ' . $rw_align->hor;
                ?>
">
															<script>
																(function ($) {
																	$('.rw-post-rating-align select').chosen({width: '100%'}).change(function (evt, params) {
																		$('#rw_align').val(params.selected);
																	});
																})(jQuery);
															</script>
														</div>
													<?php 
            }
            ?>
											</div>
										</div>
									</div>
								</div>
								<?php 
            if ('users' === $selected_key) {
                rw_require_once_view('user_rating_type_options.php');
            } else {
                if ('comments' === $selected_key) {
                    rw_require_once_view('comment_rating_mode_options.php');
                }
            }
            rw_require_once_view('options.php');
            rw_require_once_view('availability_options.php');
            rw_require_once_view('visibility_options.php');
            if ($is_blog_post) {
                rw_require_once_view('post_views_visibility.php');
            }
            if ($item_with_category) {
                rw_require_once_view('categories_availability_options.php');
            }
            rw_require_once_view('settings/frequency.php');
            rw_require_once_view('powerusers.php');
            ?>
							</div>
							<div id="rw_wp_set_widgets">
								<?php 
            if ($this->fs->is_not_paying()) {
                // Show random.
                if (0 == rand(0, 1)) {
                    rw_require_once_view('rich-snippets.php');
                } else {
                    rw_require_once_view('upgrade.php');
                }
            }
            ?>
							</div>
						</div>
					</form>
				</div>
				<?php 
            fs_require_template('powered-by.php');
            ?>
				<?php 
            // Store options if in save mode.
            if ($this->settings->IsSaveMode()) {
                $this->_options->store();
            }
        }
    /**
     * Display plugin information in dialog box form.
     *
     * Based on core install_plugin_information() function.
     *
     * @author Vova Feldman (@svovaf)
     * @since  1.0.6
     */
    function install_plugin_information()
    {
        global $tab;
        if (empty($_REQUEST['plugin'])) {
            return;
        }
        $args = array('slug' => wp_unslash($_REQUEST['plugin']), 'is_ssl' => is_ssl(), 'fields' => array('banners' => true, 'reviews' => true, 'downloaded' => false, 'active_installs' => true));
        if (is_array($args)) {
            $args = (object) $args;
        }
        if (!isset($args->per_page)) {
            $args->per_page = 24;
        }
        if (!isset($args->locale)) {
            $args->locale = get_locale();
        }
        $api = apply_filters('fs_plugins_api', false, 'plugin_information', $args);
        if (is_wp_error($api)) {
            wp_die($api);
        }
        $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array(), 'class' => array()), 'style' => array(), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'div' => array('class' => array()), 'span' => array('class' => array()), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array('class' => array()), 'i' => array('class' => array()), 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'img' => array('src' => array(), 'class' => array(), 'alt' => array()));
        $plugins_section_titles = array('description' => _x('Description', 'Plugin installer section title'), 'installation' => _x('Installation', 'Plugin installer section title'), 'faq' => _x('FAQ', 'Plugin installer section title'), 'screenshots' => _x('Screenshots', 'Plugin installer section title'), 'changelog' => _x('Changelog', 'Plugin installer section title'), 'reviews' => _x('Reviews', 'Plugin installer section title'), 'other_notes' => _x('Other Notes', 'Plugin installer section title'));
        // Sanitize HTML
        //		foreach ( (array) $api->sections as $section_name => $content ) {
        //			$api->sections[$section_name] = wp_kses( $content, $plugins_allowedtags );
        //		}
        foreach (array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key) {
            if (isset($api->{$key})) {
                $api->{$key} = wp_kses($api->{$key}, $plugins_allowedtags);
            }
        }
        // Add after $api->slug is ready.
        $plugins_section_titles['features'] = __fs('features-and-pricing', $api->slug);
        $_tab = esc_attr($tab);
        $section = isset($_REQUEST['section']) ? wp_unslash($_REQUEST['section']) : 'description';
        // Default to the Description tab, Do not translate, API returns English.
        if (empty($section) || !isset($api->sections[$section])) {
            $section_titles = array_keys((array) $api->sections);
            $section = array_shift($section_titles);
        }
        iframe_header(__('Plugin Install'));
        $_with_banner = '';
        //	var_dump($api->banners);
        if (!empty($api->banners) && (!empty($api->banners['low']) || !empty($api->banners['high']))) {
            $_with_banner = 'with-banner';
            $low = empty($api->banners['low']) ? $api->banners['high'] : $api->banners['low'];
            $high = empty($api->banners['high']) ? $api->banners['low'] : $api->banners['high'];
            ?>
				<style type="text/css">
					#plugin-information-title.with-banner
					{
						background-image: url( <?php 
            echo esc_url($low);
            ?>
 );
					}

					@media only screen and ( -webkit-min-device-pixel-ratio: 1.5 )
					{
						#plugin-information-title.with-banner
						{
							background-image: url( <?php 
            echo esc_url($high);
            ?>
 );
						}
					}
				</style>
			<?php 
        }
        echo '<div id="plugin-information-scrollable">';
        echo "<div id='{$_tab}-title' class='{$_with_banner}'><div class='vignette'></div><h2>{$api->name}</h2></div>";
        echo "<div id='{$_tab}-tabs' class='{$_with_banner}'>\n";
        foreach ((array) $api->sections as $section_name => $content) {
            if ('reviews' === $section_name && (empty($api->ratings) || 0 === array_sum((array) $api->ratings))) {
                continue;
            }
            if (isset($plugins_section_titles[$section_name])) {
                $title = $plugins_section_titles[$section_name];
            } else {
                $title = ucwords(str_replace('_', ' ', $section_name));
            }
            $class = $section_name === $section ? ' class="current"' : '';
            $href = add_query_arg(array('tab' => $tab, 'section' => $section_name));
            $href = esc_url($href);
            $san_section = esc_attr($section_name);
            echo "\t<a name='{$san_section}' href='{$href}' {$class}>{$title}</a>\n";
        }
        echo "</div>\n";
        ?>
		<div id="<?php 
        echo $_tab;
        ?>
-content" class='<?php 
        echo $_with_banner;
        ?>
'>
			<div class="fyi">
			<?php 
        if ($api->is_paid) {
            ?>
				<?php 
            if (isset($api->plans)) {
                ?>
					<div class="plugin-information-pricing">
					<?php 
                foreach ($api->plans as $plan) {
                    ?>
						<?php 
                    /**
                     * @var FS_Plugin_Plan $plan
                     */
                    ?>
						<?php 
                    $first_pricing = $plan->pricing[0];
                    ?>
						<?php 
                    $is_multi_cycle = $first_pricing->is_multi_cycle();
                    ?>
						<div class="fs-plan<?php 
                    if (!$is_multi_cycle) {
                        echo ' fs-single-cycle';
                    }
                    ?>
" data-plan-id="<?php 
                    echo $plan->id;
                    ?>
">
							<h3 data-plan="<?php 
                    echo $plan->id;
                    ?>
"><?php 
                    printf(__fs('x-plan', $api->slug), $plan->title);
                    ?>
</h3>
							<?php 
                    $has_annual = $first_pricing->has_annual();
                    ?>
							<?php 
                    $has_monthly = $first_pricing->has_monthly();
                    ?>
							<div class="nav-tab-wrapper">
								<?php 
                    $billing_cycles = array('monthly', 'annual', 'lifetime');
                    ?>
								<?php 
                    $i = 0;
                    foreach ($billing_cycles as $cycle) {
                        ?>
										<?php 
                        $prop = "{$cycle}_price";
                        if (isset($first_pricing->{$prop})) {
                            ?>
											<?php 
                            $is_featured = 'annual' === $cycle && $is_multi_cycle;
                            ?>
											<?php 
                            $prices = array();
                            foreach ($plan->pricing as $pricing) {
                                if (isset($pricing->{$prop})) {
                                    $prices[] = array('id' => $pricing->id, 'licenses' => $pricing->licenses, 'price' => $pricing->{$prop});
                                }
                            }
                            ?>
											<a class="nav-tab" data-billing-cycle="<?php 
                            echo $cycle;
                            ?>
"
											   data-pricing="<?php 
                            esc_attr_e(json_encode($prices));
                            ?>
">
												<?php 
                            if ($is_featured) {
                                ?>
													<label>&#9733; <?php 
                                _efs('best', $api->slug);
                                ?>
 &#9733;</label>
												<?php 
                            }
                            ?>
												<?php 
                            _efs($cycle, $api->slug);
                            ?>
											</a>
										<?php 
                        }
                        ?>
										<?php 
                        $i++;
                    }
                    ?>
								<?php 
                    wp_enqueue_script('jquery');
                    ?>
								<script type="text/javascript">
									(function ($, undef) {
										var
											_formatBillingFrequency = function (cycle) {
												switch (cycle) {
													case 'monthly':
														return '<?php 
                    printf(__fs('billed-x', $api->slug), __fs('monthly', $api->slug));
                    ?>
';
													case 'annual':
														return '<?php 
                    printf(__fs('billed-x', $api->slug), __fs('annually', $api->slug));
                    ?>
';
													case 'lifetime':
														return '<?php 
                    printf(__fs('billed-x', $api->slug), __fs('once', $api->slug));
                    ?>
';
												}
											},
											_formatLicensesTitle = function (pricing) {
												switch (pricing.licenses) {
													case 1:
														return '<?php 
                    _efs('license-single-site', $api->slug);
                    ?>
';
													case null:
														return '<?php 
                    _efs('license-unlimited', $api->slug);
                    ?>
';
													default:
														return '<?php 
                    _efs('license-x-sites', $api->slug);
                    ?>
'.replace('%s', pricing.licenses);
												}
											},
											_formatPrice = function (pricing, cycle, multipleLicenses) {
												if (undef === multipleLicenses)
													multipleLicenses = true;

												var priceCycle;
												switch (cycle) {
													case 'monthly':
														priceCycle = ' / <?php 
                    _efs('mo', $api->slug);
                    ?>
';
														break;
													case 'lifetime':
														priceCycle = '';
														break;
													case 'annual':
													default:
														priceCycle = ' / <?php 
                    _efs('year', $api->slug);
                    ?>
';
														break;
												}

												if (!multipleLicenses && 1 == pricing.licenses) {
													return '$' + pricing.price + priceCycle;
												}

												return _formatLicensesTitle(pricing) + ' - <var class="fs-price">$' + pricing.price + priceCycle + '</var>';
											},
											_checkoutUrl = function (plan, pricing, cycle) {
												return '<?php 
                    echo esc_url_raw(remove_query_arg('billing_cycle', add_query_arg(array('plugin_id' => $plan->plugin_id), $api->checkout_link)));
                    ?>
' +
												'&plan_id=' + plan +
												'&pricing_id=' + pricing +
												'&billing_cycle=' + cycle<?php 
                    if ($plan->has_trial()) {
                        echo " + '&trial=true'";
                    }
                    ?>
;
											},
											_updateCtaUrl = function (plan, pricing, cycle) {
												$('.plugin-information-pricing .button, #plugin-information-footer .button').attr('href', _checkoutUrl(plan, pricing, cycle));
											};

										$(document).ready(function () {
											var $plan = $('.plugin-information-pricing .fs-plan[data-plan-id=<?php 
                    echo $plan->id;
                    ?>
]');
											$plan.find('input[type=radio]').live('click', function () {
												_updateCtaUrl(
													$plan.attr('data-plan-id'),
													$(this).val(),
													$plan.find('.nav-tab-active').attr('data-billing-cycle')
												);

												$plan.find('.fs-trial-terms .fs-price').html(
													$(this).parents('label').find('.fs-price').html()
												);
											});

											$plan.find('.nav-tab').click(function () {
												if ($(this).hasClass('nav-tab-active'))
													return;

												var $this = $(this),
												    billingCycle = $this.attr('data-billing-cycle'),
												    pricing = JSON.parse($this.attr('data-pricing')),
												    $pricesList = $this.parents('.fs-plan').find('.fs-pricing-body .fs-licenses'),
												    html = '';

												// Un-select previously selected tab.
												$plan.find('.nav-tab').removeClass('nav-tab-active');

												// Select current tab.
												$this.addClass('nav-tab-active');

												// Render licenses prices.
												if (1 == pricing.length) {
													html = '<li><label><?php 
                    _efs('price', $api->slug);
                    ?>
: ' + _formatPrice(pricing[0], billingCycle, false) + '</label></li>';
												} else {
													for (var i = 0; i < pricing.length; i++) {
														html += '<li><label><input name="pricing-<?php 
                    echo $plan->id;
                    ?>
" type="radio" value="' + pricing[i].id + '">' + _formatPrice(pricing[i], billingCycle) + '</label></li>';
													}
												}
												$pricesList.html(html);

												if (1 < pricing.length) {
													// Select first license option.
													$pricesList.find('li:first input').click();
												}
												else {
													_updateCtaUrl(
														$plan.attr('data-plan-id'),
														pricing[0].id,
														billingCycle
													);
												}

												// Update billing frequency.
												$plan.find('.fs-billing-frequency').html(_formatBillingFrequency(billingCycle));

												if ('annual' === billingCycle) {
													$plan.find('.fs-annual-discount').show();
												} else {
													$plan.find('.fs-annual-discount').hide();
												}
											});

											<?php 
                    if ($has_annual) {
                        ?>
											// Select annual by default.
											$plan.find('.nav-tab[data-billing-cycle=annual]').click();
											<?php 
                    } else {
                        ?>
											// Select first tab.
											$plan.find('.nav-tab:first').click();
											<?php 
                    }
                    ?>
										});
									}(jQuery));
								</script>
							</div>
							<div class="fs-pricing-body">
								<span class="fs-billing-frequency"></span>
								<?php 
                    $annual_discount = $has_annual && $has_monthly ? $plan->pricing[0]->annual_discount_percentage() : 0;
                    ?>
								<?php 
                    if ($annual_discount > 0) {
                        ?>
									<span
										class="fs-annual-discount"><?php 
                        printf(__fs('save-x', $api->slug), $annual_discount . '%');
                        ?>
</span>
								<?php 
                    }
                    ?>
								<ul class="fs-licenses">
								</ul>
								<?php 
                    echo $this->get_plugin_cta($api, $plan);
                    ?>
								<div style="clear:both"></div>
								<?php 
                    if ($plan->has_trial()) {
                        ?>
									<?php 
                        $trial_period = $this->get_trial_period($plan);
                        ?>
									<ul class="fs-trial-terms">
										<li>
											<i class="dashicons dashicons-yes"></i><?php 
                        printf(__fs('no-commitment-x', $api->slug), $trial_period);
                        ?>
										</li>
										<li>
											<i class="dashicons dashicons-yes"></i><?php 
                        printf(__fs('after-x-pay-as-little-y', $api->slug), $trial_period, '<var class="fs-price">' . $this->get_price_tag($plan, $plan->pricing[0]) . '</var>');
                        ?>
										</li>
									</ul>
								<?php 
                    }
                    ?>
							</div>
						</div>
						</div>
					<?php 
                }
                ?>
				<?php 
            }
            ?>
			<?php 
        }
        ?>
			<div>
				<h3><?php 
        _efs('details', $api->slug);
        ?>
</h3>
				<ul>
					<?php 
        if (!empty($api->version)) {
            ?>
						<li><strong><?php 
            _e('Version:');
            ?>
</strong> <?php 
            echo $api->version;
            ?>
</li>
					<?php 
        }
        if (!empty($api->author)) {
            ?>
							<li>
								<strong><?php 
            _e('Author:');
            ?>
</strong> <?php 
            echo links_add_target($api->author, '_blank');
            ?>
							</li>
						<?php 
        }
        if (!empty($api->last_updated)) {
            ?>
							<li><strong><?php 
            _e('Last Updated:');
            ?>
</strong> <span
									title="<?php 
            echo $api->last_updated;
            ?>
">
				<?php 
            printf(__('%s ago'), human_time_diff(strtotime($api->last_updated)));
            ?>
			</span></li>
						<?php 
        }
        if (!empty($api->requires)) {
            ?>
							<li>
								<strong><?php 
            _e('Requires WordPress Version:');
            ?>
</strong> <?php 
            printf(__('%s or higher'), $api->requires);
            ?>
							</li>
						<?php 
        }
        if (!empty($api->tested)) {
            ?>
							<li><strong><?php 
            _e('Compatible up to:');
            ?>
</strong> <?php 
            echo $api->tested;
            ?>
							</li>
						<?php 
        }
        if (!empty($api->downloaded)) {
            ?>
							<li>
								<strong><?php 
            _e('Downloaded:');
            ?>
</strong> <?php 
            printf(_n('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded));
            ?>
							</li>
						<?php 
        }
        if (!empty($api->slug) && empty($api->external)) {
            ?>
							<li><a target="_blank"
							       href="https://wordpress.org/plugins/<?php 
            echo $api->slug;
            ?>
/"><?php 
            _e('WordPress.org Plugin Page &#187;');
            ?>
</a>
							</li>
						<?php 
        }
        if (!empty($api->homepage)) {
            ?>
							<li><a target="_blank"
							       href="<?php 
            echo esc_url($api->homepage);
            ?>
"><?php 
            _e('Plugin Homepage &#187;');
            ?>
</a>
							</li>
						<?php 
        }
        if (!empty($api->donate_link) && empty($api->contributors)) {
            ?>
							<li><a target="_blank"
							       href="<?php 
            echo esc_url($api->donate_link);
            ?>
"><?php 
            _e('Donate to this plugin &#187;');
            ?>
</a>
							</li>
						<?php 
        }
        ?>
				</ul>
			</div>
			<?php 
        if (!empty($api->rating)) {
            ?>
				<h3><?php 
            _e('Average Rating');
            ?>
</h3>
				<?php 
            wp_star_rating(array('rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings));
            ?>
				<small><?php 
            printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings));
            ?>
</small>
			<?php 
        }
        if (!empty($api->ratings) && array_sum((array) $api->ratings) > 0) {
            foreach ($api->ratings as $key => $ratecount) {
                // Avoid div-by-zero.
                $_rating = $api->num_ratings ? $ratecount / $api->num_ratings : 0;
                ?>
						<div class="counter-container">
					<span class="counter-label"><a
							href="https://wordpress.org/support/view/plugin-reviews/<?php 
                echo $api->slug;
                ?>
?filter=<?php 
                echo $key;
                ?>
"
							target="_blank"
							title="<?php 
                echo esc_attr(sprintf(_n('Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $key), $key));
                ?>
"><?php 
                printf(_n('%d star', '%d stars', $key), $key);
                ?>
</a></span>
					<span class="counter-back">
						<span class="counter-bar" style="width: <?php 
                echo 92 * $_rating;
                ?>
px;"></span>
					</span>
							<span class="counter-count"><?php 
                echo number_format_i18n($ratecount);
                ?>
</span>
						</div>
					<?php 
            }
        }
        if (!empty($api->contributors)) {
            ?>
					<h3><?php 
            _e('Contributors');
            ?>
</h3>
					<ul class="contributors">
						<?php 
            foreach ((array) $api->contributors as $contrib_username => $contrib_profile) {
                if (empty($contrib_username) && empty($contrib_profile)) {
                    continue;
                }
                if (empty($contrib_username)) {
                    $contrib_username = preg_replace('/^.+\\/(.+)\\/?$/', '\\1', $contrib_profile);
                }
                $contrib_username = sanitize_user($contrib_username);
                if (empty($contrib_profile)) {
                    echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&amp;s=36' width='18' height='18' />{$contrib_username}</li>";
                } else {
                    echo "<li><a href='{$contrib_profile}' target='_blank'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&amp;s=36' width='18' height='18' />{$contrib_username}</a></li>";
                }
            }
            ?>
					</ul>
					<?php 
            if (!empty($api->donate_link)) {
                ?>
						<a target="_blank"
						   href="<?php 
                echo esc_url($api->donate_link);
                ?>
"><?php 
                _e('Donate to this plugin &#187;');
                ?>
</a>
					<?php 
            }
            ?>
				<?php 
        }
        ?>
			</div>
			<div id="section-holder" class="wrap">
	<?php 
        if (!empty($api->tested) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>')) {
            echo '<div class="notice notice-warning"><p>' . '<strong>' . __('Warning:') . '</strong> ' . __('This plugin has not been tested with your current version of WordPress.') . '</p></div>';
        } else {
            if (!empty($api->requires) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<')) {
                echo '<div class="notice notice-warning"><p>' . '<strong>' . __('Warning:') . '</strong> ' . __('This plugin has not been marked as compatible with your version of WordPress.') . '</p></div>';
            }
        }
        foreach ((array) $api->sections as $section_name => $content) {
            $content = links_add_base_url($content, 'https://wordpress.org/plugins/' . $api->slug . '/');
            $content = links_add_target($content, '_blank');
            $san_section = esc_attr($section_name);
            $display = $section_name === $section ? 'block' : 'none';
            if ('description' === $section_name && (!$api->external && $api->wp_org_missing || $api->external && $api->fs_missing)) {
                $missing_notice = array('type' => 'error', 'id' => md5(microtime()), 'message' => __fs($api->is_paid ? 'paid-addon-not-deployed' : 'free-addon-not-deployed', $api->slug));
                fs_require_template('admin-notice.php', $missing_notice);
            }
            echo "\t<div id='section-{$san_section}' class='section' style='display: {$display};'>\n";
            echo $content;
            echo "\t</div>\n";
        }
        echo "</div>\n";
        echo "</div>\n";
        echo "</div>\n";
        // #plugin-information-scrollable
        echo "<div id='{$tab}-footer'>\n";
        echo $this->get_plugin_cta($api);
        echo "</div>\n";
        iframe_footer();
        exit;
    }
Exemplo n.º 8
0
 /**
  * Displays a confirmation and feedback dialog box when the user clicks on the "Deactivate" link on the plugins
  * page.
  *
  * @author Vova Feldman (@svovaf)
  * @author Leo Fajardo (@leorw)
  * @since  1.1.2
  */
 function _add_deactivation_feedback_dialog_box()
 {
     fs_enqueue_local_style('fs_deactivation_feedback', '/admin/deactivation-feedback.css');
     /* Check the type of user:
      * 1. Long-term (long-term)
      * 2. Non-registered and non-anonymous short-term (non-registered-and-non-anonymous-short-term).
      * 3. Short-term (short-term)
      */
     $is_long_term_user = true;
     // Check if the site is at least 2 days old.
     $time_installed = $this->_storage->install_timestamp;
     // Difference in seconds.
     $date_diff = time() - $time_installed;
     // Convert seconds to days.
     $date_diff_days = floor($date_diff / (60 * 60 * 24));
     if ($date_diff_days < 2) {
         $is_long_term_user = false;
     }
     $is_long_term_user = $this->apply_filters('is_long_term_user', $is_long_term_user);
     if ($is_long_term_user) {
         $user_type = 'long-term';
     } else {
         if (!$this->is_registered() && !$this->is_anonymous()) {
             $user_type = 'non-registered-and-non-anonymous-short-term';
         } else {
             $user_type = 'short-term';
         }
     }
     $uninstall_reasons = $this->_get_uninstall_reasons($user_type);
     // Load the HTML template for the deactivation feedback dialog box.
     $vars = array('reasons' => $uninstall_reasons, 'slug' => $this->_slug);
     /**
      * @todo Deactivation form core functions should be loaded only once! Otherwise, when there are multiple Freemius powered plugins the same code is loaded multiple times. The only thing that should be loaded differently is the various deactivation reasons object based on the state of the plugin.
      */
     fs_require_template('deactivation-feedback-modal.php', $vars);
 }
    /**
     * Display plugin information in dialog box form.
     *
     * Based on core install_plugin_information() function.
     *
     * @author Vova Feldman (@svovaf)
     * @since  1.0.6
     */
    function install_plugin_information()
    {
        global $tab;
        if (empty($_REQUEST['plugin'])) {
            return;
        }
        $args = array('slug' => wp_unslash($_REQUEST['plugin']), 'is_ssl' => is_ssl(), 'fields' => array('banners' => true, 'reviews' => true, 'downloaded' => false, 'active_installs' => true));
        if (is_array($args)) {
            $args = (object) $args;
        }
        if (!isset($args->per_page)) {
            $args->per_page = 24;
        }
        if (!isset($args->locale)) {
            $args->locale = get_locale();
        }
        $api = apply_filters('fs_plugins_api', false, 'plugin_information', $args);
        if (is_wp_error($api)) {
            wp_die($api);
        }
        $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array(), 'class' => array()), 'style' => array(), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'div' => array('class' => array()), 'span' => array('class' => array()), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array('class' => array()), 'i' => array('class' => array()), 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'img' => array('src' => array(), 'class' => array(), 'alt' => array()));
        $plugins_section_titles = array('description' => _x('Description', 'Plugin installer section title'), 'installation' => _x('Installation', 'Plugin installer section title'), 'faq' => _x('FAQ', 'Plugin installer section title'), 'screenshots' => _x('Screenshots', 'Plugin installer section title'), 'changelog' => _x('Changelog', 'Plugin installer section title'), 'reviews' => _x('Reviews', 'Plugin installer section title'), 'other_notes' => _x('Other Notes', 'Plugin installer section title'));
        // Sanitize HTML
        //		foreach ( (array) $api->sections as $section_name => $content ) {
        //			$api->sections[$section_name] = wp_kses( $content, $plugins_allowedtags );
        //		}
        foreach (array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key) {
            if (isset($api->{$key})) {
                $api->{$key} = wp_kses($api->{$key}, $plugins_allowedtags);
            }
        }
        // Add after $api->slug is ready.
        $plugins_section_titles['features'] = __fs('features-and-pricing', $api->slug);
        $_tab = esc_attr($tab);
        $section = isset($_REQUEST['section']) ? wp_unslash($_REQUEST['section']) : 'description';
        // Default to the Description tab, Do not translate, API returns English.
        if (empty($section) || !isset($api->sections[$section])) {
            $section_titles = array_keys((array) $api->sections);
            $section = array_shift($section_titles);
        }
        iframe_header(__('Plugin Install'));
        $_with_banner = '';
        //	var_dump($api->banners);
        if (!empty($api->banners) && (!empty($api->banners['low']) || !empty($api->banners['high']))) {
            $_with_banner = 'with-banner';
            $low = empty($api->banners['low']) ? $api->banners['high'] : $api->banners['low'];
            $high = empty($api->banners['high']) ? $api->banners['low'] : $api->banners['high'];
            ?>
				<style type="text/css">
					#plugin-information-title.with-banner
					{
						background-image: url( <?php 
            echo esc_url($low);
            ?>
 );
					}

					@media only screen and ( -webkit-min-device-pixel-ratio: 1.5 )
					{
						#plugin-information-title.with-banner
						{
							background-image: url( <?php 
            echo esc_url($high);
            ?>
 );
						}
					}
				</style>
			<?php 
        }
        echo '<div id="plugin-information-scrollable">';
        echo "<div id='{$_tab}-title' class='{$_with_banner}'><div class='vignette'></div><h2>{$api->name}</h2></div>";
        echo "<div id='{$_tab}-tabs' class='{$_with_banner}'>\n";
        foreach ((array) $api->sections as $section_name => $content) {
            if ('reviews' === $section_name && (empty($api->ratings) || 0 === array_sum((array) $api->ratings))) {
                continue;
            }
            if (isset($plugins_section_titles[$section_name])) {
                $title = $plugins_section_titles[$section_name];
            } else {
                $title = ucwords(str_replace('_', ' ', $section_name));
            }
            $class = $section_name === $section ? ' class="current"' : '';
            $href = add_query_arg(array('tab' => $tab, 'section' => $section_name));
            $href = esc_url($href);
            $san_section = esc_attr($section_name);
            echo "\t<a name='{$san_section}' href='{$href}' {$class}>{$title}</a>\n";
        }
        echo "</div>\n";
        ?>
		<div id="<?php 
        echo $_tab;
        ?>
-content" class='<?php 
        echo $_with_banner;
        ?>
'>
			<div class="fyi">
				<?php 
        if (isset($api->plans)) {
            ?>
					<div class="plugin-information-pricing">
						<?php 
            foreach ($api->plans as $plan) {
                ?>
						<?php 
                /**
                 * @var FS_Plugin_Plan $plan
                 */
                ?>
						<h3 data-plan="<?php 
                echo $plan->id;
                ?>
"><?php 
                printf(__fs('x-plan', $api->slug), $plan->title);
                ?>
</h3>
						<?php 
                if ($api->is_paid) {
                    ?>
							<ul>
								<?php 
                    if (1 === count($plan->pricing) && 1 == $plan->pricing[0]->licenses) {
                        ?>
									<?php 
                        $pricing = $plan->pricing[0];
                        ?>
									<li><label><?php 
                        _efs('price', $api->slug);
                        ?>
											: <?php 
                        echo $this->get_price_tag($plan, $pricing);
                        ?>
</label></li>
								<?php 
                    } else {
                        ?>
									<?php 
                        $first = true;
                        foreach ($plan->pricing as $pricing) {
                            ?>
										<li><label><input name="pricing-<?php 
                            echo $plan->id;
                            ?>
" type="radio"
										                  value="<?php 
                            echo $pricing->id;
                            ?>
"<?php 
                            checked($first, true);
                            ?>
><?php 
                            switch ($pricing->licenses) {
                                case '1':
                                    _efs('license-single-site', $api->slug);
                                    break;
                                case null:
                                    _efs('license-unlimited', $api->slug);
                                    break;
                                default:
                                    printf(__fs('license-x-sites', $api->slug), $pricing->licenses);
                                    break;
                            }
                            ?>
 - <?php 
                            echo $this->get_price_tag($plan, $pricing);
                            ?>
</label></li>
										<?php 
                            $first = false;
                        }
                        ?>
								<?php 
                    }
                    ?>
							</ul>
						<?php 
                }
                ?>
						<?php 
                echo $this->get_plugin_cta($api, $plan);
                ?>
						<div style="clear:both"></div>
						<?php 
                if ($api->is_paid) {
                    ?>
							<?php 
                    if ($plan->has_trial()) {
                        ?>
								<?php 
                        $trial_period = $this->get_trial_period($plan);
                        ?>
								<ul class="fs-trial-terms">
									<li>
										<i class="dashicons dashicons-yes"></i><?php 
                        printf(__fs('no-commitment-x', $api->slug), $trial_period);
                        ?>
									</li>
									<li>
										<i class="dashicons dashicons-yes"></i><?php 
                        printf(__fs('after-x-pay-as-little-y', $api->slug), $trial_period, $this->get_price_tag($plan, $plan->pricing[0]));
                        ?>
									</li>
								</ul>
							<?php 
                    }
                    ?>
						<?php 
                }
                ?>
					</div>
				<?php 
            }
            ?>
				<?php 
            if ($api->is_paid) {
                ?>
				<?php 
                $plan = $api->plans[0];
                ?>
				<?php 
                $billing_cycle = $this->get_billing_cycle($plan);
                ?>

				<?php 
                wp_enqueue_script('jquery');
                ?>
					<script type="text/javascript">
						(function ($) {
							$('.plugin-information-pricing input[type=radio]').click(function () {
								var checkout_url = '<?php 
                echo esc_url_raw(add_query_arg(array('plugin_id' => $plan->plugin_id, 'billing_cycle' => $billing_cycle), $api->checkout_link));
                ?>
&plan_id=' +
									$(this).parents('.plugin-information-pricing').find('h3').attr('data-plan') +
									'&pricing_id=' + $(this).val();

								$('.plugin-information-pricing .button, #plugin-information-footer .button').attr('href', checkout_url);
							});
						})(jQuery);
					</script>
				<?php 
            }
            ?>
				<?php 
        }
        ?>
				<div>
					<h3><?php 
        _efs('details', $api->slug);
        ?>
</h3>
					<ul>
						<?php 
        if (!empty($api->version)) {
            ?>
							<li><strong><?php 
            _e('Version:');
            ?>
</strong> <?php 
            echo $api->version;
            ?>
</li>
						<?php 
        }
        if (!empty($api->author)) {
            ?>
								<li>
									<strong><?php 
            _e('Author:');
            ?>
</strong> <?php 
            echo links_add_target($api->author, '_blank');
            ?>
								</li>
							<?php 
        }
        if (!empty($api->last_updated)) {
            ?>
								<li><strong><?php 
            _e('Last Updated:');
            ?>
</strong> <span
										title="<?php 
            echo $api->last_updated;
            ?>
">
				<?php 
            printf(__('%s ago'), human_time_diff(strtotime($api->last_updated)));
            ?>
			</span></li>
							<?php 
        }
        if (!empty($api->requires)) {
            ?>
								<li>
									<strong><?php 
            _e('Requires WordPress Version:');
            ?>
</strong> <?php 
            printf(__('%s or higher'), $api->requires);
            ?>
								</li>
							<?php 
        }
        if (!empty($api->tested)) {
            ?>
								<li><strong><?php 
            _e('Compatible up to:');
            ?>
</strong> <?php 
            echo $api->tested;
            ?>
								</li>
							<?php 
        }
        if (!empty($api->downloaded)) {
            ?>
								<li>
									<strong><?php 
            _e('Downloaded:');
            ?>
</strong> <?php 
            printf(_n('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded));
            ?>
								</li>
							<?php 
        }
        if (!empty($api->slug) && empty($api->external)) {
            ?>
								<li><a target="_blank"
								       href="https://wordpress.org/plugins/<?php 
            echo $api->slug;
            ?>
/"><?php 
            _e('WordPress.org Plugin Page &#187;');
            ?>
</a>
								</li>
							<?php 
        }
        if (!empty($api->homepage)) {
            ?>
								<li><a target="_blank"
								       href="<?php 
            echo esc_url($api->homepage);
            ?>
"><?php 
            _e('Plugin Homepage &#187;');
            ?>
</a>
								</li>
							<?php 
        }
        if (!empty($api->donate_link) && empty($api->contributors)) {
            ?>
								<li><a target="_blank"
								       href="<?php 
            echo esc_url($api->donate_link);
            ?>
"><?php 
            _e('Donate to this plugin &#187;');
            ?>
</a>
								</li>
							<?php 
        }
        ?>
					</ul>
				</div>
				<?php 
        if (!empty($api->rating)) {
            ?>
					<h3><?php 
            _e('Average Rating');
            ?>
</h3>
					<?php 
            wp_star_rating(array('rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings));
            ?>
					<small><?php 
            printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings));
            ?>
</small>
				<?php 
        }
        if (!empty($api->ratings) && array_sum((array) $api->ratings) > 0) {
            foreach ($api->ratings as $key => $ratecount) {
                // Avoid div-by-zero.
                $_rating = $api->num_ratings ? $ratecount / $api->num_ratings : 0;
                ?>
							<div class="counter-container">
					<span class="counter-label"><a
							href="https://wordpress.org/support/view/plugin-reviews/<?php 
                echo $api->slug;
                ?>
?filter=<?php 
                echo $key;
                ?>
"
							target="_blank"
							title="<?php 
                echo esc_attr(sprintf(_n('Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $key), $key));
                ?>
"><?php 
                printf(_n('%d star', '%d stars', $key), $key);
                ?>
</a></span>
					<span class="counter-back">
						<span class="counter-bar" style="width: <?php 
                echo 92 * $_rating;
                ?>
px;"></span>
					</span>
								<span class="counter-count"><?php 
                echo number_format_i18n($ratecount);
                ?>
</span>
							</div>
						<?php 
            }
        }
        if (!empty($api->contributors)) {
            ?>
						<h3><?php 
            _e('Contributors');
            ?>
</h3>
						<ul class="contributors">
							<?php 
            foreach ((array) $api->contributors as $contrib_username => $contrib_profile) {
                if (empty($contrib_username) && empty($contrib_profile)) {
                    continue;
                }
                if (empty($contrib_username)) {
                    $contrib_username = preg_replace('/^.+\\/(.+)\\/?$/', '\\1', $contrib_profile);
                }
                $contrib_username = sanitize_user($contrib_username);
                if (empty($contrib_profile)) {
                    echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&amp;s=36' width='18' height='18' />{$contrib_username}</li>";
                } else {
                    echo "<li><a href='{$contrib_profile}' target='_blank'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&amp;s=36' width='18' height='18' />{$contrib_username}</a></li>";
                }
            }
            ?>
						</ul>
						<?php 
            if (!empty($api->donate_link)) {
                ?>
							<a target="_blank"
							   href="<?php 
                echo esc_url($api->donate_link);
                ?>
"><?php 
                _e('Donate to this plugin &#187;');
                ?>
</a>
						<?php 
            }
            ?>
					<?php 
        }
        ?>
			</div>
			<div id="section-holder" class="wrap">
	<?php 
        if (!empty($api->tested) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>')) {
            echo '<div class="notice notice-warning"><p>' . '<strong>' . __('Warning:') . '</strong> ' . __('This plugin has not been tested with your current version of WordPress.') . '</p></div>';
        } else {
            if (!empty($api->requires) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<')) {
                echo '<div class="notice notice-warning"><p>' . '<strong>' . __('Warning:') . '</strong> ' . __('This plugin has not been marked as compatible with your version of WordPress.') . '</p></div>';
            }
        }
        foreach ((array) $api->sections as $section_name => $content) {
            $content = links_add_base_url($content, 'https://wordpress.org/plugins/' . $api->slug . '/');
            $content = links_add_target($content, '_blank');
            $san_section = esc_attr($section_name);
            $display = $section_name === $section ? 'block' : 'none';
            if ('description' === $section_name && (!$api->external && $api->wp_org_missing || $api->external && $api->fs_missing)) {
                $missing_notice = array('type' => 'error', 'id' => md5(microtime()), 'message' => __fs($api->is_paid ? 'paid-addon-not-deployed' : 'free-addon-not-deployed', $api->slug));
                fs_require_template('admin-notice.php', $missing_notice);
            }
            echo "\t<div id='section-{$san_section}' class='section' style='display: {$display};'>\n";
            echo $content;
            echo "\t</div>\n";
        }
        echo "</div>\n";
        echo "</div>\n";
        echo "</div>\n";
        // #plugin-information-scrollable
        echo "<div id='{$tab}-footer'>\n";
        echo $this->get_plugin_cta($api);
        echo "</div>\n";
        iframe_footer();
        exit;
    }