PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 1.1.0
Shortcodes and extra features for Phlox theme v1.1.0
2.17.21 2.17.20 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 / admin / includes / admin-hooks.php
auxin-elements / admin / includes Last commit date
classes 9 years ago compatibility 9 years ago metaboxes 9 years ago modules 9 years ago admin-ajax.php 9 years ago admin-hooks.php 9 years ago admin-the-functions.php 9 years ago index.php 9 years ago
admin-hooks.php
306 lines
1 <?php
2
3
4
5
6 /*-----------------------------------------------------------------------------------*/
7 /* Add shortcode button to tinymce
8 /*-----------------------------------------------------------------------------------*/
9
10 function auxin_register_shortcode_button( $buttons ) {
11 array_push( $buttons, '|', 'phlox_shortcodes_button' );
12 return $buttons;
13 }
14
15 /**
16 * Add the shortcode button to TinyMCE
17 *
18 * @param array $plugin_array
19 * @return array
20 */
21 function auxin_add_elements_tinymce_plugin( $plugin_array ) {
22 $wp_version = get_bloginfo( 'version' );
23
24 $plugin_array['phlox_shortcodes_button'] = AUXELS_ADMIN_URL."/assets/js/tinymce/plugins/auxin-btns.js";
25
26 return $plugin_array;
27 }
28
29
30 function axion_init_shortcode_manager(){
31 if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
32 return;
33
34 add_filter( 'mce_external_plugins', 'auxin_add_elements_tinymce_plugin' );
35 add_filter( 'mce_buttons', 'auxin_register_shortcode_button' );
36 }
37 add_action("init", "axion_init_shortcode_manager");
38
39 /*-----------------------------------------------------------------------------------*/
40 /* Add Editor styles
41 /*-----------------------------------------------------------------------------------*/
42
43 function auxin_register_mce_buttons_style(){
44 wp_register_style('auxin_mce_buttons' , AUXELS_ADMIN_URL. '/assets/css/editor.css', NULL, '1.1');
45 wp_enqueue_style('auxin_mce_buttons');
46 }
47 add_action('admin_enqueue_scripts', 'auxin_register_mce_buttons_style');
48
49
50 /*-----------------------------------------------------------------------------------*/
51 /* Adds system status tab in theme about (welcome) page
52 /*-----------------------------------------------------------------------------------*/
53
54 function auxin_about_system_status( $sections ){
55
56 $sections['status'] = array(
57 'label' => __( 'System Status', 'auxin-elements' ),
58 'description' => __( 'The informaition about your WordPress installation which can be helpful for debugging or monitoring your website.', 'auxin-elements'),
59 'callback' => 'auxin_get_about_system_status'
60 );
61
62 return $sections;
63 }
64
65 add_filter( 'auxin_admin_welcome_sections', 'auxin_about_system_status', 100 );
66
67
68 /*-----------------------------------------------------------------------------------*/
69 /* Adds feedback tab in theme about (welcome) page
70 /*-----------------------------------------------------------------------------------*/
71
72 function auxin_welcome_page_display_section_feedback(){
73 // the previous rate of the client
74 $previous_rate = auxin_get_option( 'user_rating' );
75 $support_tab_url = admin_url( 'themes.php?page=auxin-welcome&tab=support' );
76 ?>
77
78 <div class="changelog feature-section two-col feedback">
79
80 <form class="aux-feedback-form" action="<?php echo admin_url( 'admin.php?page=auxin-welcome&tab=feedback'); ?>" method="post" >
81
82 <div class="aux-rating-section">
83 <h2 class="aux-featur"><?php _e('How likely are you to recommend Phlox to a friend?', 'auxin-elements' ); ?></h2>
84 <div class="aux-theme-ratings">
85 <?php
86 for( $i = 1; $i <= 5; $i++ ){
87 printf(
88 '<div class="aux-rate-cell"><input type="radio" name="theme_rate" id="theme-rating%1$s" value="%1$s" %2$s/><label class="rating" for="theme-rating%1$s">%1$s</label></div>',
89 $i, checked( $previous_rate, $i, false )
90 );
91 }
92 ?>
93
94 </div>
95 <div class="aux-ratings-measure">
96 <p>Don't like it</p>
97 <p>Like it so much</p>
98 </div>
99 </div>
100
101 <div class="aux-feedback-section aux-hide">
102 <h2 class="aux-featur"><?php _e('Please explain why you gave this score (optional)', 'auxin-elements'); ?></h2>
103 <h4 class="aux-featur feedback-subtitle">
104 <?php
105 printf( __( 'Please do not use this form to get support, in this case please check the %s help section %s', 'auxin-elements' ),
106 '<a href="' . $support_tab_url . '">', '</a>' ); ?>
107 </h4>
108 <textarea placeholder="Enter your feedback here" rows="10" name="feedback" class="large-text"></textarea>
109 <input type="text" placeholder="Email address (Optional)" name="email" class="text-input" />
110 <?php wp_nonce_field( 'phlox_feedback' ); ?>
111
112 <input type="submit" class="button button-primary aux-button" value="Submit feedback" />
113
114 <div class="aux-sending-status">
115 <img class="ajax-progress aux-hide" src="<?php echo AUX_URL; ?>/css/images/elements/saving.gif" />
116 <span class="ajax-response aux-hide" ><?php _e( 'Submitting your feedback ..', 'auxin-elements' ); ?></span>
117 </div>
118
119 </div>
120
121 <?php auxin_send_feedback_mail(); ?>
122 </form>
123 </div>
124
125 <?php
126 }
127
128 function auxin_welcome_add_section_feedback( $sections ){
129
130 $sections['feedback'] = array(
131 'label' => __( 'Feedback', 'auxin-elements' ),
132 'description' => sprintf(__( 'Please leave a feedback and help us to improve %s theme.', 'auxin-elements'), THEME_NAME_I18N ),
133 'callback' => 'auxin_welcome_page_display_section_feedback'
134 );
135
136 return $sections;
137 }
138
139 add_filter( 'auxin_admin_welcome_sections', 'auxin_welcome_add_section_feedback', 90 );
140
141 function auxin_send_feedback_mail(){
142 if ( ! ( ! isset( $_POST['phlox_feedback'] ) || ! wp_verify_nonce( $_POST['phlox_feedback'], 'feedback_send') ) ) {
143
144 $email = ! empty( $_POST["email"] ) ? sanitize_email( $_POST["email"] ) : 'Empty';
145 $feedback = ! empty( $_POST["feedback"] ) ? esc_textarea( $_POST["feedback"] ) : '';
146
147 if( $feedback ){
148 wp_mail( 'info@averta.net', 'feedback from phlox dashboard', $feedback . chr(0x0D).chr(0x0A) . 'Email: ' . $email );
149 $text = __( 'Thanks for your feedback', 'auxin-elements' );
150 } else{
151 $text = __('Please try again and fill up at least the feedback field.', 'auxin-elements');
152 }
153
154 printf('<p class="notification">%s</p>', $text);
155 }
156 }
157
158 /*-----------------------------------------------------------------------------------*/
159 /* Adds subtitle meta field to 'Title setting' tab
160 /*-----------------------------------------------------------------------------------*/
161
162 function auxin_add_metabox_field_to_title_setting_tab( $fields, $id, $type ){
163
164 if( 'general-title' == $id ){
165 array_unshift(
166 $fields,
167 array(
168 'title' => __('Subtitle', 'auxin-elements'),
169 'description' => __('Second Title (optional). Note: You have to enable "Display Title Bar Section" option in order to display the subtitle.', 'auxin-elements'),
170 'id' => 'page_subtitle',
171 'type' => 'editor',
172 'default' => ''
173 )
174 );
175 }
176
177 return $fields;
178 }
179 add_filter( 'auxin_metabox_fields', 'auxin_add_metabox_field_to_title_setting_tab', 10, 3 );
180
181
182 /*-----------------------------------------------------------------------------------*/
183 /* Adds Custom JavaScript meta field to 'Advanced setting' tab
184 /*-----------------------------------------------------------------------------------*/
185
186 function auxin_add_metabox_field_to_advanced_setting_tab( $fields, $id, $type ){
187
188 if( 'general-advanced' == $id ){
189 $fields[] = array(
190 'title' => __('Custom JavaScript Code', 'auxin-elements'),
191 'description' => __('Attention: The following custom JavaScript code will be applied ONLY to this page.', 'auxin-elements').'<br />'.
192 __('For defining global JavaScript roles, please use custom javaScript field on option panel.', 'auxin-elements' ),
193 'id' => 'aux_page_custom_js',
194 'type' => 'code',
195 'mode' => 'javascript',
196 'default' => ''
197 );
198 }
199 return $fields;
200 }
201 add_filter( 'auxin_metabox_fields', 'auxin_add_metabox_field_to_advanced_setting_tab', 10, 3 );
202
203
204
205
206
207
208 /*======================================================================*/
209
210 function auxin_elements_add_post_metabox_models( $models ){
211
212 // Load general metabox models
213 include_once( 'metaboxes/metabox-fields-post-audio.php' );
214 include_once( 'metaboxes/metabox-fields-post-gallery.php' );
215 include_once( 'metaboxes/metabox-fields-post-quote.php' );
216 include_once( 'metaboxes/metabox-fields-post-video.php' );
217
218 $models[] = array(
219 'model' => auxin_metabox_fields_post_gallery(),
220 'priority' => 20
221 );
222
223 $models[] = array(
224 'model' => auxin_metabox_fields_post_video(),
225 'priority' => 22
226 );
227
228 $models[] = array(
229 'model' => auxin_metabox_fields_post_audio(),
230 'priority' => 24
231 );
232
233 $models[] = array(
234 'model' => auxin_metabox_fields_post_quote(),
235 'priority' => 26
236 );
237
238 return $models;
239 }
240
241 add_filter( 'auxin_admin_metabox_models_post', 'auxin_elements_add_post_metabox_models' );
242
243
244 /*-----------------------------------------------------------------------------------*/
245 /* Add theme tab in siteorigin page builder
246 /*-----------------------------------------------------------------------------------*/
247
248 function auxin_add_widget_tabs($tabs) {
249 $tabs[] = array(
250 'title' => THEME_NAME,
251 'filter' => array(
252 'groups' => array('auxin')
253 )
254 );
255
256 if (isset($tabs['recommended'])){
257 unset($tabs['recommended']);
258 }
259
260
261 return $tabs;
262 }
263 add_filter( 'siteorigin_panels_widget_dialog_tabs', 'auxin_add_widget_tabs', 20 );
264
265 // =============================================================================
266
267
268 function auxin_admin_footer_text( $footer_text ) {
269
270 // the admin pages that we intent to display theme footer text on
271 $admin_pages = array(
272 'toplevel_page_auxin',
273 'appearance_page_auxin',
274 'toplevel_page_auxin-welcome',
275 'appearance_page_auxin-welcome',
276 'page',
277 'post',
278 'widgets',
279 'dashboard',
280 'edit-post',
281 'edit-page',
282 'edit-portfolio'
283 );
284
285 if( ! ( function_exists('auxin_is_theme_admin_page') && auxin_is_theme_admin_page( $admin_pages ) ) ){
286 return $footer_text;
287 }
288
289 $welcome_tab_url = admin_url( 'themes.php?page=auxin-welcome&tab=' );
290
291 $auxin_text = sprintf(
292 __( 'Quick access to %sdashboard%s, %soptions%s, %ssupport%s and %sfeedback%s page.', 'auxin-elements' ),
293 '<a href="'. $welcome_tab_url .'features" title="Version ' . THEME_NAME_I18N . '" >' . THEME_NAME_I18N . ' ',
294 '</a>',
295 '<a href="'. admin_url( 'customize.php' ). '?url=' . $welcome_tab_url .'features" title="'. __('Theme Customizer', 'auxin-elements' ) .'" >',
296 '</a>',
297 '<a href="'. $welcome_tab_url .'support">',
298 '</a>',
299 '<a href="'. $welcome_tab_url .'feedback">',
300 '</a>'
301 );
302
303 return '<span id="footer-thankyou">' . $auxin_text . '</span>';
304 }
305 add_filter( 'admin_footer_text', 'auxin_admin_footer_text' );
306