Hi!
Saw that you already have ' . esc_attr($tmp2) . ' redirect rules that got used ' . esc_attr($tmp1) . ' times - that\'s awesome! We wanted to ask for your help to make the plugin better.
We just need a minute of your time to rate the plugin. It helps us out a lot!';
echo '
Help make the plugin better by rating it';
echo ' I\'ve already rated the plugin';
echo '
Thank you very much! The 301 Redirects team';
echo '
';
} // show_review_notice
public function admin_url($vars = array())
{
$vars = array('page' => $this->config['page_slug']) + $vars;
$url = 'options-general.php?' . http_build_query($vars);
return admin_url($url);
}
/**
*
* update_self
*
* This function will check the current version and do any fixes required
*
* @return string - version number.
* @author WebFactory Ltd
*
*/
public function update_self()
{
$version = get_option('eps_redirects_version');
if (version_compare($version, '2.0.0', '<')) {
// migrate old format to new format.
add_action('admin_init', array($this, '_migrate_to_v2'), 1);
}
$this->set_current_version(EPS_REDIRECT_VERSION);
return EPS_REDIRECT_VERSION;
}
/**
*
* _migrate_to_v2
*
* Will migrate the old storage method to the new tables.
*
* @return nothing
* @author WebFactory Ltd
*
*/
public static function _migrate_to_v2()
{
$redirects = get_option(self::$option_slug);
if (empty($redirects)) return false; // No redirects to migrate.
$new_redirects = array();
foreach ($redirects as $from => $to) {
$new_redirects[] = array(
'id' => false,
'url_to' => urldecode($to),
'url_from' => $from,
'type' => 'url',
'status' => '301'
);
}
EPS_Redirects::_save_redirects($new_redirects);
}
/**
*
* _create_tables
*
* Creates the database architecture
*
* @return nothing
* @author WebFactory Ltd
*
*/
public static function _create_redirect_table()
{
global $wpdb;
$table_name = $wpdb->prefix . "redirects";
$sql = "CREATE TABLE $table_name (
id mediumint(9) NOT NULL AUTO_INCREMENT,
url_from VARCHAR(256) DEFAULT '' NOT NULL,
url_to VARCHAR(256) DEFAULT '' NOT NULL,
status VARCHAR(12) DEFAULT '301' NOT NULL,
type VARCHAR(12) DEFAULT 'url' NOT NULL,
count mediumint(9) DEFAULT 0 NOT NULL,
UNIQUE KEY id (id)
);";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
return dbDelta($sql);
}
/**
*
* plugin_resources
*
* Enqueues the resources, and makes sure we have what we need to proceed.
*
* @return nothing
* @author WebFactory Ltd
*
*/
public static function plugin_resources()
{
global $EPS_Redirects_Plugin, $wp_rewrite;
$pointers = get_option('eps_pointers');
if (is_admin() && $pointers && !empty($wp_rewrite->permalink_structure) && (empty($_GET['page']) || sanitize_text_field($_GET['page']) != $EPS_Redirects_Plugin->config('page_slug'))) {
$pointers['_nonce_dismiss_pointer'] = wp_create_nonce('eps_dismiss_pointer');
wp_enqueue_script('wp-pointer');
wp_enqueue_script('eps-pointers', plugins_url('js/eps-admin-pointers.js', __FILE__), array('jquery'), EPS_REDIRECT_VERSION, true);
wp_enqueue_style('wp-pointer');
wp_localize_script('wp-pointer', 'eps_pointers', $pointers);
}
if (is_admin() && isset($_GET['page']) && sanitize_text_field($_GET['page']) == $EPS_Redirects_Plugin->config('page_slug')) {
// uncomment if we want to remove pointer after plugin settings are open
// unset($pointers['welcome']);
// update_option('eps_pointers', $pointers);
$notices = get_option('301-redirects-notices');
wp_enqueue_script('jquery');
wp_enqueue_script('eps_redirect_script', EPS_REDIRECT_URL . 'js/scripts.js');
wp_enqueue_style('eps_redirect_styles', EPS_REDIRECT_URL . 'css/eps_redirect.css');
wp_enqueue_style('wp-jquery-ui-dialog');
wp_enqueue_script('jquery-ui-dialog');
$js_vars = array(
'nonce_get_entry' => wp_create_nonce('eps_301_get_entry'),
'nonce_save_redirect' => wp_create_nonce('eps_301_save_redirect'),
'nonce_delete_entry' => wp_create_nonce('eps_301_delete_entry'),
'nonce_get_inline_edit_entry' => wp_create_nonce('eps_301_get_inline_edit_entry'),
'auto_open_pro_dialog' => empty($notices['dismiss_auto_pro_modal']),
);
wp_localize_script('eps_redirect_script', 'eps_301', $js_vars);
$notices['dismiss_auto_pro_modal'] = true;
update_option('301-redirects-notices', $notices);
}
global $wp_rewrite;
if (!isset($wp_rewrite->permalink_structure) || empty($wp_rewrite->permalink_structure)) {
$EPS_Redirects_Plugin->add_admin_message('