Skip to content

Commit 8552ac0

Browse files
committed
Maintenance changes from PR on original [scribu#60]
Contributors: - dikiyforester - meloniq - squigglybob
1 parent 9594a83 commit 8552ac0

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

AdminPage.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function __construct( $file = false, $options = null ) {
135135
}
136136

137137
add_action( 'admin_menu', array( $this, 'page_init' ), $this->args['admin_action_priority'] );
138-
add_filter( 'contextual_help', array( $this, '_contextual_help' ), 10, 2 );
138+
add_action( 'current_screen', array( $this, '_contextual_help_compat' ) );
139139

140140
if ( $file ) {
141141
$this->file = $file;
@@ -553,6 +553,20 @@ public function _contextual_help( $help, $screen ) {
553553
return $help;
554554
}
555555

556+
/**
557+
* Sets the old string-based contextual help for the screen for backward compatibility.
558+
*
559+
* @param WP_Screen $screen
560+
*/
561+
public function _contextual_help_compat( $screen ) {
562+
563+
$actual_help = $this->_contextual_help( '', $screen );
564+
565+
if ( $screen->id == $this->pagehook && $actual_help ) {
566+
$screen::add_old_compat_help( $screen, $actual_help );
567+
}
568+
}
569+
556570
/**
557571
* Displays page content.
558572
*

Cron.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ class scbCron {
2121
*
2222
* @return void
2323
*/
24-
public function __construct( $file = false, $args ) {
24+
public function __construct( $file = false, $args = array() ) {
25+
26+
if ( empty( $args ) ) {
27+
return;
28+
}
2529

2630
// Set time & schedule
2731
if ( isset( $args['time'] ) ) {

Forms.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static function form_table( $rows, $formdata = null ) {
6262
*
6363
* @return string
6464
*/
65-
public static function form( $inputs, $formdata = null, $nonce ) {
65+
public static function form( $inputs, $formdata = null, $nonce = 'update_options' ) {
6666
$output = '';
6767
foreach ( $inputs as $input ) {
6868
$output .= self::input( $input, $formdata );
@@ -842,7 +842,10 @@ class scbRadiosField extends scbSelectField {
842842
* @return string
843843
*/
844844
protected function _render_specific( $args ) {
845-
845+
$args = wp_parse_args( $args, array(
846+
'extra' => array(),
847+
) );
848+
846849
if ( array( 'foo' ) === $args['selected'] ) {
847850
// radio buttons should always have one option selected
848851
$args['selected'] = key( $args['choices'] );
@@ -857,6 +860,7 @@ protected function _render_specific( $args ) {
857860
'type' => 'radio',
858861
'value' => $value,
859862
'checked' => ( $value == $args['selected'] ),
863+
'extra' => $args['extra'],
860864
'desc' => $title,
861865
'desc_pos' => 'after',
862866
) );
@@ -895,6 +899,7 @@ protected function _render( $args ) {
895899
$args = wp_parse_args( $args, array(
896900
'numeric' => false, // use numeric array instead of associative
897901
'checked' => null,
902+
'extra' => array(),
898903
) );
899904

900905
if ( ! is_array( $args['checked'] ) ) {
@@ -908,6 +913,7 @@ protected function _render( $args ) {
908913
'type' => 'checkbox',
909914
'value' => $value,
910915
'checked' => in_array( $value, $args['checked'] ),
916+
'extra' => $args['extra'],
911917
'desc' => $title,
912918
'desc_pos' => 'after',
913919
) );

0 commit comments

Comments
 (0)