'. esc_html__( 'No Results Found', 'divi-plus' ) .'
'. esc_html__( 'The team you requested could not be found. Try changing your module settings or create some new team members.', 'divi-plus' ) .'
* @link https://www.elicus.com/ * @copyright 2024 Elicus Technologies Private Limited * @version 1.11.0 */ class DIPL_DiviPlus extends DiviExtension { /** * The gettext domain for the extension's translations. * * @since 1.0.0 * * @var string */ public $gettext_domain = 'divi-plus'; /** * The extension's WP Plugin name. * * @since 1.0.0 * * @var string */ public $name = 'divi-plus'; /** * The extension's version * * @since 1.0.0 * * @var string */ public $version = ELICUS_DIVI_PLUS_VERSION; /** * DIPL_DiviPlus constructor. * * @param string $name * @param array $args */ public function __construct( $name = 'divi-plus', $args = array() ) { $this->plugin_dir = plugin_dir_path( __FILE__ ); $this->plugin_dir_url = plugin_dir_url( $this->plugin_dir ); $this->_frontend_js_data = array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'ajaxnonce' => wp_create_nonce( 'elicus-divi-plus-nonce' ), ); $this->_builder_js_data = array( 'et_builder_accent_color' => esc_html( et_get_option( 'accent_color', '#7EBEC5' ) ), 'site_url' => esc_url( site_url() ), 'file' => et_is_builder_plugin_active() ? 'style-dbp' : 'style', ); add_action( 'wp_enqueue_scripts', array( $this, 'dipl_register_scripts' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'dipl_fb_enqueue_scripts' ) ); parent::__construct( $name, $args ); $this->dipl_plugin_setup(); if ( $this->dipl_is_testimonial_enabled() || $this->dipl_is_team_enabled() || $this->dipl_is_filterable_gallery_enabled() ) { $this->dipl_register_post_types(); $this->dipl_register_taxonomies(); add_action( 'load-post.php', array( $this, 'dipl_add_meta_boxes' ) ); add_action( 'load-post-new.php', array( $this, 'dipl_add_meta_boxes' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'dipl_admin_enqueue_scripts' ) ); } if ( $this->dipl_is_testimonial_enabled() ) { add_action( 'save_post', array( $this, 'dipl_save_testimonial_meta_fields' ) ); } if ( $this->dipl_is_team_enabled() ) { add_action( 'save_post', array( $this, 'dipl_save_team_member_meta_fields' ) ); } add_action( 'init', array( $this, 'dipl_load_plugin_textdomain' ) ); add_action( 'wp_ajax_et_fb_ajax_save', array( $this, 'et_fb_ajax_save' ), 10 ); add_action( 'wp_ajax_dipl_ajax_search_results', array( $this, 'dipl_ajax_search_results' ) ); add_action( 'wp_ajax_nopriv_dipl_ajax_search_results', array( $this, 'dipl_ajax_search_results' ) ); add_action( 'wp_ajax_dipl_get_woo_products', array( $this, 'dipl_get_woo_products' ) ); add_action( 'wp_ajax_nopriv_dipl_get_woo_products', array( $this, 'dipl_get_woo_products' ) ); add_filter( 'upload_mimes', array( $this, 'dipl_mime_types' ) ); add_filter( 'wp_check_filetype_and_ext', array( $this, 'dipl_check_filetype_and_ext' ), 10, 4 ); add_filter( 'plugin_action_links_divi-plus/divi-plus.php', array( $this, 'dipl_action_links' ) ); add_filter( 'nonce_user_logged_out', array( $this, 'dipl_update_nonce' ), 999, 2 ); add_action( 'wp_ajax_dipl_get_product_page', array( $this, 'dipl_get_product_page' ) ); add_action( 'wp_ajax_nopriv_dipl_get_product_page', array( $this, 'dipl_get_product_page' ) ); add_action( 'wp_ajax_dipl_get_teamgrid_page', array( $this, 'dipl_get_teamgrid_page' ) ); add_action( 'wp_ajax_nopriv_dipl_get_teamgrid_page', array( $this, 'dipl_get_teamgrid_page' ) ); add_filter( 'et_late_global_assets_list', array( $this, 'dipl_late_assets' ), 10, 3 ); add_filter( 'et_pb_module_shortcode_attributes', array( $this, 'dipl_migrate_gradient' ), 10, 5 ); add_action( 'wp_ajax_dipl_get_images', array( $this, 'dipl_get_images' ) ); add_action( 'wp_ajax_nopriv_dipl_get_images', array( $this, 'dipl_get_images' ) ); add_action( 'wp_ajax_dipl_get_team_members', array( $this, 'dipl_get_team_members' ) ); add_action( 'wp_ajax_nopriv_dipl_get_team_members', array( $this, 'dipl_get_team_members' ) ); add_action( 'wp_ajax_dipl_get_testimonials', array( $this, 'dipl_get_testimonials' ) ); add_action( 'wp_ajax_nopriv_dipl_get_testimonials', array( $this, 'dipl_get_testimonials' ) ); if ( is_admin() && $this->dipl_is_filterable_gallery_enabled() && ! is_plugin_active( 'divi-gallery-extended/divi-gallery-extended.php' ) ) { add_filter( 'attachment_fields_to_edit', array( $this, 'dipl_add_attachment_fields' ), 10, 2 ); add_filter( 'attachment_fields_to_save', array( $this, 'dipl_save_attachment_fields' ), 10, 2 ); add_filter( 'bulk_actions-upload', array( $this, 'dipl_add_bulk_edit_action' ) ); add_action( 'admin_footer-upload.php', array( $this, 'dipl_media_list_table' ) ); add_filter( 'handle_bulk_actions-upload', array( $this, 'dipl_media_bulk_edit' ), 10 , 3 ); add_action( 'admin_enqueue_scripts', array( $this, 'dipl_media_admin_enqueue_scripts' ) ); $this->dipl_update_term_count(); } } /** * plugin setup function. * *@since 1.0.0 */ public function dipl_plugin_setup() { require_once plugin_dir_path( __FILE__ ) . 'src/functions.php'; require_once plugin_dir_path( __FILE__ ) . 'panel/init.php'; require_once plugin_dir_path( __FILE__ ) . 'extensions/extensions.php'; } public function dipl_media_admin_enqueue_scripts() { $current_screen = get_current_screen(); if ( 'upload' === $current_screen->base ) { wp_enqueue_script( 'dge-inline-edit-script', "{$this->plugin_dir_url}includes/assets/js/inline-edit.min.js", array('jquery'), $this->version, false ); wp_enqueue_style( 'dge-upload-style', "{$this->plugin_dir_url}includes/assets/css/admin_media.min.css", array(), $this->version ); } } public function dipl_register_scripts() { wp_register_script( 'elicus-isotope-script', "{$this->plugin_dir_url}includes/assets/js/isotope.pkgd.min.js", array('jquery'), '3.0.6', true ); wp_register_script( 'elicus-images-loaded-script', "{$this->plugin_dir_url}includes/assets/js/imagesloaded.pkgd.min.js", array('jquery'), '4.1.4', true ); wp_register_script( 'elicus-lottie-script', "{$this->plugin_dir_url}includes/assets/js/lottie.min.js", array('jquery'), '5.7.3', true ); wp_register_script( 'elicus-twenty-twenty-script', "{$this->plugin_dir_url}includes/assets/js/jquery_twentytwenty.min.js", array('jquery'), null, true ); wp_register_script( 'elicus-event-move-script', "{$this->plugin_dir_url}includes/assets/js/jquery_event_move.min.js", array('jquery'), '2.0.0', true ); wp_register_script( 'elicus-tooltipster-script', "{$this->plugin_dir_url}includes/assets/js/tooltipster.bundle.min.js", array('jquery'), null, true ); wp_register_script( 'elicus-swiper-script', "{$this->plugin_dir_url}includes/assets/js/swiper/swiper.min.js", array('jquery'), '6.4.5', true ); wp_register_script( 'elicus-particle-script', "{$this->plugin_dir_url}includes/assets/js/particles.min.js", array('jquery'), '2.0.0', true ); wp_register_script( 'elicus-magnify-script', "{$this->plugin_dir_url}includes/assets/js/jquery.magnify.min.js", array('jquery'), '2.3.3', true ); wp_register_script( 'elicus-magnify-mobile-script', "{$this->plugin_dir_url}includes/assets/js/jquery.magnify-mobile.min.js", array('jquery'), '2.3.3', true ); wp_register_script( 'elicus-tilt-script', "{$this->plugin_dir_url}includes/assets/js/tilt.jquery.min.js", array('jquery'), '1.2.1', true ); wp_register_script( 'magnific-popup', "{$this->plugin_dir_url}includes/assets/js/magnific_popup.min.js", array('jquery'), '1.0.0', true ); wp_register_script( 'elicus-twbs-pagination', "{$this->plugin_dir_url}includes/assets/js/twbsPagination.min.js", array('jquery'), '1.4.2', true ); wp_register_style( 'elicus-tooltipster-style', "{$this->plugin_dir_url}includes/assets/css/tooltipster.bundle.min.css", array(), null ); wp_register_style( 'elicus-swiper-style', "{$this->plugin_dir_url}includes/assets/css/swiper/swiper.min.css", array(), '6.4.5' ); wp_register_style( 'elicus-magnify-style', "{$this->plugin_dir_url}includes/assets/css/magnify/magnify.min.css", array(), null ); wp_register_style( 'magnific-popup', "{$this->plugin_dir_url}includes/assets/css/magnific_popup.min.css", array(), '1.0.0' ); wp_register_style( 'dipl-swiper-style', "{$this->plugin_dir_url}styles/diplSwiper.min.css", array(), '1.0.0' ); } public function dipl_fb_enqueue_scripts() { if ( et_core_is_fb_enabled() ) { wp_enqueue_script( 'elicus-isotope-script' ); wp_enqueue_script( 'elicus-images-loaded-script' ); wp_enqueue_script( 'elicus-lottie-script' ); wp_enqueue_script( 'elicus-twenty-twenty-script' ); wp_enqueue_script( 'elicus-event-move-script' ); wp_enqueue_script( 'elicus-tooltipster-script' ); wp_enqueue_script( 'elicus-swiper-script' ); wp_enqueue_script( 'elicus-magnify-script' ); wp_enqueue_script( 'elicus-magnify-mobile-script' ); wp_enqueue_script( 'elicus-tilt-script' ); wp_enqueue_style( 'elicus-tooltipster-style' ); wp_enqueue_style( 'elicus-swiper-style' ); wp_enqueue_style( 'elicus-magnify-style' ); wp_enqueue_script( 'elicus-twbs-pagination' ); } } public function dipl_admin_enqueue_scripts( $hook_suffix ) { if ( $hook_suffix === 'post-new.php' || $hook_suffix === 'post.php' ) { wp_enqueue_style( 'dipl-admin-style', "{$this->plugin_dir_url}styles/admin.min.css", array(), $this->version, false ); wp_enqueue_script( 'dipl-admin-script', "{$this->plugin_dir_url}scripts/admin.min.js", array('jquery'), $this->version, false ); } } public function dipl_load_plugin_textdomain() { load_plugin_textdomain( 'divi-plus', false, dirname( plugin_basename( __DIR__ ) ) . '/languages/' ); } /** * Update nonce in Ajax Search Module when updating the cart. * * @since 1.7.2 */ public function dipl_update_nonce( $uid , $action = -1 ) { if ( ! is_user_logged_in() && $action === 'elicus-divi-plus-ajax-search-nonce' ) { return get_current_user_id(); } return $uid; } /** * add JSON to allowed file uploads. * * @since 1.5.2 */ public function dipl_mime_types( $mimes ) { $mimes['json'] = 'application/json'; return $mimes; } /** * add JSON to wp_check_filetype_and_ext. * * @since 1.5.2 */ public function dipl_check_filetype_and_ext( $types, $file, $filename, $mimes ) { $check_file = wp_check_filetype( $filename ); if ( 'json' === $check_file['ext'] ) { $types['ext'] = 'json'; $types['type'] = 'application/json'; } return $types; } public function dipl_exists_and_is_not_empty( $key, $array ) { if ( ! array_key_exists( $key, $array ) ) { return false; } return ! empty( $array[ $key ] ); } public function dipl_migrate_gradient( $props, $attrs, $render_slug, $_address, $content ) { if ( 'dipl_' === substr( $render_slug, 0, 5 ) && ET_BUILDER_PRODUCT_VERSION >= '4.16.0' ) { $basenames = array( 'search_result_box_bg', 'search_result_item_bg', 'bar_bg', 'filled_bar_bg', 'post_content_wrapper_background', 'timeline_background', 'button_bg', 'pre_background', 'main_background', 'post_background', 'front_background', 'back_background', 'buttons_bg', 'reset_bg', 'submit_bg', 'save_continue_bg', 'tooltip_background', 'accordion_bg', 'active_accordion_bg', 'content_bg', 'mask_background', 'trigger_element_bg', 'modal_overlay_bg', 'modal_bg', 'modal_header_bg', 'modal_body_bg', 'modal_footer_bg', 'trigger_button_bg', 'back_button_bg', 'read_more_bg', 'nav_bg', 'grid_overlay_bg', 'grid_bg', 'category_background', 'active_category_background', 'slide_bg', 'testimonial_card_bg', 'pre_post_background', 'main_background', 'global_timeline_background', 'timeline_bg', 'product_bg', 'add_to_cart_bg', 'quickview_add_to_cart_bg', 'category_content_bg', ); foreach( $basenames as $basename ) { if ( isset( $props["{$basename}_color_gradient_stops"] ) && '#2b87da 0%|#29c4a9 100%' === $props["{$basename}_color_gradient_stops"] ) { if ( $this->dipl_exists_and_is_not_empty( "{$basename}_color_gradient_start", $props ) && $this->dipl_exists_and_is_not_empty( "{$basename}_color_gradient_start_position", $props ) && $this->dipl_exists_and_is_not_empty( "{$basename}_color_gradient_end", $props ) && $this->dipl_exists_and_is_not_empty( "{$basename}_color_gradient_end_position", $props ) ) { // Strip percent signs and round to nearest int for our calculations. $pos_start = round( floatval( $props["{$basename}_color_gradient_start_position"] ) ); $pos_start_unit = trim( $props["{$basename}_color_gradient_start_position"], ',. 0..9' ); $pos_end = round( floatval( $props["{$basename}_color_gradient_end_position"] ) ); $pos_end_unit = trim( $props["{$basename}_color_gradient_end_position"], ',. 0..9' ); // Our sliders use percent values, but pixel values might be manually set. $pos_units_match = ( $pos_start_unit === $pos_end_unit ); // If (and ONLY if) both values use the same unit of measurement, // adjust the end position value to be no smaller than the start. if ( $pos_units_match && $pos_end < $pos_start ) { $pos_end = $pos_start; } // Prepare to receive the new gradient settings. $new_values = array( 'start' => $props["{$basename}_color_gradient_start"] . ' ' . $pos_start . $pos_start_unit, 'end' => $props["{$basename}_color_gradient_end"] . ' ' . $pos_end . $pos_end_unit, ); $props["{$basename}_color_gradient_stops"] = implode( '|', $new_values ); $is_responsive_enabled = et_pb_responsive_options()->is_responsive_enabled( $props, "{$basename}_color" ); if ( $is_responsive_enabled ) { if ( $this->dipl_exists_and_is_not_empty( "{$basename}_color_gradient_start_tablet", $props ) ) { $start_color = $props["{$basename}_color_gradient_start_tablet"]; } else { $start_color = $props["{$basename}_color_gradient_start"]; } if ( $this->dipl_exists_and_is_not_empty( "{$basename}_color_gradient_end_tablet", $props ) ) { $end_color = $props["{$basename}_color_gradient_end_tablet"]; } else { $end_color = $props["{$basename}_color_gradient_end"]; } if ( $this->dipl_exists_and_is_not_empty( "{$basename}_color_gradient_start_position_tablet", $props ) ) { $pos_start = $props["{$basename}_color_gradient_start_position_tablet"]; $pos_start_unit = trim( $props["{$basename}_color_gradient_start_position_tablet"], ',. 0..9' ); } else { $pos_start = $props["{$basename}_color_gradient_start_position"]; $pos_start_unit = trim( $props["{$basename}_color_gradient_start_position"], ',. 0..9' ); } if ( $this->dipl_exists_and_is_not_empty( "{$basename}_color_gradient_end_position_tablet", $props ) ) { $pos_end = $props["{$basename}_color_gradient_end_position_tablet"]; $pos_end_unit = trim( $props["{$basename}_color_gradient_end_position_tablet"], ',. 0..9' ); } else { $pos_end = $props["{$basename}_color_gradient_end_position"]; $pos_end_unit = trim( $props["{$basename}_color_gradient_end_position"], ',. 0..9' ); } // Our sliders use percent values, but pixel values might be manually set. $pos_units_match = ( $pos_start_unit === $pos_end_unit ); // If (and ONLY if) both values use the same unit of measurement, // adjust the end position value to be no smaller than the start. if ( $pos_units_match && $pos_end < $pos_start ) { $pos_end = $pos_start; } // Prepare to receive the new gradient settings. $new_values = array( 'start' => $start_color . ' ' . $pos_start . $pos_start_unit, 'end' => $end_color . ' ' . $pos_end . $pos_end_unit, ); $props["{$basename}_color_gradient_stops_tablet"] = implode( '|', $new_values ); if ( $this->dipl_exists_and_is_not_empty( "{$basename}_color_gradient_start_phone", $props ) ) { $start_color = $props["{$basename}_color_gradient_start_phone"]; } if ( $this->dipl_exists_and_is_not_empty( "{$basename}_color_gradient_end_phone", $props ) ) { $end_color = $props["{$basename}_color_gradient_end_phone"]; } if ( $this->dipl_exists_and_is_not_empty( "{$basename}_color_gradient_start_position_phone", $props ) ) { $pos_start = $props["{$basename}_color_gradient_start_position_phone"]; $pos_start_unit = trim( $props["{$basename}_color_gradient_start_position_phone"], ',. 0..9' ); } if ( $this->dipl_exists_and_is_not_empty( "{$basename}_color_gradient_end_position_phone", $props ) ) { $pos_end = $props["{$basename}_color_gradient_end_position_phone"]; $pos_end_unit = trim( $props["{$basename}_color_gradient_end_position_phone"], ',. 0..9' ); } // Our sliders use percent values, but pixel values might be manually set. $pos_units_match = ( $pos_start_unit === $pos_end_unit ); // If (and ONLY if) both values use the same unit of measurement, // adjust the end position value to be no smaller than the start. if ( $pos_units_match && $pos_end < $pos_start ) { $pos_end = $pos_start; } // Prepare to receive the new gradient settings. $new_values = array( 'start' => $start_color . ' ' . $pos_start . $pos_start_unit, 'end' => $end_color . ' ' . $pos_end . $pos_end_unit, ); $props["{$basename}_color_gradient_stops_phone"] = implode( '|', $new_values ); } $is_hover_enabled = et_pb_hover_options()->is_enabled( "{$basename}_color", $props ); if ( $is_hover_enabled ) { if ( isset( $props["{$basename}_color_gradient_start__hover"], $props["{$basename}_color_gradient_start_position__hover"], $props["{$basename}_color_gradient_end__hover"], $props["{$basename}_color_gradient_end_position__hover"] ) ) { // Strip percent signs and round to nearest int for our calculations. $pos_start = round( floatval( $props["{$basename}_color_gradient_start_position__hover"] ) ); $pos_start_unit = trim( $props["{$basename}_color_gradient_start_position__hover"], ',. 0..9' ); $pos_end = round( floatval( $props["{$basename}_color_gradient_end_position__hover"] ) ); $pos_end_unit = trim( $props["{$basename}_color_gradient_end_position__hover"], ',. 0..9' ); // Our sliders use percent values, but pixel values might be manually set. $pos_units_match = ( $pos_start_unit === $pos_end_unit ); // If (and ONLY if) both values use the same unit of measurement, // adjust the end position value to be no smaller than the start. if ( $pos_units_match && $pos_end < $pos_start ) { $pos_end = $pos_start; } // Prepare to receive the new gradient settings. $new_values = array( 'start' => $props["{$basename}_color_gradient_start__hover"] . ' ' . $pos_start . $pos_start_unit, 'end' => $props["{$basename}_color_gradient_end__hover"] . ' ' . $pos_end . $pos_end_unit, ); $props["{$basename}_color_gradient_stops__hover"] = implode( '|', $new_values ); } } } } if ( $this->dipl_exists_and_is_not_empty( "{$basename}_color_gradient_type", $props ) && 'radial' === $props["{$basename}_color_gradient_type"] ) { $props["{$basename}_color_gradient_type"] = 'circular'; $is_responsive_enabled = et_pb_responsive_options()->is_responsive_enabled( $props, "{$basename}_color" ); if ( $is_responsive_enabled ) { foreach( array( 'tablet', 'phone' ) as $device ) { if ( $this->dipl_exists_and_is_not_empty( "{$basename}_color_gradient_type_{$device}", $props ) && 'radial' === $props["{$basename}_color_gradient_type_{$device}"] ) { $props["{$basename}_color_gradient_type_{$device}"] = 'circular'; } } } $is_hover_enabled = et_pb_hover_options()->is_enabled( "{$basename}_color", $props ); if ( $is_hover_enabled ) { if ( $this->dipl_exists_and_is_not_empty( "{$basename}_color_gradient_type__hover", $props ) && 'radial' === $props["{$basename}_color_gradient_type__hover"] ) { $props["{$basename}_color_gradient_type__hover"] = 'circular'; } } } } } return $props; } public function dipl_add_bulk_edit_action($actions) { unset( $actions['delete'] ); $actions['edit'] = esc_html__( 'Edit', 'divi-plus' ); $actions['delete'] = esc_html__( 'Delete permanently', 'divi-plus' ); return $actions; } public function dipl_media_list_table() { $modes = array( 'grid', 'list' ); $mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid'; // phpcs:ignore WordPress,NonceVerification,NoNonce. if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], $modes, true ) ) { // phpcs:ignore WordPress,NonceVerification,NoNonce. $mode = sanitize_text_field( wp_unslash( $_GET['mode'] ) ); } if ( 'list' === $mode ) { require_once plugin_dir_path( __FILE__ ) . 'src/class-media-list-table.php'; $media_list_table = new DIPL_Media_List_Table(); if ( $media_list_table->has_items() ) { $media_list_table->inline_edit(); } } } public function dipl_media_bulk_edit( $location, $doaction, $post_ids ) { if ( isset( $_REQUEST['dge_bulk_edit'] ) && 'edit' === $doaction ) { if ( ! isset( $_REQUEST['dge_bulk_edit_nonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_REQUEST['dge_bulk_edit_nonce'] ) ), 'bulkeditnonce' ) ) { return $location; } $post_data = $_REQUEST; if ( empty( $post_data ) ) { $post_data = &$_POST; } if ( isset( $post_data['post_type'] ) && 'attachment' !== $post_data['post_type'] ) { return false; } else { $ptype = get_post_type_object( 'attachment' ); } if ( ! current_user_can( $ptype->cap->edit_posts ) ) { wp_die( esc_html__( 'Sorry, you are not allowed to edit attachments.' ) ); } $reset = array( 'caption', 'description', 'meta_input', 'tax_input', ); foreach ( $reset as $field ) { if ( isset( $post_data[ $field ] ) && ( '' === $post_data[ $field ] || -1 == $post_data[ $field ] ) ) { unset( $post_data[ $field ] ); } } $tax_input = array(); if ( isset( $post_data['tax_input'] ) ) { foreach ( $post_data['tax_input'] as $tax_name => $terms ) { if ( empty( $terms ) ) { continue; } if ( is_taxonomy_hierarchical( $tax_name ) ) { $tax_input[ $tax_name ] = array_map( 'absint', $terms ); } else { $comma = _x( ',', 'tag delimiter' ); if ( ',' !== $comma ) { $terms = str_replace( $comma, ',', $terms ); } $tax_input[ $tax_name ] = explode( ',', trim( $terms, " \n\t\r\0\x0B," ) ); } } } $meta_input = array(); if ( isset( $post_data['meta_input'] ) ) { foreach ( $post_data['meta_input'] as $meta_key => $meta_value ) { if ( empty( trim( $meta_value ) ) ) { unset( $post_data['meta_input'][$meta_key] ); continue; } $meta_input[$meta_key] = sanitize_text_field( $meta_value ); } if ( ! empty( $meta_input ) ) { $post_data['meta_input'] = $meta_input; } else { unset($post_data['meta_input']); } } $updated = array(); $skipped = array(); $locked = array(); $shared_post_data = $post_data; foreach ( $post_ids as $post_id ) { // Start with fresh post data with each iteration. $post_data = $shared_post_data; $post_type_object = get_post_type_object( get_post_type( $post_id ) ); if ( ! isset( $post_type_object ) || ! current_user_can( 'edit_post', $post_id ) ) { $skipped[] = $post_id; continue; } if ( wp_check_post_lock( $post_id ) ) { $locked[] = $post_id; continue; } $post = get_post( $post_id ); $tax_names = get_object_taxonomies( $post ); foreach ( $tax_names as $tax_name ) { $current_terms = array(); $taxonomy_obj = get_taxonomy( $tax_name ); if ( isset( $tax_input[ $tax_name ] ) && current_user_can( $taxonomy_obj->cap->assign_terms ) ) { $new_terms = $tax_input[ $tax_name ]; } else { $new_terms = array(); } if ( $taxonomy_obj->hierarchical ) { $current_terms = (array) wp_get_object_terms( $post_id, $tax_name, array( 'fields' => 'ids' ) ); } else { $current_terms = (array) wp_get_object_terms( $post_id, $tax_name, array( 'fields' => 'names' ) ); } $post_data['tax_input'][ $tax_name ] = array_merge( $current_terms, $new_terms ); } $post_data['ID'] = $post_id; $post_data['post_type'] = $post->post_type; $post_data['post_mime_type'] = $post->post_mime_type; if ( isset( $post_data['caption'] ) && '' !== trim( $post_data['caption'] ) ) { $post_data['post_excerpt'] = $post_data['caption']; } if ( isset( $post_data['description'] ) && '' !== trim( $post_data['description'] ) ) { $post_data['post_content'] = $post_data['description']; } $updated[] = wp_update_post( $post_data ); } $done = array(); $done['updated'] = count( $updated ); $done['skipped'] = count( $skipped ); $done['locked'] = count( $locked ); $location = add_query_arg( $done, $location ); } return $location; } public function dipl_add_attachment_fields( $form_fields, $post ) { if ( preg_match( "/image/", $post->post_mime_type ) ) { $attachment_categories = wp_get_object_terms( $post->ID, 'attachment-category', array( 'fields' => 'ids' ) ); $attachment_categories = sanitize_text_field( implode( ',', $attachment_categories ) ); $categories_checklist = wp_terms_checklist( $post->ID, array( 'taxonomy' => 'attachment-category', 'echo' => false, 'checked_ontop' => false, ) ); if ( $categories_checklist ) { $metafield = sprintf( '
', $post->ID, $attachment_categories, $categories_checklist ); } else { $metafield = sprintf( '', esc_url( admin_url( 'edit-tags.php?taxonomy=attachment-category&post_type=attachment' ) ) ); } $form_fields['dge_attachment_categories'] = array( 'label' => esc_html__( 'Attachment Category', 'divi-plus' ), 'input' => 'html', 'html' => $metafield, 'show_in_edit' => false, ); $attachment_link = esc_url_raw( get_post_meta( $post->ID, 'dge_attachment_link', true ) ); $form_fields['dge_attachment_link'] = array( 'label' => esc_html__( 'Custom Link', 'divi-plus' ), 'input' => 'text', 'value' => $attachment_link, 'show_in_edit' => true, ); } return $form_fields; } public function dipl_save_attachment_fields( $post, $attachment ) { if ( isset( $attachment['dge_attachment_categories'] ) ) { if ( taxonomy_exists( 'attachment-category' ) ) { $categories = array_map( 'absint', preg_split( '/,+/', $attachment['dge_attachment_categories'] ) ); wp_set_object_terms( $post['ID'], $categories, 'attachment-category', false ); } } if ( isset( $attachment['dge_attachment_link'] ) ) { update_post_meta( $post['ID'], 'dge_attachment_link', esc_url_raw( $attachment['dge_attachment_link'] ) ); } return $post; } public function dipl_update_term_count() { $terms = get_terms( array( 'taxonomy' => 'attachment-category', 'fields' => 'ids', 'hide_empty' => false, ) ); if ( $terms && ! is_wp_error( $terms ) && ! empty( $terms ) ) { wp_update_term_count_now( $terms, 'attachment-category'); } } public function dipl_late_assets( $assets_list, $assets_args, $dynamic_assets ) { if ( function_exists( 'et_get_dynamic_assets_path' ) && function_exists( 'et_is_cpt' ) ) { $cpt_suffix = et_is_cpt() ? '_cpt' : ''; $assets_list['et_legacy_animations'] = array( 'css' => $assets_args['assets_prefix'] . "/css/legacy_animations{$cpt_suffix}.css", ); $assets_list['et_icons_all'] = array( 'css' => $assets_args['assets_prefix'] . "/css/icons_all.css", ); $assets_list['et_overlay'] = array( 'css' => $assets_args['assets_prefix'] . "/css/overlay{$cpt_suffix}.css", ); $assets_list['et_icons_fa'] = array( 'css' => $assets_args['assets_prefix'] . "/css/icons_fa_all.css", ); $assets_list['animations'] = array( 'css' => $assets_args['assets_prefix'] . "/css/animations{$cpt_suffix}.css", ); $assets_list['et_icons_social'] = array( 'css' => $assets_args['assets_prefix'] . "/css/icons_base_social.css", ); } return $assets_list; } public function dipl_is_filterable_gallery_enabled() { $plugin_options = get_option( ELICUS_DIVI_PLUS_OPTION ); if ( isset( $plugin_options['dipl-modules'] ) ) { $modules = explode( ',', $plugin_options['dipl-modules'] ); if ( in_array( 'dipl_filterable_gallery', $modules ) ) { return true; } } else { return true; } return false; } public function dipl_is_testimonial_enabled() { $plugin_options = get_option( ELICUS_DIVI_PLUS_OPTION ); if ( isset( $plugin_options['dipl-modules'] ) ) { $modules = explode( ',', $plugin_options['dipl-modules'] ); if ( in_array( 'dipl_testimonial_slider', $modules ) || in_array( 'dipl_testimonial_grid', $modules ) ) { return true; } } else { return true; } return false; } public function dipl_is_team_enabled() { $plugin_options = get_option( ELICUS_DIVI_PLUS_OPTION ); if ( isset( $plugin_options['dipl-modules'] ) ) { $modules = explode( ',', $plugin_options['dipl-modules'] ); if ( in_array( 'dipl_team_slider', $modules ) || in_array( 'dipl_team_grid', $modules ) ) { return true; } } else { return true; } return false; } public function dipl_register_post_types() { $labels = array( 'name' => esc_html_x( 'DP Testimonials', 'Post Type General Name', 'divi-plus' ), 'singular_name' => esc_html_x( 'DP Testimonial', 'Post Type Singular Name', 'divi-plus' ), 'menu_name' => esc_html__( 'DP Testimonials', 'divi-plus' ), 'name_admin_bar' => esc_html__( 'DP Testimonial', 'divi-plus' ), 'archives' => esc_html__( 'DP Testimonial Archives', 'divi-plus' ), 'attributes' => esc_html__( 'DP Testimonial Attributes', 'divi-plus' ), 'parent_item_colon' => esc_html__( 'Parent Testimonial:', 'divi-plus' ), 'all_items' => esc_html__( 'All Testimonials', 'divi-plus' ), 'add_new_item' => esc_html__( 'Add New Testimonial', 'divi-plus' ), 'add_new' => esc_html__( 'Add New', 'divi-plus' ), 'new_item' => esc_html__( 'New Testimonial', 'divi-plus' ), 'edit_item' => esc_html__( 'Edit Testimonial', 'divi-plus' ), 'update_item' => esc_html__( 'Update Testimonial', 'divi-plus' ), 'view_item' => esc_html__( 'View Testimonial', 'divi-plus' ), 'view_items' => esc_html__( 'View Testimonial', 'divi-plus' ), 'search_items' => esc_html__( 'Search Testimonial', 'divi-plus' ), 'not_found' => esc_html__( 'Not found', 'divi-plus' ), 'not_found_in_trash' => esc_html__( 'Not found in Trash', 'divi-plus' ), 'featured_image' => esc_html__( 'Testimonial Author Image', 'divi-plus' ), 'set_featured_image' => esc_html__( 'Set testimonial author image', 'divi-plus' ), 'remove_featured_image' => esc_html__( 'Remove testimonial author image', 'divi-plus' ), 'use_featured_image' => esc_html__( 'Use as testimonial author image', 'divi-plus' ), 'insert_into_item' => esc_html__( 'Insert into item', 'divi-plus' ), 'uploaded_to_this_item' => esc_html__( 'Uploaded to this item', 'divi-plus' ), 'items_list' => esc_html__( 'Testimonials list', 'divi-plus' ), 'items_list_navigation' => esc_html__( 'Testimonials list navigation', 'divi-plus' ), 'filter_items_list' => esc_html__( 'Filter testimonial list', 'divi-plus' ), ); $args = array( 'label' => esc_html__( 'DP Testimonials', 'divi-plus' ), 'description' => esc_html__( 'Divi Plus Testimonials Custom Post', 'divi-plus' ), 'labels' => $labels, 'supports' => array( 'title', 'editor', 'thumbnail', ), 'taxonomies' => array( 'dipl-testimonial-category' ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 20, 'menu_icon' => 'dashicons-format-quote', 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'post', ); if ( $this->dipl_is_testimonial_enabled() ) { register_post_type( 'dipl-testimonial', $args ); } $labels = array( 'name' => esc_html__( 'DP Team Members', 'divi-plus' ), 'singular_name' => esc_html__( 'DP Team Member', 'divi-plus' ), 'menu_name' => esc_html__( 'DP Team Members', 'divi-plus' ), 'add_new' => esc_html__( 'Add New', 'divi-plus' ), 'add_new_item' => esc_html__( 'Add New Member', 'divi-plus' ), 'edit_item' => esc_html__( 'Edit Member', 'divi-plus' ), 'new_item' => esc_html__( 'New Member', 'divi-plus' ), 'view_item' => esc_html__( 'View Member', 'divi-plus' ), 'all_items' => esc_html__( 'All Members', 'divi-plus' ), 'search_items' => esc_html__( 'Search Members', 'divi-plus' ), 'not_found' => esc_html__( 'No member found', 'divi-plus' ), 'not_found_in_trash' => esc_html__( 'No members found in Trash', 'divi-plus' ), 'featured_image' => esc_html__( 'Team Member Image', 'divi-plus' ), 'set_featured_image' => esc_html__( 'Set team member image', 'divi-plus' ), 'remove_featured_image' => esc_html__( 'Remove team member image', 'divi-plus' ), 'use_featured_image' => esc_html__( 'Use as team member image', 'divi-plus' ), 'parent_item_colon' => esc_html__( 'Parent Member:', 'divi-plus' ), ); $args = array( 'labels' => $labels, 'description' => esc_html__( 'Divi Plus Team Members Custom Post', 'divi-plus' ), 'public' => true, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'revisions' ), 'taxonomies' => array( 'dipl-team-member-category' ), 'hierarchical' => false, 'menu_position' => 20, 'menu_icon' => 'dashicons-admin-users', 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'has_archive' => true, 'query_var' => true, 'capability_type' => 'post', ); if ( $this->dipl_is_team_enabled() ) { register_post_type( 'dipl-team-member', $args ); } } public function dipl_register_taxonomies() { $labels = array( 'name' => esc_html_x( 'DP Testimonial Categories', 'Taxonomy General Name', 'divi-plus' ), 'singular_name' => esc_html_x( 'DP Testimonial Category', 'Taxonomy Singular Name', 'divi-plus' ), 'menu_name' => esc_html__( 'DP Testimonial Categories', 'divi-plus' ), 'all_items' => esc_html__( 'All Testimonial Categories', 'divi-plus' ), 'parent_item' => esc_html__( 'Parent Testimonial Category', 'divi-plus' ), 'parent_item_colon' => esc_html__( 'Parent Testimonial Category:', 'divi-plus' ), 'new_item_name' => esc_html__( 'New Testimonial Category Name', 'divi-plus' ), 'add_new_item' => esc_html__( 'Add New Testimonial Category', 'divi-plus' ), 'edit_item' => esc_html__( 'Edit Testimonial Category', 'divi-plus' ), 'update_item' => esc_html__( 'Update Testimonial Category', 'divi-plus' ), 'view_item' => esc_html__( 'View Testimonial Category', 'divi-plus' ), 'separate_items_with_commas' => esc_html__( 'Separate categories with commas', 'divi-plus' ), 'add_or_remove_items' => esc_html__( 'Add or remove categories', 'divi-plus' ), 'choose_from_most_used' => esc_html__( 'Choose from the most used', 'divi-plus' ), 'popular_items' => esc_html__( 'Popular Testimonial Categories', 'divi-plus' ), 'search_items' => esc_html__( 'Search Testimonial Categories', 'divi-plus' ), 'not_found' => esc_html__( 'Not Found', 'divi-plus' ), 'no_terms' => esc_html__( 'No Testimonial Categories', 'divi-plus' ), 'items_list' => esc_html__( 'Testimonial Categories list', 'divi-plus' ), 'items_list_navigation' => esc_html__( 'Testimonial Categories list navigation', 'divi-plus' ), ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => true, ); if ( $this->dipl_is_testimonial_enabled() ) { register_taxonomy( 'dipl-testimonial-category', array( 'dipl-testimonial' ), $args ); } $labels = array( 'name' => esc_html_x( 'DP Team Member Categories', 'Taxonomy General Name', 'divi-plus' ), 'singular_name' => esc_html_x( 'DP Team Member Category', 'Taxonomy Singular Name', 'divi-plus' ), 'menu_name' => esc_html__( 'DP Team Member Categories', 'divi-plus' ), 'all_items' => esc_html__( 'All Team Member Categories', 'divi-plus' ), 'parent_item' => esc_html__( 'Parent Team Member Category', 'divi-plus' ), 'parent_item_colon' => esc_html__( 'Parent Team Member Category:', 'divi-plus' ), 'new_item_name' => esc_html__( 'New Team Member Category Name', 'divi-plus' ), 'add_new_item' => esc_html__( 'Add New Team Member Category', 'divi-plus' ), 'edit_item' => esc_html__( 'Edit Team Member Category', 'divi-plus' ), 'update_item' => esc_html__( 'Update Team Member Category', 'divi-plus' ), 'view_item' => esc_html__( 'View Team Member Category', 'divi-plus' ), 'separate_items_with_commas' => esc_html__( 'Separate categories with commas', 'divi-plus' ), 'add_or_remove_items' => esc_html__( 'Add or remove categories', 'divi-plus' ), 'choose_from_most_used' => esc_html__( 'Choose from the most used', 'divi-plus' ), 'popular_items' => esc_html__( 'Popular Team Member Categories', 'divi-plus' ), 'search_items' => esc_html__( 'Search Team Member Categories', 'divi-plus' ), 'not_found' => esc_html__( 'Not Found', 'divi-plus' ), 'no_terms' => esc_html__( 'No Team Member Categories', 'divi-plus' ), 'items_list' => esc_html__( 'Team Member Categories list', 'divi-plus' ), 'items_list_navigation' => esc_html__( 'Team Member Categories list navigation', 'divi-plus' ), ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => true, ); if ( $this->dipl_is_team_enabled() ) { register_taxonomy( 'dipl-team-member-category', array( 'dipl-team-member' ), $args ); } $labels = array( 'name' => esc_html_x( 'Media Categories', 'Taxonomy General Name', 'divi-plus' ), 'singular_name' => esc_html_x( 'Media Category', 'Taxonomy Singular Name', 'divi-plus' ), 'menu_name' => esc_html__( 'Media Categories', 'divi-plus' ), 'all_items' => esc_html__( 'All Media Categories', 'divi-plus' ), 'parent_item' => esc_html__( 'Parent Media Category', 'divi-plus' ), 'parent_item_colon' => esc_html__( 'Parent Media Category:', 'divi-plus' ), 'new_item_name' => esc_html__( 'New Media Category Name', 'divi-plus' ), 'add_new_item' => esc_html__( 'Add New Media Category', 'divi-plus' ), 'edit_item' => esc_html__( 'Edit Media Category', 'divi-plus' ), 'update_item' => esc_html__( 'Update Media Category', 'divi-plus' ), 'view_item' => esc_html__( 'View Media Category', 'divi-plus' ), 'separate_items_with_commas' => esc_html__( 'Separate categories with commas', 'divi-plus' ), 'add_or_remove_items' => esc_html__( 'Add or remove categories', 'divi-plus' ), 'choose_from_most_used' => esc_html__( 'Choose from the most used', 'divi-plus' ), 'popular_items' => esc_html__( 'Popular Media Categories', 'divi-plus' ), 'search_items' => esc_html__( 'Search Media Categories', 'divi-plus' ), 'not_found' => esc_html__( 'Not Found', 'divi-plus' ), 'no_terms' => esc_html__( 'No Media Categories', 'divi-plus' ), 'items_list' => esc_html__( 'Media Categories list', 'divi-plus' ), 'items_list_navigation' => esc_html__( 'Media Categories list navigation', 'divi-plus' ), ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'public' => false, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => true, 'update_count_callback' => '_update_generic_term_count', ); if ( $this->dipl_is_filterable_gallery_enabled() && ! is_plugin_active( 'divi-gallery-extended/divi-gallery-extended.php' ) ) { register_taxonomy( 'attachment-category', array( 'attachment' ), $args ); } } public function dipl_add_meta_boxes() { add_action( 'add_meta_boxes', array( $this, 'dipl_meta_boxes' ) ); } public function dipl_meta_boxes() { if ( $this->dipl_is_testimonial_enabled() ) { add_meta_box( 'dipl_testimonial_metabox', esc_html__( 'Testimonial Meta Fields', 'divi-plus' ), array( $this, 'dipl_testimonials_metabox_callback' ), 'dipl-testimonial', 'normal', 'high' ); } if ( $this->dipl_is_team_enabled() ) { add_meta_box( 'dipl_team_member_metabox', esc_html__( 'Team Member Meta Fields', 'divi-plus' ), array( $this, 'dipl_team_member_metabox_callback' ), 'dipl-team-member', 'normal', 'high' ); } } public function dipl_testimonials_metabox_callback( $post ) { wp_nonce_field( 'dipl_metaboxes_nonce', 'dipl_testimonial_metabox_nonce' ); $author_name = get_post_meta( $post->ID, 'dipl_testimonial_author_name', true ); $author_email = get_post_meta( $post->ID, 'dipl_testimonial_author_email', true ); $author_designation = get_post_meta( $post->ID, 'dipl_testimonial_author_designation', true ); $author_company = get_post_meta( $post->ID, 'dipl_testimonial_author_company', true ); $author_company_url = get_post_meta( $post->ID, 'dipl_testimonial_author_company_url', true ); $author_rating = get_post_meta( $post->ID, 'dipl_testimonial_author_rating', true ); $author_rating = $author_rating ? $author_rating : '5'; $ratings = array( '0.5', '1', '1.5', '2', '2.5', '3', '3.5', '4', '4.5', '5' ); ?> ID ); $short_desc = isset( $values['dipl_team_member_short_desc'] ) ? $values['dipl_team_member_short_desc'][0] : ''; $designation = isset( $values['dipl_team_member_designation'] ) ? $values['dipl_team_member_designation'][0] : ''; $website_url = isset( $values['dipl_team_member_website'] ) ? $values['dipl_team_member_website'][0] : ''; $linkedin = isset( $values['dipl_team_member_linkedin'] ) ? $values['dipl_team_member_linkedin'][0] : ''; $facebook = isset( $values['dipl_team_member_facebook'] ) ? $values['dipl_team_member_facebook'][0] : ''; $twitter = isset( $values['dipl_team_member_twitter'] ) ? $values['dipl_team_member_twitter'][0] : ''; $instagram = isset( $values['dipl_team_member_instagram'] ) ? $values['dipl_team_member_instagram'][0] : ''; $youtube = isset( $values['dipl_team_member_youtube'] ) ? $values['dipl_team_member_youtube'][0] : ''; $email = isset( $values['dipl_team_member_email'] ) ? $values['dipl_team_member_email'][0] : ''; $phone = isset( $values['dipl_team_member_phone'] ) ? $values['dipl_team_member_phone'][0] : ''; $skills = isset( $values['dipl_team_member_skills'] ) ? $values['dipl_team_member_skills'][0] : ''; $skills_value = isset( $values['dipl_team_member_skills_value'] ) ? $values['dipl_team_member_skills_value'][0] : ''; wp_nonce_field( 'dipl_metaboxes_nonce', 'dipl_team_member_metabox_nonce' ); $allowed_html = array( 'p' => array( 'id' => array(), 'class' => array(), ), 'ul' => array( 'id' => array(), 'class' => array(), ), 'ol' => array( 'id' => array(), 'class' => array(), ), 'li' => array( 'id' => array(), 'class' => array(), ), 'span' => array( 'id' => array(), 'class' => array(), ), 'strong' => array( 'id' => array(), 'class' => array(), ), 'b' => array( 'id' => array(), 'class' => array(), ), 'a' => array( 'href' => array(), 'id' => array(), 'class' => array(), ), 'br' => array( 'id' => array(), 'class' => array(), ), 'h1' => array( 'id' => array(), 'class' => array(), ), 'h2' => array( 'id' => array(), 'class' => array(), ), 'h3' => array( 'id' => array(), 'class' => array(), ), 'h4' => array( 'id' => array(), 'class' => array(), ), 'h5' => array( 'id' => array(), 'class' => array(), ), 'h6' => array( 'id' => array(), 'class' => array(), ), ); ?> array( 'id' => array(), 'class' => array(), ), 'ul' => array( 'id' => array(), 'class' => array(), ), 'ol' => array( 'id' => array(), 'class' => array(), ), 'li' => array( 'id' => array(), 'class' => array(), ), 'span' => array( 'id' => array(), 'class' => array(), ), 'strong' => array( 'id' => array(), 'class' => array(), ), 'b' => array( 'id' => array(), 'class' => array(), ), 'a' => array( 'href' => array(), 'id' => array(), 'class' => array(), ), 'br' => array( 'id' => array(), 'class' => array(), ), 'h1' => array( 'id' => array(), 'class' => array(), ), 'h2' => array( 'id' => array(), 'class' => array(), ), 'h3' => array( 'id' => array(), 'class' => array(), ), 'h4' => array( 'id' => array(), 'class' => array(), ), 'h5' => array( 'id' => array(), 'class' => array(), ), 'h6' => array( 'id' => array(), 'class' => array(), ), ); foreach ( $fields as $field ) { if ( isset( $_POST[ $field ] ) ) { if ( 'dipl_team_member_short_desc' === $field ) { ${$field} = wp_kses( wp_unslash( $_POST[$field] ), $allowed_html ); } else { ${$field} = sanitize_text_field( wp_unslash( $_POST[ $field ] ) ); } update_post_meta( $post_id, $field, ${$field} ); } } } public function dipl_get_images() { if ( ! isset( $_POST['dipl_get_images_nonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['dipl_get_images_nonce'] ) ), 'elicus-divi-plus-nonce' ) ) { return; } if ( ! isset( $_POST['props'] ) ) { return; } $defaults = array( 'number_of_images' => 20, 'offset_number' => 0, 'gallery_order_by' => 'date', 'gallery_order' => 'DESC', 'include_categories' => '', 'image_size' => 'medium', 'on_click_trigger' => 'none', 'link_target' => 'off', 'enable_overlay' => 'off', 'show_overlay_icon' => 'off', 'overlay_icon' => '', 'show_title' => 'off', 'show_caption' => 'off', 'disable_lazy_loading' => 'on', 'title_level' => 'h4', 'page' => 1, 'total_pages' => 1, 'tax_query_field' => 'term_id', ); foreach ( $defaults as $key => $default ) { // phpcs:ignore ET.Sniffs.ValidatedSanitizedInput.InputNotSanitized if ( isset( $_POST['props'][$key] ) && et_()->includes( $_POST['props'][$key], '%' ) ) { // phpcs:ignore ET.Sniffs.ValidatedSanitizedInput.InputNotSanitized $prepared_value = preg_replace( '/%([a-f0-9]{2})/', '%_$1', $_POST['props'][$key] ); ${$key} = preg_replace( '/%_([a-f0-9]{2})/', '%$1', trim( sanitize_text_field( wp_unslash( $prepared_value ) ) ) ); } else { // phpcs:ignore ET.Sniffs.ValidatedSanitizedInput.InputNotSanitized ${$key} = trim( sanitize_text_field( wp_unslash( et_()->array_get( $_POST['props'], $key, $default ) ) ) ); } } $processed_title_level = esc_html( $title_level ); $valid_heading_tag = array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ); if ( ! in_array( $processed_title_level, $valid_heading_tag, true ) ) { $processed_title_level = esc_html( 'h4' ); } $number_of_images = absint( $number_of_images ); $offset_number = absint( $offset_number ); $page = absint( $page ); $offset_number = ( $number_of_images * ( $page - 1 ) ) + $offset_number; $args = array( 'post_type' => 'attachment', 'posts_per_page' => $number_of_images, 'post_status' => 'any', 'orderby' => $gallery_order_by, 'order' => $gallery_order, 'offset' => $offset_number, 'post_mime_type' => 'image/jpeg,image/gif,image/jpg,image/png,image/webp', ); if ( '' !== $include_categories ) { if ( 'slug' === $tax_query_field ) { $include_categories = array_map( 'sanitize_text_field', explode( ',', $include_categories ) ); } else { $include_categories = array_map( 'intval', explode( ',', $include_categories ) ); } $args['tax_query'] = array( array( 'taxonomy' => 'attachment-category', 'field' => $tax_query_field, 'terms' => $include_categories, 'operator' => 'IN', ), ); } $query = new WP_Query( $args ); if ( $query->have_posts() ) { $image_ids = wp_list_pluck( $query->posts, 'ID' ); if ( 'on' === $enable_overlay ) { if ( 'on' === $show_overlay_icon ) { $overlay_output = sprintf( '', esc_attr( $overlay_icon ) ); } else { $overlay_output = ''; } } $gallery_items = ''; $gallery_item_class = 'dipl_filterable_gallery_item_page_' . $page; $allowed_tags = array( 'div' => array( 'class' => true, 'id' => true, ), 'p' => array( 'class' => true, 'id' => true, ), 'h1' => array( 'class' => true, 'id' => true, ), 'h2' => array( 'class' => true, 'id' => true, ), 'h3' => array( 'class' => true, 'id' => true, ), 'h4' => array( 'class' => true, 'id' => true, ), 'h5' => array( 'class' => true, 'id' => true, ), 'h6' => array( 'class' => true, 'id' => true, ), 'ul' => array( 'class' => true, 'id' => true, ), 'ol' => array( 'class' => true, 'id' => true, ), 'li' => array( 'class' => true, 'id' => true, ), 'a' => array( 'href' => true, 'title' => true, 'class' => true, 'id' => true, 'target' => true, ), 'abbr' => array( 'title' => true, ), 'acronym' => array( 'title' => true, ), 'b' => array(), 'blockquote' => array( 'cite' => true, ), 'cite' => array(), 'code' => array(), 'del' => array( 'datetime' => true, ), 'em' => array(), 'i' => array(), 'q' => array( 'cite' => true, ), 's' => array(), 'strike' => array(), 'strong' => array(), 'span' => array( 'class' => true, 'id' => true, ), ); foreach( $image_ids as $image_id ) { $link = get_post_meta( intval( $image_id ), 'dge_attachment_link', true ); if ( 'on' === $show_title && '' !== trim( wptexturize( get_the_title( $image_id ) ) ) ) { if ( '' !== $link ) { $title_text = sprintf( '%1$s', trim( wptexturize( get_the_title( $image_id ) ) ), esc_url( $link ), 'on' === $link_target ? '_blank' : '_self' ); } else { $title_text = wp_kses( get_the_title( $image_id ), $allowed_tags ); } $title = sprintf( '<%1$s class="dipl_filterable_gallery_item_title">%2$s%1$s>', $processed_title_level, et_core_esc_previously( $title_text ) ); } else { $title = ''; } if ( 'on' === $show_caption && '' !== trim( wp_get_attachment_caption( $image_id ) ) ) { if ( '' !== $link ) { $caption_text = sprintf( '%1$s', wp_kses( wp_get_attachment_caption( $image_id ), $allowed_tags ), esc_url( $link ), 'on' === $link_target ? '_blank' : '_self' ); } else { $caption_text = wp_kses( wp_get_attachment_caption( $image_id ), $allowed_tags ); } $caption = sprintf( ''. esc_html__( 'The team you requested could not be found. Try changing your module settings or create some new team members.', 'divi-plus' ) .'
';
}
} else {
$image = '
';
}
} else {
$image = '
';
}
$author_image = sprintf(
'',
et_core_intentionally_unescaped( $image, 'html' )
);
}
//* Get Author Name */
$name = get_post_meta( $testimonial_id, 'dipl_testimonial_author_name', true );
if ( '' !== $name ) {
$author_name = sprintf(
'',
esc_html( $name )
);
} else {
$author_name = '';
}
/* Get Author Designation */
if ( 'on' === $show_author_designation ) {
$desgination = get_post_meta( $testimonial_id, 'dipl_testimonial_author_designation', true );
if ( '' !== $desgination ) {
$author_designation = sprintf(
'',
esc_html( $desgination )
);
} else {
$author_designation = '';
}
}
/* Get Company Details */
if ( 'on' === $show_author_company_name ) {
$company_name = get_post_meta( $testimonial_id, 'dipl_testimonial_author_company', true );
$company_url = get_post_meta( $testimonial_id, 'dipl_testimonial_author_company_url', true );
$author_company = '';
if ( '' !== $company_url && '' !== $company_name ) {
$author_company = sprintf(
'',
esc_url( $company_url ),
esc_html( $company_name )
);
} elseif ( '' !== $company_name ) {
$author_company = sprintf(
'',
esc_html( $company_name )
);
}
}
$testimonials .= ''. esc_html__( 'The testimonials you requested could not be found. Try changing your module settings or create some new testimonials.', 'divi-plus' ) .'