$value) { $result[$key] = _object_to_array($value); } return $result; } return $object; } function resourceURL($file){ return plugins_url($file, __FILE__); } function init_plugin(){ add_option('SnazzyMapUniqueStyle'); } add_action('init', 'init_plugin'); //Pass the style information into the javascript file on the main page function enqueue_script() { $uniqueStyle = get_option('SnazzyMapDefaultStyle'); if(!empty($uniqueStyle) && !is_null($uniqueStyle)){ $handle = 'snazzymaps-js'; wp_enqueue_script($handle, plugins_url('snazzymaps.js', __FILE__), $deps = array('jquery'), $ver = SNAZZY_VERSION_NUMBER, $in_footer = false); //We have to use l10n_print_after so we can support older versions of WordPress $json = new Services_JSON(); wp_localize_script($handle, 'SnazzyDataForSnazzyMaps', array('l10n_print_after' => 'SnazzyDataForSnazzyMaps=' . $json->encode($uniqueStyle))); } } add_action( 'wp_enqueue_scripts', 'enqueue_script'); //Found in admin/index.php add_action( 'admin_enqueue_scripts', 'admin_enqueue_script'); function admin_add_custom_menu(){ add_theme_page('Snazzy Maps', 'Snazzy Maps', 'manage_options', 'snazzy_maps', 'admin_add_custom_content'); } add_action( 'admin_menu', 'admin_add_custom_menu'); // Add a settings link to the plugin listing page add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'my_plugin_action_links' ); function my_plugin_action_links( $links ) { array_unshift($links, 'Settings'); return $links; } //The post method is performed by the tab before redirecting add_action ('admin_head-appearance_page_snazzy_maps', 'admin_perform_post'); ?>