| @@ -1,85 +1,85 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -// don't load directly | |
| 4 | -defined( 'ABSPATH' ) || exit; | |
| 5 | - | |
| 6 | -if ( ! function_exists( 'get_contact_form_7_posts' ) ) : | |
| 7 | - function get_contact_form_7_posts(){ | |
| 8 | - | |
| 9 | - $args = array('post_type' => 'wpcf7_contact_form', 'posts_per_page' => -1); | |
| 10 | - | |
| 11 | - $cf7_form_list=[]; | |
| 12 | - | |
| 13 | - if( $cf7_forms = get_posts($args)){ | |
| 14 | - foreach ( $cf7_forms as $form ) { | |
| 15 | - (int)$cf7_form_list[$form->ID] = $form->post_title; | |
| 16 | - } | |
| 17 | - } | |
| 18 | - else{ | |
| 19 | - (int)$cf7_form_list['0'] = esc_html__('No contect From 7 form found', 'borderless'); | |
| 20 | - } | |
| 21 | - return $cf7_form_list; | |
| 22 | - } | |
| 23 | -endif; | |
| 24 | - | |
| 25 | - | |
| 26 | -// ajax request handler | |
| 27 | -if( !function_exists('get_contact_form_7_posts_by_ajax')) { | |
| 28 | - | |
| 29 | - function get_contact_form_7_posts_by_ajax(){ | |
| 30 | - $cf7_form_list = get_contact_form_7_posts(); | |
| 31 | - echo json_encode($cf7_form_list); | |
| 32 | - wp_die(); | |
| 33 | - } | |
| 34 | - | |
| 35 | -} | |
| 36 | - | |
| 37 | -//ajax action | |
| 38 | -add_action( 'wp_ajax_cf7_data', 'get_contact_form_7_posts_by_ajax' ); | |
| 39 | - | |
| 40 | - | |
| 41 | -if ( ! function_exists( 'get_all_pages' ) ) : | |
| 42 | - | |
| 43 | - function get_all_pages(){ | |
| 44 | - | |
| 45 | - $args = array('post_type' => 'page', 'posts_per_page' => -1); | |
| 46 | - | |
| 47 | - $catlist=[]; | |
| 48 | - | |
| 49 | - if( $categories = get_posts($args)){ | |
| 50 | - foreach ( $categories as $category ) { | |
| 51 | - (int)$catlist[$category->ID] = $category->post_title; | |
| 52 | - } | |
| 53 | - } | |
| 54 | - else{ | |
| 55 | - (int)$catlist['0'] = esc_html__('No Pages Found!', 'borderless'); | |
| 56 | - } | |
| 57 | - return $catlist; | |
| 58 | - } | |
| 59 | - | |
| 60 | -endif; | |
| 61 | - | |
| 62 | - | |
| 63 | -if( !function_exists('promotional_notice_dismiss_handler')){ | |
| 64 | - | |
| 65 | - function promotional_notice_dismiss_handler(){ | |
| 66 | - // Pick up the notice "type" - passed via jQuery (the "data-notice" attribute on the notice) | |
| 67 | - $type = $_POST['type']; | |
| 68 | - | |
| 69 | - $status = $_POST['status']; | |
| 70 | - | |
| 71 | - if($status == 'remind-me-later'){ | |
| 72 | - // Store it in the options table | |
| 73 | - update_option( 'dismissed-' . $type . "-at", date('Y-m-d') ); | |
| 74 | - | |
| 75 | - }elseif( $status == 'never-show'){ | |
| 76 | - | |
| 77 | - update_option( 'dismissed-'. $type . '-never', TRUE ); | |
| 78 | - | |
| 79 | - }else{ | |
| 80 | - update_option( 'dismissed-'. $type . '-never', TRUE ); | |
| 81 | - } | |
| 82 | - } | |
| 83 | -} | |
| 84 | - | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +// don't load directly | |
| 4 | +defined( 'ABSPATH' ) || exit; | |
| 5 | + | |
| 6 | +if ( ! function_exists( 'get_contact_form_7_posts' ) ) : | |
| 7 | + function get_contact_form_7_posts(){ | |
| 8 | + | |
| 9 | + $args = array('post_type' => 'wpcf7_contact_form', 'posts_per_page' => -1); | |
| 10 | + | |
| 11 | + $cf7_form_list=[]; | |
| 12 | + | |
| 13 | + if( $cf7_forms = get_posts($args)){ | |
| 14 | + foreach ( $cf7_forms as $form ) { | |
| 15 | + (int)$cf7_form_list[$form->ID] = $form->post_title; | |
| 16 | + } | |
| 17 | + } | |
| 18 | + else{ | |
| 19 | + (int)$cf7_form_list['0'] = esc_html__('No contect From 7 form found', 'borderless'); | |
| 20 | + } | |
| 21 | + return $cf7_form_list; | |
| 22 | + } | |
| 23 | +endif; | |
| 24 | + | |
| 25 | + | |
| 26 | +// ajax request handler | |
| 27 | +if( !function_exists('get_contact_form_7_posts_by_ajax')) { | |
| 28 | + | |
| 29 | + function get_contact_form_7_posts_by_ajax(){ | |
| 30 | + $cf7_form_list = get_contact_form_7_posts(); | |
| 31 | + echo json_encode($cf7_form_list); | |
| 32 | + wp_die(); | |
| 33 | + } | |
| 34 | + | |
| 35 | +} | |
| 36 | + | |
| 37 | +//ajax action | |
| 38 | +add_action( 'wp_ajax_cf7_data', 'get_contact_form_7_posts_by_ajax' ); | |
| 39 | + | |
| 40 | + | |
| 41 | +if ( ! function_exists( 'get_all_pages' ) ) : | |
| 42 | + | |
| 43 | + function get_all_pages(){ | |
| 44 | + | |
| 45 | + $args = array('post_type' => 'page', 'posts_per_page' => -1); | |
| 46 | + | |
| 47 | + $catlist=[]; | |
| 48 | + | |
| 49 | + if( $categories = get_posts($args)){ | |
| 50 | + foreach ( $categories as $category ) { | |
| 51 | + (int)$catlist[$category->ID] = $category->post_title; | |
| 52 | + } | |
| 53 | + } | |
| 54 | + else{ | |
| 55 | + (int)$catlist['0'] = esc_html__('No Pages Found!', 'borderless'); | |
| 56 | + } | |
| 57 | + return $catlist; | |
| 58 | + } | |
| 59 | + | |
| 60 | +endif; | |
| 61 | + | |
| 62 | + | |
| 63 | +if( !function_exists('promotional_notice_dismiss_handler')){ | |
| 64 | + | |
| 65 | + function promotional_notice_dismiss_handler(){ | |
| 66 | + // Pick up the notice "type" - passed via jQuery (the "data-notice" attribute on the notice) | |
| 67 | + $type = $_POST['type']; | |
| 68 | + | |
| 69 | + $status = $_POST['status']; | |
| 70 | + | |
| 71 | + if($status == 'remind-me-later'){ | |
| 72 | + // Store it in the options table | |
| 73 | + update_option( 'dismissed-' . $type . "-at", date('Y-m-d') ); | |
| 74 | + | |
| 75 | + }elseif( $status == 'never-show'){ | |
| 76 | + | |
| 77 | + update_option( 'dismissed-'. $type . '-never', TRUE ); | |
| 78 | + | |
| 79 | + }else{ | |
| 80 | + update_option( 'dismissed-'. $type . '-never', TRUE ); | |
| 81 | + } | |
| 82 | + } | |
| 83 | +} | |
| 84 | + | |
| 85 | 85 | add_action('wp_ajax_dismissed_promotional_notice_handler', 'promotional_notice_dismiss_handler'); |