Changeset 2237695
- Timestamp:
- 02/03/2020 02:21:23 PM (6 years ago)
- Location:
- experience-manager/trunk
- Files:
-
- 8 added
- 3 deleted
- 13 edited
-
assets/divi (added)
-
assets/divi/experience-manager-divi.js (added)
-
assets/gutenberg/index.js (added)
-
assets/gutenberg/script.js (deleted)
-
assets/gutenberg/style.css (deleted)
-
assets/gutenberg/style.rtl.css (deleted)
-
assets/hook.js (added)
-
css/experience-manager.css (modified) (1 diff)
-
css/tma-settings.css (modified) (2 diffs)
-
experience-manager.php (modified) (3 diffs)
-
includes/backend/class.tma_settings.php (modified) (3 diffs)
-
includes/class.plugins.php (modified) (1 diff)
-
includes/modules/class.integrations.php (added)
-
includes/modules/editors/class.integration.php (modified) (2 diffs)
-
includes/modules/editors/divi (added)
-
includes/modules/editors/divi/class.divibuilder_integration.php (added)
-
includes/modules/editors/divi/index.php (added)
-
includes/modules/editors/elementor/class.elementor_integration.php (modified) (3 diffs)
-
includes/modules/editors/gutenberg/class.gutenberg_integration.php (modified) (3 diffs)
-
js/experience-manager-frontend.js (modified) (2 diffs)
-
modules/class.settings-api.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
tma-autoload.php (modified) (2 diffs)
-
tma-scripts.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
experience-manager/trunk/css/experience-manager.css
r2096995 r2237695 30 30 display: none; 31 31 } 32 [data-tma-divi-default="no"] { 33 display: none; 34 } -
experience-manager/trunk/css/tma-settings.css
r2096995 r2237695 1 .overflow_hidden { 2 overflow: hidden 3 } 4 1 5 /* The switch - the box around the slider */ 2 6 .switch { … … 44 48 transition: .4s; 45 49 } 50 fieldset:disabled .slider:before { 51 position: absolute; 52 content: ""; 53 height: 26px; 54 width: 26px; 55 left: 4px; 56 bottom: 4px; 57 background-color: darkgray; 58 -webkit-transition: .4s; 59 transition: .4s; 60 } 46 61 47 62 input:checked + .slider { -
experience-manager/trunk/experience-manager.php
r2235008 r2237695 14 14 } 15 15 16 define("TMA_EXPERIENCE_MANAGER_VERSION", "3. 0.0");16 define("TMA_EXPERIENCE_MANAGER_VERSION", "3.1.0"); 17 17 define("TMA_EXPERIENCE_MANAGER_SEGMENT_MATCHING_ALL", "all"); 18 18 define("TMA_EXPERIENCE_MANAGER_SEGMENT_MATCHING_ANY", "any"); … … 40 40 add_action("init", "tma_webtools_init"); 41 41 add_action("rest_api_init", "tma_webtools_rest_init"); 42 add_action("plugins_loaded", "tma_webtools_plugins_loaded"); 42 //add_action("plugins_loaded", "tma_webtools_plugins_loaded"); 43 add_action("init", "tma_webtools_plugins_loaded"); 43 44 44 45 function tma_webtools_plugins_loaded() { 45 46 tma_exm_log("load editor plugins"); 46 47 47 if (\TMA\ExperienceManager\Plugins::getInstance()->elementor()) { 48 \TMA\ExperienceManager\Elementor_Integration::getInstance(); 49 \TMA\ExperienceManager\Elementor_Preview::getInstance(); 50 51 // \TMA\ExperienceManager\ElementorPopupIntegration::getInstance()->init(); 52 } 53 if (\TMA\ExperienceManager\Plugins::getInstance()->popup_maker()) { 54 \TMA\ExperienceManager\TMA_PopupMakerIntegration::getInstance()->init(); 55 } 56 if (\TMA\ExperienceManager\Plugins::getInstance()->advanced_ads()) { 57 \TMA\ExperienceManager\TMA_AdvancedAdsIntegration::getInstance()->init(); 58 } 59 if (\TMA\ExperienceManager\Plugins::getInstance()->gutenberg()) { 60 new \TMA\ExperienceManager\Gutenberg_Integration(); 61 } 48 \TMA\ExperienceManager\Modules\Integrations::getInstance()->init(); 62 49 63 require_once 'includes/modules/events/class.ecommerce_events.php';50 // require_once 'includes/modules/events/class.ecommerce_events.php'; 64 51 } 65 52 … … 74 61 75 62 tma_exm_log("tma_webtools_init"); 76 wp_register_style('experience-manager', plugins_url('css/experience-manager.css', __FILE__)); 77 wp_enqueue_style('experience-manager'); 78 // has to be global 79 // Settings 80 // require_once 'includes/frontend/class.tma_script_helper.php'; 81 //require_once 'includes/frontend/class.shortcode_tma_content.php'; 63 if (!is_admin()) { 64 wp_register_style('experience-manager', plugins_url('css/experience-manager.css', __FILE__)); 65 wp_enqueue_style('experience-manager'); 66 67 wp_register_script("experience-manager-hooks", plugins_url('assets/hook.js', __FILE__), [], "1.0.0", false); 68 // wp_enqueue_script("experience-manager-hooks", plugins_url('assets/hook.js', __FILE__), [], "1.0.0", false); 69 } 70 82 71 require_once 'includes/frontend/template_tags.php'; 83 72 -
experience-manager/trunk/includes/backend/class.tma_settings.php
r2235008 r2237695 60 60 'title' => __('Basic Settings', 'wedevs') 61 61 ), 62 array(63 'id' => 'tma_webtools_option_targeting',64 'title' => __('Targeting', 'wedevs')65 )62 // array( 63 // 'id' => 'tma_webtools_option_targeting', 64 // 'title' => __('Targeting', 'wedevs') 65 // ) 66 66 ); 67 67 … … 126 126 'type' => 'toggle' 127 127 ), 128 /* 128 129 array( 129 130 'name' => 'webtools_score', … … 132 133 'type' => 'toggle' 133 134 ) 135 */ 134 136 ), 135 'tma_webtools_option_targeting' => array(136 /*137 array(138 'name' => 'webtools_backend_mode',139 'label' => __("Backend mode?", "tma-webtools"),140 'desc' => __("Experimental: If enabled, the targeting is done in the backend.", "tma-webtools"),141 'type' => 'toggle'142 ),143 */144 array(145 'name' => 'webtools_shortcode_single_item_per_group',146 'label' => __("Single item per group?", "tma-webtools"),147 'desc' => __("If enabled, only the first matching group is delivered.", "tma-webtools"),148 'type' => 'toggle'149 )150 )137 // 'tma_webtools_option_targeting' => array( 138 // /* 139 // array( 140 // 'name' => 'webtools_backend_mode', 141 // 'label' => __("Backend mode?", "tma-webtools"), 142 // 'desc' => __("Experimental: If enabled, the targeting is done in the backend.", "tma-webtools"), 143 // 'type' => 'toggle' 144 // ), 145 // */ 146 // array( 147 // 'name' => 'webtools_shortcode_single_item_per_group', 148 // 'label' => __("Single item per group?", "tma-webtools"), 149 // 'desc' => __("If enabled, only the first matching group is delivered.", "tma-webtools"), 150 // 'type' => 'toggle' 151 // ) 152 // ) 151 153 ); 152 154 -
experience-manager/trunk/includes/class.plugins.php
r2215120 r2237695 39 39 return in_array('elementor/elementor.php', $this->plugins); 40 40 } 41 public function divi() { 42 return function_exists("et_setup_theme"); 43 } 41 44 42 45 public function popup_maker() { -
experience-manager/trunk/includes/modules/editors/class.integration.php
r2201127 r2237695 19 19 } 20 20 21 protected function is_visible($settings) {22 $visible = TRUE;23 // var_dump($settings);24 // frontend25 if (!$this->isActivated($settings)) {26 return true;27 }28 // var_dump($settings);29 $group = $this->getGroup($settings);30 if (!$this->matching($settings)) {31 // segmentation activated AND not matching AND not group default OR group content already added32 if ($this->isGroupDefault($settings) && $this->contentAdded($group)) {33 $visible = FALSE;34 } else if (!$this->isGroupDefault($settings)) {35 $visible = FALSE;36 }37 } else if ($this->singleItemPerGroup() && $this->contentAdded($group)) {38 // segmentation activated & only single item per group & group content already added39 $visible = FALSE;40 }41 if ($visible) {42 $this->addGroupContent($group);43 }44 45 46 $visible = apply_filters("experience-manager/modules/editors/visible", $visible, $settings);47 48 return $visible;49 }50 51 protected function singleItemPerGroup() {52 return $this->onlySingleItemPerGroup === true;53 }54 55 protected function addGroupContent($group) {56 $_REQUEST["tmagroup_" . $group] = true;57 }58 59 protected function contentAdded($group) {60 if (array_key_exists("tmagroup_".$group, $_REQUEST)) {61 return filter_var($_REQUEST["tmagroup_" . $group], FILTER_VALIDATE_BOOLEAN);62 }63 return false;64 }65 66 21 protected function isActivated($args) { 67 22 return (is_array($args) … … 127 82 $attr_segments = array_map('trim', $attr_segments); 128 83 if ($matching_mode === ShortCode_TMA_CONTENT::$match_mode_all) { 129 // $matching = ShortCode_TMA_CONTENT::matching_mode_all(ShortCode_TMA_CONTENT::array_flat($segments), $attr_segments);130 84 $matching = tma_exm_array_match_all($attr_segments, $segments); 131 85 } else if ($matching_mode === ShortCode_TMA_CONTENT::$match_mode_any) { 132 // $matching = ShortCode_TMA_CONTENT::matching_mode_any(ShortCode_TMA_CONTENT::array_flat($segments), $attr_segments);133 86 $matching = tma_exm_array_match_any($attr_segments, $segments); 134 87 } else if ($matching_mode === ShortCode_TMA_CONTENT::$match_mode_none) { 135 // $matching = !ShortCode_TMA_CONTENT::matching_mode_any(ShortCode_TMA_CONTENT::array_flat($segments), $attr_segments);136 88 $matching = !tma_exm_array_match_all($attr_segments, $segments); 137 89 } -
experience-manager/trunk/includes/modules/editors/elementor/class.elementor_integration.php
r2200549 r2237695 56 56 } 57 57 if (!$in_edit) { 58 if ( tma_exm_is_frontend_mode_enabled() &&Elementor_Integration::_isActivated($settings)) {58 if (Elementor_Integration::_isActivated($settings)) { 59 59 if ($settings['tma_default'] === "no") { 60 $attrs["class"] = 'tma-hide';61 }62 } else {63 if ($this->is_widget_visible($element) === FALSE) {64 60 $attrs["class"] = 'tma-hide'; 65 61 } … … 100 96 function isActivated($args) { 101 97 return Elementor_Integration::_isActivated($args); 102 }103 104 protected function isGroupDefault($args) {105 return (is_array($args) && !empty($args['tma_default']) && $args['tma_default'] === "yes");106 }107 108 function is_widget_visible($widget) {109 $visible = TRUE;110 $args = $widget->get_settings();111 // var_dump($args);112 if (\Elementor\Plugin::$instance->editor->is_edit_mode()) {113 $visible = TRUE;114 } else {115 $visible = $this->is_visible($args);116 }117 return $visible;118 98 } 119 99 … … 198 178 199 179 } 200 201 //$tma_elementor_integration = new Elementor_Integration(); -
experience-manager/trunk/includes/modules/editors/gutenberg/class.gutenberg_integration.php
r2096995 r2237695 27 27 public function __construct() { 28 28 29 add_action( 'enqueue_block_editor_assets', array( $this, 'register_block_assets' ));29 add_action('enqueue_block_editor_assets', array($this, 'register_block_assets')); 30 30 } 31 31 … … 39 39 */ 40 40 public function register_block_assets() { 41 $block_js = 'assets/gutenberg/script.js'; 42 $block_css = 'assets/gutenberg/style.css'; 43 41 $block_js = 'assets/gutenberg/index.js'; 44 42 // Script 45 43 wp_register_script( … … 47 45 TMA_EXPERIENCE_MANAGER_URL . $block_js, 48 46 array( 49 'wp-i18n', 50 'wp-blocks', 51 'wp-components', 52 'wp-hooks', 53 'wp-element', 54 'wp-editor' 47 'lodash', 'wp-components', 'wp-compose', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill' 55 48 ), 56 49 filemtime(TMA_EXPERIENCE_MANAGER_DIR . $block_js) 57 50 ); 58 59 // Common stlyes60 wp_register_style(61 'targeting-block-style',62 TMA_EXPERIENCE_MANAGER_URL . $block_css,63 array(64 'wp-blocks',65 ),66 filemtime(TMA_EXPERIENCE_MANAGER_DIR . $block_css)67 );68 69 wp_enqueue_style('targeting-block-style');70 51 wp_enqueue_script('targeting-block-js'); 71 52 } 72 53 73 54 } 74 75 //$tma_elementor_integration = new Elementor_Integration(); -
experience-manager/trunk/js/experience-manager-frontend.js
r2200549 r2237695 16 16 */ 17 17 (function ($) { 18 19 20 18 function tma_webtools_update(segments) { 19 20 EXM_Hook.call("experience-manager/frontend/update/before", {}); 21 21 22 let flat_segments = segments.user_segments.map(segment => "" + segment.wpid); 22 23 webtools.Frontend.update(flat_segments); … … 24 25 25 26 webtools.domReady(function (event) { 26 27 27 webtools.Request.get(TMA_CONFIG.rest_url + "experience-manager/v1/segments").then(function (response) { 28 28 response.json().then(tma_webtools_update); -
experience-manager/trunk/modules/class.settings-api.php
r2096995 r2237695 143 143 'max' => isset( $option['max'] ) ? $option['max'] : '', 144 144 'step' => isset( $option['step'] ) ? $option['step'] : '', 145 'disable' => isset( $option['disable'] ) ? $option['disable'] : FALSE, 145 146 ); 146 147 … … 245 246 $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ); 246 247 247 $html = '<fieldset>'; 248 $html .= sprintf( '<label for="wpuf-%1$s[%2$s]" class="switch">', $args['section'], $args['id'] ); 249 $html .= sprintf( '<input type="checkbox" class="slider" id="wpuf-%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s />', $args['section'], $args['id'], checked( $value, 'on', false ) ); 248 $disabled = ""; 249 if (isset($args['disable']) && $args['disable']) { 250 $disabled = "disabled"; 251 } 252 253 $html = '<fieldset ' . $disabled . ' class="overflow_hidden">'; 254 $html .= sprintf( '<label for="wpuf-%1$s[%2$s]" class="switch overflow_hidden">', $args['section'], $args['id'] ); 255 $html .= sprintf( '<input type="checkbox" class="slider overflow_hidden" id="wpuf-%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s />', $args['section'], $args['id'], checked( $value, 'on', false ) ); 250 256 $html .= sprintf( '<span class="slider"></span>'); 251 257 $html .= sprintf( '</label>'); -
experience-manager/trunk/readme.txt
r2235008 r2237695 4 4 Requires at least: 4.4.1 5 5 Tested up to: 5.3.2 6 Stable tag: 3.0.0 6 Stable tag: 3.1.0 7 Version: 3.1.0 7 8 License: GPLv2 or later 8 9 … … 64 65 == Changelog == 65 66 67 3.1.0 68 * Add possibility to disable integrations into other plugins 69 Attention: By default all integrations are disabled and must be activated first. 70 * Support for the DIVI PageBuilder was added 71 * Gutenberg class name issue fixed 72 66 73 3.0.0 67 74 * Generate unique id for cart tracking -
experience-manager/trunk/tma-autoload.php
r2235008 r2237695 21 21 "TMA\ExperienceManager\TMA_Widget_Targeting" => "includes/widgets/class.widget_targeting.php", 22 22 23 // Integrations 24 "TMA\ExperienceManager\Modules\Integrations" => "includes/modules/class.integrations.php", 23 25 // Popup Maker 24 26 "TMA\ExperienceManager\TMA_PopupMakerIntegration" => "includes/modules/messages/popup-maker/class.popup-maker.php", … … 32 34 // Gutenberg 33 35 "TMA\ExperienceManager\Gutenberg_Integration" => "includes/modules/editors/gutenberg/class.gutenberg_integration.php", 36 // DIVI 37 "TMA\ExperienceManager\Modules\Editors\Divi\DiviBuilder_Integration" => "includes/modules/editors/divi/class.divibuilder_integration.php", 34 38 35 39 // Audience Editor -
experience-manager/trunk/tma-scripts.php
r2192435 r2237695 26 26 */ 27 27 if (tma_exm_is_frontend_mode_enabled() /*&& !is_user_logged_in()*/) { 28 wp_enqueue_script('experience-manager-frontend', TMA_EXPERIENCE_MANAGER_URL . 'js/experience-manager-frontend.js', array("jquery", "webtools-frontend" ), "1");28 wp_enqueue_script('experience-manager-frontend', TMA_EXPERIENCE_MANAGER_URL . 'js/experience-manager-frontend.js', array("jquery", "webtools-frontend", "experience-manager-hooks"), "1"); 29 29 } else if (/*!is_user_logged_in() && */function_exists("has_blocks") && has_blocks()) { 30 wp_enqueue_script('experience-manager-frontend', TMA_EXPERIENCE_MANAGER_URL . 'js/experience-manager-frontend.js', array("jquery", "webtools-frontend" ), "1");30 wp_enqueue_script('experience-manager-frontend', TMA_EXPERIENCE_MANAGER_URL . 'js/experience-manager-frontend.js', array("jquery", "webtools-frontend", "experience-manager-hooks"), "1"); 31 31 } 32 32 }
Note: See TracChangeset
for help on using the changeset viewer.