* @version 02/09/2013 * @since 2.0.0 */ if ( ! function_exists( 'add_action' ) ) { echo "Hi there! I'm just a part of plugin, not much I can do when called directly."; exit; } class Add_Quicktag_Settings extends Add_Quicktag { protected static $classobj = NULL; // string for translation static public $textdomain; // string for options in table options static private $option_string; // string for plugin file static private $plugin; // post types for the settings static private $post_types_for_js; // string for nonce fields static public $nonce_string; protected $page_hook; /** * Handler for the action 'init'. Instantiates this class. * * @access public * @since 2.0.0 * @return $classobj */ public static function get_object() { if ( NULL === self :: $classobj ) { self :: $classobj = new self; } return self :: $classobj; } /** * Constructor, init on defined hooks of WP and include second class * * @access public * @since 0.0.2 * @uses register_activation_hook, register_uninstall_hook, add_action * @return void */ public function __construct() { if ( ! is_admin() ) return NULL; // textdomain from parent class self::$textdomain = parent::get_textdomain(); self::$option_string = parent::get_option_string(); self::$plugin = parent::get_plugin_string(); self::$post_types_for_js = parent::get_post_types_for_js(); self::$nonce_string = 'addquicktag_nonce'; register_uninstall_hook( __FILE__, array( 'Add_Quicktag_Settings', 'unregister_settings' ) ); // settings for an active multisite if ( is_multisite() && is_plugin_active_for_network( self::$plugin ) ) { add_action( 'network_admin_menu', array( $this, 'add_settings_page' ) ); // add settings link add_filter( 'network_admin_plugin_action_links', array( $this, 'network_admin_plugin_action_links' ), 10, 2 ); // save settings on network add_action( 'network_admin_edit_' . self::$option_string, array( $this, 'save_network_settings_page' ) ); // return message for update settings add_action( 'network_admin_notices', array( $this, 'get_network_admin_notices' ) ); // add script on settings page } else { add_action( 'admin_menu', array( $this, 'add_settings_page' ) ); // add settings link add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2 ); // use settings API add_action( 'admin_init', array( $this, 'register_settings' ) ); } // include js add_action( 'admin_print_scripts-settings_page_' . str_replace( '.php', '', plugin_basename( __FILE__ ) ), array( $this, 'print_scripts' ) ); // add meta boxes on settings pages add_action( 'addquicktag_settings_page_sidebar', array( $this, 'get_plugin_infos' ) ); add_action( 'addquicktag_settings_page_sidebar', array( $this, 'get_about_plugin' ) ); // include class for im/export require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'class-imexport.php'; } /** * Retrun allowed post types for include scripts * * @since 2.1.1 * @access public * @return Array */ public function get_post_types_for_js() { return self::$post_types_for_js; } /** * Return Textdomain string * * @access public * @since 2.0.0 * @return string */ public function get_textdomain() { return self :: $textdomain; } /** * Add settings link on plugins.php in backend * * @uses * @access public * @param array $links, string $file * @since 2.0.0 * @return string $links */ public function plugin_action_links( $links, $file ) { if ( parent :: get_plugin_string() == $file ) $links[] = '' . __('Settings') . ''; return $links; } /** * Add settings link on plugins.php on network admin in backend * * @uses * @access public * @param array $links, string $file * @since 2.0.0 * @return string $links */ public function network_admin_plugin_action_links( $links, $file ) { if ( parent :: get_plugin_string() == $file ) $links[] = '' . __('Settings') . ''; return $links; } /** * Add settings page in WP backend * * @uses add_options_page * @access public * @since 2.0.0 * @return void */ public function add_settings_page () { if ( is_multisite() && is_plugin_active_for_network( self::$plugin ) ) { add_submenu_page( 'settings.php', parent :: get_plugin_data( 'Name' ) . ' ' . __( 'Settings', $this->get_textdomain() ), parent :: get_plugin_data( 'Name' ), 'manage_options', plugin_basename(__FILE__), array( $this, 'get_settings_page' ) ); } else { add_options_page( parent :: get_plugin_data( 'Name' ) . ' ' . __( 'Settings', $this->get_textdomain() ), parent :: get_plugin_data( 'Name' ), 'manage_options', plugin_basename(__FILE__), array( $this, 'get_settings_page' ) ); add_action( 'contextual_help', array( $this, 'contextual_help' ), 10, 3 ); } } /** * Return form and markup on settings page * * @uses settings_fields, normalize_whitespace, is_plugin_active_for_network, get_site_option, get_option * @access public * @since 0.0.2 * @return void */ public function get_settings_page() { ?>
get_textdomain() ); ?>
get_textdomain() ); ?>
get_textdomain() ); ?>
' .$message . '
' . __( '' ) . '
'; return normalize_whitespace( $contextual_help ); } } $add_quicktag_settings = Add_Quicktag_Settings :: get_object();