PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / trunk
Shortcodes and extra features for Phlox theme vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / elements / dropcap.php
auxin-elements / includes / elements Last commit date
about-widget.php 5 months ago accordion-widget.php 1 month ago accordion.php 5 months ago attachment-url.php 5 months ago audio.php 5 months ago before-after.php 5 months ago button.php 5 months ago code.php 5 months ago contact-box.php 5 months ago contact-form.php 5 months ago custom-list.php 5 months ago divider.php 5 months ago dropcap.php 5 months ago facebook.php 5 months ago flickr.php 5 months ago gallery.php 5 months ago gmap.php 5 months ago highlight.php 5 months ago image.php 5 months ago instagram-feed.php 5 months ago latest-posts-slider.php 5 months ago popular-posts-widget.php 5 months ago products-grid.php 5 months ago quote.php 5 months ago recent-posts-grid-carousel.php 5 months ago recent-posts-land-style.php 5 months ago recent-posts-masonry.php 5 months ago recent-posts-tiles-carousel.php 5 months ago recent-posts-tiles.php 5 months ago recent-posts-timeline.php 5 months ago recent-posts-widget.php 5 months ago recent-products.php 5 months ago related-posts.php 8 years ago sample-element.php 5 months ago search.php 5 months ago socials-list.php 5 months ago staff.php 5 months ago tab-widget.php 5 months ago tabs.php 5 months ago testimonial.php 5 months ago text.php 5 months ago touch-slider.php 5 months ago video.php 5 months ago
dropcap.php
207 lines
1 <?php
2 /**
3 * Dropcap element
4 *
5 *
6 * @package Auxin
7 * @license LICENSE.txt
8 * @author averta
9 * @link http://phlox.pro/
10 * @copyright (c) 2010-2026 averta
11 */
12 function auxin_get_dropcap_master_array( $master_array ) {
13
14 $master_array['aux_dropcap'] = array(
15 'name' => __("Dropcap", 'auxin-elements' ),
16 'auxin_output_callback' => 'auxin_widget_dropcap_callback',
17 'base' => 'aux_dropcap',
18 'description' => __('Big styled character at the beginning of paragraph', 'auxin-elements' ),
19 'class' => 'aux-widget-dropcap',
20 'show_settings_on_create' => true,
21 'weight' => 1,
22 'is_widget' => false,
23 'is_shortcode' => true,
24 'category' => THEME_NAME,
25 'group' => '',
26 'admin_enqueue_js' => '',
27 'admin_enqueue_css' => '',
28 'front_enqueue_js' => '',
29 'front_enqueue_css' => '',
30 'icon' => 'aux-element aux-pb-icons-dropcap',
31 'custom_markup' => '',
32 'js_view' => '',
33 'html_template' => '',
34 'deprecated' => '',
35 'content_element' => '',
36 'as_parent' => '',
37 'as_child' => '',
38 'params' => array(
39 array(
40 'heading' => __('Dropcap style','auxin-elements' ),
41 'description' => '',
42 'param_name' => 'style',
43 'type' => 'aux_visual_select',
44 'def_value' => 'classic',
45 'holder' => '',
46 'class' => 'style',
47 'admin_label' => true,
48 'dependency' => '',
49 'weight' => '',
50 'group' => '' ,
51 'edit_field_class' => '',
52 'choices' => array(
53 'classic' => array(
54 'label' => __('Classic', 'auxin-elements' ),
55 'image' => AUXIN_URL . 'images/visual-select/dropcap-classic.svg'
56 ),
57 'square' => array(
58 'label' => __('Square', 'auxin-elements' ),
59 'image' => AUXIN_URL . 'images/visual-select/dropcap-square.svg'
60 ),
61 'square-outline' => array(
62 'label' => __('Outline Square', 'auxin-elements' ),
63 'image' => AUXIN_URL . 'images/visual-select/dropcap-square-outline.svg'
64 ),
65 'square-round' => array(
66 'label' => __('Round Square', 'auxin-elements' ),
67 'image' => AUXIN_URL . 'images/visual-select/dropcap-square-round.svg'
68 ),
69 'circle' => array(
70 'label' => __('Circle', 'auxin-elements' ),
71 'image' => AUXIN_URL . 'images/visual-select/dropcap-circle.svg'
72 ),
73 'circle-outline' => array(
74 'label' => __('Outline Circle', 'auxin-elements' ),
75 'image' => AUXIN_URL . 'images/visual-select/dropcap-circle-outline.svg'
76 )
77 )
78 ),
79 array(
80 'heading' => __('Content','auxin-elements' ),
81 'description' => __('Enter a text to show as dropcap text.', 'auxin-elements' ),
82 'param_name' => 'content',
83 'type' => 'textarea_html',
84 'value' => '',
85 'holder' => '',
86 'class' => 'content',
87 'admin_label' => false,
88 'dependency' => '',
89 'weight' => '',
90 'group' => '' ,
91 'edit_field_class' => ''
92 ),
93 array(
94 'heading' => __('Extra class name','auxin-elements' ),
95 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'auxin-elements' ),
96 'param_name' => 'extra_classes',
97 'type' => 'textfield',
98 'value' => '',
99 'holder' => '',
100 'class' => 'extra_classes',
101 'admin_label' => false,
102 'dependency' => '',
103 'weight' => '',
104 'group' => '' ,
105 'edit_field_class' => ''
106 )
107 )
108 );
109
110 return $master_array;
111 }
112
113 add_filter( 'auxin_master_array_shortcodes', 'auxin_get_dropcap_master_array', 10, 1 );
114
115 /**
116 * The front-end output of this element is returned by the following function
117 *
118 * @param array $atts The array containing the parsed values from shortcode, it should be same as defined params above.
119 * @param string $shortcode_content The shorcode content
120 * @return string The output of element markup
121 */
122 function auxin_widget_dropcap_callback( $atts, $shortcode_content = null ) {
123
124 // Defining default attributes
125 $default_atts = array(
126 'title' => '', // header title
127 'style' => 'classic',
128 'content' => '', // custom css class names for this element
129
130 'extra_classes' => '',
131 'custom_el_id' => '',
132 'base_class' => 'aux-widget-dropcap'
133 );
134
135 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
136 extract( $result['parsed_atts'] );
137
138 ob_start();
139
140 // widget header ------------------------------
141 echo wp_kses_post( $result['widget_header'] );
142 echo wp_kses_post( $result['widget_title'] );
143
144 // The output for element here
145 $class_names = "";
146
147 switch ($style) {
148 case 'classic':
149 $class_names = "dropcap";
150 break;
151 case 'square':
152 $class_names = "dropcap square";
153
154 break;
155 case 'square-outline':
156 $class_names = "dropcap square outline";
157
158 break;
159 case 'square-round':
160 $class_names = "dropcap square round";
161
162 break;
163 case 'square-round-outline':
164 $class_names = "dropcap square round outline";
165
166 break;
167 case 'circle':
168 $class_names = "dropcap circle";
169
170 break;
171 case 'circle-outline':
172 $class_names = "dropcap circle outline";
173
174 break;
175 }
176
177 $first_letter = substr( $content, 0, 1); // get the first letter
178
179 if ( $first_letter === "<") {
180 $tag = auxin_get_string_between($content, '<', '>');
181 $content = auxin_str_replace_first( "<" .$tag. ">" ,"" , $content );
182 $content = auxin_str_replace_first( "</".$tag. ">" ,"" , $content );
183 }
184
185 $first_letter = mb_substr( $content, 0, 1,'utf-8' ); // get the first letter
186 $rest_of_text = mb_substr( $content, 1, null, 'utf-8' ); // get the rest of text
187
188 echo '<p class="'. esc_attr( $extra_classes ) .'">' .
189 '<span class="'. esc_attr( $class_names ) .'">'. esc_html( $first_letter ) .'</span>'. wp_kses_post( $rest_of_text ) .
190 '</p>';
191
192 // widget footer ------------------------------
193 echo wp_kses_post( $result['widget_footer'] );
194
195 return ob_get_clean();
196 }
197
198
199 if( ! function_exists( 'auxin_str_replace_first' ) ) {
200
201 function auxin_str_replace_first($from, $to, $subject) {
202 $from = '/'.preg_quote($from, '/').'/';
203 return preg_replace($from, $to, $subject, 1);
204 }
205 }
206
207