. */ class MetaTagManagerAdmin { /** loads the plugin */ function init() { // i18n load_plugin_textdomain ( 'meta-tag-manager', '', basename ( dirname ( __FILE__ ) ) ); // add plugin page to admin menu add_action ( 'admin_menu', array ( __CLASS__, 'menus' ) ); } /** adds plugin page to admin menu; put it under 'Settings' */ function menus() { $page = add_options_page ( __ ( 'Meta Tag Manager', 'meta-tag-manager' ), __ ( 'Meta Tag Manager', 'meta-tag-manager' ), 8, 'mtmverification', array ( __CLASS__, 'options' ) ); // add javascript add_action ( "admin_print_scripts-$page", array ( __CLASS__, 'scripts' ) ); } /** loads javascript on plugin admin page */ function scripts() { wp_enqueue_script ( 'meta-tag-manager', path_join ( WP_PLUGIN_URL, basename ( dirname ( __FILE__ ) ) . '/mtm_script.js' ), array ('jquery' ) ); } /** the plugin page and all the admin code – old php style spaghetti code */ function options() { add_option ( 'mtm_data' ); $mtm_data = array (); if (is_admin () and 1 == $_POST ['mtm_submitted']) { check_admin_referer ( 'mtmverification' ); for($i = 1; isset ( $_POST ["mtm_{$i}_ref"] ); $i ++) { $name = trim ( $_POST ["mtm_{$i}_name"] ); $content = trim ( $_POST ["mtm_{$i}_content"] ); $ref = trim ( $_POST ["mtm_{$i}_ref"] ); if ( get_magic_quotes_gpc() ) { $name = stripslashes ( $name ); $content = stripslashes ( $content ); $ref = stripslashes ( $ref ); } if ('' != $name and '' != $content) { $meta = array ($name, $content, $ref ); if (isset ( $_POST ["mtm_{$i}_homepageonly"] )) $meta [3] = 1; $mtm_data [] = $meta; } } update_option ( 'mtm_data', $mtm_data ); echo '
' . __ ( 'Settings saved.' ) . '