/**
  * Enqueue install assets
  *
  * @since  1.0.0
  * @access public
  */
 public function enqueue_install_assets()
 {
     global $wp_scripts;
     wp_enqueue_style('rp4wp-install-css', plugins_url('/assets/css/install.css', RP4WP::get_plugin_file()));
     wp_enqueue_script('rp4wp-install-js', plugins_url('/assets/js/install' . (!SCRIPT_DEBUG ? '.min' : '') . '.js', RP4WP::get_plugin_file()), array('jquery', 'jquery-ui-core', 'jquery-ui-progressbar'));
     wp_enqueue_style('jquery-ui-smoothness', "http://ajax.googleapis.com/ajax/libs/jqueryui/" . $wp_scripts->query('jquery-ui-core')->ver . "/themes/smoothness/jquery-ui.css", false, null);
 }
 /**
  * Metabox content
  *
  * @access public
  * @return void
  */
 public function callback($post)
 {
     echo "<div class='rp4wp_mb_manage'>\n";
     // Add nonce
     echo "<input type='hidden' name='rp4wp-ajax-nonce' id='rp4wp-ajax-nonce' value='" . wp_create_nonce('rp4wp-ajax-nonce-omgrandomword') . "' />\n";
     // Output plugin URL in hidden val
     echo "<input type='hidden' name='rp4wp-dir-img' id='rp4wp-dir-img' value='" . plugins_url('/assets/images/', RP4WP::get_plugin_file()) . "' />\n";
     // Create a Post Link Manager object
     $post_link_manager = new RP4WP_Post_Link_Manager();
     // Get the children
     $children = $post_link_manager->get_children($post->ID);
     echo "<div class='rp4wp_button_holder'>\n";
     // Build the related post link
     $url = get_admin_url() . "admin.php?page=rp4wp_link_related&amp;rp4wp_parent=" . $post->ID;
     // WPML check
     if (isset($_GET['lang'])) {
         $url .= "&amp;lang=" . $_GET['lang'];
     }
     echo "<span id='view-post-btn'>";
     echo "<a href='" . $url . "' class='button button-primary'>";
     _e('Add Related Posts', 'related-posts-for-wp');
     echo "</a>";
     echo "</span>\n";
     echo "</div>\n";
     if (count($children) > 0) {
         // Managet table
         echo "<table class='wp-list-table widefat fixed pages rp4wp_table_manage sortable'>\n";
         echo "<tbody>\n";
         $i = 0;
         foreach ($children as $link_id => $child) {
             $child_id = $child->ID;
             $edit_url = get_admin_url() . "post.php?post={$child_id}&amp;action=edit&amp;rp4wp_parent={$post->ID}";
             echo "<tr id='{$link_id}'>\n";
             echo "<td>";
             echo "<strong><a href='{$edit_url}' class='row-title' title='{$child->post_title}'>{$child->post_title}</a></strong>\n";
             echo "<div class='row-actions'>\n";
             echo "<span class='edit'><a href='{$edit_url}' title='" . __('Edit Post', 'related-posts-for-wp') . "'>";
             _e('Edit Post', 'related-posts-for-wp');
             echo "</a> | </span>";
             echo "<span class='trash'><a class='submitdelete' title='" . __('Unlink Related Post', 'related-posts-for-wp') . "' href='javascript:;'>";
             _e('Unlink Related Post', 'related-posts-for-wp');
             echo "</a></span>";
             echo "</div>\n";
             echo "</td>\n";
             echo "</tr>\n";
             $i++;
         }
         echo "</tbody>\n";
         echo "</table>\n";
     } else {
         echo '<br/>';
         _e('No related posts found.', 'related-posts-for-wp');
     }
     // Reset Post Data
     wp_reset_postdata();
     echo "</div>\n";
 }
 /**
  * Enqueue install assets
  *
  * @since  1.0.0
  * @access public
  */
 public function enqueue_install_assets()
 {
     global $wp_scripts;
     wp_enqueue_style('rp4wp-install-css', plugins_url('/assets/css/install.css', RP4WP::get_plugin_file()), array(), RP4WP::VERSION);
     wp_enqueue_script('rp4wp-install-js', plugins_url('/assets/js/install' . (!SCRIPT_DEBUG ? '.min' : '') . '.js', RP4WP::get_plugin_file()), array('jquery', 'jquery-ui-core', 'jquery-ui-progressbar'), RP4WP::VERSION);
     wp_enqueue_script('rp4wp-tipped', plugins_url('/assets/js/lib/tipped.js', RP4WP::get_plugin_file()), array(), RP4WP::VERSION);
     // Make JavaScript strings translatable
     wp_localize_script('rp4wp-install-js', 'rp4wp_js', RP4WP_Javascript_Strings::get());
     wp_enqueue_style('jquery-ui-smoothness', "https://ajax.googleapis.com/ajax/libs/jqueryui/" . $wp_scripts->query('jquery-ui-core')->ver . "/themes/smoothness/jquery-ui.css", false, null);
 }
 public function run()
 {
     global $pagenow;
     // Post screen
     if ($pagenow == 'post.php' || $pagenow == 'post-new.php') {
         // Load PL JS
         wp_enqueue_script('rp4wp_edit_post_js', plugins_url('/assets/js/edit-post' . (!SCRIPT_DEBUG ? '.min' : '') . '.js', RP4WP::get_plugin_file()), array('jquery', 'jquery-ui-sortable'));
         // Make JavaScript strings translatable
         wp_localize_script('rp4wp_edit_post_js', 'rp4wp_js', RP4WP_Javascript_Strings::get());
         // CSS
         wp_enqueue_style('rp4wp_edit_post_css', plugins_url('/assets/css/edit-post.css', RP4WP::get_plugin_file()));
     }
 }
 public function run()
 {
     global $pagenow;
     // Post screen
     if ($pagenow == 'post.php' || $pagenow == 'post-new.php') {
         // Load PL JS
         wp_enqueue_script('rp4wp_edit_post_js', plugins_url('/assets/js/edit-post' . (!SCRIPT_DEBUG ? '.min' : '') . '.js', RP4WP::get_plugin_file()), array('jquery', 'jquery-ui-sortable'), RP4WP::VERSION);
         // Make JavaScript strings translatable
         wp_localize_script('rp4wp_edit_post_js', 'rp4wp_js', RP4WP_Javascript_Strings::get());
         // CSS
         wp_enqueue_style('rp4wp_edit_post_css', plugins_url('/assets/css/edit-post.css', RP4WP::get_plugin_file()), array(), RP4WP::VERSION);
     }
     if ('options-general.php' == $pagenow && isset($_GET['page']) && $_GET['page'] === 'rp4wp') {
         // Main settings JS
         wp_enqueue_script('rp4wp_settings_js', plugins_url('/assets/js/settings' . (!SCRIPT_DEBUG ? '.min' : '') . '.js', RP4WP::get_plugin_file()), array('jquery'), RP4WP::VERSION);
     }
 }
 public function run()
 {
     global $pagenow;
     // Post screen
     if ($pagenow == 'post.php' || $pagenow == 'post-new.php') {
         // Load PL JS
         wp_enqueue_script('rp4wp_edit_post_js', plugins_url('/assets/js/edit-post' . (!SCRIPT_DEBUG ? '.min' : '') . '.js', RP4WP::get_plugin_file()), array('jquery', 'jquery-ui-sortable'), RP4WP::VERSION);
         // Make JavaScript strings translatable
         wp_localize_script('rp4wp_edit_post_js', 'rp4wp_js', RP4WP_Javascript_Strings::get());
         // CSS
         wp_enqueue_style('rp4wp_edit_post_css', plugins_url('/assets/css/edit-post.css', RP4WP::get_plugin_file()), array(), RP4WP::VERSION);
     }
     if ('options-general.php' == $pagenow && isset($_GET['page']) && 0 === strpos($_GET['page'], 'rp4wp_')) {
         // Configurator
         if ('rp4wp_configurator' === $_GET['page']) {
             // Load the configurator file
             /*
             wp_enqueue_script(
             	'rp4wp_lodash',
             	plugins_url( '/assets/js/configurator/lodash.min.js', RP4WP::get_plugin_file() ),
             	array( 'jquery' ),
             	RP4WP::VERSION
             );
             */
             wp_enqueue_script('jquery-ui-core');
             wp_enqueue_script('jquery-ui-widget');
             wp_enqueue_script('jquery-ui-mouse');
             wp_enqueue_script('jquery-ui-draggable');
             wp_enqueue_script('jquery-ui-resizable');
             // Load the configurator file
             wp_enqueue_script('rp4wp_configurator_js', plugins_url('/assets/js/configurator/configurator.min.js', RP4WP::get_plugin_file()), array('jquery', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse', 'jquery-ui-draggable', 'jquery-ui-resizable'), RP4WP::VERSION);
             // Configurator CSS
             wp_enqueue_style('rp4wp_configurator_css', plugins_url('/assets/css/configurator.css', RP4WP::get_plugin_file()), array(), RP4WP::VERSION);
         }
         // Weights JS
         if ('rp4wp_weights' === $_GET['page']) {
             wp_enqueue_script('rp4wp_settings_weight_js', plugins_url('/assets/js/settings-weight' . (!SCRIPT_DEBUG ? '.min' : '') . '.js', RP4WP::get_plugin_file()), array('jquery'), RP4WP::VERSION);
         }
         // Main settings JS
         wp_enqueue_script('rp4wp_settings_js', plugins_url('/assets/js/settings' . (!SCRIPT_DEBUG ? '.min' : '') . '.js', RP4WP::get_plugin_file()), array('jquery'), RP4WP::VERSION);
     }
 }
 /**
  * Enqueue settings page assets
  *
  * @since  1.0.0
  * @access public
  */
 public function enqueue_assets()
 {
     wp_enqueue_style('rp4wp-settings-css', plugins_url('/assets/css/settings.css', RP4WP::get_plugin_file()));
 }
    /**
     * The sidebar
     *
     * @since  1.0.0
     * @access private
     */
    private function sidebar()
    {
        ?>
		<div class="rp4wp-sidebar">

			<div class="rp4wp-box rp4wp-box-upgrade">
				<h3><?php 
        _e('Related Posts for WordPress Premium', 'related-posts-for-wp');
        ?>
</h3>

				<p><?php 
        _e('This plugin has an even better premium version, I am sure you will love it.', 'related-posts-for-wp');
        ?>
</p>

				<p><?php 
        _e('Premium features include:', 'related-posts-for-wp');
        ?>
</p>
				<ul>
					<li><?php 
        _e('Full control over your post display with our configurator', 'related-posts-for-wp');
        ?>
</li>
					<li><?php 
        _e('Related Custom Post Types & Taxonomies to each other', 'related-posts-for-wp');
        ?>
</li>
					<li><?php 
        _e('Ability to Exclude posts from being related', 'related-posts-for-wp');
        ?>
</li>
					<li><?php 
        _e('Keep Manually created links', 'related-posts-for-wp');
        ?>
</li>
					<li><?php 
        _e('Define What you find related by setting weights', 'related-posts-for-wp');
        ?>
</li>
					<li><?php 
        _e('Top notch priority Email support', 'related-posts-for-wp');
        ?>
</li>
				</ul>

				<p><?php 
        _e('And more features, click the button below to get a full overview including a demo video!', 'related-posts-for-wp');
        ?>
</p>

				<p><?php 
        printf(__('%sView All Premium Features%s', 'related-posts-for-wp'), '<a class="button button-primary button-large" href="https://www.relatedpostsforwp.com/upgrade-premium/?utm_source=plugin&utm_medium=link&utm_campaign=upgrade-box" target="_blank">', '</a>');
        ?>
</p>
			</div>

			<div class="rp4wp-box">
				<h3 class="rp4wp-title"><?php 
        _e('Can we help you?', 'related-posts-for-wp');
        ?>
</h3>

				<p><?php 
        printf(__("We've covered a lot of general questions in our %sdocumentation%s, is your question not covered there? Feel free to open a thread at our %sWordPress.org forum%s.", 'related-posts-for-wp'), '<a href="https://www.relatedpostsforwp.com/documentation/" target="_blank">', '</a>', '<a href="http://wordpress.org/support/plugin/related-posts-for-wp" target="_blank">', '</a>');
        ?>
</p>

				<p><?php 
        printf(__("Did you know our %sPremium customers%s get priority email support?", 'related-posts-for-wp'), '<a href="https://www.relatedpostsforwp.com/upgrade-premium/?utm_source=plugin&utm_medium=link&utm_campaign=support" target="_blank">', '</a>');
        ?>
</p>

			</div>

			<div class="rp4wp-box">
				<h3 class="rp4wp-title"><?php 
        _e('Want to help us?', 'related-posts-for-wp');
        ?>
</h3>

				<p><?php 
        printf(__("%sUpgrade to Related Posts for WordPress Premium%s", 'related-posts-for-wp'), '<a href="https://www.relatedpostsforwp.com/upgrade-premium/?utm_source=plugin&utm_medium=link&utm_campaign=help-us" target="_blank">', '</a>');
        ?>
</p>

				<p><?php 
        printf(__("%sLeave a ★★★★★ plugin review on WordPress.org%s", 'related-posts-for-wp'), '<a href="http://wordpress.org/support/view/plugin-reviews/related-posts-for-wp?rate=5#postform" target="_blank">', '</a>');
        ?>
</p>

				<p><?php 
        printf(__("%sTweet about Related Posts for WordPress%s", 'related-posts-for-wp'), '<a href="https://twitter.com/intent/tweet?text=Showing%20my%20appreciation%20to%20%40CageNL%20for%20his%20WordPress%20plugin%3A%20Related%20Posts%20for%20WordPress%20-%20check%20it%20out!%20http%3A%2F%2Fwordpress.org%2Fplugins%2Frelated-posts-for-wp%2F" target="_blank">', '</a>');
        ?>
</p>

				<p><?php 
        printf(__("%sVote 'works' on the WordPress.org plugin page%s", 'related-posts-for-wp'), '<a href="http://wordpress.org/plugins/related-posts-for-wp/" target="_blank">', '</a>');
        ?>
</p>

				<p><a href="http://www.never5.com/" target="_blank"><?php 
        _e("Check out our other plugins at Never5.com", 'related-posts-for-wp');
        ?>
</a></p>

			</div>

			<div class="rp4wp-box">
				<h3 class="rp4wp-title"><?php 
        _e('About Never5', 'related-posts-for-wp');
        ?>
</h3>

				<a href="http://www.never5.com" target="_blank"><img src="<?php 
        echo plugins_url('/assets/images/never5-logo.png', RP4WP::get_plugin_file());
        ?>
" alt="Never5" style="float:left;padding:0 10px 10px 0;" /></a>

				<p><?php 
        printf(__('At %sNever5%s we create high quality premium WordPress plugins, with extensive support. We offer solutions in related posts, advanced download management, vehicle management and connecting post types.', 'related-posts-for-wp'), '<a href="http://www.never5.com" target="_blank">', '</a>');
        ?>
</p>

				<p><?php 
        printf(__("%sFollow Never5 on Twitter%s", 'related-posts-for-wp'), '<a href="https://twitter.com/Never5Plugins" target="_blank">', '</a>');
        ?>
</p>
			</div>

		</div>
		<?php 
    }
    /**
     * The sidebar
     *
     * @since  1.0.0
     * @access private
     */
    private function sidebar()
    {
        ?>
		<div class="rp4wp-sidebar">

			<div class="rp4wp-box">
				<div class="rp4wp-sidebar-header">
					<h3>Related Posts for WordPress</h3>
				</div>

				<p><?php 
        _e('Plugin version', 'related-posts-for-wp');
        ?>
: <?php 
        echo RP4WP::VERSION;
        ?>
</p>
			</div>

			<div class="rp4wp-box">
				<h3 class="rp4wp-title">Looking for support?</h3>

				<p><?php 
        printf(__('Got a question? Simply send us an email at %ssupport@relatedpostsforwp.com%s. Please note that support requires an active license.', 'related-posts-for-wp'), '<a href="mailto:support@relatedpostsforwp.com">', '</a>');
        ?>
</p>
			</div>

			<div class="rp4wp-box">
				<h3 class="rp4wp-title"><?php 
        _e('More information', 'related-posts-for-wp');
        ?>
</h3>

				<p><?php 
        printf(__("<a href='%s'>Documentation</a>", 'related-posts-for-wp'), 'https://www.relatedpostsforwp.com/documentation/');
        ?>
</p>

				<p><?php 
        printf(__("<a href='%s'>Changelog</a>", 'related-posts-for-wp'), 'https://www.relatedpostsforwp.com/changelog/');
        ?>
</p>

				<p><?php 
        printf(__("<a href='%s'>Give us a review</a>", 'related-posts-for-wp'), 'http://wordpress.org/support/view/plugin-reviews/related-posts-for-wp');
        ?>
</p>

				<p><a href="http://www.never5.com/" target="_blank"><?php 
        _e("Check out our other plugins at Never5.com", 'related-posts-for-wp');
        ?>
</a></p>

			</div>

			<div class="rp4wp-box">
				<h3 class="rp4wp-title"><?php 
        _e('About Never5', 'related-posts-for-wp');
        ?>
</h3>

				<a href="http://www.never5.com" target="_blank"><img src="<?php 
        echo plugins_url('/assets/images/never5-logo.png', RP4WP::get_plugin_file());
        ?>
" alt="Never5" style="float:left;padding:0 10px 10px 0;" /></a>

				<p><?php 
        printf(__('At %sNever5%s we create high quality premium WordPress plugins, with extensive support. We offer solutions in related posts, advanced download management, vehicle management and connecting post types.', 'related-posts-for-wp'), '<a href="http://www.never5.com" target="_blank">', '</a>');
        ?>
</p>

				<p><?php 
        printf(__("%sFollow Never5 on Twitter%s", 'related-posts-for-wp'), '<a href="https://twitter.com/Never5Plugins" target="_blank">', '</a>');
        ?>
</p>
			</div>

		</div>
	<?php 
    }