remove underscore prefix from $_options field
This commit is contained in:
@ -129,7 +129,7 @@ class SCLiveticker_Admin extends SCLiveticker {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function settings_enable_ajax_field() {
|
public static function settings_enable_ajax_field() {
|
||||||
$checked = self::$_options['enable_ajax'];
|
$checked = self::$options['enable_ajax'];
|
||||||
|
|
||||||
echo '<input id="' . esc_attr( self::OPTION ) . '-enable-ajax" type="checkbox" name="' . esc_attr( self::OPTION ) . '[enable_ajax]" value="1" ' . checked( $checked, 1, false ) . '> ';
|
echo '<input id="' . esc_attr( self::OPTION ) . '-enable-ajax" type="checkbox" name="' . esc_attr( self::OPTION ) . '[enable_ajax]" value="1" ' . checked( $checked, 1, false ) . '> ';
|
||||||
esc_html_e( 'Enable', 'stklcode-liveticker' );
|
esc_html_e( 'Enable', 'stklcode-liveticker' );
|
||||||
@ -142,7 +142,7 @@ class SCLiveticker_Admin extends SCLiveticker {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function settings_poll_interval_field() {
|
public static function settings_poll_interval_field() {
|
||||||
$poll_interval = self::$_options['poll_interval'];
|
$poll_interval = self::$options['poll_interval'];
|
||||||
|
|
||||||
echo '<input id="' . esc_attr( self::OPTION ) . '-poll-interval" type="number" name="' . esc_attr( self::OPTION ) . '[poll_interval]" value="' . esc_attr( $poll_interval ) . '"> ';
|
echo '<input id="' . esc_attr( self::OPTION ) . '-poll-interval" type="number" name="' . esc_attr( self::OPTION ) . '[poll_interval]" value="' . esc_attr( $poll_interval ) . '"> ';
|
||||||
esc_html_e( 'seconds', 'stklcode-liveticker' );
|
esc_html_e( 'seconds', 'stklcode-liveticker' );
|
||||||
@ -156,7 +156,7 @@ class SCLiveticker_Admin extends SCLiveticker {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function settings_enable_css_field() {
|
public static function settings_enable_css_field() {
|
||||||
$checked = self::$_options['enable_css'];
|
$checked = self::$options['enable_css'];
|
||||||
|
|
||||||
echo '<input id="' . esc_attr( self::OPTION ) . '-enable-css" type="checkbox" name="' . esc_attr( self::OPTION ) . '[enable_css]" value="1" ' . checked( $checked, 1, false ) . ' /> ';
|
echo '<input id="' . esc_attr( self::OPTION ) . '-enable-css" type="checkbox" name="' . esc_attr( self::OPTION ) . '[enable_css]" value="1" ' . checked( $checked, 1, false ) . ' /> ';
|
||||||
esc_html_e( 'Enable', 'stklcode-liveticker' );
|
esc_html_e( 'Enable', 'stklcode-liveticker' );
|
||||||
@ -169,7 +169,7 @@ class SCLiveticker_Admin extends SCLiveticker {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function settings_show_feed_field() {
|
public static function settings_show_feed_field() {
|
||||||
$checked = self::$_options['show_feed'];
|
$checked = self::$options['show_feed'];
|
||||||
|
|
||||||
echo '<input id="' . esc_attr( self::OPTION ) . '-show-feed" type="checkbox" name="' . esc_attr( self::OPTION ) . '[show_feed]" value="1" ' . checked( $checked, 1, false ) . ' /> ';
|
echo '<input id="' . esc_attr( self::OPTION ) . '-show-feed" type="checkbox" name="' . esc_attr( self::OPTION ) . '[show_feed]" value="1" ' . checked( $checked, 1, false ) . ' /> ';
|
||||||
esc_html_e( 'Enable', 'stklcode-liveticker' );
|
esc_html_e( 'Enable', 'stklcode-liveticker' );
|
||||||
|
@ -31,7 +31,7 @@ class SCLiveticker_System extends SCLiveticker {
|
|||||||
// Add default settings to database.
|
// Add default settings to database.
|
||||||
$defaults = self::default_options();
|
$defaults = self::default_options();
|
||||||
|
|
||||||
if ( self::$_options['reset_settings'] ) {
|
if ( self::$options['reset_settings'] ) {
|
||||||
// Reset requested, overwrite existing options with default.
|
// Reset requested, overwrite existing options with default.
|
||||||
update_option( self::OPTION, $defaults );
|
update_option( self::OPTION, $defaults );
|
||||||
} else {
|
} else {
|
||||||
|
@ -33,9 +33,9 @@ class SCLiveticker {
|
|||||||
/**
|
/**
|
||||||
* Plugin options.
|
* Plugin options.
|
||||||
*
|
*
|
||||||
* @var array $_options
|
* @var array $options
|
||||||
*/
|
*/
|
||||||
protected static $_options;
|
protected static $options;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marker if shortcode is present.
|
* Marker if shortcode is present.
|
||||||
@ -67,7 +67,7 @@ class SCLiveticker {
|
|||||||
self::update_options();
|
self::update_options();
|
||||||
|
|
||||||
// Skip on AJAX if not enabled disabled.
|
// Skip on AJAX if not enabled disabled.
|
||||||
if ( ( ! isset( self::$_options['enable_ajax'] ) || 1 !== self::$_options['enable_ajax'] ) && ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
|
if ( ( ! isset( self::$options['enable_ajax'] ) || 1 !== self::$options['enable_ajax'] ) && ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ class SCLiveticker {
|
|||||||
add_action( 'wp_footer', array( __CLASS__, 'enqueue_scripts' ) );
|
add_action( 'wp_footer', array( __CLASS__, 'enqueue_scripts' ) );
|
||||||
|
|
||||||
// Add AJAX hook if configured.
|
// Add AJAX hook if configured.
|
||||||
if ( 1 === self::$_options['enable_ajax'] ) {
|
if ( 1 === self::$options['enable_ajax'] ) {
|
||||||
add_action( 'wp_ajax_sclt_update-ticks', array( __CLASS__, 'ajax_update' ) );
|
add_action( 'wp_ajax_sclt_update-ticks', array( __CLASS__, 'ajax_update' ) );
|
||||||
add_action( 'wp_ajax_nopriv_sclt_update-ticks', array( __CLASS__, 'ajax_update' ) );
|
add_action( 'wp_ajax_nopriv_sclt_update-ticks', array( __CLASS__, 'ajax_update' ) );
|
||||||
}
|
}
|
||||||
@ -195,11 +195,11 @@ class SCLiveticker {
|
|||||||
if ( isset( $atts['feed'] ) ) {
|
if ( isset( $atts['feed'] ) ) {
|
||||||
$show_feed = 'true' === strtolower( $atts['feed'] ) || '1' === $atts['feed'];
|
$show_feed = 'true' === strtolower( $atts['feed'] ) || '1' === $atts['feed'];
|
||||||
} else {
|
} else {
|
||||||
$show_feed = 1 === self::$_options['show_feed'];
|
$show_feed = 1 === self::$options['show_feed'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = '<ul class="sclt-ticker';
|
$output = '<ul class="sclt-ticker';
|
||||||
if ( 1 === self::$_options['enable_ajax'] ) {
|
if ( 1 === self::$options['enable_ajax'] ) {
|
||||||
$output .= ' sclt-ticker-ajax" '
|
$output .= ' sclt-ticker-ajax" '
|
||||||
. 'data-sclt-ticker="' . $ticker . '" '
|
. 'data-sclt-ticker="' . $ticker . '" '
|
||||||
. 'data-sclt-limit="' . $limit . '" '
|
. 'data-sclt-limit="' . $limit . '" '
|
||||||
@ -255,7 +255,8 @@ class SCLiveticker {
|
|||||||
'wplt-css',
|
'wplt-css',
|
||||||
SCLIVETICKER_BASE . 'styles/liveticker.min.css',
|
SCLIVETICKER_BASE . 'styles/liveticker.min.css',
|
||||||
'',
|
'',
|
||||||
self::VERSION, 'all'
|
self::VERSION,
|
||||||
|
'all'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -283,7 +284,7 @@ class SCLiveticker {
|
|||||||
array(
|
array(
|
||||||
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||||
'nonce' => wp_create_nonce( 'scliveticker_update-ticks' ),
|
'nonce' => wp_create_nonce( 'scliveticker_update-ticks' ),
|
||||||
'poll_interval' => self::$_options['poll_interval'] * 1000,
|
'poll_interval' => self::$options['poll_interval'] * 1000,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -385,7 +386,7 @@ class SCLiveticker {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected static function update_options( $options = null ) {
|
protected static function update_options( $options = null ) {
|
||||||
self::$_options = wp_parse_args(
|
self::$options = wp_parse_args(
|
||||||
get_option( self::OPTION ),
|
get_option( self::OPTION ),
|
||||||
self::default_options()
|
self::default_options()
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user