Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintenance from contributors #60

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.svn
/nbproject/
20 changes: 18 additions & 2 deletions AdminPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -35,6 +35,8 @@ abstract class scbAdminPage {
// l10n
protected $textdomain;

protected $nonce;


// ____________REGISTRATION COMPONENT____________

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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.
*
Expand Down
6 changes: 5 additions & 1 deletion Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ) ) {
Expand Down
8 changes: 7 additions & 1 deletion Forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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
Expand All @@ -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',
) );
Expand Down Expand Up @@ -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'] ) ) {
Expand All @@ -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',
) );
Expand Down
12 changes: 12 additions & 0 deletions PostMetabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down