esc_like() Vs esc_sql()
*
* @since 1.00
*
* @var boolean
*/
private static $wp_4dot0_plus = true;
/**
* Initialization function, similar to __construct()
*
* @since 1.00
*
* @return void
*/
public static function initialize() {
self::$wp_4dot0_plus = version_compare( get_bloginfo('version'), '4.0', '>=' );
//add_action( 'admin_init', 'Unattached_Fixit::admin_init_action' );
add_action( 'admin_menu', 'Unattached_Fixit::admin_menu_action' );
}
/**
* Admin Init Action
*
* @since 1.00
*
* @return void
*/
public static function admin_init_action() {
}
/**
* Add submenu page in the "Tools" section
*
* @since 1.00
*
* @return void
*/
public static function admin_menu_action( ) {
$current_page_hook = add_submenu_page( 'tools.php', 'Unattached Fixit Tools', 'Unattached Fixit', 'manage_options', self::SLUG_PREFIX . 'tools', 'Unattached_Fixit::render_tools_page' );
add_filter( 'plugin_action_links', 'Unattached_Fixit::add_plugin_links_filter', 10, 2 );
}
/**
* Add the "Tools" link to the Plugins section entry
*
* @since 1.00
*
* @param array array of links for the Plugin, e.g., "Activate"
* @param string Directory and name of the plugin Index file
*
* @return array Updated array of links for the Plugin
*/
public static function add_plugin_links_filter( $links, $file ) {
if ( $file == 'mla-unattached-fixit.php' ) {
$tools_link = sprintf( '%s', admin_url( 'tools.php?page=' . self::SLUG_PREFIX . 'tools' ), 'Tools' );
array_unshift( $links, $tools_link );
}
return $links;
}
/**
* Render (echo) the "Unattached Fixit" submenu in the Tools section
*
* @since 1.00
*
* @return void Echoes HTML markup for the submenu page
*/
public static function render_tools_page() {
error_log( 'Unattached_Fixit::render_tools_page() $_REQUEST = ' . var_export( $_REQUEST, true ), 0 );
if ( !current_user_can( 'manage_options' ) ) {
echo "Unattached Fixit - Error\n";
wp_die( 'You do not have permission to manage plugin settings.' );
}
$setting_actions = array(
'help' => array( 'handler' => '', 'comment' => 'Enter first and (optional) last attachment/item ID values above to restrict tool application range. To operate on one ID, enter just the "First ID". The default is to perform the operation on all Media Library items.
You can find ID values in the "ID/Parent" column or by by hovering over the thumbnail image in the Media/Assistant submenu table; look for the number following post= in the item’s URL.' ),
'warning' => array( 'handler' => '', 'comment' => 'These tools make permanent updates to your database. Make a backup before you use the tools so you can restore your old values if you don’t like the results.' ),
'trash' => array( 'handler' => '', 'comment' => 'You can define ("MEDIA_TRASH", true); in your wp-config.php to activate the WordPress "Trash" feature for attachments.' ),
'c0' => array( 'handler' => '', 'comment' => '