PluginProbe
Cool Timeline (Horizontal & Vertical Timeline) / trunk
Cool Timeline (Horizontal & Vertical Timeline) vtrunk
3.4.0 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 2.2.3 2.3.3 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.6.1 2.7.1 2.8.3 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 2.9.9 3.0.0 All 79 releases
cool-timeline / includes / shortcodes / class-ctl-settings.php

class-ctl-settings.php in Cool Timeline (Horizontal & Vertical Timeline) trunk, at includes/shortcodes/class-ctl-settings.php

77 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals -- Legacy CTL_* class name kept for compatibility.
3 /**
4 * CTL Settings.
5 *
6 * @package CTL
7 */
8
9 /**
10 * Do not access the page directly
11 */
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit;
14 }
15
16
17 /**
18 * Create shortcode class if class not exists
19 */
20 if ( ! class_exists( 'CTL_Settings' ) ) {
21
22 /**
23 * Class Shortcode.
24 */
25 class CTL_Settings {
26
27 /**
28 * Configure settings array
29 *
30 * @var settings
31 */
32 public $settings = array();
33
34 /**
35 * Constructor
36 */
37 public function __construct() {
38 $this->settings = get_option( 'cool_timeline_settings' );
39 }
40
41 /**
42 * Get Settings and set default values
43 */
44 public function ctl_get_settings() {
45 $settings = array();
46 $settings_arr = $this->settings;
47
48 $settings['timeline_background'] = isset( $settings_arr['timeline_background'] ) ? sanitize_text_field( $settings_arr['timeline_background'] ) : 0; // Sanitize
49
50 $settings['timeline_bg_color'] = isset( $settings_arr['timeline_bg_color'] ) ? sanitize_hex_color( $settings_arr['timeline_bg_color'] ) : ''; // Sanitize as hex color
51
52 $settings['timeline_title'] = isset( $settings_arr['timeline_header']['title_text'] ) ? sanitize_text_field( $settings_arr['timeline_header']['title_text'] ) : ''; // Sanitize text
53
54 $settings['timeline_image'] = isset( $settings_arr['timeline_header']['user_avatar'] ) ? $settings_arr['timeline_header']['user_avatar'] : ''; // Sanitize URL
55
56 $settings['story_content_length'] = isset( $settings_arr['story_content_settings']['content_length'] ) ? intval( $settings_arr['story_content_settings']['content_length'] ) : 50; // Sanitize as integer
57
58 $settings['story_link_target'] = isset( $settings_arr['story_content_settings']['story_link_target'] ) ? esc_attr( $settings_arr['story_content_settings']['story_link_target'] ) : '_self'; // Sanitize attribute
59
60 $settings['display_readmore'] = isset( $settings_arr['story_content_settings']['display_readmore'] ) ? esc_attr( $settings_arr['story_content_settings']['display_readmore'] ) : 'yes'; // Sanitize attribute
61
62 $settings['first_story_position'] = isset( $settings_arr['first_story_position'] ) ? sanitize_text_field( $settings_arr['first_story_position'] ) : 'right'; // Sanitize text
63
64 $settings['year_label'] = isset( $settings_arr['story_date_settings']['year_label_visibility'] ) ? sanitize_text_field( $settings_arr['story_date_settings']['year_label_visibility'] ) : 1; // Sanitize
65
66 $settings['timeline_title_tag'] = isset( $settings_arr['title_tag'] ) ? sanitize_text_field( $settings_arr['title_tag'] ) : 'H2'; // Sanitize text
67
68 $settings['title_color'] = isset( $settings_arr['title_color'] ) ? sanitize_hex_color( $settings_arr['title_color'] ) : '#fff'; // Sanitize as hex color
69
70 $settings['year_bg_color'] = isset( $settings_arr['circle_border_color'] ) ? sanitize_hex_color( $settings_arr['circle_border_color'] ) : '#333333'; // Sanitize as hex color
71 return $settings;
72 }
73
74 }
75
76 }
77