Changeset 2143309 for maintenance/trunk/includes/functions.php
- Timestamp:
- 08/21/2019 06:08:02 PM (6 years ago)
- File:
-
- 1 edited
- maintenance/trunk/includes/functions.php (modified) (40 diffs)
Legend:
- Unmodified
- Added
- Removed
-
maintenance/trunk/includes/functions.php
r2140617 r2143309 21 21 ); 22 22 23 24 function mt_get_plugin_options( $is_current = false ) { 23 function mtnc_get_plugin_options( $is_current = false ) { 25 24 $saved = (array) get_option( 'maintenance_options' ); 26 25 27 26 if ( ! $is_current ) { 28 $options = wp_parse_args( get_option( 'maintenance_options', array() ), mt _get_default_array() );27 $options = wp_parse_args( get_option( 'maintenance_options', array() ), mtnc_get_default_array() ); 29 28 } else { 30 29 $options = $saved; … … 33 32 } 34 33 35 function generate_input_filed( $title, $id, $name, $value, $placeholder = '' ) {34 function mtnc_generate_input_filed( $title, $id, $name, $value, $placeholder = '' ) { 36 35 $out_filed = ''; 37 36 $out_filed .= '<tr valign="top">'; … … 39 38 $out_filed .= '<td>'; 40 39 $out_filed .= '<fieldset>'; 41 $out_filed .= '<input type="text" id="' . esc_attr( $id ) . '" name="lib_options[' . $name . ']" value="' . esc_attr( stripslashes( $value ) ) . '" placeholder="' . $placeholder. '"/>';40 $out_filed .= '<input type="text" id="' . esc_attr( $id ) . '" name="lib_options[' . $name . ']" value="' . esc_attr( stripslashes( $value ) ) . '" placeholder="' . esc_attr( $placeholder ) . '"/>'; 42 41 $out_filed .= '</fieldset>'; 43 42 $out_filed .= '</td>'; 44 43 $out_filed .= '</tr>'; 45 echo $out_filed; 46 } 47 48 function generate_number_filed( $title, $id, $name, $value, $placeholder = '' ) {44 echo $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput 45 } 46 47 function mtnc_generate_number_filed( $title, $id, $name, $value, $placeholder = '' ) { 49 48 $out_filed = ''; 50 49 $out_filed .= '<tr valign="top">'; … … 52 51 $out_filed .= '<td>'; 53 52 $out_filed .= '<fieldset>'; 54 $out_filed .= '<input type="number" min="0" step="1" pattern="[0-9]{10}" id="' . esc_attr( $id ) . '" name="lib_options[' . $name . ']" value="' . esc_attr( stripslashes( $value ) ) . '" placeholder="' . $placeholder. '"/>';53 $out_filed .= '<input type="number" min="0" step="1" pattern="[0-9]{10}" id="' . esc_attr( $id ) . '" name="lib_options[' . $name . ']" value="' . esc_attr( stripslashes( $value ) ) . '" placeholder="' . esc_attr( $placeholder ) . '"/>'; 55 54 $out_filed .= '</fieldset>'; 56 55 $out_filed .= '</td>'; 57 56 $out_filed .= '</tr>'; 58 echo $out_filed; 59 } 60 61 function generate_textarea_filed( $title, $id, $name, $value ) {57 echo $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput 58 } 59 60 function mtnc_generate_textarea_filed( $title, $id, $name, $value ) { 62 61 $out_filed = ''; 63 62 $out_filed .= '<tr valign="top">'; … … 65 64 $out_filed .= '<td>'; 66 65 $out_filed .= '<fieldset>'; 67 $out_filed .= '<textarea name="lib_options[' . $name . ']" id="' . esc_attr( $id ) . '" cols="30" rows="10">' . wp_kses_post( stripslashes( $value )) . '</textarea>';66 $out_filed .= '<textarea name="lib_options[' . $name . ']" id="' . esc_attr( $id ) . '" cols="30" rows="10">' . esc_textarea( $value ) . '</textarea>'; 68 67 $out_filed .= '</fieldset>'; 69 68 $out_filed .= '</td>'; 70 69 $out_filed .= '</tr>'; 71 echo $out_filed; 72 } 73 74 75 function generate_tinymce_filed( $title, $id, $name, $value ) {70 echo $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput 71 } 72 73 74 function mtnc_generate_tinymce_filed( $title, $id, $name, $value ) { 76 75 $out_filed = ''; 77 76 $out_filed .= '<tr valign="top">'; … … 94 93 $out_filed .= '</td>'; 95 94 $out_filed .= '</tr>'; 96 echo $out_filed; 97 } 98 99 100 function generate_check_filed( $title, $label, $id, $name, $value ) {95 echo $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput 96 } 97 98 99 function mtnc_generate_check_filed( $title, $label, $id, $name, $value ) { 101 100 $out_filed = ''; 102 101 $out_filed .= '<tr valign="top">'; … … 111 110 $out_filed .= '</td>'; 112 111 $out_filed .= '</tr>'; 113 echo $out_filed; 114 } 115 116 function generate_image_filed( $title, $id, $name, $value, $class, $name_btn, $class_btn ) {112 echo $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput 113 } 114 115 function mtnc_generate_image_filed( $title, $id, $name, $value, $class, $name_btn, $class_btn ) { 117 116 $out_filed = ''; 118 117 … … 140 139 $out_filed .= '</td>'; 141 140 $out_filed .= '</tr>'; 142 echo $out_filed; 143 } 144 145 function get_color_field( $title, $id, $name, $value, $default_color ) {141 echo $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput 142 } 143 144 function mtnc_get_color_field( $title, $id, $name, $value, $default_color ) { 146 145 $out_filed = ''; 147 146 $out_filed .= '<tr valign="top">'; … … 153 152 $out_filed .= '</td>'; 154 153 $out_filed .= '</tr>'; 155 echo $out_filed; 156 } 157 158 function mt _get_google_font( $font = null ) {154 echo $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput 155 } 156 157 function mtnc_get_google_font( $font = null ) { 159 158 $font_params = $full_link = $gg_fonts = ''; 160 159 161 $gg_fonts = json_decode( mt _get_google_fonts() );160 $gg_fonts = json_decode( mtnc_get_google_fonts() ); 162 161 163 162 if ( property_exists( $gg_fonts, $font ) ) { … … 180 179 } 181 180 181 /* 182 * Function get_fonts_field is backward compatibility with Maintenance PRO Version 3.6.2 and below */ 182 183 function get_fonts_field( $title, $id, $name, $value ) { 184 return mtnc_get_fonts_field( $title, $id, $name, $value ); 185 } 186 187 function mtnc_get_fonts_field( $title, $id, $name, $value ) { 183 188 global $standart_fonts; 184 189 $out_items = $gg_fonts = ''; 185 190 186 $gg_fonts = json_decode( mt _get_google_fonts() );191 $gg_fonts = json_decode( mtnc_get_google_fonts() ); 187 192 188 193 $out_filed = ''; … … 213 218 $out_filed .= '</td>'; 214 219 $out_filed .= '</tr>'; 215 return $out_filed; 216 } 217 218 function get_fonts_subsets( $title, $id, $name, $value ) {220 return $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput 221 } 222 223 function mtnc_get_fonts_subsets( $title, $id, $name, $value ) { 219 224 global $standart_fonts; 220 225 $out_items = $gg_fonts = $curr_font = $mt_option = ''; 221 $mt_option = mt _get_plugin_options( true );226 $mt_option = mtnc_get_plugin_options( true ); 222 227 $curr_font = esc_attr( $mt_option['body_font_family'] ); 223 228 $vars = 'subsets'; 224 229 225 $gg_fonts = json_decode( mt _get_google_fonts(), true );230 $gg_fonts = json_decode( mtnc_get_google_fonts(), true ); 226 231 227 232 if ( ! empty( $gg_fonts ) ) { … … 234 239 $out_filed .= '<select class="select2_customize" name="lib_options[' . $name . ']" id="' . esc_attr( $id ) . '">'; 235 240 if ( ! empty( $gg_fonts[ $curr_font ] ) ) { 236 // if(!empty($gg_fonts[$curr_font][$vars])){237 241 foreach ( $gg_fonts[ $curr_font ]['variants'] as $key => $v ) { 238 242 $out_filed .= '<option value="' . $v . '" ' . selected( $value, $v, false ) . '>' . $v . '</option>'; 239 243 } 240 // }241 244 } 242 245 $out_filed .= '</select>'; … … 246 249 $out_filed .= '</tr>'; 247 250 } 248 return $out_filed; 249 } 250 251 function m aintenance_page_create_meta_boxes() {252 global $m aintenance_variable;253 add_meta_box( 'm aintenance-general', __( 'General Settings', 'maintenance' ), 'add_data_fields', $maintenance_variable->options_page, 'normal', 'default' );254 add_meta_box( 'm aintenance-css', __( 'Custom CSS', 'maintenance' ), 'add_css_fields', $maintenance_variable->options_page, 'normal', 'default' );255 add_meta_box( 'm aintenance-excludepages', __( 'Exclude pages from maintenance mode', 'maintenance' ), 'add_exclude_pages_fields', $maintenance_variable->options_page, 'normal', 'default' );256 } 257 add_action( 'add_mt_meta_boxes', 'm aintenance_page_create_meta_boxes', 10 );258 259 function m aintenance_page_create_meta_boxes_widget_pro() {260 global $m aintenance_variable;261 add_meta_box( 'promo-extended', __( 'Pro version', 'maintenance' ), 'm aintenanace_extended_version', $maintenance_variable->options_page, 'side', 'default' );262 } 263 add_action( 'add_mt_meta_boxes', 'm aintenance_page_create_meta_boxes_widget_pro', 11 );264 265 266 function m aintenance_page_create_meta_boxes_our_themes() {267 global $m aintenance_variable;268 add_meta_box( 'promo-our-themes', __( 'Fruitful Code projects', 'maintenance' ), 'm aintenanace_our_themes', $maintenance_variable->options_page, 'side', 'default' );269 } 270 add_action( 'add_mt_meta_boxes', 'm aintenance_page_create_meta_boxes_our_themes', 12 );271 272 function m aintenance_page_create_meta_boxes_widget_support() {273 global $m aintenance_variable;274 add_meta_box( 'promo-content', __( 'Support', 'maintenance' ), 'm aintenanace_contact_support', $maintenance_variable->options_page, 'side', 'default' );275 } 276 add_action( 'add_mt_meta_boxes', 'm aintenance_page_create_meta_boxes_widget_support', 13 );277 278 function m aintenance_page_create_meta_boxes_improve_translate() {279 global $m aintenance_variable;280 add_meta_box( 'promo-translate', __( 'Translation', 'maintenance' ), 'm aintenanace_improve_translate', $maintenance_variable->options_page, 'side', 'default' );281 } 282 add_action( 'add_mt_meta_boxes', 'm aintenance_page_create_meta_boxes_improve_translate', 14 );283 284 function add_data_fields( $object, $box ) {285 $mt_option = mt _get_plugin_options( true );251 return $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput 252 } 253 254 function mtnc_page_create_meta_boxes() { 255 global $mtnc_variable; 256 add_meta_box( 'mtnc-general', __( 'General Settings', 'maintenance' ), 'mtnc_add_data_fields', $mtnc_variable->options_page, 'normal', 'default' ); 257 add_meta_box( 'mtnc-css', __( 'Custom CSS', 'maintenance' ), 'mtnc_add_css_fields', $mtnc_variable->options_page, 'normal', 'default' ); 258 add_meta_box( 'mtnc-excludepages', __( 'Exclude pages from maintenance mode', 'maintenance' ), 'mtnc_add_exclude_pages_fields', $mtnc_variable->options_page, 'normal', 'default' ); 259 } 260 add_action( 'add_mt_meta_boxes', 'mtnc_page_create_meta_boxes', 10 ); 261 262 function mtnc_page_create_meta_boxes_widget_pro() { 263 global $mtnc_variable; 264 add_meta_box( 'promo-extended', __( 'Pro version', 'maintenance' ), 'mtnc_extended_version', $mtnc_variable->options_page, 'side', 'default' ); 265 } 266 add_action( 'add_mt_meta_boxes', 'mtnc_page_create_meta_boxes_widget_pro', 11 ); 267 268 269 function mtnc_page_create_meta_boxes_our_themes() { 270 global $mtnc_variable; 271 add_meta_box( 'promo-our-themes', __( 'Fruitful Code projects', 'maintenance' ), 'mtnc_our_themes', $mtnc_variable->options_page, 'side', 'default' ); 272 } 273 add_action( 'add_mt_meta_boxes', 'mtnc_page_create_meta_boxes_our_themes', 12 ); 274 275 function mtnc_page_create_meta_boxes_widget_support() { 276 global $mtnc_variable; 277 add_meta_box( 'promo-content', __( 'Support', 'maintenance' ), 'mtnc_contact_support', $mtnc_variable->options_page, 'side', 'default' ); 278 } 279 add_action( 'add_mt_meta_boxes', 'mtnc_page_create_meta_boxes_widget_support', 13 ); 280 281 function mtnc_page_create_meta_boxes_improve_translate() { 282 global $mtnc_variable; 283 add_meta_box( 'promo-translate', __( 'Translation', 'maintenance' ), 'mtnc_improve_translate', $mtnc_variable->options_page, 'side', 'default' ); 284 } 285 add_action( 'add_mt_meta_boxes', 'mtnc_page_create_meta_boxes_improve_translate', 14 ); 286 287 function mtnc_add_data_fields( $object, $box ) { 288 $mt_option = mtnc_get_plugin_options( true ); 286 289 $is_blur = false; 287 290 … … 313 316 <tbody> 314 317 <?php 315 generate_input_filed( __( 'Page title', 'maintenance' ), 'page_title', 'page_title', $page_title );316 generate_input_filed( __( 'Headline', 'maintenance' ), 'heading', 'heading', $heading );317 generate_tinymce_filed( __( 'Description', 'maintenance' ), 'description', 'description', $description );318 generate_input_filed( __( 'Footer Text', 'maintenance' ), 'footer_text', 'footer_text', $footer_text );319 generate_number_filed( __( 'Set Logo width', 'maintenance' ), 'logo_width', 'logo_width', $logo_width );320 generate_number_filed( __( 'Set Logo height', 'maintenance' ), 'logo_height', 'logo_height', $logo_height );321 generate_image_filed( __( 'Logo', 'maintenance' ), 'logo', 'logo', (int)$mt_option['logo'], 'boxes box-logo', __( 'Upload Logo', 'maintenance' ), 'upload_logo upload_btn button' );322 generate_image_filed( __( 'Retina logo', 'maintenance' ), 'retina_logo', 'retina_logo', (int)$mt_option['retina_logo'], 'boxes box-logo', __( 'Upload Retina Logo', 'maintenance' ), 'upload_logo upload_btn button' );323 do_action( 'm aintenance_background_field' );324 generate_image_filed( __( 'Background image (portrait mode)', 'maintenance' ), 'bg_image_portrait', 'bg_image_portrait', isset( $mt_option['bg_image_portrait'] ) ? (int)$mt_option['bg_image_portrait'] : '', 'boxes box-logo', __( 'Upload image for portrait device orientation', 'maintenance' ), 'upload_logo upload_btn button' );325 generate_image_filed( __( 'Page preloader image', 'maintenance' ), 'preloader_img', 'preloader_img', isset( $mt_option['preloader_img'] ) ? (int)$mt_option['preloader_img'] : '', 'boxes box-logo', __( 'Upload preloader', 'maintenance' ), 'upload_logo upload_btn button' );326 327 do_action( 'm aintenance_color_fields' );328 do_action( 'm aintenance_font_fields' );329 generate_check_filed( __( '503', 'maintenance' ), __( 'Service temporarily unavailable, Google analytics will be disable.', 'maintenance' ), '503_enabled', '503_enabled', ! empty( $mt_option['503_enabled'] ) );318 mtnc_generate_input_filed( __( 'Page title', 'maintenance' ), 'page_title', 'page_title', $page_title ); 319 mtnc_generate_input_filed( __( 'Headline', 'maintenance' ), 'heading', 'heading', $heading ); 320 mtnc_generate_tinymce_filed( __( 'Description', 'maintenance' ), 'description', 'description', $description ); 321 mtnc_generate_input_filed( __( 'Footer Text', 'maintenance' ), 'footer_text', 'footer_text', $footer_text ); 322 mtnc_generate_number_filed( __( 'Set Logo width', 'maintenance' ), 'logo_width', 'logo_width', $logo_width ); 323 mtnc_generate_number_filed( __( 'Set Logo height', 'maintenance' ), 'logo_height', 'logo_height', $logo_height ); 324 mtnc_generate_image_filed( __( 'Logo', 'maintenance' ), 'logo', 'logo', (int) $mt_option['logo'], 'boxes box-logo', __( 'Upload Logo', 'maintenance' ), 'upload_logo upload_btn button' ); 325 mtnc_generate_image_filed( __( 'Retina logo', 'maintenance' ), 'retina_logo', 'retina_logo', (int) $mt_option['retina_logo'], 'boxes box-logo', __( 'Upload Retina Logo', 'maintenance' ), 'upload_logo upload_btn button' ); 326 do_action( 'mtnc_background_field' ); 327 mtnc_generate_image_filed( __( 'Background image (portrait mode)', 'maintenance' ), 'bg_image_portrait', 'bg_image_portrait', isset( $mt_option['bg_image_portrait'] ) ? (int) $mt_option[ 'bg_image_portrait' ] : '', 'boxes box-logo', __( 'Upload image for portrait device orientation', 'maintenance' ), 'upload_logo upload_btn button' ); 328 mtnc_generate_image_filed( __( 'Page preloader image', 'maintenance' ), 'preloader_img', 'preloader_img', isset( $mt_option['preloader_img'] ) ? (int) $mt_option['preloader_img'] : '', 'boxes box-logo', __( 'Upload preloader', 'maintenance' ), 'upload_logo upload_btn button' ); 329 330 do_action( 'mtnc_color_fields' ); 331 do_action( 'mtnc_font_fields' ); 332 mtnc_generate_check_filed( __( '503', 'maintenance' ), __( 'Service temporarily unavailable, Google analytics will be disable.', 'maintenance' ), '503_enabled', '503_enabled', ! empty( $mt_option['503_enabled'] ) ); 330 333 331 334 $gg_analytics_id = ''; … … 334 337 } 335 338 336 generate_input_filed( __( 'Google Analytics ID', 'maintenance' ), 'gg_analytics_id', 'gg_analytics_id', $gg_analytics_id, __( 'UA-XXXXX-X', 'maintenance' ) );337 generate_input_filed( __( 'Set blur intensity', 'maintenance' ), 'blur_intensity', 'blur_intensity', (int) $mt_option['blur_intensity'] );339 mtnc_generate_input_filed( __( 'Google Analytics ID', 'maintenance' ), 'gg_analytics_id', 'gg_analytics_id', $gg_analytics_id, __( 'UA-XXXXX-X', 'maintenance' ) ); 340 mtnc_generate_input_filed( __( 'Set blur intensity', 'maintenance' ), 'blur_intensity', 'blur_intensity', (int) $mt_option['blur_intensity'] ); 338 341 339 342 if ( isset( $mt_option['is_blur'] ) ) { … … 343 346 } 344 347 345 generate_check_filed( __( 'Apply background blur', 'maintenance' ), '', 'is_blur', 'is_blur', $is_blur );346 generate_check_filed( __( 'Enable frontend login', 'maintenance' ), '', 'is_login', 'is_login', isset( $mt_option['is_login'] ) );348 mtnc_generate_check_filed( __( 'Apply background blur', 'maintenance' ), '', 'is_blur', 'is_blur', $is_blur ); 349 mtnc_generate_check_filed( __( 'Enable frontend login', 'maintenance' ), '', 'is_login', 'is_login', isset( $mt_option['is_login'] ) ); 347 350 348 351 ?> … … 353 356 354 357 355 function add_css_fields() {356 $mt_option = mt _get_plugin_options( true );358 function mtnc_add_css_fields() { 359 $mt_option = mtnc_get_plugin_options( true ); 357 360 echo '<table class="form-table">'; 358 361 echo '<tbody>'; 359 generate_textarea_filed( __( 'CSS Code', 'maintenance' ), 'custom_css', 'custom_css', wp_kses_stripslashes( $mt_option['custom_css'] ) );362 mtnc_generate_textarea_filed( __( 'CSS Code', 'maintenance' ), 'custom_css', 'custom_css', wp_kses_stripslashes( $mt_option['custom_css'] ) ); 360 363 echo '</tbody>'; 361 364 echo '</table>'; 362 365 } 363 366 364 function add_exclude_pages_fields() {365 $mt_option = mt _get_plugin_options( true );367 function mtnc_add_exclude_pages_fields() { 368 $mt_option = mtnc_get_plugin_options( true ); 366 369 $out_filed = ''; 367 370 … … 435 438 $out_filed .= '</table>'; 436 439 437 echo $out_filed; 438 } 439 440 function get_background_fileds_action() {441 $mt_option = mt _get_plugin_options( true );442 generate_image_filed( __( 'Background image', 'maintenance' ), 'body_bg', 'body_bg', esc_attr( $mt_option['body_bg'] ), 'boxes box-bg', __( 'Upload Background', 'maintenance' ), 'upload_background upload_btn button' );443 } 444 add_action( 'm aintenance_background_field', 'get_background_fileds_action', 10 );445 446 function get_color_fileds_action() {447 $mt_option = mt _get_plugin_options( true );448 get_color_field( __( 'Background color', 'maintenance' ), 'body_bg_color', 'body_bg_color', esc_attr( $mt_option['body_bg_color'] ), '#111111' );449 get_color_field( __( 'Font color', 'maintenance' ), 'font_color', 'font_color', esc_attr( $mt_option['font_color'] ), '#ffffff' );450 get_color_field( __( 'Login block background color', 'maintenance' ), 'controls_bg_color', 'controls_bg_color', isset( $mt_option['controls_bg_color'] ) ? esc_attr( $mt_option['controls_bg_color'] ) : '', '#000000' );451 } 452 add_action( 'm aintenance_color_fields', 'get_color_fileds_action', 10 );453 454 455 function get_font_fileds_action() {456 $mt_option = mt _get_plugin_options( true );457 echo get_fonts_field( __( 'Font family', 'maintenance' ), 'body_font_family', 'body_font_family', esc_attr( $mt_option['body_font_family'] ) );440 echo $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput 441 } 442 443 function mtnc_get_background_fileds_action() { 444 $mt_option = mtnc_get_plugin_options( true ); 445 mtnc_generate_image_filed( __( 'Background image', 'maintenance' ), 'body_bg', 'body_bg', esc_attr( $mt_option['body_bg'] ), 'boxes box-bg', __( 'Upload Background', 'maintenance' ), 'upload_background upload_btn button' ); 446 } 447 add_action( 'mtnc_background_field', 'mtnc_get_background_fileds_action', 10 ); 448 449 function mtnc_get_color_fileds_action() { 450 $mt_option = mtnc_get_plugin_options( true ); 451 mtnc_get_color_field( __( 'Background color', 'maintenance' ), 'body_bg_color', 'body_bg_color', esc_attr( $mt_option['body_bg_color'] ), '#111111' ); 452 mtnc_get_color_field( __( 'Font color', 'maintenance' ), 'font_color', 'font_color', esc_attr( $mt_option['font_color'] ), '#ffffff' ); 453 mtnc_get_color_field( __( 'Login block background color', 'maintenance' ), 'controls_bg_color', 'controls_bg_color', isset( $mt_option['controls_bg_color'] ) ? esc_attr( $mt_option['controls_bg_color'] ) : '', '#000000' ); 454 } 455 add_action( 'mtnc_color_fields', 'mtnc_get_color_fileds_action', 10 ); 456 457 458 function mtnc_get_font_fileds_action() { 459 $mt_option = mtnc_get_plugin_options( true ); 460 echo mtnc_get_fonts_field( __( 'Font family', 'maintenance' ), 'body_font_family', 'body_font_family', esc_attr( $mt_option['body_font_family'] ) ); // phpcs:ignore WordPress.Security.EscapeOutput 458 461 $subset = ''; 459 462 … … 461 464 $subset = $mt_option['body_font_subset']; 462 465 } 463 echo get_fonts_subsets( __( 'Subsets', 'maintenance' ), 'body_font_subset', 'body_font_subset', esc_attr( $subset ) );464 } 465 add_action( 'm aintenance_font_fields', 'get_font_fileds_action', 10 );466 467 468 function m aintenanace_contact_support() {466 echo mtnc_get_fonts_subsets( __( 'Subsets', 'maintenance' ), 'body_font_subset', 'body_font_subset', esc_attr( $subset ) ); // phpcs:ignore WordPress.Security.EscapeOutput 467 } 468 add_action( 'mtnc_font_fields', 'mtnc_get_font_fileds_action', 10 ); 469 470 471 function mtnc_contact_support() { 469 472 $promo_text = ''; 470 473 $promo_text .= '<div class="sidebar-promo" id="sidebar-promo">'; … … 476 479 ) . '</p>'; 477 480 $promo_text .= '</div>'; 478 echo $promo_text; 479 } 480 481 function m aintenanace_improve_translate() {481 echo $promo_text; // phpcs:ignore WordPress.Security.EscapeOutput 482 } 483 484 function mtnc_improve_translate() { 482 485 $promo_text = ''; 483 486 $promo_text .= '<div class="sidebar-promo" id="sidebar-translate">'; … … 489 492 ) . '</p>'; 490 493 $promo_text .= '</div>'; 491 echo $promo_text; 492 } 493 494 function m aintenanace_our_themes() {494 echo $promo_text; // phpcs:ignore WordPress.Security.EscapeOutput 495 } 496 497 function mtnc_our_themes() { 495 498 $promo_text = ''; 496 499 $promo_text .= '<div class="sidebar-promo" id="sidebar-themes">'; … … 518 521 519 522 $promo_text .= '</div>'; 520 echo $promo_text; 521 } 522 523 function m aintenanace_extended_version() {523 echo $promo_text; // phpcs:ignore WordPress.Security.EscapeOutput 524 } 525 526 function mtnc_extended_version() { 524 527 $promo_text = ''; 525 528 $promo_text .= '<div class="sidebar-promo worker" id="sidebar-promo">'; … … 536 539 ); 537 540 $promo_text .= '</div>'; 538 echo $promo_text; 539 } 540 541 function mt _cur_page_url() {541 echo $promo_text; // phpcs:ignore WordPress.Security.EscapeOutput 542 } 543 544 function mtnc_cur_page_url() { 542 545 $page_url = 'http'; 543 546 if ( isset( $_SERVER['HTTPS'] ) ) { … … 552 555 } 553 556 554 function mt _check_exclude() {557 function mtnc_check_exclude() { 555 558 global $mt_options, $post; 556 $mt_options = mt _get_plugin_options( true );559 $mt_options = mtnc_get_plugin_options( true ); 557 560 $is_skip = false; 558 $cur_url = mt_cur_page_url();561 $cur_url = mtnc_cur_page_url(); 559 562 if ( is_page() || is_single() ) { 560 $curr_ ID= $post->ID;563 $curr_id = $post->ID; 561 564 } else { 562 565 if ( is_home() ) { 563 566 $blog_id = get_option( 'page_for_posts' ); 564 567 if ( $blog_id ) { 565 $curr_ ID= $blog_id;568 $curr_id = $blog_id; 566 569 } 567 570 } … … 570 573 $front_page_id = get_option( 'show_on_front' ); 571 574 if ( $front_page_id ) { 572 $curr_ ID= $front_page_id;575 $curr_id = $front_page_id; 573 576 } 574 577 } … … 579 582 foreach ( $exlude_objs as $objs_id ) { 580 583 foreach ( $objs_id as $obj_id ) { 581 if ( $curr_ ID=== (int) $obj_id ) {584 if ( $curr_id === (int) $obj_id ) { 582 585 $is_skip = true; 583 586 break; … … 591 594 592 595 593 function load_maintenance_page( $original_template ) {596 function mtnc_load_maintenance_page( $original_template ) { 594 597 global $mt_options; 595 $preview = ( isset( $_GET['preview'] ) && $_GET['preview'] === 1 ); 598 if ( is_preview() && ! wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . (int) $_GET['preview_id'] ) ) { 599 return; 600 } 601 $preview = isset( $_GET['preview'] ); 596 602 597 603 $v_curr_date_start = $v_curr_date_end = $v_curr_time = ''; 598 $vdate_start = $vdate_end = date_i18n( 'Y-m-d', strtotime( current_time( 'mysql', 0 ) ) );599 $vtime_start = date_i18n( 'h:i:s A', strtotime( '01:00:00 am' ) );600 $vtime_end = date_i18n( 'h:i:s A', strtotime( '12:59:59 pm' ) );604 $vdate_start = $vdate_end = date_i18n( 'Y-m-d', strtotime( current_time( 'mysql', 0 ) ) ); 605 $vtime_start = date_i18n( 'h:i:s A', strtotime( '01:00:00 am' ) ); 606 $vtime_end = date_i18n( 'h:i:s A', strtotime( '12:59:59 pm' ) ); 601 607 602 608 if ( ! is_user_logged_in() ) { … … 621 627 $v_curr_date_end = strtotime( $vdate_end . ' ' . $vtime_end ); 622 628 623 if ( mt _check_exclude() ) {629 if ( mtnc_check_exclude() ) { 624 630 return $original_template; 625 631 } … … 634 640 } 635 641 636 if ( file_exists( M AINTENANCE_LOAD . 'index.php' ) ) {637 add_filter( 'script_loader_tag', 'm aintenance_defer_scripts', 10, 2 );638 return M AINTENANCE_LOAD . 'index.php';642 if ( file_exists( MTNC_LOAD . 'index.php' ) ) { 643 add_filter( 'script_loader_tag', 'mtnc_defer_scripts', 10, 2 ); 644 return MTNC_LOAD . 'index.php'; 639 645 } else { 640 646 return $original_template; 641 647 } 642 } elseif ( $preview && file_exists( M AINTENANCE_LOAD . 'index.php' ) ) {643 add_filter( 'script_loader_tag', 'm aintenance_defer_scripts', 10, 2 );644 return M AINTENANCE_LOAD . 'index.php';648 } elseif ( $preview && file_exists( MTNC_LOAD . 'index.php' ) ) { 649 add_filter( 'script_loader_tag', 'mtnc_defer_scripts', 10, 2 ); 650 return MTNC_LOAD . 'index.php'; 645 651 } else { 646 652 return $original_template; … … 648 654 } 649 655 650 function m aintenance_defer_scripts( $tag, $handle ) {656 function mtnc_defer_scripts( $tag, $handle ) { 651 657 if ( strpos( $handle, '_ie' ) !== 0 ) { 652 658 return $tag; … … 655 661 } 656 662 657 function m aintenance_metaboxes_scripts() {658 global $m aintenance_variable;663 function mtnc_metaboxes_scripts() { 664 global $mtnc_variable; 659 665 ?> 660 666 <script type="text/javascript"> … … 662 668 jQuery(document).ready( function() { 663 669 jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed'); 664 postboxes.add_postbox_toggles( '<?php echo esc_js( $m aintenance_variable->options_page ); ?>' );670 postboxes.add_postbox_toggles( '<?php echo esc_js( $mtnc_variable->options_page ); ?>' ); 665 671 }); 666 672 //]]> … … 669 675 } 670 676 671 function m aintenance_add_toolbar_items() {677 function mtnc_add_toolbar_items() { 672 678 global $wp_admin_bar, $wpdb; 673 $mt_options = mt _get_plugin_options( true );679 $mt_options = mtnc_get_plugin_options( true ); 674 680 $check = ''; 675 681 if ( ! is_super_admin() || ! is_admin_bar_showing() ) { … … 685 691 $wp_admin_bar->add_menu( 686 692 array( 687 'id' => 'm aintenance_options',693 'id' => 'mtnc_options', 688 694 'title' => __( 'Maintenance', 'maintenance' ) . __( ' is ', 'maintenance' ) . $check, 689 695 'href' => $url_to, … … 702 708 703 709 704 function m aintenance_hex2rgb( $hex ) {710 function mtnc_hex2rgb( $hex ) { 705 711 $hex = str_replace( '#', '', $hex ); 706 712 … … 719 725 720 726 721 function mt _insert_attach_sample_files() {727 function mtnc_insert_attach_sample_files() { 722 728 global $wpdb; 723 729 … … 731 737 require_once ABSPATH . 'wp-admin/includes/image.php'; 732 738 $upload_dir = wp_upload_dir(); 733 $image_url = M AINTENANCE_URI . 'images/mt-sample-background.jpg';739 $image_url = MTNC_URI . 'images/mt-sample-background.jpg'; 734 740 $file_name = basename( $image_url ); 735 741 $file_content = wp_remote_get( $image_url ); … … 762 768 } 763 769 764 function mt _get_default_array() {770 function mtnc_get_default_array() { 765 771 766 772 $defaults = array( … … 774 780 'logo' => '', 775 781 'retina_logo' => '', 776 'body_bg' => mt _insert_attach_sample_files(),782 'body_bg' => mtnc_insert_attach_sample_files(), 777 783 'bg_image_portrait' => '', 778 784 'preloader_img' => '', … … 790 796 'exclude_pages' => '', 791 797 ); 792 return apply_filters( 'mt _get_default_array', $defaults );793 } 794 795 if ( ! function_exists( 'mt _get_google_fonts' ) ) {796 function mt _get_google_fonts() {797 $gg_fonts = wp_remote_get( M AINTENANCE_URI . 'includes/fonts/googlefonts.json' );798 return apply_filters( 'mtnc_get_default_array', $defaults ); 799 } 800 801 if ( ! function_exists( 'mtnc_get_google_fonts' ) ) { 802 function mtnc_get_google_fonts() { 803 $gg_fonts = wp_remote_get( MTNC_URI . 'includes/fonts/googlefonts.json' ); 798 804 return $gg_fonts['body']; 799 805 }
Note: See TracChangeset for help on using the changeset viewer.