← Back
Editing: divi-tabs-maker.php
<?php /* Plugin Name: Divi Tabs Maker Plugin URI: https://www.peeayecreative.com/product/divi-tabs-maker/ Description: Easily create beautiful advanced tabs in Divi with tons of custom content and design settings! Version: 2.3.1 Author: Pee-Aye Creative Author URI: https://www.peeayecreative.com/ Update URI: https://www.peeayecreative.com/ License: GPL2 License URI: https://www.gnu.org/licenses/gpl-2.0.html Text Domain: pac-dtm-divi-tabs-maker Domain Path: /languages Divi Tabs Maker is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or any later version. Divi Tabs Maker is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Divi Tabs Maker. If not, see https://www.gnu.org/licenses/gpl-2.0.html. */ if (!function_exists('pacdtm_initialize_extension')) : /** * Creates the extension's main class instance. * * @since 1.0.0 */ function pacdtm_initialize_extension() { require_once plugin_dir_path(__FILE__) . 'includes/PACDiviTabsMaker.php'; } add_action('divi_extensions_init', 'pacdtm_initialize_extension'); endif; if (!defined('pac_dtm_plugin_basename')) { define('pac_dtm_plugin_basename', plugin_basename(__FILE__)); } // Register New Shortcode add_shortcode('pac_dtm_gallery_item', 'pac_dtm_shortcode_callback'); // Create New Shortcode function pac_dtm_shortcode_callback($pac_dtm_id) { $pac_dtm_arg = shortcode_atts(array('id' => '*'), $pac_dtm_id); $id = (int) $pac_dtm_arg['id']; return do_shortcode('[et_pb_section global_module="' . esc_attr($id) . ' "][/et_pb_section]'); } function pwh_custom_fields($custom_fields) { $pac_dtm_library_layouts = get_posts('post_type=et_pb_layout&posts_per_page=-1'); $pac_dtm_library_layouts = wp_list_pluck($pac_dtm_library_layouts, 'post_title', 'ID'); foreach ($pac_dtm_library_layouts as $pac_dtm_library_layout_id => $pac_dtm_library_layout_title) { $settings = array( 'label' => esc_html($pac_dtm_library_layout_title), 'type' => 'any', 'fields' => array( 'before' => array( 'label' => esc_html__('', 'et_builder'), 'type' => 'text', 'default' => '[pac_dtm_gallery_item id="' . $pac_dtm_library_layout_id . '"]', 'value' => '[pac_dtm_gallery_item id="' . $pac_dtm_library_layout_id . '"]', 'show_on' => 'text', ), ), 'meta_key' => 'pac_dtm_gallery_' . $pac_dtm_library_layout_id, // phpcs:ignore 'group' => __('Divi Library', 'et_builder'), ); $custom_fields["pac_dtm_gallery_layouts_" . $pac_dtm_library_layout_id] = $settings; } return $custom_fields; } function pac_dtm_remove_extra_fields() { $pac_dtm_library_layouts = get_posts('post_type=et_pb_layout&posts_per_page=-1'); $pac_dtm_library_layouts = wp_list_pluck($pac_dtm_library_layouts, 'post_title', 'ID'); $classes = []; foreach ($pac_dtm_library_layouts as $id => $title) { array_push($classes, ".select-option-item-pac_dtm_gallery_layouts_" . $id); } ?> <script> jQuery(($) => { const targetNode = document.querySelector('#et-fb-content_dynamic_content'); if (!targetNode) { return; } const observer = new MutationObserver((mutationsList) => { for (const mutation of mutationsList) { if (mutation.target.parentElement && mutation.target.parentElement.closest('[data-name="pac_dtm_main_content_tab"]')) { return; } } <?php // Deleting all dynamic fields that might have been displayed elsewhere // Note, we're only deleting the ones we added via pwh_custom_fields() foreach ($classes as $class) { echo sprintf('el.find(\'%1$s\').parents(\'.et-fb-option-subgroup-separator\').remove(); ', esc_js($class)); } ?> }); observer.observe(targetNode, { childList: true, subtree: true }); }) </script> <?php } function plugin_extra_headers_divi_tabs_maker($headers){ if (!in_array('DocumentationURI', $headers)) { $headers[] = 'DocumentationURI'; } return $headers; } function plugin_meta_links_divi_tabs_maker($links, $file) { if (pac_dtm_plugin_basename !== $file) { return $links; } $links[] = sprintf('<a href="%s" target="_blank">'.esc_html__('Documentation & Support', 'pac-dtm-divi-tabs-maker').'</a>', esc_url('https://www.peeayecreative.com/docs/divi-tabs-maker/')); return $links; } add_filter('extra_plugin_headers', 'plugin_extra_headers_divi_tabs_maker'); add_filter('plugin_row_meta', 'plugin_meta_links_divi_tabs_maker', 10, 2); add_filter('et_builder_custom_dynamic_content_fields', 'pwh_custom_fields', 10, 3); add_action('wp_head', 'pac_dtm_remove_extra_fields'); add_action('admin_head', 'pac_dtm_remove_extra_fields'); // LICENSE MANAGER CODE BEGINS HERE if(!defined('WOO_SLT_DTM_PATH_DTM')) define('WOO_SLT_DTM_PATH_DTM', plugin_dir_path(__FILE__)); if(!defined('WOO_SLT_DTM_URL_DTM')) define('WOO_SLT_DTM_URL_DTM', plugins_url('', __FILE__)); if(!defined('WOO_SLT_DTM_APP_API_URL_DTM')) define('WOO_SLT_DTM_APP_API_URL_DTM', 'https://www.peeayecreative.com/product/divi-tabs-maker/'); if(!defined('WOO_SLT_DTM_VERSION_DTM')) define('WOO_SLT_DTM_VERSION_DTM', '2.3.1'); if(!defined('WOO_SLT_DTM_DB_VERSION_DTM')) define('WOO_SLT_DTM_DB_VERSION_DTM', '2.3.1'); if(!defined('WOO_SLT_DTM_PRODUCT_ID_DTM')) define('WOO_SLT_DTM_PRODUCT_ID_DTM', 'PA-DTM'); if(!defined('WOO_SLT_DTM_INSTANCE_DTM')) define('WOO_SLT_DTM_INSTANCE_DTM', str_replace(array ("https://" , "http://"), "", network_site_url())); if(!class_exists('WOO_SLT_DTM')) include_once(WOO_SLT_DTM_PATH_DTM . '/license/class.wooslt.php'); if(!class_exists('WOO_SLT_DTM_licence')) include_once(WOO_SLT_DTM_PATH_DTM . '/license/class.licence.php'); if(!class_exists('WOO_SLT_DTM_options_interface')) include_once(WOO_SLT_DTM_PATH_DTM . '/license/class.options.php'); if(!class_exists('WOO_SLT_DTM_CodeAutoUpdate')) include_once(WOO_SLT_DTM_PATH_DTM . '/license/class.updater.php'); function WOO_SLT_DTM_DTM_activated() { } function WOO_SLT_DTM_DTM_deactivated() { } global $WOO_SLT_DTM; $WOO_SLT_DTM = new WOO_SLT_DTM() ?>
Save File
Cancel