Example #1
0
function sociable_activate()
{
    if (!get_option('sociable_options')) {
        return sociable_reset();
    }
}
 /**
  * Add The Menu Pages To The Administration Options
  */
 function add_menu_pages()
 {
     global $sociable_post_types;
     $url = $_SERVER["QUERY_STRING"];
     //	$page[] = add_options_page( __( 'Sociable Options' ), __( 'Sociable Plugin' ), 'manage_options', 'sociable_select' , array( 'sociable_Admin_Options' , 'Select_Sociable_Page' ) );
     //$page[]= add_plugins_page( __( 'Sociable Options' ), __( 'Sociable Plugin' ), 'manage_options', 'Create_Options_Page_Skycraper'  );
     //$page[]= add_plugins_page( 'sociable_options', 'sociable_options', 'read', 'Create_Options_Page'  );
     $page[] = add_options_page("", "", 'manage_options', 'sociable_select', array('sociable_Admin_Options', 'Select_Sociable_Page'));
     $page[] = add_options_page("", "", 'manage_options', 'sociable_options', array('sociable_Admin_Options', 'Create_Options_Page'));
     $page[] = add_options_page("", "", 'manage_options', 'skyscraper_options', array('sociable_Admin_Options', 'Create_Options_Page_Skycraper'));
     // Add a new submenu under Settings:
     //	$page[] =  add_options_page(__( 'Sociable Options' ),__( 'Sociable Plugin' ), 'manage_options', 'sociable_select', 'Select_Sociable_Page');
     // Add a new top-level menu (ill-advised):
     add_menu_page(__('Sociable Options'), __('Select Sociable Plugin'), 'manage_options', '/options-general.php?page=sociable_select');
     // Add a submenu to the custom top-level menu:
     add_submenu_page('options-general.php?page=sociable_select', __('Sociable Options'), __('Sociable Options'), 'manage_options', 'sociable_options', array('sociable_Admin_Options', 'Create_Options_Page'));
     // Add a second submenu to the custom top-level menu:
     add_submenu_page('options-general.php?page=sociable_select', __('Skyscraper Options'), __('Skyscraper Options'), 'manage_options', 'skyscraper_options', array('sociable_Admin_Options', 'Create_Options_Page_Skycraper'));
     //Add CSS And Javascript Specific To This Options Pages
     add_action('admin_print_styles-' . $page[0], array('sociable_Admin_Options', 'enqueue_styles'));
     add_action('admin_print_scripts-' . $page[0], array('sociable_Admin_Options', 'enqueue_scripts'));
     add_action('admin_print_styles-' . $page[1], array('sociable_Admin_Options', 'enqueue_styles'));
     add_action('admin_print_scripts-' . $page[1], array('sociable_Admin_Options', 'enqueue_scripts'));
     add_action('admin_print_styles-' . $page[2], array('sociable_Admin_Options', 'enqueue_styles'));
     add_action('admin_print_scripts-' . $page[2], array('sociable_Admin_Options', 'enqueue_scripts'));
     if (isset($_POST['sociable_reset'])) {
         check_admin_referer('sociable-reset');
         sociable_reset();
         wp_redirect($_SERVER['HTTP_REFERER']);
     }
     if (isset($_POST['skyscraper_reset'])) {
         check_admin_referer('sociable-reset');
         skyscraper_reset();
         wp_redirect($_SERVER['HTTP_REFERER']);
     }
     /*
      * We can create The Meta Boxes Here
      */
     foreach ($sociable_post_types as $type => $data) {
         self::add_meta_box($type);
     }
     //Also on posts and pages
     self::add_meta_box('post');
     self::add_meta_box('page');
 }