PluginProbe
HootKit / trunk
HootKit vtrunk
trunk 2.0.21 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5
hootkit / include / class-strings.php

class-strings.php in HootKit trunk, at include/class-strings.php

169 lines 6.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * HootKit Strings
4 *
5 * @package Hootkit
6 */
7
8 namespace HootKit\Inc;
9
10 // If this file is called directly, abort.
11 if ( ! defined( 'ABSPATH' ) ) {
12 die;
13 }
14
15 if ( ! class_exists( '\HootKit\Inc\Strings' ) ) :
16
17 class Strings {
18
19 /**
20 * Class Instance
21 */
22 private static $instance;
23
24 /**
25 * Strings
26 */
27 public static $strings = null;
28
29 /**
30 * Constructor
31 */
32 public function __construct() {}
33
34 /**
35 * Get String values.
36 *
37 * @param string $key
38 * @param string|bool $default
39 * @return string
40 */
41 public static function get_string( $key, $default = false ) {
42 $return = '';
43 if ( !is_array( self::$strings ) ) {
44 self::set_strings();
45 }
46 if ( !is_array( self::$strings ) ) {
47 $return = '';
48 } else {
49 $return = ( !empty( self::$strings[ $key ] ) ? self::$strings[ $key ] : '' );
50 }
51
52 if ( !empty( $return ) && is_string( $return ) ) {
53 return esc_html( $return );
54 } elseif ( is_string( $default ) ) {
55 // allow empty string default
56 return esc_html( $default );
57 } elseif ( function_exists( 'hootkit_formatlabel' ) ) {
58 return esc_html( hootkit_formatlabel( $key ) );
59 } else {
60 return esc_html( ucwords( str_replace( array( '-', '_' ), ' ' , $key ) ) );
61 }
62 }
63
64 /**
65 * Set strings upon first call
66 */
67 public static function set_strings() {
68 if ( null === self::$strings ) {
69 $strings = self::defaults();
70 self::$strings = wp_parse_args( apply_filters( 'hootkit_strings', array() ), $strings );
71 }
72 }
73
74 /**
75 * Default Strings
76 */
77 public static function defaults() {
78 return apply_filters( 'hootkit_inc_strings', array(
79
80 // Settings
81
82 'setting-widget' => __( 'Widgets', 'hootkit' ),
83 'setting-block' => __( 'Gutenberg Blocks', 'hootkit' ),
84 'setting-misc' => __( 'Miscellaneous', 'hootkit' ),
85 'setting-scgen' => __( 'Shortcode Generator', 'hootkit' ),
86
87 // Settings Display sets filters
88
89 'sliders' => __( 'Sliders', 'hootkit' ),
90 'content' => __( 'Content', 'hootkit' ),
91 'post' => __( 'Post', 'hootkit' ),
92 'display' => __( 'Display', 'hootkit' ),
93 'woocom' => __( 'WooCommerce', 'hootkit' ),
94 'misc' => __( 'Misc. Features', 'hootkit' ),
95
96 // Widgets
97
98 'widget-prefix' => __( 'HK > ', 'hootkit' ),
99
100 // Manifest : modules [Settings, Widget Title] :: 'types' => 'widget'
101
102 'slider-image' => __( 'Slider Images', 'hootkit' ),
103 'carousel' => __( 'Carousel', 'hootkit' ),
104 'ticker' => __( 'Ticker', 'hootkit' ),
105 'image' => __( 'Slider Images', 'hootkit' ),
106 'postimage' => __( 'Posts Slider', 'hootkit' ),
107
108 'content-posts-blocks' => __( 'Posts Blocks', 'hootkit' ),
109 'post-grid' => __( 'Posts Grid', 'hootkit' ),
110 'post-list' => __( 'Posts List', 'hootkit' ),
111 'postcarousel' => __( 'Posts Carousel', 'hootkit' ),
112 'postlistcarousel' => __( 'Posts List Carousel', 'hootkit' ),
113 'ticker-posts' => __( 'Posts Ticker', 'hootkit' ),
114 'slider-postimage' => __( 'Posts Slider', 'hootkit' ),
115 'page-content' => __( 'Page Content', 'hootkit' ),
116
117 'announce' => __( 'Announce', 'hootkit' ),
118 'profile' => __( 'About/Profile', 'hootkit' ),
119 'cta' => __( 'Call To Action', 'hootkit' ),
120 'content-blocks' => __( 'Content Blocks', 'hootkit' ),
121 'content-grid' => __( 'Content Grid', 'hootkit' ),
122 'contact-info' => __( 'Contact Info', 'hootkit' ),
123 'icon-list' => __( 'Icon List', 'hootkit' ),
124 'notice' => __( 'Notice Box', 'hootkit' ),
125 'number-blocks' => __( 'Number Blocks', 'hootkit' ),
126 'tabs' => __( 'Tabs', 'hootkit' ),
127 'toggle' => __( 'Toggle', 'hootkit' ),
128 'vcards' => __( 'Vcards', 'hootkit' ),
129
130 'buttons' => __( 'Buttons', 'hootkit' ),
131 'cover-image' => __( 'Cover Image', 'hootkit' ),
132 'icon' => __( 'Icon', 'hootkit' ),
133 'social-icons' => __( 'Social Icons', 'hootkit' ),
134
135 'products-carticon' => __( 'Products Cart Icon', 'hootkit' ),
136 'content-products-blocks' => __( 'Products Blocks', 'hootkit' ),
137 'product-list' => __( 'Products List', 'hootkit' ),
138 'productcarousel' => __( 'Products Carousel', 'hootkit' ),
139 'productlistcarousel' => __( 'Products List Carousel', 'hootkit' ),
140 'products-ticker' => __( 'Products Ticker', 'hootkit' ),
141 'products-search' => __( 'Products Search', 'hootkit' ),
142
143 // Manifest : modules [Settings] :: 'types' => 'misc'
144
145 'import' => __( 'Demo Import', 'hootkit' ),
146 'code' => __( 'Custom Code', 'hootkit' ),
147 'tools' => __( 'Tools (Import/Export)', 'hootkit' ),
148 'top-banner' => __( 'Top Banner', 'hootkit' ),
149 'shortcode-timer' => __( 'Timer (shortcode)', 'hootkit' ),
150 'fly-cart' => __( 'Offscreen WooCommerce Cart', 'hootkit' ),
151 'classic-widgets' => __( 'Classic Widgets', 'hootkit' ),
152 'widgets-as-sc' => __( 'Widgets as Shortcodes', 'hootkit' ),
153
154 ) );
155 }
156
157 /**
158 * Returns the instance
159 */
160 public static function get_instance() {
161 if ( ! isset( self::$instance ) ) {
162 self::$instance = new self();
163 }
164 return self::$instance;
165 }
166
167 }
168
169 endif;