Skip to content

Commit

Permalink
check/set existence of checkbox option late
Browse files Browse the repository at this point in the history
avoids PHP notice
  • Loading branch information
afragen committed Jul 31, 2016
1 parent 95744fb commit 684ce1e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/GitHub_Updater/Settings.php
Expand Up @@ -61,13 +61,6 @@ public function __construct() {
&$this,
'plugin_action_links',
) );

// Make sure array values exist.
foreach ( array_keys( self::$remote_management ) as $key ) {
if ( empty( parent::$options_remote[ $key ] ) ) {
parent::$options_remote[ $key ] = null;
}
}
}

/**
Expand Down Expand Up @@ -656,9 +649,10 @@ public function token_callback_text( $args ) {
* @param $args
*/
public function token_callback_checkbox( $args ) {
$checked = isset( parent::$options[ $args['id'] ] ) ? parent::$options[ $args['id'] ] : null;
?>
<label for="<?php esc_attr_e( $args['id'] ); ?>">
<input type="checkbox" name="github_updater[<?php esc_attr_e( $args['id'] ); ?>]" value="1" <?php checked( '1', parent::$options[ $args['id'] ], true ); ?> >
<input type="checkbox" name="github_updater[<?php esc_attr_e( $args['id'] ); ?>]" value="1" <?php checked( '1', $checked, true ); ?> >
</label>
<?php
}
Expand All @@ -672,9 +666,10 @@ public function token_callback_checkbox( $args ) {
* @return bool|void
*/
public function token_callback_checkbox_remote( $args ) {
$checked = isset( parent::$options_remote[ $args['id'] ] ) ? parent::$options_remote[ $args['id'] ] : null;
?>
<label for="<?php esc_attr_e( $args['id'] ); ?>">
<input type="checkbox" name="github_updater_remote_management[<?php esc_attr_e( $args['id'] ); ?>]" value="1" <?php checked( '1', parent::$options_remote[ $args['id'] ], true ); ?> >
<input type="checkbox" name="github_updater_remote_management[<?php esc_attr_e( $args['id'] ); ?>]" value="1" <?php checked( '1', $checked, true ); ?> >
</label>
<?php
}
Expand Down

0 comments on commit 684ce1e

Please sign in to comment.