Example #1
2
/**
 * Create WP ULike About page
 *
 * @author       	Alimir	 	
 * @since           1.7
 * @updated         2.1
 * @return			String
 */
function wp_ulike_about_page()
{
    include plugin_dir_path(__FILE__) . 'classes/tmp/svg-source.php';
    ?>
	<style>
	.ulike-badge{
		background: url('<?php 
    echo plugins_url('/assets', dirname(__FILE__));
    ?>
/img/wp-ulike-badge.png') no-repeat scroll center 24px / 95px 95px #F3643A;
		color: #fff;
		font-size: 14px;
		text-align: center;
		font-weight: 600;
		margin: 5px 0px 0px;
		padding-top: 120px;
		height: 40px;
		display: inline-block;
		width: 150px;
		text-rendering: optimizelegibility;
		box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.2);
	}
	.boxstyle {
		padding: 1px 12px;
		background-color: #FFF;
		box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.1);
	}
	.wp_ulike_version {
		display: inline-block;
		position: absolute;
		top: 54px;
		left:0;
		padding: 5px 10px;
		background: #e74c3c;
		color: #FFF;
		font-size: 13px;
		font-weight: normal;
	}
	.about-wrap .headline-feature h2 {
		margin: 1.1em 0px 0.2em;
		font-size: 2.4em;
		font-weight: 300;
		line-height: 1.3;
		text-align: center;
	}
	.about-wrap .feature-list h2 {
		margin: 30px 0px 15px;
		text-align: center;
	}	
	<?php 
    if (is_rtl()) {
        ?>
	.about-wrap .ulike-badge {
		position: absolute;
		top: 0px;
		left: 0px;
	}
	.about-wrap .feature-list svg {
		float: right;
		clear: right;
		margin: 15px 0 0px 15px;
		height: 90px;
		width: 90px;
		background-color: #CCC;
		border-radius: 50%;
		fill: #999;
		border: 1px solid #C1C1C1;
	}	
	<?php 
    } else {
        ?>
	.about-wrap .ulike-badge {
		position: absolute;
		top: 0px;
		right: 0px;
	}
	.about-wrap .feature-list svg {
		float: left;
		clear: left;
		margin: 15px 15px 0px 0px;
		height: 90px;
		width: 90px;
		background-color: #CCC;
		border-radius: 50%;
		fill: #999;
		border: 1px solid #C1C1C1;
	}	
	<?php 
    }
    ?>
	</style>

	<div class="wrap about-wrap">

		<h1><?php 
    echo _e('Welcome to WP ULike', WP_ULIKE_SLUG) . ' ' . WP_ULIKE_VERSION;
    ?>
</h1>

		<div class="about-text"><?php 
    echo _e('Thank you for choosing WP ULike! This version is our leanest and most powerful version yet.', WP_ULIKE_SLUG);
    ?>
<br />
		<a target="_blank" href="http://preview.alimir.ir/developer/wp-ulike/"> <?php 
    _e('Visit our homepage', WP_ULIKE_SLUG);
    ?>
</a>
		</div>
		<div class="ulike-badge"><?php 
    echo _e('Version', WP_ULIKE_SLUG) . ' ' . WP_ULIKE_VERSION;
    ?>
</div>
		<h2 class="nav-tab-wrapper">
			<a class="nav-tab <?php 
    if (!isset($_GET["credit"])) {
        echo 'nav-tab-active';
    }
    ?>
" href="admin.php?page=wp-ulike-about"><?php 
    echo _e('Getting Started', WP_ULIKE_SLUG);
    ?>
</a> 
			<a class="nav-tab <?php 
    if (isset($_GET["credit"])) {
        echo 'nav-tab-active';
    }
    ?>
" href="admin.php?page=wp-ulike-about&credit=true"><?php 
    echo _e('Credits', WP_ULIKE_SLUG);
    ?>
</a> 
			<a target="_blank" class="nav-tab" href="https://wordpress.org/support/plugin/wp-ulike"><?php 
    echo _e('Support', WP_ULIKE_SLUG);
    ?>
</a> 
			<a target="_blank" class="nav-tab" href="https://wordpress.org/plugins/wp-ulike/faq/"><?php 
    echo _e('FAQ', WP_ULIKE_SLUG);
    ?>
</a> 
			<a target="_blank" class="nav-tab" href="https://wordpress.org/support/view/plugin-reviews/wp-ulike"><?php 
    echo _e('Reviews', WP_ULIKE_SLUG);
    ?>
</a> 
		</h2>
		
		<?php 
    if (!isset($_GET["credit"])) {
        ?>
		
        <div class="changelog headline-feature">
            <h2><?php 
        echo _e('Introducing WP ULike', WP_ULIKE_SLUG);
        ?>
</h2>
            <div class="featured-image">
                <img src="<?php 
        echo plugins_url('/assets', dirname(__FILE__));
        ?>
/img/wp-ulike-intro.png">
            </div>       

            <div class="feature-section">
                <div class="col">
                    <h3><?php 
        echo _e('About WP ULike', WP_ULIKE_SLUG);
        ?>
</h3>
                    <span style="text-align:center">
                    <?php 
        $args = array('rating' => 5, 'type' => 'rating', 'number' => 43);
        wp_star_rating($args);
        ?>
                    </span>          
                    <p><?php 
        echo _e('WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordPress website to allow your visitors to like and unlike pages, posts, comments AND buddypress activities. Its very simple to use and supports many options.', WP_ULIKE_SLUG);
        ?>
</p>
                </div>
            </div>

            <div class="clear"></div>
        </div>
        
        <div class="feature-section three-col">
            <div class="col">
                <div class="svg-container">
                    <svg viewBox="-10 -10 52 52">
                        <g filter="">
                        <use xlink:href="#like"></use>
                        </g>
                    </svg>
                </div>
                <h3><?php 
        echo _e('WP Ulike Extension', WP_ULIKE_SLUG);
        ?>
</h3>
                <p><?php 
        echo _e('Right now, WP ULike support wordpress posts / comments, BuddyPress activities & bbPress Topics.', WP_ULIKE_SLUG);
        ?>
</p>
            </div>
            <div class="col">
                <div class="svg-container">
                    <svg viewBox="-10 -10 52 52">
                        <g filter="">
                          <use xlink:href="#globe"></use>
                        </g>
                    </svg>
                </div>
                <h3><?php 
        echo _e('Added More Than 20 Language Files', WP_ULIKE_SLUG);
        ?>
</h3>
                <p><?php 
        echo _e('WP ULike is already translated into +20 languages, with more always in progress.', WP_ULIKE_SLUG);
        ?>
</p>
            </div>
            <div class="col">
                <div class="svg-container">
                    <svg viewBox="-10 -10 52 52">
                        <g filter="">
                        <use xlink:href="#happy-smiley"></use>
                        </g>
                    </svg>
                </div>
                <h3><?php 
        echo _e('User Profile Links', WP_ULIKE_SLUG);
        ?>
</h3>
                <p><?php 
        echo _e('Since WP ULike 2.3, We have synced the likers profile with BuddyPress & UltimateMember plugins.', WP_ULIKE_SLUG);
        ?>
</p>
            </div>
            <div class="col">
                <div class="svg-container">
                    <svg viewBox="-10 -10 52 52">
                        <g filter="">
                        <use xlink:href="#heart"></use>
                        </g>
                    </svg>
                </div>
                <h3><?php 
        echo _e('New Themes And Styles', WP_ULIKE_SLUG);
        ?>
</h3>
                <p><?php 
        echo _e('Since WP ULike 2.3, We have made some new styles and themes and you can customize them by your taste.', WP_ULIKE_SLUG);
        ?>
</p>
            </div>
            <div class="col">
                <div class="svg-container">
                    <svg viewBox="-10 -10 52 52">
                        <g filter="">
                        <use xlink:href="#prize"></use>
                        </g>
                    </svg>
                </div>
                <h3><?php 
        echo _e('myCRED Points Support', WP_ULIKE_SLUG);
        ?>
</h3>
               <p><?php 
        echo _e('myCRED is an adaptive points management system that lets you award / charge your users for interacting with your WordPress.', WP_ULIKE_SLUG);
        ?>
</p>
            </div>
            <div class="col">
                <div class="svg-container">
                    <svg viewBox="-10 -10 52 52">
                        <g filter="">
                        <use xlink:href="#tag"></use>
                        </g>
                    </svg>
                </div>
                <h3><?php 
        echo _e('Likers World Map', WP_ULIKE_SLUG);
        ?>
</h3>
                <p><?php 
        echo _e('Since WP ULike 2.3, We have made a new ability that you can track your likers by their country in the world map & Top Liker widget.', WP_ULIKE_SLUG);
        ?>
</p>
            </div>
        </div>        
		
		<div class="changelog feature-list">
			<div class="return-to-dashboard">
				<a href="admin.php?page=wp-ulike-statistics"><?php 
        echo _e('WP ULike Statistics', WP_ULIKE_SLUG);
        ?>
 &rarr; <?php 
        echo _e('Home', WP_ULIKE_SLUG);
        ?>
</a> <?php 
        echo _e('OR', WP_ULIKE_SLUG);
        ?>
 <a href="admin.php?page=wp-ulike-settings"><?php 
        echo _e('WP ULike Settings', WP_ULIKE_SLUG);
        ?>
</a>
			</div>
		</div>
		
		<?php 
    } else {
        ?>
		
		<p class="about-description"><?php 
        echo _e('WP ULike is created by many love and time. Enjoy it :)', WP_ULIKE_SLUG);
        ?>
</p>	
		<h4 class="wp-people-group"><?php 
        echo _e('Project Leaders', WP_ULIKE_SLUG);
        ?>
</h4>
		<ul class="wp-people-group">
			<li class="wp-person" id="wp-person-alimirzaei">
				<a href="https://profiles.wordpress.org/alimir/"><?php 
        echo get_avatar('*****@*****.**', 64);
        ?>
</a>
				<a class="web" target="_blank" href="https://ir.linkedin.com/in/alimirir/">Ali Mirzaei</a>
				<span class="title"><?php 
        echo _e('Project Lead & Developer', WP_ULIKE_SLUG);
        ?>
</span>
			</li>					
		</ul>
			
		<h4 class="wp-people-group"><?php 
        _e('Translations', WP_ULIKE_SLUG);
        ?>
</h4>
		<ul>
		<li>English (United States)</li>
		<li>Persian (Iran)</li>
		<li>French (France)</li>
		<li>Chinese (China)</li>
		<li>Chinese (Taiwan)</li>
		<li>Dutch (Netherlands) </li>
		<li>Arabic</li>
		<li>Portuguese (Brazil)</li>
		<li>Turkish (Turkey)</li>
		<li>Greek</li>
		<li>Russian (Russia)</li>
		<li>Spanish (Spain)</li>
		<li>German (Germany)</li>
		<li>Japanese</li>
		<li>Romanian (Romania)</li>
		<li>Slovak (Slovakia)</li>
		<li>Czech (Czech Republic)</li>
		<li>Hebrew (Israel)</li>
		<li>Italian (Italy)</li>
		<li>Polish (Poland)</li>
		<li>Finnish</li>
		<li>Hungarian (Hungary)</li>
		<li>Lithuanian (Lithuania)</li>
		<li>Indonesian (Indonesia)</li>
		<li>Khmer</li>
		<li>Norwegian Bokmal (Norway)</li>
		<li>Portuguese (Portugal)</li>
		<li>Swedish (Sweden)</li>
		<li>Danish (Denmark)</li>
		<li>Estonian</li>
		<li>Korean (Korea)</li>
		<li>Vietnamese</li>
		<li>Basque</li>
		<li>Bosnian (Bosnia and Herzegovina)</li>
		<li>English (United Kingdom)</li>
		</ul>
		
		<p class="about-description"><?php 
        _e('Would you like to help translate the plugin into more languages?', WP_ULIKE_SLUG);
        ?>
 <a target="_blank" href="https://www.transifex.com/projects/p/wp-ulike/" title"WP-Translations">[<?php 
        _e('Join our WP-Translations Community', WP_ULIKE_SLUG);
        ?>
]</a></p>	
		
		<h4 class="wp-people-group"><?php 
        echo _e('Other Plugins', WP_ULIKE_SLUG);
        ?>
</h4>
		<ul class="wp-people-group">
			<li class="wp-person" id="wp-person-alimirzaei">
				<a target="_blank" href="https://wordpress.org/plugins/blue-login-style"><img class="gravatar" src="<?php 
        echo plugins_url('/assets', dirname(__FILE__));
        ?>
/img/blue-login-themes.jpg" alt="Blue Login Themes" /></a>
				<a class="web" href="https://profiles.wordpress.org/alimir/">Ali Mirzaei</a>
				<span class="title">Blue Login Themes</span>
			</li>									
			<li class="wp-person" id="wp-person-alimirzaei">
				<a target="_blank" href="https://wordpress.org/plugins/custom-fields-notifications/"><img class="gravatar" src="<?php 
        echo plugins_url('/assets', dirname(__FILE__));
        ?>
/img/custom-fileds-notifications.png" alt="Custom Fields Notifications" /></a>
				<a class="web" href="https://profiles.wordpress.org/alimir/">Ali Mirzaei</a>
				<span class="title">Custom Fields Notifications</span>
			</li>									
			<li class="wp-person" id="wp-person-alimirzaei">
				<a target="_blank" href="http://wordpress.org/plugins/ajax-bootmodal-login/"><img class="gravatar" src="<?php 
        echo plugins_url('/assets', dirname(__FILE__));
        ?>
/img/ajax-bootmodal-login.jpg" alt="Ajax BootModal Login" /></a>
				<a class="web" href="https://profiles.wordpress.org/alimir/">Ali Mirzaei</a>
				<span class="title">Ajax BootModal Login</span>
			</li>									
		</ul>	
		
		<h4 class="wp-people-group"><?php 
        _e('Like this plugin?', WP_ULIKE_SLUG);
        ?>
</h4>
		<div class="boxstyle"><p><strong><?php 
        _e('Show your support by Rating 5 Star in <a href="http://wordpress.org/plugins/wp-ulike"> Plugin Directory reviews</a>', WP_ULIKE_SLUG);
        ?>
</strong></p></div>
		
		<?php 
    }
    ?>
							
	</div>
	<?php 
}
 protected function wp_star_rating($args)
 {
     if (function_exists('wp_star_rating')) {
         echo wp_star_rating($args);
         return;
     }
     echo '<div class="star-holder" title="' . sprintf($this->__('based on %s rating(s)'), number_format_i18n($args['number'])) . '">' . '<div class="star star-rating" style="width:' . esc_attr(str_replace(',', '.', $args['rating'])) . 'px"></div>' . '</div>';
 }
    /**
     * @global string $wp_version
     */
    public function display_rows()
    {
        $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array());
        $plugins_group_titles = array('Performance' => _x('Performance', 'Plugin installer group title'), 'Social' => _x('Social', 'Plugin installer group title'), 'Tools' => _x('Tools', 'Plugin installer group title'));
        $group = null;
        foreach ((array) $this->items as $plugin) {
            if (is_object($plugin)) {
                $plugin = (array) $plugin;
            }
            // Display the group heading if there is one
            if (isset($plugin['group']) && $plugin['group'] != $group) {
                if (isset($this->groups[$plugin['group']])) {
                    $group_name = $this->groups[$plugin['group']];
                    if (isset($plugins_group_titles[$group_name])) {
                        $group_name = $plugins_group_titles[$group_name];
                    }
                } else {
                    $group_name = $plugin['group'];
                }
                // Starting a new group, close off the divs of the last one
                if (!empty($group)) {
                    echo '</div></div>';
                }
                echo '<div class="plugin-group"><h3>' . esc_html($group_name) . '</h3>';
                // needs an extra wrapping div for nth-child selectors to work
                echo '<div class="plugin-items">';
                $group = $plugin['group'];
            }
            $title = wp_kses($plugin['name'], $plugins_allowedtags);
            // Remove any HTML from the description.
            $description = strip_tags($plugin['short_description']);
            $version = wp_kses($plugin['version'], $plugins_allowedtags);
            $name = strip_tags($title . ' ' . $version);
            $author = wp_kses($plugin['author'], $plugins_allowedtags);
            if (!empty($author)) {
                $author = ' <cite>' . sprintf(__('By %s'), $author) . '</cite>';
            }
            $action_links = array();
            if (current_user_can('install_plugins') || current_user_can('update_plugins')) {
                $status = install_plugin_install_status($plugin);
                switch ($status['status']) {
                    case 'install':
                        if ($status['url']) {
                            /* translators: 1: Plugin name and version. */
                            $action_links[] = '<a class="install-now button" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url($status['url']) . '" aria-label="' . esc_attr(sprintf(__('Install %s now'), $name)) . '" data-name="' . esc_attr($name) . '">' . __('Install Now') . '</a>';
                        }
                        break;
                    case 'update_available':
                        if ($status['url']) {
                            /* translators: 1: Plugin name and version */
                            $action_links[] = '<a class="update-now button" data-plugin="' . esc_attr($status['file']) . '" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url($status['url']) . '" aria-label="' . esc_attr(sprintf(__('Update %s now'), $name)) . '" data-name="' . esc_attr($name) . '">' . __('Update Now') . '</a>';
                        }
                        break;
                    case 'latest_installed':
                    case 'newer_installed':
                        $action_links[] = '<span class="button button-disabled" title="' . esc_attr__('This plugin is already installed and is up to date') . ' ">' . _x('Installed', 'plugin') . '</span>';
                        break;
                }
            }
            $details_link = self_admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] . '&amp;TB_iframe=true&amp;width=600&amp;height=550');
            /* translators: 1: Plugin name and version. */
            $action_links[] = '<a href="' . esc_url($details_link) . '" class="thickbox" aria-label="' . esc_attr(sprintf(__('More information about %s'), $name)) . '" data-title="' . esc_attr($name) . '">' . __('More Details') . '</a>';
            if (!empty($plugin['icons']['svg'])) {
                $plugin_icon_url = $plugin['icons']['svg'];
            } elseif (!empty($plugin['icons']['2x'])) {
                $plugin_icon_url = $plugin['icons']['2x'];
            } elseif (!empty($plugin['icons']['1x'])) {
                $plugin_icon_url = $plugin['icons']['1x'];
            } else {
                $plugin_icon_url = $plugin['icons']['default'];
            }
            /**
             * Filter the install action links for a plugin.
             *
             * @since 2.7.0
             *
             * @param array $action_links An array of plugin action hyperlinks. Defaults are links to Details and Install Now.
             * @param array $plugin The plugin currently being listed.
             */
            $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin);
            $date_format = __('M j, Y @ H:i');
            $last_updated_timestamp = strtotime($plugin['last_updated']);
            ?>
            <div class="plugin-card plugin-card-<?php 
            echo sanitize_html_class($plugin['slug']);
            ?>
">
                <div class="plugin-card-top">
                    <a href="<?php 
            echo esc_url($details_link);
            ?>
" class="thickbox plugin-icon"><img
                            src="<?php 
            echo esc_attr($plugin_icon_url);
            ?>
"/></a>

                    <div class="name column-name">
                        <h4><a href="<?php 
            echo esc_url($details_link);
            ?>
" class="thickbox"><?php 
            echo $title;
            ?>
</a>
                        </h4>
                    </div>
                    <div class="action-links">
                        <?php 
            if ($action_links) {
                echo '<ul class="plugin-action-buttons"><li>' . implode('</li><li>', $action_links) . '</li></ul>';
            }
            ?>
                    </div>
                    <div class="desc column-description">
                        <p><?php 
            echo $description;
            ?>
</p>

                        <p class="authors"><?php 
            echo $author;
            ?>
</p>
                    </div>
                </div>
                <div class="plugin-card-bottom">
                    <div class="vers column-rating">
                        <?php 
            wp_star_rating(array('rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings']));
            ?>
                        <span class="num-ratings">(<?php 
            echo number_format_i18n($plugin['num_ratings']);
            ?>
)</span>
                    </div>
                    <div class="column-updated">
                        <strong><?php 
            _e('Last Updated:');
            ?>
</strong> <span
                            title="<?php 
            echo esc_attr(date_i18n($date_format, $last_updated_timestamp));
            ?>
">
						<?php 
            printf(__('%s ago'), human_time_diff($last_updated_timestamp));
            ?>
					</span>
                    </div>
                    <div class="column-downloaded">
                        <?php 
            if ($plugin['active_installs'] >= 1000000) {
                $active_installs_text = _x('1+ Million', 'Active plugin installs');
            } else {
                $active_installs_text = number_format_i18n($plugin['active_installs']) . '+';
            }
            printf(__('%s Active Installs'), $active_installs_text);
            ?>
                    </div>
                    <div class="column-compatibility">
                        <?php 
            if (!empty($plugin['tested']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['tested'])), $plugin['tested'], '>')) {
                echo '<span class="compatibility-untested">' . __('Untested with your version of WordPress') . '</span>';
            } elseif (!empty($plugin['requires']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['requires'])), $plugin['requires'], '<')) {
                echo '<span class="compatibility-incompatible">' . __('<strong>Incompatible</strong> with your version of WordPress') . '</span>';
            } else {
                echo '<span class="compatibility-compatible">' . __('<strong>Compatible</strong> with your version of WordPress') . '</span>';
            }
            ?>
                    </div>
                </div>
            </div>
            <?php 
        }
        // Close off the group divs of the last one
        if (!empty($group)) {
            echo '</div></div>';
        }
    }
    /**
     * Print a rating box that shows the star ratings and an upgrade message if a newer version of the plugin is available.
     *
     * Plugin data is fetched using the `plugins_api()` function, then cached for 2 hours as a transient using the `{$slug}_plugin_info` key.
     *
     * @uses plugins_api() Get the plugin data
     *
     * @param  string $name The display name of the plugin.
     * @param  string $slug The WP.org directory repo slug of the plugin
     * @param  string|float|integer $version The version number of the plugin
     *
     * @version 1.0
     */
    function kws_show_rating_box($name = '', $slug = '', $version)
    {
        global $wp_version;
        ?>
		<div class="<?php 
        echo $slug;
        ?>
-ratingbox alignright" style="padding:9px 0; max-width:400px;">
			<?php 
        // Display plugin ratings
        require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
        // Get the cached data
        $api = get_transient($slug . '_plugin_info');
        // The cache data doesn't exist or it's expired.
        if (empty($api)) {
            $api = plugins_api('plugin_information', array('slug' => $slug));
            if (!is_wp_error($api)) {
                // Cache for 2 hours
                set_transient($slug . '_plugin_info', $api, DAY_IN_SECONDS);
            }
        }
        if (!is_wp_error($api)) {
            if (!empty($api->rating)) {
                ?>
					<p><a target="_blank"
					      href="http://wordpress.org/support/view/plugin-reviews/<?php 
                echo $slug;
                ?>
?rate=5#postform"
					      class="button button-secondary"><?php 
                _e('Rate this Plugin', 'ctctcf7');
                ?>
</a>
						<strong><?php 
                _e('&larr; Help spread the word!', 'ctctcf7');
                ?>
</strong></p>
					<?php 
                if (!empty($api->downloaded)) {
                    echo sprintf(__('Downloaded %s times.', 'ctctcf7'), number_format_i18n($api->downloaded));
                }
                if (function_exists('wp_star_rating')) {
                    $ratings_args = array('rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings);
                    wp_star_rating($ratings_args);
                } else {
                    ?>
						<div class="star-holder"
						     title="<?php 
                    echo esc_attr(sprintf(__('(Average rating based on %s ratings)', 'ctctcf7'), number_format_i18n($api->num_ratings)));
                    ?>
">
							<div class="star-rating" style="width: <?php 
                    echo esc_attr($api->rating);
                    ?>
px"></div>
						</div>
						<?php 
                }
                ?>
					<div>
						<small style="display:block;"><?php 
                echo sprintf(__('Average rating based on %s ratings.', 'ctctcf7'), number_format_i18n($api->num_ratings));
                ?>
</small>
					</div>
					<?php 
            }
        }
        // if ( !is_wp_error($api)
        if (isset($api->version)) {
            if (version_compare($api->version, $version, '>') && version_compare($api->requires, $wp_version, '<=')) {
                $message = sprintf(__('%sA newer version of %s is available: %s.%s', 'ctctcf7'), '<a class="thickbox" title="Update ' . esc_html($name) . '" href="' . admin_url('plugin-install.php?tab=plugin-information&plugin=' . $slug . '&section=changelog&TB_iframe=true&width=640&height=808') . '">', esc_html($name), $api->version, '</a>');
                // Don't use make_notice_box so can be reused in other plugins.
                echo '<div id="message" class="updated">' . wpautop($message) . '</div>';
            } elseif (version_compare($api->requires, $wp_version, '>')) {
                echo '<div id="message" class="updated">';
                echo wpautop(sprintf(__('There is a newer version of %s available, but your current version of WordPress does not support it.

					%sUpdate WordPress%s', 'ctctcf7'), $name, '<a class="button button-secondary" href="' . admin_url('update-core.php') . '">', '</a>'));
                echo '</div>';
            } else {
                echo wpautop(sprintf(__('Version %s (up to date)', 'si-contact-form'), $version));
            }
        }
        ?>
		</div>
		<?php 
    }
																				<?php 
                _e("Visit Website", tech_bank);
                ?>
																			</a>
																		<?php 
                break;
        }
        ?>
														</li>
													</ul>
												</div>
											</div>
											<div class="plugin-card-bottom plugin-card-bottom_settings">
												<div class="vers column-rating">
													<?php 
        wp_star_rating(array("rating" => $plugin["rating"], "type" => "percent", "number" => $plugin["num_ratings"]));
        ?>
													<span class="num-ratings">
														(<?php 
        echo number_format_i18n($plugin["num_ratings"]);
        ?>
)
													</span>
												</div>
												<div class="column-updated">
													<strong><?php 
        _e("Last Updated:");
        ?>
</strong> <span title="<?php 
        echo esc_attr($plugin["last_updated"]);
        ?>
    /**
     * Prints the info for a theme (to be used in the theme installer modal).
     *
     * @param object $theme - A WordPress.org Theme API object.
     */
    public function install_theme_info($theme)
    {
        global $themes_allowedtags;
        if (empty($theme)) {
            return;
        }
        $name = wp_kses($theme->name, $themes_allowedtags);
        $author = wp_kses($theme->author, $themes_allowedtags);
        $install_url = add_query_arg(array('action' => 'install-theme', 'theme' => $theme->slug), self_admin_url('update.php'));
        $update_url = add_query_arg(array('action' => 'upgrade-theme', 'theme' => $theme->slug), self_admin_url('update.php'));
        $status = $this->_get_theme_status($theme);
        ?>
		<div class="install-theme-info"><?php 
        switch ($status) {
            case 'update_available':
                echo '<a class="theme-install button-primary" href="' . esc_url(wp_nonce_url($update_url, 'upgrade-theme_' . $theme->slug)) . '" title="' . esc_attr(sprintf(__('Update to version %s'), $theme->version)) . '">' . __('Update') . '</a>';
                break;
            case 'newer_installed':
            case 'latest_installed':
                echo '<span class="theme-install" title="' . esc_attr__('This theme is already installed and is up to date') . '">' . _x('Installed', 'theme') . '</span>';
                break;
            case 'install':
            default:
                echo '<a class="theme-install button-primary" href="' . esc_url(wp_nonce_url($install_url, 'install-theme_' . $theme->slug)) . '">' . __('Install') . '</a>';
                break;
        }
        ?>
			<h3 class="theme-name"><?php 
        echo $name;
        ?>
</h3>
			<span class="theme-by"><?php 
        printf(__('By %s'), $author);
        ?>
</span>
			<?php 
        if (isset($theme->screenshot_url)) {
            ?>
				<img class="theme-screenshot" src="<?php 
            echo esc_url($theme->screenshot_url);
            ?>
" />
			<?php 
        }
        ?>
			<div class="theme-details">
				<?php 
        wp_star_rating(array('rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings));
        ?>
				<div class="theme-version">
					<strong><?php 
        _e('Version:');
        ?>
 </strong>
					<?php 
        echo wp_kses($theme->version, $themes_allowedtags);
        ?>
				</div>
				<div class="theme-description">
					<?php 
        echo wp_kses($theme->description, $themes_allowedtags);
        ?>
				</div>
			</div>
			<input class="theme-preview-url" type="hidden" value="<?php 
        echo esc_url($theme->preview_url);
        ?>
" />
		</div>
		<?php 
    }
Example #7
0
/**
 * Interate over the plugins array and displays each plugin.
 *
 * @since 1.0.0
 *
 * @param string $group The plugin group. Options are 'purchased', 'active', 'installed', or 'install'.
 */
function envato_market_plugins_column($group = 'install')
{
    $premium = envato_market()->items()->plugins($group);
    if (empty($premium)) {
        return;
    }
    $plugins = envato_market()->items()->wp_plugins();
    foreach ($premium as $slug => $plugin) {
        $name = $plugin['name'];
        $author = $plugin['author'];
        $version = $plugin['version'];
        $description = $plugin['description'];
        $url = $plugin['url'];
        $author_url = $plugin['author_url'];
        $plugin['hasUpdate'] = false;
        // Setup the column CSS classes.
        $classes = array('envato-card', 'plugin');
        if ('active' === $group) {
            $classes[] = 'active';
        }
        // Setup the update action links.
        $updateActions = array();
        // Check for an update.
        if (isset($plugins[$slug]) && version_compare($plugins[$slug]['Version'], $plugin['version'], '<')) {
            $plugin['hasUpdate'] = true;
            $classes[] = 'update';
            $classes[] = 'envato-card-' . sanitize_key(dirname($slug));
            if (current_user_can('update_plugins')) {
                // Upgrade link.
                $upgrade_link = add_query_arg(array('action' => 'upgrade-plugin', 'plugin' => $slug), self_admin_url('update.php'));
                // Details link.
                $details_link = add_query_arg(array('action' => 'upgrade-plugin', 'tab' => 'plugin-information', 'plugin' => dirname($slug), 'section' => 'changelog', 'TB_iframe' => 'true', 'width' => 640, 'height' => 662), self_admin_url('plugin-install.php'));
                $updateActions['update'] = sprintf('<a class="update-now" href="%1$s" aria-label="%2$s" data-name="%3$s %6$s" data-plugin="%4$s" data-slug="%5$s" data-version="%6$s">%7$s</a>', wp_nonce_url($upgrade_link, 'upgrade-plugin_' . $slug), esc_attr__('Update %s now', 'envato-market'), esc_attr($name), esc_attr($slug), sanitize_key(dirname($slug)), esc_attr($version), esc_html__('Update Available', 'envato-market'));
                $updateActions['details'] = sprintf('<a href="%1$s" class="thickbox details" title="%2$s">%3$s</a>', esc_url($details_link), esc_attr($name), sprintf(__('View version %1$s details.', 'envato-market'), $version));
            }
        }
        // Setup the action links.
        $actions = array();
        if ('active' === $group) {
            // Deactivate link.
            $deactivate_link = add_query_arg(array('action' => 'deactivate', 'plugin' => $slug), self_admin_url('plugins.php'));
            $actions['deactivate'] = '
			<a href="' . wp_nonce_url($deactivate_link, 'deactivate-plugin_' . $slug) . '" class="button">
				<span aria-hidden="true">' . __('Deactivate', 'envato-market') . '</span>
				<span class="screen-reader-text">' . sprintf(__('Deactivate %s', 'envato-market'), $name) . '</span>
			</a>';
        } elseif ('installed' === $group) {
            if (!is_multisite() && current_user_can('delete_plugins')) {
                // Delete link.
                $delete_link = add_query_arg(array('action' => 'delete-selected', 'checked[]' => $slug), self_admin_url('plugins.php'));
                $actions['delete'] = '
				<a href="' . wp_nonce_url($delete_link, 'bulk-plugins') . '" class="button-delete">
					<span aria-hidden="true">' . __('Delete', 'envato-market') . '</span>
					<span class="screen-reader-text">' . sprintf(__('Delete %s', 'envato-market'), $name) . '</span>
				</a>';
            }
            if (!is_multisite() && current_user_can('activate_plugins')) {
                // Activate link.
                $activate_link = add_query_arg(array('action' => 'activate', 'plugin' => $slug), self_admin_url('plugins.php'));
                $actions['activate'] = '
				<a href="' . wp_nonce_url($activate_link, 'activate-plugin_' . $slug) . '" class="button">
					<span aria-hidden="true">' . __('Activate', 'envato-market') . '</span>
					<span class="screen-reader-text">' . sprintf(__('Activate %s', 'envato-market'), $name) . '</span>
				</a>';
            }
            // @codeCoverageIgnoreStart
            // Multisite needs special attention.
            if (is_multisite()) {
                if (current_user_can('manage_sites')) {
                    $actions['site_activate'] = '
					<a href="' . esc_url(admin_url(wp_nonce_url('plugins.php?action=activate&amp;plugin=' . urlencode($slug), 'activate-plugin_' . $slug))) . '" class="button">
						<span aria-hidden="true">' . __('Site Activate', 'envato-market') . '</span>
						<span class="screen-reader-text">' . sprintf(__('Site Activate %s', 'envato-market'), $name) . '</span>
					</a>';
                }
                if (current_user_can('manage_network_plugins')) {
                    $actions['network_activate'] = '
					<a href="' . esc_url(network_admin_url(wp_nonce_url('plugins.php?action=activate&amp;plugin=' . urlencode($slug), 'activate-plugin_' . $slug))) . '" class="button">
						<span aria-hidden="true">' . __('Network Activate', 'envato-market') . '</span>
						<span class="screen-reader-text">' . sprintf(__('Network Activate %s', 'envato-market'), $name) . '</span>
					</a>';
                }
            }
            // @codeCoverageIgnoreEnd
        } elseif ('install' === $group && current_user_can('install_plugins')) {
            // Install link.
            $install_link = add_query_arg(array('page' => envato_market()->get_slug(), 'action' => 'install-plugin', 'id' => $plugin['id']), self_admin_url('admin.php'));
            $actions['install'] = '
			<a href="' . wp_nonce_url($install_link, 'install-plugin_' . $plugin['id']) . '" class="button button-primary">
				<span aria-hidden="true">' . __('Install', 'envato-market') . '</span>
				<span class="screen-reader-text">' . sprintf(__('Install %s', 'envato-market'), $name) . '</span>
			</a>';
        }
        if (0 === strrpos(html_entity_decode($author), '<a ')) {
            $author_link = $author;
        } else {
            $author_link = '<a href="' . esc_url($author_url) . '">' . esc_html($author) . '</a>';
        }
        ?>
		<div class="col" data-id="<?php 
        echo esc_attr($plugin['id']);
        ?>
">
			<div class="<?php 
        echo esc_attr(implode(' ', $classes));
        ?>
">
				<div class="envato-card-top">
					<a href="<?php 
        echo esc_url($url);
        ?>
" class="column-icon">
						<img src="<?php 
        echo esc_url($plugin['thumbnail_url']);
        ?>
"/>
					</a>
					<div class="column-name">
						<h4>
							<a href="<?php 
        echo esc_url($url);
        ?>
"><?php 
        echo esc_html($name);
        ?>
</a>
							<span class="version" aria-label="<?php 
        esc_attr_e('Version %s', 'envato-market');
        ?>
"><?php 
        echo esc_html(sprintf(__('Version %s', 'envato-market'), isset($plugins[$slug]) ? $plugins[$slug]['Version'] : $version));
        ?>
</span>
						</h4>
					</div>
					<div class="column-description">
						<div class="description">
							<?php 
        echo wp_kses_post(wpautop($description));
        ?>
						</div>
						<p class="author">
							<cite><?php 
        esc_html_e('By', 'envato-market');
        ?>
 <?php 
        echo wp_kses_post($author_link);
        ?>
</cite>
						</p>
					</div>
					<?php 
        if (!empty($updateActions)) {
            ?>
					<div class="column-update">
						<?php 
            echo implode("\n", $updateActions);
            ?>
					</div>
					<?php 
        }
        ?>
				</div>
				<div class="envato-card-bottom">
					<div class="column-rating">
						<?php 
        wp_star_rating(array('rating' => $plugin['rating']['rating'] / 5 * 100, 'type' => 'percent', 'number' => $plugin['rating']['count']));
        ?>
						<span class="num-ratings">(<?php 
        echo esc_html(number_format_i18n($plugin['rating']['count']));
        ?>
)</span>
					</div>
					<div class="column-actions">
						<?php 
        echo implode("\n", $actions);
        ?>
					</div>
				</div>
			</div>
		</div>
	<?php 
    }
}
    /**
     * 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;
    }
Example #9
0
<div class="recipe-rating">
    <?php 
global $post;
$settings = get_option('maera_recipes');
?>

    <?php 
if (!function_exists('wp_star_rating')) {
    require_once ABSPATH . 'wp-admin/includes/template.php';
}
wp_star_rating(array('rating' => get_post_meta($post->ID, 'comment_rating-average-rating', true), 'type' => 'rating', 'number' => Maera_Recipes_Reviews::count_votes($post->ID)));
?>

</div>
Example #10
0
        /**
         * Display Plugin Information Card
         *
         * @since 1.0.0
         * @access public
         * @return array|string
         */
        function display_plugin_card($plugin, $registered = false)
        {
            ?>
				<div id="plugin-card-<?php 
            echo $plugin['id'];
            ?>
" class="plugin-card">
					<div class="plugin-card-top" plugin-id="<?php 
            echo $plugin['id'];
            ?>
">
						<a href="<?php 
            echo esc_url($plugin['url']);
            ?>
" class="plugin-icon" target="_blank">
							<img src="<?php 
            echo esc_attr($plugin['thumbnail']);
            ?>
" width="80" height="80" style="width:80px;height:80px;" /></a>
						<div class="name column-name" style="margin-left: 100px;">
							<h4><a href="<?php 
            echo esc_url($plugin['url']);
            ?>
" target="_blank"><?php 
            echo $plugin['item'];
            ?>
</a></h4>
							<?php 
            if ($registered) {
                ?>
							<p class="meta-links">
								<a href="http://codecanyon.net/downloads#item-<?php 
                echo $plugin['id'];
                ?>
" target="_blank">Rate Plugin</a> |
								<a href="http://bolderelements.net/support/" target="_blank">Get Support</a>
							</p>
							<?php 
            }
            ?>
						</div>
						<div class="action-links">
							<ul class="plugin-action-buttons">
								<?php 
            if ($registered) {
                ?>
								<li><a href="#" class="button remove">Remove Settings</a></li>
								<?php 
            } else {
                ?>
								<li><a href="#" class="button register">Add Purchase Code</a></li>
								<!-- <li><a href="<?php 
                echo esc_url($plugin['live_preview_url']);
                ?>
">Live Demo</a></li> -->
								<?php 
            }
            ?>
							</ul>
						</div>
						<div class="desc column-description"></div>
					</div>
					<div class="plugin-card-bottom">
						<div class="vers column-rating">
							<?php 
            wp_star_rating(array('rating' => $plugin['rating_decimal'], 'type' => 'rating', 'number' => 1));
            ?>
						</div>
						<div class="column-updated">
							<strong><?php 
            _e('Last Updated');
            ?>
:</strong> <span title="<?php 
            echo esc_attr($plugin['last_update']);
            ?>
">
								<?php 
            printf(__('%s ago'), human_time_diff(strtotime($plugin['last_update'])));
            ?>
							</span>
						</div>
						<div class="column-downloaded">
							<?php 
            echo sprintf(_n('%s Purchase', '%s Purchases', $plugin['sales']), number_format_i18n($plugin['sales']));
            ?>
						</div>
						<div class="column-compatibility">
							<strong>Price:</strong> $<?php 
            echo $plugin['cost'];
            ?>
 USD
						</div>
					</div>
				</div>
<?php 
        }
Example #11
0
?>
</strong> <span title="<?php 
echo esc_attr(date_i18n($date_format, $last_updated_timestamp));
?>
">
                    <?php 
printf(__('%s ago'), human_time_diff($last_updated_timestamp));
?>
                </span>
        </div>
        <?php 
if (isset($plugin['rating'])) {
    ?>
        <div class="vers column-rating">
            <?php 
    wp_star_rating(array('rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings']));
    ?>
            <span class="num-ratings">(<?php 
    echo number_format_i18n($plugin['num_ratings']);
    ?>
)</span>
        </div>
        <div class="column-downloaded">
            <?php 
    if ($plugin['active_installs'] >= 1000000) {
        $active_installs_text = _x('1+ Million', 'Active plugin installs');
    } else {
        $active_installs_text = number_format_i18n($plugin['active_installs']) . '+';
    }
    if ($plugin['downloaded'] >= 1000000) {
        $download_text = _x('1+ Million', 'Downloaded');
function learn_press_output_add_ons_list($add_ons, $tab = '')
{
    if (!is_array($add_ons) || sizeof($add_ons) == 0) {
        printf('<h3>%s</h3>', __('No add-ons found', 'learn_press'));
        return false;
    }
    echo '<ul class="learn-press-add-ons ' . $tab . '">';
    foreach ($add_ons as $file => $add_on) {
        $action_links = learn_press_get_add_on_action_link($add_on, $file);
        /*if ( is_plugin_active( $file ) ) {
        			$action_links[] = '<input data-state="enabled" type="checkbox" class="lpr-fancy-checkbox" checked="checked" data-plugin="' . $file . '" data-url="' . wp_nonce_url( "plugins.php?action=deactivate&plugin={$file}", 'deactivate-plugin_' . $file ) . '" />';
        		} else {
        			$action_links[] = '<input data-state="disabled" type="checkbox" class="lpr-fancy-checkbox" data-plugin="' . $file . '" data-url="' . wp_nonce_url( "plugins.php?action=activate&plugin={$file}", 'activate-plugin_' . $file ) . '" />';
        		}*/
        ?>
		<li class="plugin-card plugin-card-learnpress" id="learn-press-plugin-<?php 
        echo $add_on['slug'];
        ?>
">
			<div class="plugin-card-top">
				<a href="" class="thickbox plugin-icon"><img src="<?php 
        echo $add_on['icons']['2x'];
        ?>
"></a>

				<div class="name column-name">
					<h4><a href="" class="thickbox"><?php 
        echo $add_on['name'];
        ?>
</a></h4>
				</div>
				<div class="action-links">
					<?php 
        if ($action_links) {
            echo '<ul class="plugin-action-buttons"><li>' . implode('</li><li>', $action_links) . '</li></ul>';
        }
        ?>
				</div>
				<div class="desc column-description">
					<p><?php 
        echo $add_on['short_description'];
        ?>
</p>

					<p class="authors"><?php 
        printf(__('<cite>By %s</cite>', 'learn_press'), $add_on['author']);
        ?>
</p>
				</div>
			</div>
			<div class="plugin-card-bottom">
				<?php 
        if (array_key_exists('rating', $add_on)) {
            ?>
					<div class="vers column-rating">
						<?php 
            wp_star_rating(array('rating' => $add_on['rating'], 'type' => 'percent', 'number' => $add_on['num_ratings']));
            ?>
						<span class="num-ratings">(<?php 
            echo number_format_i18n($add_on['num_ratings']);
            ?>
)</span>
					</div>
				<?php 
        }
        ?>
				<?php 
        if (array_key_exists('last_updated', $add_on)) {
            ?>
					<?php 
            $date_format = 'M j, Y @ H:i';
            $last_updated_timestamp = strtotime($add_on['last_updated']);
            ?>
					<div class="column-updated">
						<strong><?php 
            _e('Last Updated:', 'learn_press');
            ?>
</strong> <span title="<?php 
            echo esc_attr(date_i18n($date_format, $last_updated_timestamp));
            ?>
">
						<?php 
            printf(__('%s ago', 'learn_press'), human_time_diff($last_updated_timestamp));
            ?>
					    </span>
					</div>
				<?php 
        }
        ?>
				<?php 
        if (array_key_exists('active_installs', $add_on)) {
            ?>
					<div class="column-downloaded">
						<?php 
            if ($add_on['active_installs'] >= 1000000) {
                $active_installs_text = _x('1+ Million', 'Active plugin installs');
            } else {
                $active_installs_text = number_format_i18n($add_on['active_installs']) . '+';
            }
            printf(__('%s Active Installs', 'learn_press'), $active_installs_text);
            ?>
					</div>
				<?php 
        }
        ?>

				<div class="column-compatibility">
					<?php 
        if (!empty($add_on['tested']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($add_on['tested'])), $add_on['tested'], '>')) {
            echo '<span class="compatibility-untested">' . __('Untested with your version of WordPress', 'learn_press') . '</span>';
        } elseif (!empty($plugin['requires']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($add_on['requires'])), $add_on['requires'], '<')) {
            echo '<span class="compatibility-incompatible">' . __('<strong>Incompatible</strong> with your version of WordPress', 'learn_press') . '</span>';
        } else {
            echo '<span class="compatibility-compatible">' . __('<strong>Compatible</strong> with your version of WordPress', 'learn_press') . '</span>';
        }
        ?>
				</div>
			</div>
		</li>
		<?php 
    }
    echo '</ul>';
}
Example #13
0
    /**
     * Outputs a given addon using custom markup.
     *
     * @uses apply_filters() Calls 'appthemes_addons_mp_markup_<screen_id>'
     * @uses do_action()	 Calls 'appthemes_addons_mp_addon_after'
     *
     * @param object The addon object to output.
     */
    public function single_row($addon)
    {
        ob_start();
        ?>
		<div class="plugin-card">
			<div class="plugin-card-top">
				<a href="<?php 
        echo esc_url($addon->link);
        ?>
" target="_new" class="thickbox plugin-icon"><?php 
        echo $addon->image;
        ?>
</a>
				<div class="name-top">
					<div class="name column-name">
						<h4><?php 
        echo $addon->title;
        ?>
</h4>
					</div>
					<div class="action-links price-meta">
						<ul class="plugin-action-buttons price">
							<li><?php 
        echo $addon->price;
        ?>
</li>
						</ul>
					</div>
				</div>
				<div class="desc column-description">
					<p><?php 
        echo $addon->description;
        ?>
</p>
					<p class="authors">
						<cite><?php 
        echo sprintf(__('By %1$s', APP_TD), $addon->author_link);
        ?>
 </cite>
					</p>
				</div>
			</div>
			<div class="plugin-card-bottom">
				<div class="vers column-rating">
					<?php 
        wp_star_rating(array('rating' => (double) $addon->rating, 'number' => $addon->votes));
        ?>
					<span class="num-ratings">(<?php 
        echo number_format_i18n($addon->votes);
        ?>
)</span>
				</div>
				<div class="column-updated">
					<strong><?php 
        echo __('Last Updated:', APP_TD);
        ?>
</strong>
					<span title="<?php 
        echo esc_attr($addon->last_updated);
        ?>
"><?php 
        echo sprintf(__('%1$s ago', APP_TD), $addon->last_updated_h);
        ?>
</span>
				</div>
				<div class="column-category">
					<strong><?php 
        echo __('Category:', APP_TD);
        ?>
</strong> <span title="<?php 
        echo esc_attr($addon->category_desc);
        ?>
"><?php 
        echo $addon->category_desc;
        ?>
</span>
				</div>
				<div class="column-requirements">
					<strong><?php 
        echo __('Requirements:', APP_TD);
        ?>
</strong> <span title="<?php 
        echo esc_attr($addon->requirements);
        ?>
"><?php 
        echo $addon->requirements;
        ?>
</span>
				</div>
			</div>
			<?php 
        /**
         * Fires after the all the content for each plugin is displayed.
         *
         * Recommended for addons marketing campaigns: discounts codes, etc.
         */
        do_action('appthemes_addons_mp_addon_after', $addon);
        ?>
		</div>
<?php 
        $output = ob_get_clean();
        echo apply_filters("appthemes_addons_mp_markup_{$this->screen->id}", $output, $addon);
    }
Example #14
0
function hocwp_star_rating_result($args = array())
{
    if (!function_exists('wp_star_rating')) {
        require_once ABSPATH . 'wp-admin/includes/template.php';
    }
    $votes = 0;
    if (!isset($args['rating'])) {
        $id = hocwp_get_value_by_key($args, 'post_id', get_the_ID());
        $score = get_post_meta($id, '_kksr_ratings', true);
        if (!hocwp_is_positive_number($score)) {
            $score = 0;
        }
        if (!isset($args['number'])) {
            $votes = get_post_meta($id, '_kksr_casts', true);
            if (!hocwp_is_positive_number($votes)) {
                $votes = 0;
            }
        }
        $args['number'] = $votes;
        if ($votes != 0) {
            $avg = (double) ($score / $votes);
            $score = $score ? round($avg, 2) : 0;
        }
        $args['rating'] = $score;
    }
    $hide_empty = hocwp_get_value_by_key($args, 'hide_empty');
    if ($hide_empty) {
        $rating = $args['rating'];
        if (!hocwp_is_positive_number($rating)) {
            return;
        }
    }
    $before = hocwp_get_value_by_key($args, 'before');
    echo $before;
    wp_star_rating($args);
    $show_count = hocwp_get_value_by_key($args, 'show_count', true);
    $number = hocwp_get_value_by_key($args, 'number');
    $number = absint($number);
    if ($show_count) {
        echo '<span aria-hidden="true" class="num-ratings">(' . $number . ')</span>';
    }
    $after = hocwp_get_value_by_key($args, 'after');
    echo $after;
}
Example #15
0
function learn_press_output_add_ons_list($add_ons, $tab = '')
{
    if (!is_array($add_ons)) {
        return false;
    }
    echo '<ul class="learn-press-add-ons ' . $tab . '">';
    foreach ($add_ons as $file => $add_on) {
        if (!empty($add_on['options']['tag']) && 'required' === $add_on['options']['tag']) {
            continue;
        }
        $action_links = array();
        if (is_plugin_active($file)) {
            $action_links[] = '<input data-state="enabled" type="checkbox" class="lpr-fancy-checkbox" checked="checked" data-plugin="' . $file . '" data-url="' . wp_nonce_url("plugins.php?action=deactivate&plugin={$file}", 'deactivate-plugin_' . $file) . '" />';
        } else {
            $action_links[] = '<input data-state="disabled" type="checkbox" class="lpr-fancy-checkbox" data-plugin="' . $file . '" data-url="' . wp_nonce_url("plugins.php?action=activate&plugin={$file}", 'activate-plugin_' . $file) . '" />';
        }
        $date_format = 'M j, Y @ H:i';
        $last_updated_timestamp = strtotime($add_on['last_updated']);
        ?>
        <li class="plugin-card plugin-card-learnpress">
			<div class="plugin-card-top">
				<a href="" class="thickbox plugin-icon"><img src="<?php 
        echo $add_on['Icons']['2x'];
        ?>
"></a>
				<div class="name column-name">
					<h4><a href="" class="thickbox"><?php 
        echo $add_on['Name'];
        ?>
</a></h4>
				</div>
				<div class="action-links">
					<?php 
        if ($action_links) {
            echo '<ul class="plugin-action-buttons"><li>' . implode('</li><li>', $action_links) . '</li></ul>';
        }
        ?>
                </div>
				<div class="desc column-description">
					<p><?php 
        echo $add_on['Description'];
        ?>
</p>
					<p class="authors"><?php 
        printf(__('<cite>By <a href="%s">%s</a></cite>', 'learn_press'), $add_on['AuthorURI'], $add_on['Author']);
        ?>
</p>
				</div>
			</div>
			<div class="plugin-card-bottom">
				<div class="vers column-rating">
                        <?php 
        wp_star_rating(array('rating' => $add_on['rating'], 'type' => 'percent', 'number' => $add_on['num_ratings']));
        ?>
                        <span class="num-ratings">(<?php 
        echo number_format_i18n($add_on['num_ratings']);
        ?>
)</span>
                    </div>
                    <div class="column-updated">
                        <strong><?php 
        _e('Last Updated:', 'learn_press');
        ?>
</strong> <span title="<?php 
        echo esc_attr(date_i18n($date_format, $last_updated_timestamp));
        ?>
">
						<?php 
        printf(__('%s ago', 'learn_press'), human_time_diff($last_updated_timestamp));
        ?>
					    </span>
                    </div>
                    <div class="column-downloaded">
                        <?php 
        if ($add_on['active_installs'] >= 1000000) {
            $active_installs_text = _x('1+ Million', 'Active plugin installs');
        } else {
            $active_installs_text = number_format_i18n($add_on['active_installs']) . '+';
        }
        printf(__('%s Active Installs', 'learn_press'), $active_installs_text);
        ?>
                    </div>
                    <div class="column-compatibility">
                        <?php 
        if (!empty($add_on['tested']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($add_on['tested'])), $add_on['tested'], '>')) {
            echo '<span class="compatibility-untested">' . __('Untested with your version of WordPress', 'learn_press') . '</span>';
        } elseif (!empty($plugin['requires']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($add_on['requires'])), $add_on['requires'], '<')) {
            echo '<span class="compatibility-incompatible">' . __('<strong>Incompatible</strong> with your version of WordPress', 'learn_press') . '</span>';
        } else {
            echo '<span class="compatibility-compatible">' . __('<strong>Compatible</strong> with your version of WordPress', 'learn_press') . '</span>';
        }
        ?>
                    </div>
			</div>
        </li>

        <?php 
        continue;
        ?>
        <li>
            <div class="add-on-inner">
                <div class="add-on-thumbnail">
                    <?php 
        if (!empty($add_on['preview'])) {
            ?>
                        <img src="<?php 
            echo $add_on['preview'];
            ?>
">
                    <?php 
        } else {
            ?>
                        <img src="<?php 
            echo admin_url('admin-ajax.php?action=learnpress_dummy_image');
            ?>
&text=<?php 
            echo $add_on['name'];
            ?>
&color=777777&width=400&height=250&padding=40">
                    <?php 
        }
        ?>
                    <div class="add-on-overlay"></div>
                    <p class="add-on-description"><?php 
        echo $add_on['description'];
        ?>
</p>
                </div>
                <div class="add-on-info">
                    <h3> <?php 
        echo $add_on['name'];
        echo $is_core ? '<span>' . __('Core', 'learn_press') . '</span>' : '';
        ?>
</h3>
                    <p class="add-on-actions">
                    <?php 
        if (learn_press_is_addon_enabled($add_on['slug'])) {
            ?>
                        <?php 
            $url = $is_core ? wp_nonce_url(get_site_url() . '/wp-admin/admin.php?page=learn_press_add_ons&learn-press-disable-addon=' . $add_on['slug'] . '&tab=' . $tab, 'learn-press-disable-add-on') : admin_url() . 'plugins.php';
            ?>
                        <input data-state="enabled" type="checkbox" class="lpr-fancy-checkbox" name="<?php 
            echo $add_on['slug'];
            ?>
" checked="checked" data-url="<?php 
            echo $url;
            ?>
" data-iscore="<?php 
            echo $is_core ? 1 : 0;
            ?>
">
                    <?php 
        } else {
            ?>
                        <input data-state="disabled" type="checkbox" class="lpr-fancy-checkbox" name="<?php 
            echo $add_on['slug'];
            ?>
" data-url="<?php 
            echo wp_nonce_url(get_site_url() . '/wp-admin/admin.php?page=learn_press_add_ons&learn-press-enable-addon=' . $add_on['slug'] . '&tab=' . $tab, 'learn-press-enable-add-on');
            ?>
"  data-iscore="<?php 
            echo $is_core ? 1 : 0;
            ?>
">
                    <?php 
        }
        ?>
                    <span class="add-on-state dashicons dashicons-yes"></span>
                    <?php 
        if (!empty($add_on['options']['settings-callback']) && is_callable($add_on['options']['settings-callback'])) {
            ?>
                       <a href="<?php 
            echo admin_url('admin.php?page=learn_press_add_ons&add-on-settings=' . $add_on['slug']);
            ?>
" class="add-on-settings"><?php 
            _e('Settings', 'learn_press');
            ?>
</a>
                    <?php 
        }
        ?>
                    </p>
                </div>
            </div>
        </li>
    <?php 
    }
    echo '</ul>';
}
/**
 * Display plugin information in dialog box form.
 *
 * @since 2.7.0
 */
function install_plugin_information()
{
    global $tab;
    $api = plugins_api('plugin_information', array('slug' => wp_unslash($_REQUEST['plugin']), 'is_ssl' => is_ssl()));
    if (is_wp_error($api)) {
        wp_die($api);
    }
    $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => 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'), '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);
        }
    }
    $_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'));
    echo "<div id='{$_tab}-title'>{$api->name}</div>";
    echo "<div id='{$_tab}-tabs'>\n";
    foreach ((array) $api->sections as $section_name => $content) {
        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">
	<div class="fyi">
		<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 $api->homepage;
        ?>
"><?php 
        _e('Plugin Homepage &#187;');
        ?>
</a></li>
<?php 
    }
    ?>
		</ul>
		<?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 
    }
    ?>
	</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="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> 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="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.') . '</p></div>';
        }
    }
    foreach ((array) $api->sections as $section_name => $content) {
        if (isset($plugins_section_titles[$section_name])) {
            $title = $plugins_section_titles[$section_name];
        } else {
            $title = ucwords(str_replace('_', ' ', $section_name));
        }
        $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';
        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 id='{$tab}-footer'>\n";
    if (!empty($api->download_link) && (current_user_can('install_plugins') || current_user_can('update_plugins'))) {
        $status = install_plugin_install_status($api);
        switch ($status['status']) {
            case 'install':
                if ($status['url']) {
                    echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Now') . '</a>';
                }
                break;
            case 'update_available':
                if ($status['url']) {
                    echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') . '</a>';
                }
                break;
            case 'newer_installed':
                echo '<a class="button button-primary right disabled">' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>';
                break;
            case 'latest_installed':
                echo '<a class="button button-primary right disabled">' . __('Latest Version Installed') . '</a>';
                break;
        }
    }
    echo "</div>\n";
    iframe_footer();
    exit;
}
Example #17
0
    public static function renderFound($api)
    {
        ?>
    <table class="wp-list-table widefat plugin-install" cellspacing="0">
        <thead>
        <tr>
            <th scope="col" id="name" class="manage-column column-name" style=""><?php 
        _e('Name', 'mainwp');
        ?>
</th>
            <th scope="col" id="version" class="manage-column column-version" style=""><?php 
        _e('Version', 'mainwp');
        ?>
</th>
            <th scope="col" id="rating" class="manage-column column-rating" style=""><?php 
        _e('Rating', 'mainwp');
        ?>
</th>
            <th scope="col" id="description" class="manage-column column-description" style=""><?php 
        _e('Description', 'mainwp');
        ?>
</th>
        </tr>
        </thead>
        <tfoot>
        <tr>
            <th scope="col" class="manage-column column-name" style=""><?php 
        _e('Name', 'mainwp');
        ?>
</th>
            <th scope="col" class="manage-column column-version" style=""><?php 
        _e('Version', 'mainwp');
        ?>
</th>
            <th scope="col" class="manage-column column-rating" style=""><?php 
        _e('Rating', 'mainwp');
        ?>
</th>
            <th scope="col" class="manage-column column-description" style=""><?php 
        _e('Description', 'mainwp');
        ?>
</th>
        </tr>
        </tfoot>
        <tbody id="the-list">
            <?php 
        if (!isset($api) || !isset($api->info['results']) || $api->info['results'] == 0) {
            ?>
            <tr class="no-items">
                <td class="colspanchange" colspan="4"><?php 
            _e('No plugins match your request.', 'mainwp');
            ?>
</td>
            </tr>
                <?php 
        } else {
            foreach ($api->plugins as $plugin) {
                $author = $plugin->author;
                if (!empty($author)) {
                    $author = ' ' . sprintf(__('By %s'), $author) . '.';
                }
                //Limit description to 400char, and remove any HTML.
                $description = strip_tags($plugin->description);
                if (strlen($description) > 400) {
                    $description = mb_substr($description, 0, 400) . '&#8230;';
                }
                //remove any trailing entities
                $description = preg_replace('/&[^;\\s]{0,6}$/', '', $description);
                //strip leading/trailing & multiple consecutive lines
                $description = trim($description);
                $description = preg_replace("|(\r?\n)+|", "\n", $description);
                //\n => <br>
                $description = nl2br($description);
                ?>
                <tr>
                    <td class="name column-name"><strong><?php 
                echo $plugin->name;
                ?>
</strong>

                        <div class="action-links"><a
                                href="<?php 
                echo admin_url() . 'plugin-install.php?tab=plugin-information&plugin=' . $plugin->slug . '&TB_iframe=true&width=640&height=477';
                ?>
" target="_blank"
                                class="thickbox" title="More information about <?php 
                echo $plugin->name;
                ?>
"><?php 
                _e('Details', 'mainwp');
                ?>
</a> |
                            <a class="install-now" href="#" id="install-plugin-<?php 
                echo $plugin->slug;
                ?>
"
                               title="Install <?php 
                echo $plugin->name;
                ?>
  <?php 
                echo $plugin->version;
                ?>
"><?php 
                _e('Install Now', 'mainwp');
                ?>
</a>
                            <?php 
                do_action('mainwp_installplugins_extra_links', $plugin);
                ?>
                        </div>
                    </td>
                    <td class="vers column-version"><?php 
                echo $plugin->version;
                ?>
</td>
                    <td class="vers column-rating">
                        <?php 
                if (function_exists('wp_star_rating')) {
                    wp_star_rating(array('rating' => esc_attr($plugin->rating), 'type' => 'percent', 'number' => $plugin->num_ratings));
                } else {
                    ?>

                        <div class="legacy-star-holder star-holder" title="(based on <?php 
                    echo $plugin->num_ratings;
                    ?>
 rating<?php 
                    if ($plugin->num_ratings > 1) {
                        echo 's';
                    }
                    ?>
)">
                            <div class="legacy-star legacy-star-rating star star-rating"
                                 style="width: <?php 
                    echo esc_attr($plugin->rating);
                    ?>
px"></div>
                        </div>
                        <?php 
                }
                ?>
                    </td>
                    <td class="desc column-description"><?php 
                echo $description, $author;
                ?>
</td>
                </tr>
                    <?php 
            }
        }
        ?>
        </tbody>
    </table>
    <?php 
        die;
    }
/**
 * Display plugin information in dialog box form.
 *
 * @since 2.7.0
 */
function fs_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));
    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) {
            ?>
					<h3 data-plan="<?php 
            echo $plan->id;
            ?>
"><?php 
            printf(__fs('x-plan', $api->slug), $plan->title);
            ?>
</h3>
					<ul>
						<?php 
            $billing_cycle = 'annual';
            ?>
						<?php 
            if (1 === count($plan->pricing) && 1 == $plan->pricing[0]->licenses) {
                ?>
							<?php 
                $pricing = $plan->pricing[0];
                ?>
							<li><label><?php 
                _efs('price', $api->slug);
                ?>
: $<?php 
                if (isset($pricing->annual_price)) {
                    echo $pricing->annual_price . ($plan->is_block_features ? ' / year' : '');
                    $billing_cycle = 'annual';
                } else {
                    if (isset($pricing->monthly_price)) {
                        echo $pricing->monthly_price . ' / mo';
                        $billing_cycle = 'monthly';
                    } else {
                        if (isset($pricing->lifetime_price)) {
                            echo $pricing->lifetime_price;
                            $billing_cycle = 'lifetime';
                        }
                    }
                }
                ?>
</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 
                    if (isset($pricing->annual_price)) {
                        echo $pricing->annual_price . ($plan->is_block_features ? ' / year' : '');
                        $billing_cycle = 'annual';
                    } else {
                        if (isset($pricing->monthly_price)) {
                            echo $pricing->monthly_price . ' / mo';
                            $billing_cycle = 'monthly';
                        } else {
                            if (isset($pricing->lifetime_price)) {
                                echo $pricing->lifetime_price;
                                $billing_cycle = 'lifetime';
                            }
                        }
                    }
                    ?>
</label></li>
								<?php 
                    $first = false;
                }
                ?>
						<?php 
            }
            ?>
					</ul>
					<?php 
            echo ' <a class="button button-primary right" href="' . esc_url(add_query_arg(array('plugin_id' => $plan->plugin_id, 'plan_id' => $plan->id, 'pricing_id' => $plan->pricing[0]->id, 'billing_cycle' => $billing_cycle), $api->checkout_link)) . '" target="_parent">' . __fs('purchase', $api->slug) . '</a>';
            ?>
				</div>
			<?php 
        }
        ?>
			<?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 
    }
    ?>
			<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';
        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";
    if (current_user_can('install_plugins') || current_user_can('update_plugins')) {
        if (!empty($api->checkout_link) && isset($api->plans) && 0 < is_array($api->plans)) {
            echo ' <a class="button button-primary right" href="' . esc_url(add_query_arg(array('plugin_id' => $plan->plugin_id, 'plan_id' => $plan->id, 'pricing_id' => $plan->pricing[0]->id, 'billing_cycle' => $billing_cycle), $api->checkout_link)) . '" target="_parent">' . __fs('purchase', $api->slug) . '</a>';
            // @todo Add Cart concept.
            //			echo ' <a class="button right" href="' . $status['url'] . '" target="_parent">' . __( 'Add to Cart' ) . '</a>';
        } else {
            if (!empty($api->download_link)) {
                $status = install_plugin_install_status($api);
                switch ($status['status']) {
                    case 'install':
                        if ($status['url']) {
                            echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Now') . '</a>';
                        }
                        break;
                    case 'update_available':
                        if ($status['url']) {
                            echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') . '</a>';
                        }
                        break;
                    case 'newer_installed':
                        echo '<a class="button button-primary right disabled">' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>';
                        break;
                    case 'latest_installed':
                        echo '<a class="button button-primary right disabled">' . __('Latest Version Installed') . '</a>';
                        break;
                }
            }
        }
    }
    echo "</div>\n";
    iframe_footer();
    exit;
}
    function display_rows()
    {
        $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array());
        list($columns, $hidden) = $this->get_column_info();
        $style = array();
        foreach ($columns as $column_name => $column_display_name) {
            $style[$column_name] = in_array($column_name, $hidden) ? 'style="display:none;"' : '';
        }
        foreach ((array) $this->items as $plugin) {
            if (is_object($plugin)) {
                $plugin = (array) $plugin;
            }
            $title = wp_kses($plugin['name'], $plugins_allowedtags);
            //Limit description to 400char, and remove any HTML.
            $description = strip_tags($plugin['description']);
            if (strlen($description) > 400) {
                $description = mb_substr($description, 0, 400) . '&#8230;';
            }
            //remove any trailing entities
            $description = preg_replace('/&[^;\\s]{0,6}$/', '', $description);
            //strip leading/trailing & multiple consecutive lines
            $description = trim($description);
            $description = preg_replace("|(\r?\n)+|", "\n", $description);
            //\n => <br>
            $description = nl2br($description);
            $version = wp_kses($plugin['version'], $plugins_allowedtags);
            $name = strip_tags($title . ' ' . $version);
            $author = $plugin['author'];
            if (!empty($plugin['author'])) {
                $author = ' <cite>' . sprintf(__('By %s'), $author) . '.</cite>';
            }
            $author = wp_kses($author, $plugins_allowedtags);
            $action_links = array();
            $action_links[] = '<a href="' . self_admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] . '&amp;TB_iframe=true&amp;width=600&amp;height=550') . '" class="thickbox" title="' . esc_attr(sprintf(__('More information about %s'), $name)) . '">' . __('Details') . '</a>';
            if (current_user_can('install_plugins') || current_user_can('update_plugins')) {
                $status = install_plugin_install_status($plugin);
                switch ($status['status']) {
                    case 'install':
                        if ($status['url']) {
                            $action_links[] = '<a class="install-now" href="' . $status['url'] . '" title="' . esc_attr(sprintf(__('Install %s'), $name)) . '">' . __('Install Now') . '</a>';
                        }
                        break;
                    case 'update_available':
                        if ($status['url']) {
                            $action_links[] = '<a href="' . $status['url'] . '" title="' . esc_attr(sprintf(__('Update to version %s'), $status['version'])) . '">' . __('Update Now') . '</a>';
                        }
                        break;
                    case 'latest_installed':
                    case 'newer_installed':
                        $action_links[] = '<span title="' . esc_attr__('This plugin is already installed and is up to date') . ' ">' . _x('Installed', 'plugin') . '</span>';
                        break;
                }
            }
            /**
             * Filter the install action links for a plugin.
             *
             * @since 2.7.0
             *
             * @param array $action_links An array of plugin action hyperlinks. Defaults are links to Details and Install Now.
             * @param array $plugin       The plugin currently being listed.
             */
            $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin);
            ?>
		<tr>
			<td class="name column-name"<?php 
            echo $style['name'];
            ?>
><strong><?php 
            echo $title;
            ?>
</strong>
				<div class="action-links"><?php 
            if (!empty($action_links)) {
                echo implode(' | ', $action_links);
            }
            ?>
</div>
			</td>
			<td class="vers column-version"<?php 
            echo $style['version'];
            ?>
><?php 
            echo $version;
            ?>
</td>
			<td class="vers column-rating"<?php 
            echo $style['rating'];
            ?>
>
				<?php 
            wp_star_rating(array('rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings']));
            ?>
			</td>
			<td class="desc column-description"<?php 
            echo $style['description'];
            ?>
><?php 
            echo $description, $author;
            ?>
</td>
		</tr>
		<?php 
        }
    }
esc_html_e('Wordpress.org Plugin Page', 'the-events-calendar');
?>
</a>
		</p>
	</div>


	<?php 
if (isset($rating) && isset($num_rating)) {
    ?>
		<h3><?php 
    esc_html_e('Average Rating', 'the-events-calendar');
    ?>
</h3>
		<?php 
    wp_star_rating(array('rating' => $rating, 'type' => 'percent', 'number' => $num_rating));
    ?>
		<?php 
    printf(_n('Based on %d rating', 'Based on %d ratings', $num_rating, 'the-events-calendar'), $num_rating);
    ?>
		<p>
			<?php 
    /**
     * Filter the URL to The Events Calendar plugin page on Wordpress.org
     *
     * @param string $url
     */
    $tribe_help_tab_wp_plugin_url = apply_filters('tribe_help_tab_wp_plugin_url', 'http://wordpress.org/support/view/plugin-reviews/the-events-calendar?filter=5');
    ?>
			<a href="<?php 
    echo esc_url($tribe_help_tab_wp_plugin_url);
Example #21
0
function ewic_free_plugin_page()
{
    include ABSPATH . "wp-admin/includes/plugin-install.php";
    global $tabs, $tab, $paged, $type, $term;
    $tabs = array();
    $tab = "search";
    $per_page = 30;
    $args = array("author" => "GhozyLab", "page" => $paged, "per_page" => $per_page, "fields" => array("last_updated" => true, "downloaded" => true, "icons" => true), "locale" => get_locale());
    $args = apply_filters("install_plugins_table_api_args_{$tab}", $args);
    $api = plugins_api("query_plugins", $args);
    $item = $api->plugins;
    $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => 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(), 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'img' => array('src' => array(), 'class' => array(), 'alt' => array()));
    ?>
	<form id="plugin-filter">
    
<div class="wrap">
	<style>
	.ewic-plugin-action-buttons {
		text-align:right;
		}
	.ewic-plugin-action-buttons li {
		display: inline-block;
		margin-left: 1em;
		}
		
	.ewic-button-con {
		padding-right: 15px;
		}
		
.ewic-button-install {
background: none repeat scroll 0% 0% #2EA2CC !important;
border-color: #0074A2 !important;
box-shadow: 0px 1px 0px rgba(120, 200, 230, 0.5) inset, 0px 1px 0px rgba(0, 0, 0, 0.15) !important;
color: #FFF !important;
}

.ewic-button-install:focus {
    box-shadow: 0px 0px 0px 1px #5B9DD9, 0px 0px 2px 1px rgba(30, 140, 190, 0.8) !important;
}
	
.ewic-button-install:hover {
    color: #FFF !important;
	background: none repeat scroll 0% 0% #5B9DD9 !important;
}	

.ewic-button-update {
background: none repeat scroll 0% 0% #E74F34 !important;
border-color: #C52F2F !important;
box-shadow: 0px 1px 0px rgba(255, 235, 235, 0.5) inset, 0px 1px 0px rgba(0, 0, 0, 0.15) !important;
color: #FFF !important;
}

.ewic-button-update:focus {
    box-shadow: 0px 0px 0px 1px #DA3232, 0px 0px 2px 1px rgba(255, 140, 140, 0.8) !important;
}
	
.ewic-button-update:hover {
    color: #FFF !important;
	background: none repeat scroll 0% 0% #DA3232 !important;
}	

		
        </style>

<div style="margin-top:30px;" class="wp-list-table widefat plugin-install">
	<div id="the-list">
    
		<?php 
    foreach ((array) $item as $plugin) {
        if (is_object($plugin)) {
            $plugin = (array) $plugin;
        }
        $title = wp_kses($plugin['name'], $plugins_allowedtags);
        // Remove any HTML from the description.
        $description = strip_tags($plugin['short_description']);
        $version = wp_kses($plugin['version'], $plugins_allowedtags);
        $name = strip_tags($title . ' ' . $version);
        $author = wp_kses($plugin['author'], $plugins_allowedtags);
        if (!empty($author)) {
            $author = ' <cite>' . sprintf(__('By %s'), $author) . '</cite>';
        }
        $action_links = array();
        if (current_user_can('install_plugins') || current_user_can('update_plugins')) {
            $status = install_plugin_install_status($plugin);
            switch ($status['status']) {
                case 'install':
                    if ($status['url']) {
                        /* translators: 1: Plugin name and version. */
                        $action_links[] = '<a class="install-now button-secondary ewic-button-install" href="' . $status['url'] . '" aria-label="' . esc_attr(sprintf(__('Install %s now'), $name)) . '">' . __('Install Now') . '</a>';
                    }
                    break;
                case 'update_available':
                    if ($status['url']) {
                        /* translators: 1: Plugin name and version */
                        $action_links[] = '<a class="button ewic-button-update" href="' . $status['url'] . '" aria-label="' . esc_attr(sprintf(__('Update %s now'), $name)) . '">' . __('Update Now') . '</a>';
                    }
                    break;
                case 'latest_installed':
                case 'newer_installed':
                    $action_links[] = '<span class="button button-disabled" title="' . esc_attr__('This plugin is already installed and is up to date') . ' ">' . _x('Installed', 'plugin') . '</span>';
                    break;
            }
        }
        $details_link = self_admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] . '&amp;TB_iframe=true&amp;width=600&amp;height=550');
        /* translators: 1: Plugin name and version. */
        $action_links[] = '<a href="' . esc_url($details_link) . '" class="thickbox" aria-label="' . esc_attr(sprintf(__('More information about %s'), $name)) . '" data-title="' . esc_attr($name) . '">' . __('More Details') . '</a>';
        if (!empty($plugin['icons']['svg'])) {
            $plugin_icon_url = $plugin['icons']['svg'];
        } elseif (!empty($plugin['icons']['2x'])) {
            $plugin_icon_url = $plugin['icons']['2x'];
        } elseif (!empty($plugin['icons']['1x'])) {
            $plugin_icon_url = $plugin['icons']['1x'];
        } else {
            $plugin_icon_url = $plugin['icons']['default'];
        }
        /**
         * Filter the install action links for a plugin.
         *
         * @since 2.7.0
         *
         * @param array $action_links An array of plugin action hyperlinks. Defaults are links to Details and Install Now.
         * @param array $plugin       The plugin currently being listed.
         */
        $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin);
        ?>
		<div class="plugin-card">
			<div class="plugin-card-top" style="min-height: 160px !important;">
				<a href="<?php 
        echo esc_url($details_link);
        ?>
" class="thickbox plugin-icon"><img src="<?php 
        echo esc_attr($plugin_icon_url);
        ?>
" /></a>
				<div class="name column-name" style="margin-right: 20px !important;">
					<h4><a href="<?php 
        echo esc_url($details_link);
        ?>
" class="thickbox"><?php 
        echo $title;
        ?>
</a></h4>
				</div>
				<div class="desc column-description" style="margin-right: 20px !important;">
					<p><?php 
        echo $description;
        ?>
</p>
					<p class="authors"><?php 
        echo $author;
        ?>
</p>			
				</div>
			</div>
					<div class="ewic-button-con">
					<?php 
        if ($action_links) {
            echo '<ul class="ewic-plugin-action-buttons">';
            echo '<li>' . $action_links[0] . '</li>';
            switch ($plugin["slug"]) {
                case "easy-media-gallery":
                    echo '<li><a class="button" aria-label="PRO VERSION DEMO" href="http://ghozylab.com/plugins/easy-media-gallery-pro/demo/" target="_blank">PRO VERSION DEMO</a></li>';
                    break;
                case "image-slider-widget":
                    echo '<li><a class="button" aria-label="PRO VERSION DEMO" href="http://demo.ghozylab.com/plugins/easy-image-slider-plugin/image-slider-with-thumbnails-at-the-bottom/" target="_blank">PRO VERSION DEMO</a></li>';
                    break;
                case "easy-notify-lite":
                    echo '<li><a class="button" aria-label="PRO VERSION DEMO" href="http://ghozylab.com/plugins/easy-notify-pro/demo/" target="_blank">PRO VERSION DEMO</a></li>';
                    break;
                case "contact-form-lite":
                    echo '<li><a class="button" aria-label="PRO VERSION DEMO" href="http://demo.ghozylab.com/plugins/easy-contact-form-plugin/contact-form-recaptcha/" target="_blank">PRO VERSION DEMO</a></li>';
                    break;
                default:
                    break;
            }
            echo '</ul>';
        }
        ?>
				</div>
			<div class="plugin-card-bottom">
				<div class="vers column-rating">
					<?php 
        wp_star_rating(array('rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings']));
        ?>
					<span class="num-ratings">(<?php 
        echo number_format_i18n($plugin['num_ratings']);
        ?>
)</span>
				</div>
				<div class="column-updated">
					<strong><?php 
        _e('Last Updated:');
        ?>
</strong> <span title="<?php 
        echo esc_attr($plugin['last_updated']);
        ?>
">
						<?php 
        printf(__('%s ago'), human_time_diff(strtotime($plugin['last_updated'])));
        ?>
					</span>
				</div>
				<div class="column-downloaded">
					<?php 
        echo sprintf(_n('%s download', '%s downloads', $plugin['downloaded']), number_format_i18n($plugin['downloaded']));
        ?>
				</div>
				<div class="column-compatibility">
					<?php 
        if (!empty($plugin['tested']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['tested'])), $plugin['tested'], '>')) {
            echo '<span class="compatibility-untested">' . __('Untested with your version of WordPress') . '</span>';
        } elseif (!empty($plugin['requires']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['requires'])), $plugin['requires'], '<')) {
            echo '<span class="compatibility-incompatible">' . __('<strong>Incompatible</strong> with your version of WordPress') . '</span>';
        } else {
            echo '<span class="compatibility-compatible">' . __('<strong>Compatible</strong> with your version of WordPress') . '</span>';
        }
        ?>
				</div>
			</div>
		</div>
		<?php 
    }
    ?>

     	</div>	
	</div>       
</div>    
	</form>   
    

<?php 
}
Example #22
0
function hocwp_loop_plugin_card($plugin, $allow_tags = array(), $base_name = '')
{
    $is_local = false;
    if (is_object($plugin)) {
        $plugin = (array) $plugin;
    }
    $title = wp_kses(hocwp_get_value_by_key($plugin, 'name'), $allow_tags);
    if (empty($title)) {
        $is_local = true;
    }
    $description = strip_tags(hocwp_get_value_by_key($plugin, 'short_description'));
    $version = wp_kses(hocwp_get_value_by_key($plugin, 'version'), $allow_tags);
    $name = strip_tags($title . ' ' . $version);
    $author = wp_kses(hocwp_get_value_by_key($plugin, 'author'), $allow_tags);
    if (!empty($author)) {
        $author = ' <cite>' . sprintf(__('By %s'), $author) . '</cite>';
    }
    $action_links = array();
    if (!$is_local && (current_user_can('install_plugins') || current_user_can('update_plugins'))) {
        $status = hocwp_plugin_install_status($plugin);
        switch ($status['status']) {
            case 'install':
                if ($status['url']) {
                    $action_links[] = '<a class="install-now button" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url($status['url']) . '" aria-label="' . esc_attr(sprintf(__('Install %s now'), $name)) . '" data-name="' . esc_attr($name) . '">' . __('Install Now') . '</a>';
                }
                break;
            case 'update_available':
                if ($status['url']) {
                    $action_links[] = '<a class="update-now button" data-plugin="' . esc_attr($status['file']) . '" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url($status['url']) . '" aria-label="' . esc_attr(sprintf(__('Update %s now'), $name)) . '" data-name="' . esc_attr($name) . '">' . __('Update Now') . '</a>';
                }
                break;
            case 'latest_installed':
            case 'newer_installed':
                $action_links[] = '<span class="button button-disabled" title="' . esc_attr__('This plugin is already installed and is up to date') . ' ">' . _x('Installed', 'plugin') . '</span>';
                break;
        }
    }
    $details_link = self_admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . hocwp_get_value_by_key($plugin, 'slug') . '&amp;TB_iframe=true&amp;width=600&amp;height=550');
    $action_links[] = '<a target="_blank" href="' . esc_url($details_link) . '" class="thickbox" aria-label="' . esc_attr(sprintf(__('More information about %s'), $name)) . '" data-title="' . esc_attr($name) . '">' . __('More Details') . '</a>';
    $plugin_icon_url = hocwp_get_plugin_icon_url($plugin);
    $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin);
    $date_format = __('M j, Y @ H:i');
    $last_updated_timestamp = strtotime(hocwp_get_value_by_key($plugin, 'last_updated'));
    if (empty($title) && !empty($base_name)) {
        $local_plugin = hocwp_get_plugin_info($base_name);
        $title = wp_kses($local_plugin['Name'], $allow_tags);
        $description = strip_tags($local_plugin['Description']);
        $description = str_replace(' By HocWP.', '', $description);
        $action_links = array();
        //$version = wp_kses($local_plugin['Version'], $allow_tags);
        //$name = strip_tags($title . ' ' . $version);
        $author = wp_kses($local_plugin['Author'], $allow_tags);
        if (!empty($author)) {
            $author = ' <cite>' . sprintf(__('By %s'), $author) . '</cite>';
        }
    }
    if (empty($title)) {
        return;
    }
    ?>
	<div
		class="plugin-card plugin-card-<?php 
    echo sanitize_html_class(hocwp_get_value_by_key($plugin, 'slug'));
    ?>
">
		<div class="plugin-card-top">
			<div class="name column-name">
				<h3>
					<a target="_blank" href="<?php 
    echo esc_url($details_link);
    ?>
" class="thickbox">
						<?php 
    echo $title;
    ?>
						<img src="<?php 
    echo esc_attr($plugin_icon_url);
    ?>
" class="plugin-icon" alt="">
					</a>
				</h3>
			</div>
			<div class="action-links">
				<?php 
    if ($action_links) {
        echo '<ul class="plugin-action-buttons"><li>' . implode('</li><li>', $action_links) . '</li></ul>';
    }
    ?>
			</div>
			<div class="desc column-description">
				<p><?php 
    echo $description;
    ?>
</p>

				<p class="authors"><?php 
    echo $author;
    ?>
</p>
			</div>
		</div>
		<div class="plugin-card-bottom">
			<?php 
    if (!$is_local) {
        ?>
				<div class="vers column-rating">
					<?php 
        wp_star_rating(array('rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings']));
        ?>
					<span class="num-ratings">(<?php 
        echo number_format_i18n($plugin['num_ratings']);
        ?>
)</span>
				</div>
				<div class="column-updated">
					<strong><?php 
        _e('Last Updated:');
        ?>
</strong> <span
						title="<?php 
        echo esc_attr(date_i18n($date_format, $last_updated_timestamp));
        ?>
">
						<?php 
        printf(__('%s ago'), human_time_diff($last_updated_timestamp));
        ?>
					</span>
				</div>
				<div class="column-downloaded">
					<?php 
        if ($plugin['active_installs'] >= 1000000) {
            $active_installs_text = _x('1+ Million', 'Active plugin installs');
        } else {
            $active_installs_text = number_format_i18n($plugin['active_installs']) . '+';
        }
        printf(__('%s Active Installs'), $active_installs_text);
        ?>
				</div>
				<div class="column-compatibility">
					<?php 
        if (!empty($plugin['tested']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['tested'])), $plugin['tested'], '>')) {
            echo '<span class="compatibility-untested">' . __('Untested with your version of WordPress') . '</span>';
        } elseif (!empty($plugin['requires']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['requires'])), $plugin['requires'], '<')) {
            echo '<span class="compatibility-incompatible">' . __('<strong>Incompatible</strong> with your version of WordPress') . '</span>';
        } else {
            echo '<span class="compatibility-compatible">' . __('<strong>Compatible</strong> with your version of WordPress') . '</span>';
        }
        ?>
				</div>
			<?php 
    } else {
        ?>
				<p><?php 
        _e('This is a local plugin so there is no stats for it.', 'hocwp-theme');
        ?>
</p>
			<?php 
    }
    ?>
		</div>
	</div>
	<?php 
}
function buddyforms_get_addons($call_api)
{
    ?>

    <div class="col-12" itemscope="" itemtype="http://schema.org/SoftwareApplication">


        <p style="text-align: right"><strong style="float: left"> Showing <?php 
    echo count($call_api->plugins) + 1;
    ?>
 Extensions </strong>
        <br class="clear"></p>

        <div class="plugin-group">
            <?php 
    foreach ($call_api->plugins as $plugin) {
        $plugin = (array) $plugin;
        $date_format = __('M j, Y @ H:i');
        $last_updated_timestamp = strtotime($plugin['last_updated']);
        $details_link = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . '&TB_iframe=true&width=772&height=600');
        if (!empty($plugin['icons']['svg'])) {
            $plugin_icon_url = $plugin['icons']['svg'];
        } elseif (!empty($plugin['icons']['2x'])) {
            $plugin_icon_url = $plugin['icons']['2x'];
        } elseif (!empty($plugin['icons']['1x'])) {
            $plugin_icon_url = $plugin['icons']['1x'];
        } else {
            $plugin_icon_url = $plugin['icons']['default'];
        }
        $action_links = array();
        // Remove any HTML from the description.
        $description = strip_tags($plugin['short_description']);
        $version = $plugin['version'];
        $title = $plugin['name'];
        $name = strip_tags($title . ' ' . $version);
        $author = $plugin['author'];
        if (!empty($author)) {
            $author = ' <cite>' . sprintf(__('By %s'), $author) . '</cite>';
        }
        if (current_user_can('install_plugins') || current_user_can('update_plugins')) {
            $status = install_plugin_install_status($plugin);
            //echo $status['status'];
            //echo wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . sanitize_html_class( $plugin['slug'] )), 'install-plugin_' . sanitize_html_class( $plugin['slug'] ));
            switch ($status['status']) {
                case 'install':
                    if ($status['url']) {
                        /* translators: 1: Plugin name and version. */
                        $action_links[] = '<a class="install-now button" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url($status['url']) . '" aria-label="' . esc_attr(sprintf(__('Install %s now'), $name)) . '" data-name="' . esc_attr($name) . '">' . __('Install Now') . '</a>';
                    }
                    break;
                case 'update_available':
                    if ($status['url']) {
                        /* translators: 1: Plugin name and version */
                        $action_links[] = '<a class="update-now button" data-plugin="' . esc_attr($status['file']) . '" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url($status['url']) . '" aria-label="' . esc_attr(sprintf(__('Update %s now'), $name)) . '" data-name="' . esc_attr($name) . '">' . __('Update Now') . '</a>';
                    }
                    break;
                case 'latest_installed':
                case 'newer_installed':
                    //$action_links[] = '<a class="activate-now button" data-plugin="' . esc_attr( $status['file'] ) . '" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . sanitize_html_class( $plugin['slug'] )), 'install-plugin_' . sanitize_html_class( $plugin['slug'] )) . '" aria-label="' . esc_attr( sprintf( __( 'Update %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '">' . __( 'Update Now' ) . '</a>';
                    $action_links[] = '<span class="button button-disabled" title="' . esc_attr__('This plugin is already installed and is up to date') . ' ">' . _x('Installed', 'plugin') . '</span>';
                    break;
            }
        }
        ?>
                <div class="plugin-card plugin-card-<?php 
        echo sanitize_html_class($plugin['slug']);
        ?>
">
                    <div class="plugin-card-top">
                        <a href="<?php 
        echo esc_url($details_link);
        ?>
" class="thickbox plugin-icon"><img src="<?php 
        echo esc_attr($plugin_icon_url);
        ?>
" /></a>
                        <div class="name column-name">
                            <h4><a href="<?php 
        echo esc_url($details_link);
        ?>
" class="thickbox"><?php 
        echo $plugin['name'];
        ?>
</a></h4>
                        </div>
                        <div class="action-links">
                            <?php 
        if ($action_links) {
            echo '<ul class="plugin-action-buttons"><li>' . implode('</li><li>', $action_links) . '</li></ul>';
        }
        ?>
                        </div>
                        <div class="desc column-description">
                            <p><?php 
        echo $description;
        ?>
</p>
                            <p class="authors"><?php 
        echo $author;
        ?>
</p>
                        </div>
                    </div>
                    <div class="plugin-card-bottom">
                        <div class="vers column-rating">
                            <?php 
        wp_star_rating(array('rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings']));
        ?>
                            <span class="num-ratings">(<?php 
        echo number_format_i18n($plugin['num_ratings']);
        ?>
)</span>
                        </div>
                        <div class="column-updated">
                            <strong><?php 
        _e('Last Updated:');
        ?>
</strong> <span title="<?php 
        echo esc_attr(date_i18n($date_format, $last_updated_timestamp));
        ?>
">
						<?php 
        printf(__('%s ago'), human_time_diff($last_updated_timestamp));
        ?>
					</span>
                        </div>
                        <div class="column-downloaded">
                            <?php 
        if ($plugin['active_installs'] >= 1000000) {
            $active_installs_text = _x('1+ Million', 'Active plugin installs');
        } else {
            $active_installs_text = number_format_i18n($plugin['active_installs']) . '+';
        }
        printf(__('%s Active Installs'), $active_installs_text);
        ?>
                        </div>
                        <div class="column-compatibility">
                            <?php 
        if (!empty($plugin['tested']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['tested'])), $plugin['tested'], '>')) {
            echo '<span class="compatibility-untested">' . __('Untested with your version of WordPress') . '</span>';
        } elseif (!empty($plugin['requires']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['requires'])), $plugin['requires'], '<')) {
            echo '<span class="compatibility-incompatible">' . __('<strong>Incompatible</strong> with your version of WordPress') . '</span>';
        } else {
            echo '<span class="compatibility-compatible">' . __('<strong>Compatible</strong> with your version of WordPress') . '</span>';
        }
        ?>
                        </div>
                    </div>
                </div>
            <?php 
    }
    ?>
        </div>
    </div>
<?php 
}
function custom_base_terms_plugin($nombre)
{
    global $custom_base_terms;
    $argumentos = (object) array('slug' => $nombre);
    $consulta = array('action' => 'plugin_information', 'timeout' => 15, 'request' => serialize($argumentos));
    $respuesta = get_transient('custom_base_terms_plugin');
    if (false === $respuesta) {
        $respuesta = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array('body' => $consulta));
        set_transient('custom_base_terms_plugin', $respuesta, 24 * HOUR_IN_SECONDS);
    }
    if (!is_wp_error($respuesta)) {
        $plugin = get_object_vars(unserialize($respuesta['body']));
    } else {
        $plugin['rating'] = 100;
    }
    $rating = array('rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings']);
    ob_start();
    wp_star_rating($rating);
    $estrellas = ob_get_contents();
    ob_end_clean();
    return '<a title="' . sprintf(__('Please, rate %s:', 'custom_base_terms'), $custom_base_terms['plugin']) . '" href="' . $custom_base_terms['puntuacion'] . '?rate=5#postform" class="estrellas">' . $estrellas . '</a>';
}
    public static function get_plugin_item($plugin, $popup_id, $plugin_default_checked)
    {
        $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array());
        $details_link = esc_url(admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin->slug . '&amp;TB_iframe=true&amp;width=772&amp;height=598'));
        $author = wp_kses($plugin->author, $plugins_allowedtags);
        if (!empty($author)) {
            $author = ' <cite>' . sprintf(__('By %s'), $author) . '</cite>';
        }
        ?>

		<div class="plugin-card">
			<div class="plugin-card-top">
				<?php 
        if (isset($plugin->icon)) {
            ?>
				<a href="<?php 
            echo $details_link;
            ?>
" class="thickbox">
					<img src="<?php 
            echo esc_attr($plugin->icon);
            ?>
" class="plugin-icon">
				</a>
				<?php 
        }
        ?>

				<div class="action-links">
					<ul class="plugin-action-buttons">
						<li class="oneandone-install-checkbox<?php 
        echo $plugin_default_checked == true ? ' checked' : '';
        ?>
">
							<label for="plugin-<?php 
        echo $plugin->slug;
        ?>
">
							 <input id="plugin-<?php 
        echo $plugin->slug;
        ?>
" name="plugins[]" value="<?php 
        echo $plugin->slug;
        ?>
" type="checkbox" <?php 
        echo $plugin_default_checked == true ? 'checked' : '';
        ?>
>
								<?php 
        _e('Install', '1and1-wordpress-wizard');
        ?>
							</label>
						</li>
						<li>
							<?php 
        $name = strip_tags($plugin->name . ' ' . $plugin->version);
        /* translators: 1: Plugin name and version. */
        echo '<a href="' . esc_url($details_link) . '" class="thickbox" aria-label="' . esc_attr(sprintf(__('More information about %s'), $name)) . '" data-title="' . esc_attr($name) . '">' . __('More Details') . '</a>';
        ?>
						</li>
					</ul>
				</div>

				<div class="name column-name">
					<h4>
						<a href="<?php 
        echo $details_link;
        ?>
" class="thickbox">
							<?php 
        echo strip_tags($plugin->name);
        ?>
						</a>
					</h4>
				</div>

				<div class="desc column-description">
					<p><?php 
        echo strip_tags($plugin->short_description);
        ?>
</p>
					<p class="authors"><?php 
        echo $author;
        ?>
</p>
				</div>
			</div>

			<div class="plugin-card-bottom">
				<div class="vers column-rating">
					<?php 
        wp_star_rating(array('rating' => $plugin->rating, 'type' => 'percent', 'number' => $plugin->num_ratings));
        ?>
					<span class="num-ratings">(<?php 
        echo number_format_i18n($plugin->num_ratings);
        ?>
)</span>
				</div>
				<div class="column-updated">
					<strong><?php 
        _e('Last Updated:');
        ?>
</strong>
					<span title="<?php 
        echo esc_attr($plugin->last_updated);
        ?>
">
						<?php 
        printf(__('%s ago'), human_time_diff(strtotime($plugin->last_updated)));
        ?>
					</span>
				</div>
				<div class="column-downloaded">
					<?php 
        echo sprintf(_n('%s download', '%s downloads', $plugin->downloaded), number_format_i18n($plugin->downloaded));
        ?>
				</div>
				<div class="column-compatibility">
					<?php 
        if (!empty($plugin->tested) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin->tested)), $plugin->tested, '>')) {
            echo __('<strong>Untested</strong> with your install ');
        } elseif (!empty($plugin->requires) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin->requires)), $plugin->requires, '<')) {
            echo __('<strong>Incompatible</strong> with your install ');
        } else {
            echo __('<strong>Compatible</strong> with your install ');
        }
        ?>
				</div>
			</div>
		</div>

	<?php 
    }
/**
 * Display plugin information in dialog box form.
 *
 * @since 2.7.0
 */
function install_plugin_information()
{
    global $tab;
    if (empty($_REQUEST['plugin'])) {
        return;
    }
    $api = plugins_api('plugin_information', array('slug' => wp_unslash($_REQUEST['plugin']), 'is_ssl' => is_ssl(), 'fields' => array('banners' => true, 'reviews' => true)));
    if (is_wp_error($api)) {
        wp_die($api);
    }
    $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => 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(), '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);
        }
    }
    $_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 = '';
    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">
		<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>
		<?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">
					<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));
            ?>
">
						<span class="counter-label"><?php 
            printf(_n('%d star', '%d stars', $key), $key);
            ?>
</span>
						<span class="counter-back">
							<span class="counter-bar" style="width: <?php 
            echo 92 * $_rating;
            ?>
px;"></span>
						</span>
					</a>
					<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="error"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> 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="error"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> 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';
        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";
    if (!empty($api->download_link) && (current_user_can('install_plugins') || current_user_can('update_plugins'))) {
        $status = install_plugin_install_status($api);
        switch ($status['status']) {
            case 'install':
                if ($status['url']) {
                    echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Now') . '</a>';
                }
                break;
            case 'update_available':
                if ($status['url']) {
                    echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') . '</a>';
                }
                break;
            case 'newer_installed':
                echo '<a class="button button-primary right disabled">' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>';
                break;
            case 'latest_installed':
                echo '<a class="button button-primary right disabled">' . __('Latest Version Installed') . '</a>';
                break;
        }
    }
    echo "</div>\n";
    iframe_footer();
    exit;
}
Example #27
0
    /**
     * Prints the Plugin box for the given plugin
     *
     * @since  4.0
     *
     * @param  string $plugin Plugin Name key
     * @return void
     */
    public function print_plugin_box($plugin)
    {
        $plugin = (object) $this->get_plugins($plugin, false);
        $api_data = $this->get_plugin_api_data($plugin);
        $addons = $this->get_addons($plugin->name);
        $plugins = get_plugins();
        if ($api_data) {
            if (!function_exists('install_plugin_install_status')) {
                include_once ABSPATH . '/wp-admin/includes/plugin-install.php';
            }
            $status = install_plugin_install_status($api_data);
            $plugin_active = is_plugin_active($status['file']);
            $plugin_exists = isset($plugins[$status['file']]);
            if ('install' !== $status['status'] && !$plugin_active) {
                $args = array('action' => 'activate', 'plugin' => $status['file'], 'plugin_status' => 'all', 'paged' => 1, 's' => '');
                $activate_url = wp_nonce_url(add_query_arg($args, 'plugins.php'), 'activate-plugin_' . $status['file']);
                $link = '<a class="button" href="' . $activate_url . '" aria-label="' . esc_attr(sprintf(esc_attr__('Activate %s', 'tribe-common'), $plugin->name)) . '">' . esc_html__('Activate Plugin', 'tribe-common') . '</a>';
            } elseif ('update_available' === $status['status']) {
                $args = array('action' => 'upgrade-plugin', 'plugin' => $status['file']);
                $update_url = wp_nonce_url(add_query_arg($args, 'update.php'), 'upgrade-plugin_' . $status['file']);
                $link = '<a class="button" href="' . $update_url . '">' . esc_html__('Upgrade Plugin', 'tribe-common') . '</a>';
            } elseif ($plugin_exists) {
                $link = '<a class="button disabled">' . esc_html__('You are up to date!', 'tribe-common') . '</a>';
            }
        }
        if (!isset($link)) {
            if ($api_data) {
                $args = array('tab' => 'plugin-information', 'plugin' => $plugin->name, 'TB_iframe' => true, 'width' => 772, 'height' => 600);
                $iframe_url = add_query_arg($args, admin_url('/plugin-install.php'));
                $link = '<a class="button thickbox" href="' . $iframe_url . '" aria-label="' . esc_attr(sprintf(esc_attr__('Install %s', 'tribe-common'), $plugin->name)) . '">' . esc_html__('Install Plugin', 'tribe-common') . '</a>';
            } else {
                $link = null;
            }
        }
        ?>
		<div class="tribe-help-plugin-info">
			<h3><a href="<?php 
        echo esc_url($plugin->repo);
        ?>
"><?php 
        echo esc_html($plugin->title);
        ?>
</a></h3>

			<?php 
        if (!empty($plugin->description) && !$plugin->is_active) {
            echo wpautop($plugin->description);
        }
        ?>

			<?php 
        if ($api_data) {
            ?>
			<dl>
				<dt><?php 
            esc_html_e('Latest Version:', 'tribe-common');
            ?>
</dt>
				<dd><?php 
            echo esc_html($api_data->version);
            ?>
</dd>

				<dt><?php 
            esc_html_e('Requires:', 'tribe-common');
            ?>
</dt>
				<dd><?php 
            echo esc_html__('WordPress ', 'tribe-common') . esc_html($api_data->requires);
            ?>
+</dd>

				<dt><?php 
            esc_html_e('Active Users:', 'tribe-common');
            ?>
</dt>
				<dd><?php 
            echo esc_html(number_format($api_data->active_installs));
            ?>
+</dd>

				<dt><?php 
            esc_html_e('Rating:', 'tribe-common');
            ?>
</dt>
				<dd><a href="<?php 
            echo esc_url($plugin->stars_url);
            ?>
" target="_blank">
				<?php 
            wp_star_rating(array('rating' => $api_data->rating, 'type' => 'percent', 'number' => $api_data->num_ratings));
            ?>
				</a></dd>
			</dl>
			<?php 
        }
        ?>

			<?php 
        // Only show the link to the users can use it
        if (current_user_can('update_plugins') && current_user_can('install_plugins')) {
            echo $link ? '<p style="text-align: center;">' . $link . '</p>' : '';
        }
        ?>

			<?php 
        if (!empty($addons)) {
            ?>
				<h3><?php 
            esc_html_e('Premium Add-Ons', 'tribe-common');
            ?>
</h3>
				<ul class='tribe-list-addons'>
					<?php 
            foreach ($addons as $addon) {
                $addon = (object) $addon;
                if (isset($addon->is_active) && $addon->is_active) {
                    $active_title = __('Plugin Active', 'tribe-common');
                } else {
                    $active_title = __('Plugin Inactive', 'tribe-common');
                }
                echo '<li title="' . esc_attr($active_title) . '" class="' . (isset($addon->is_active) && $addon->is_active ? 'tribe-active-addon' : '') . '">';
                if (isset($addon->link)) {
                    echo '<a href="' . esc_url($addon->link) . '" title="' . esc_attr__('Visit the Add-on Page', 'tribe-common') . '" target="_blank">';
                }
                echo esc_html($addon->title);
                if (isset($addon->link)) {
                    echo '</a>';
                }
                echo '</li>';
            }
            ?>
				</ul>
			<?php 
        }
        ?>
		</div>
	<?php 
    }
Example #28
0
/**
 * Ajax handler for getting themes from themes_api().
 *
 * @since 3.9.0
 *
 * @global array $themes_allowedtags
 * @global array $theme_field_defaults
 */
function wp_ajax_query_themes()
{
    global $themes_allowedtags, $theme_field_defaults;
    if (!current_user_can('install_themes')) {
        wp_send_json_error();
    }
    $args = wp_parse_args(wp_unslash($_REQUEST['request']), array('per_page' => 20, 'fields' => $theme_field_defaults));
    if (isset($args['browse']) && 'favorites' === $args['browse'] && !isset($args['user'])) {
        $user = get_user_option('wporg_favorites');
        if ($user) {
            $args['user'] = $user;
        }
    }
    $old_filter = isset($args['browse']) ? $args['browse'] : 'search';
    /** This filter is documented in wp-admin/includes/class-wp-theme-install-list-table.php */
    $args = apply_filters('install_themes_table_api_args_' . $old_filter, $args);
    $api = themes_api('query_themes', $args);
    if (is_wp_error($api)) {
        wp_send_json_error();
    }
    $update_php = network_admin_url('update.php?action=install-theme');
    foreach ($api->themes as &$theme) {
        $theme->install_url = add_query_arg(array('theme' => $theme->slug, '_wpnonce' => wp_create_nonce('install-theme_' . $theme->slug)), $update_php);
        $theme->name = wp_kses($theme->name, $themes_allowedtags);
        $theme->author = wp_kses($theme->author, $themes_allowedtags);
        $theme->version = wp_kses($theme->version, $themes_allowedtags);
        $theme->description = wp_kses($theme->description, $themes_allowedtags);
        $theme->stars = wp_star_rating(array('rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings, 'echo' => false));
        $theme->num_ratings = number_format_i18n($theme->num_ratings);
        $theme->preview_url = set_url_scheme($theme->preview_url);
    }
    wp_send_json_success($api);
}
 /**
  * Displays the content of custom theme columns on the edit screen.
  *
  * @since  1.0.0
  * @access public
  * @param  string  $column
  * @param  int     $post_id
  * @return void
  */
 public function custom_column($column, $post_id)
 {
     if ('screenshot' === $column) {
         if (has_post_thumbnail()) {
             the_post_thumbnail(array(75, 75));
         } elseif (function_exists('get_the_image')) {
             get_the_image(array('scan' => true, 'width' => 75, 'link' => false));
         }
     } else {
         if ('downloads' === $column) {
             $count = thds_get_theme_download_count($post_id);
             echo $count ? number_format_i18n($count) : '&ndash;';
         } else {
             if ('rating' === $column) {
                 $rating = thds_get_theme_rating($post_id);
                 $number = thds_get_theme_rating_count($post_id);
                 wp_star_rating(array('type' => 'rating', 'rating' => floatval($rating), 'number' => absint($number)));
             }
         }
     }
 }