'; echo '
' . esc_html__( 'Disable this option to not use AJAX update. This means all liveticker widgets and shortcodes are only updated once on site load.', 'stklcode-liveticker' ) . '
'; } /** * Render AJAX poll interval field. * * @return void */ public static function settings_poll_interval_field() { $poll_interval = self::$options['poll_interval']; echo ' '; esc_html_e( 'seconds', 'stklcode-liveticker' ); echo '' . esc_html__( 'Interval (in seconds) to update ticker if AJAX is enabled.', 'stklcode-liveticker' ) . '
'; } /** * Render enable css field. * * @return void */ public static function settings_enable_css_field() { $checked = self::$options['enable_css']; echo ' '; esc_html_e( 'Enable', 'stklcode-liveticker' ); echo '' . esc_html__( 'Disable this option to remove the default styling CSS file.', 'stklcode-liveticker' ) . '
'; } /** * Render enable css field. * * @return void */ public static function settings_show_feed_field() { $checked = self::$options['show_feed']; echo ' '; esc_html_e( 'Enable', 'stklcode-liveticker' ); echo '' . esc_html__( 'Can be overwritten in shortcode.', 'stklcode-liveticker' ) . '
'; } /** * Render the settings page. * * @return void */ public static function settings_page() { include SCLIVETICKER_DIR . 'views/settings-page.php'; } /** * Validate settings callback. * * @param array $input Input arguments. * * @return array Parsed arguments. */ public static function validate_settings( $input ) { $defaults = self::default_options(); $result['enable_ajax'] = isset( $input['enable_ajax'] ) ? intval( $input['enable_ajax'] ) : 0; $result['poll_interval'] = isset( $input['poll_interval'] ) ? intval( $input['poll_interval'] ) : $defaults['poll_interval']; $result['enable_css'] = isset( $input['enable_css'] ) ? intval( $input['enable_css'] ) : 0; $result['show_feed'] = isset( $input['show_feed'] ) ? intval( $input['show_feed'] ) : 0; return $result; } /** * Register custom Gutenberg block type. * * @return void * @since 1.1 */ public static function register_block() { wp_register_script( 'scliveticker-editor', SCLIVETICKER_BASE . 'scripts/block.min.js', array( 'wp-blocks', 'wp-element' ), self::VERSION, true ); wp_register_style( 'scliveticker-editor', SCLIVETICKER_BASE . 'styles/block.min.css', array(), self::VERSION ); register_block_type( 'scliveticker-block/liveticker', array( 'editor_script' => 'scliveticker-editor', 'editor_style' => 'scliveticker-editor', ) ); } }