diff --git a/.gitignore b/.gitignore index 90ec22b..24d637e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .svn +/nbproject/ diff --git a/AdminPage.php b/AdminPage.php index 7eb4c3b..f0432b0 100644 --- a/AdminPage.php +++ b/AdminPage.php @@ -10,7 +10,7 @@ abstract class scbAdminPage { * $menu_title (string) (default: $page_title) * $submenu_title (string) (default: $menu_title) * $page_slug (string) (default: sanitized $page_title) - * $toplevel (string) If not empty, will create a new top level menu (for expected values see http://codex.wordpress.org/Administration_Menus#Using_add_submenu_page) + * $toplevel (string) If not empty, will create a new top level menu (for expected values see https://codex.wordpress.org/Administration_Menus#Using_add_submenu_page) * - $icon_url (string) URL to an icon for the top level menu * - $position (int) Position of the toplevel menu (caution!) * $screen_icon (string) The icon type to use in the screen header @@ -35,6 +35,8 @@ abstract class scbAdminPage { // l10n protected $textdomain; + protected $nonce; + // ____________REGISTRATION COMPONENT____________ @@ -135,7 +137,7 @@ public function __construct( $file = false, $options = null ) { } add_action( 'admin_menu', array( $this, 'page_init' ), $this->args['admin_action_priority'] ); - add_filter( 'contextual_help', array( $this, '_contextual_help' ), 10, 2 ); + add_action( 'current_screen', array( $this, '_contextual_help_compat' ) ); if ( $file ) { $this->file = $file; @@ -553,6 +555,20 @@ public function _contextual_help( $help, $screen ) { return $help; } + /** + * Sets the old string-based contextual help for the screen for backward compatibility. + * + * @param WP_Screen $screen + */ + public function _contextual_help_compat( $screen ) { + + $actual_help = $this->_contextual_help( '', $screen ); + + if ( $screen->id == $this->pagehook && $actual_help ) { + $screen::add_old_compat_help( $screen, $actual_help ); + } + } + /** * Displays page content. * diff --git a/Cron.php b/Cron.php index 27341bf..4cdc553 100644 --- a/Cron.php +++ b/Cron.php @@ -21,7 +21,11 @@ class scbCron { * * @return void */ - public function __construct( $file = false, $args ) { + public function __construct( $file = false, $args = array() ) { + + if ( empty( $args ) ) { + return; + } // Set time & schedule if ( isset( $args['time'] ) ) { diff --git a/Forms.php b/Forms.php index 43c4cd1..82ece4c 100644 --- a/Forms.php +++ b/Forms.php @@ -62,7 +62,7 @@ public static function form_table( $rows, $formdata = null ) { * * @return string */ - public static function form( $inputs, $formdata = null, $nonce ) { + public static function form( $inputs, $formdata = null, $nonce = 'update_options' ) { $output = ''; foreach ( $inputs as $input ) { $output .= self::input( $input, $formdata ); @@ -842,6 +842,9 @@ class scbRadiosField extends scbSelectField { * @return string */ protected function _render_specific( $args ) { + $args = wp_parse_args( $args, array( + 'extra' => array(), + ) ); if ( array( 'foo' ) === $args['selected'] ) { // radio buttons should always have one option selected @@ -857,6 +860,7 @@ protected function _render_specific( $args ) { 'type' => 'radio', 'value' => $value, 'checked' => ( $value == $args['selected'] ), + 'extra' => $args['extra'], 'desc' => $title, 'desc_pos' => 'after', ) ); @@ -895,6 +899,7 @@ protected function _render( $args ) { $args = wp_parse_args( $args, array( 'numeric' => false, // use numeric array instead of associative 'checked' => null, + 'extra' => array(), ) ); if ( ! is_array( $args['checked'] ) ) { @@ -908,6 +913,7 @@ protected function _render( $args ) { 'type' => 'checkbox', 'value' => $value, 'checked' => in_array( $value, $args['checked'] ), + 'extra' => $args['extra'], 'desc' => $title, 'desc_pos' => 'after', ) ); diff --git a/PostMetabox.php b/PostMetabox.php index bfae253..8f58843 100644 --- a/PostMetabox.php +++ b/PostMetabox.php @@ -28,6 +28,18 @@ class scbPostMetabox { */ private $post_data = array(); + /** + * Metabox context. + * @var string + */ + private $context; + + /** + * Metabox priority. + * @var string + */ + private $priority; + /** * Action hooks. * @var array