-
-
Save tommcfarlin/5426f8d7e592eb99a128d663aec87b01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
private function load_dates() { | |
$options = get_option( 'acme_date_options' ); | |
$event_settings = $options['event']; | |
$import = $event_settings['import']; | |
$post_type = $event_settings['post-type']; | |
if ( ( 0 === strcmp( 'yes', $import ) ) && ( 0 === strcmp( 'events', $post_type ) ) ) { | |
// This is where you take whatever action you want. | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
private function load_dates() { | |
$options = get_option( 'acme_date_options' ); | |
if ( ! isset( $options['event'] ) ) { | |
return; | |
} | |
$event_settings = $options['event']; | |
if ( ! isset( $event_settings['import'] ) || ! isset( $event_settings['post-type'] ) ) { | |
return; | |
} | |
$import = $event_settings['import']; | |
$post_type = $event_settings['post-type']; | |
if ( ( 0 === strcmp( 'yes', $import ) ) && ( 0 === strcmp( 'events', $post_type ) ) ) { | |
// This is where you take whatever action you want. | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
private function has_valid_option( $option ) { | |
return isset( $option ); | |
} | |
private function has_valid_values( $value1, $value2 ) { | |
return ! ( isset( $value1 ) && isset( $value2 ) ); | |
} | |
private function can_import_data( $value1, $value2 ) { | |
return | |
( 0 === strcmp( 'yes', $value1 ) ) && | |
( 0 === strcmp( 'events', $value2 ) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
private function load_dates() { | |
$options = get_option( 'acme_date_options' ); | |
if ( ! $this->has_valid_option( $options ) ) { | |
return; | |
} | |
$event_settings = $options['event']; | |
if ( ! $this->has_valid_values( $event_settings['import'], $event_settings['post-type'] ) ) { | |
return; | |
} | |
$import = $event_settings['import']; | |
$post_type = $event_settings['post-type']; | |
if ( $this->can_import_data( $import, $post_type ) ) { | |
// This is where you take whatever action you want. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment