'; 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(): void { $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(): void { $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(): void { $checked = self::$options['show_feed']; echo ' '; esc_html_e( 'Enable', 'stklcode-liveticker' ); echo '' . esc_html__( 'Can be overwritten in shortcode.', 'stklcode-liveticker' ) . '
'; } /** * Render enable shortcode field. * * @return void * * @since 1.2 */ public static function settings_enable_shortcode_field(): void { $checked = self::$options['enable_shortcode']; echo ' '; esc_html_e( 'Enable', 'stklcode-liveticker' ); echo '' . esc_html__( 'Enable shortcode processing in tick content.', 'stklcode-liveticker' ) . '
'; } /** * Render embedded script field. * * @return void * * @since 1.2 */ public static function settings_embedded_script_field(): void { $checked = self::$options['embedded_script']; echo ' '; esc_html_e( 'Enable', 'stklcode-liveticker' ); echo '' . esc_html__( 'Allow embedded script evaluation in tick contents. This might be useful for embedded content, e.g. social media integrations.', 'stklcode-liveticker' ) . '
'; } /** * Render the settings page. * * @return void */ public static function settings_page(): void { include SCLIVETICKER_DIR . 'views/settings-page.php'; } /** * Validate settings callback. * * @param array $input Input arguments. * * @return array Parsed arguments. */ public static function validate_settings( array $input ): array { $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; $result['enable_shortcode'] = isset( $input['enable_shortcode'] ) ? intval( $input['enable_shortcode'] ) : 0; $result['embedded_script'] = isset( $input['embedded_script'] ) ? intval( $input['embedded_script'] ) : 0; return $result; } /** * Register custom Gutenberg block type. * * @return void * @since 1.1 */ public static function register_block(): void { 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', ) ); } }