| @@ -76,8 +76,9 @@ | ||
| 76 | 76 | 'nx_bar_border_radius_top' => 0, |
| 77 | 77 | 'nx_bar_border_radius_bottom' => 0, |
| 78 | 78 | 'button_icon' => 'none', |
| 79 | 79 | 'bar_bg_color' => '#5807a2', |
| 80 | + // phpcs:ignore WordPress.WP.I18n.NoHtmlWrappedStrings -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 80 | 81 | 'press_content' => __('<b>We\'re excited to introduce something new!</b>','notificationx'), |
| 81 | 82 | 'button_text' => __('Show Me!', 'notificationx'), |
| 82 | 83 | 'link_button_bg_color' => '#9c2bff', |
| 83 | 84 | 'link_button_text_color' => '#ffffff', |
| @@ -126,8 +127,9 @@ | ||
| 126 | 127 | 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/press_bar_theme-four-preview.webp', |
| 127 | 128 | 'column' => "12", |
| 128 | 129 | 'defaults' => [ |
| 129 | 130 | 'enable_countdown' => 1, |
| 131 | + // phpcs:ignore WordPress.WP.I18n.NoHtmlWrappedStrings -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 130 | 132 | 'press_content' => __('<p><span style="color: #F54747;">4 Years</span> Of Seamlessly Creating NotificationX!</p>','notificationx'), |
| 131 | 133 | 'button_text' => __('Grab Deal Now', 'notificationx'), |
| 132 | 134 | 'link_button_bg_color' => '#ffffff', |
| 133 | 135 | 'link_button_text_color' => '#000', |
| @@ -143,8 +145,9 @@ | ||
| 143 | 145 | 'theme-five' => [ |
| 144 | 146 | 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/press_bar_theme-five-preview.webp', |
| 145 | 147 | 'column' => "12", |
| 146 | 148 | 'defaults' => [ |
| 149 | + // phpcs:ignore WordPress.WP.I18n.NoHtmlWrappedStrings -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 147 | 150 | 'press_content' => __('<p><span style="color: #fff;">🎁 Flash 30%</span> Sale is On Now! Don’t miss out on this opportunity</p>','notificationx'), |
| 148 | 151 | 'enable_countdown' => 1, |
| 149 | 152 | 'nx_bar_border_radius_left' => 16, |
| 150 | 153 | 'nx_bar_border_radius_right' => 16, |
| @@ -162,8 +165,9 @@ | ||
| 162 | 165 | 'theme-six' => [ |
| 163 | 166 | 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/press_bar_theme-six-preview.webp', |
| 164 | 167 | 'column' => "12", |
| 165 | 168 | 'defaults' => [ |
| 169 | + // phpcs:ignore WordPress.WP.I18n.NoHtmlWrappedStrings -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 166 | 170 | 'press_content' => __('<p><span style="color: #000;">🎁 Flash 30%</span> Sale is On Now! Don’t miss out on this opportunity</p>','notificationx'), |
| 167 | 171 | 'enable_countdown' => 1, |
| 168 | 172 | 'nx_bar_border_radius_left' => 16, |
| 169 | 173 | 'nx_bar_border_radius_right' => 16, |
| @@ -179,8 +183,9 @@ | ||
| 179 | 183 | 'theme-seven' => [ |
| 180 | 184 | 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/press_bar_theme-seven-preview.webp', |
| 181 | 185 | 'column' => "12", |
| 182 | 186 | 'defaults' => [ |
| 187 | + // phpcs:ignore WordPress.WP.I18n.NoHtmlWrappedStrings -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 183 | 188 | 'press_content' => __('<p><span style="color: #9F7800;">4 years</span> Of Seamlessly Creating NotificationX!</p>','notificationx'), |
| 184 | 189 | 'enable_countdown' => 0, |
| 185 | 190 | 'nx_bar_border_radius_left' => 0, |
| 186 | 191 | 'nx_bar_border_radius_right' => 0, |
| @@ -347,9 +352,9 @@ | ||
| 347 | 352 | unset($post['data']['is_gutenberg']); |
| 348 | 353 | unset($post['data']['is_gb_confirmed']); |
| 349 | 354 | $post['data']['countdown_start_date'] = !empty( $data['countdown_start_date'] ) ? Helper::mysql_time($data['countdown_start_date']) : ''; |
| 350 | 355 | $post['data']['countdown_end_date'] = !empty( $data['countdown_end_date'] ) ? Helper::mysql_time($data['countdown_end_date']) : ''; |
| 351 | - $post['data']['countdown_rand'] = rand(); | |
| 356 | + $post['data']['countdown_rand'] = wp_rand(); | |
| 352 | 357 | return $post; |
| 353 | 358 | } |
| 354 | 359 | |
| 355 | 360 | public function saved_post($post, $data, $nx_id) { |
| @@ -1171,10 +1176,8 @@ | ||
| 1171 | 1176 | * @param array $args Settings arguments. |
| 1172 | 1177 | * @return mixed |
| 1173 | 1178 | */ |
| 1174 | 1179 | public function customize_fields($fields) { |
| 1175 | - $wp_roles = $this->get_roles(); | |
| 1176 | - | |
| 1177 | 1180 | $fields['queue_management'] = Rules::is('source', $this->id, true, $fields['queue_management']); |
| 1178 | 1181 | $_fields = &$fields["appearance"]['fields']; |
| 1179 | 1182 | $conversion_position = &$_fields['position']['options']; |
| 1180 | 1183 | |
| @@ -1303,62 +1306,11 @@ | ||
| 1303 | 1306 | Rules::is('appear_condition', 'after_few_seconds'), |
| 1304 | 1307 | ]), |
| 1305 | 1308 | ]; |
| 1306 | 1309 | |
| 1307 | - $fields['targeting'] = [ | |
| 1308 | - 'label' => __('Targeting', 'notificationx'), | |
| 1309 | - 'type' => 'section', | |
| 1310 | - 'id' => 'targeting', | |
| 1311 | - 'classes' => 'nx-targeting', | |
| 1312 | - 'priority' => 100, | |
| 1313 | - 'info' => InfoTooltipManager::get_instance()->render('button'), | |
| 1314 | - 'fields' => [] | |
| 1315 | - ]; | |
| 1310 | + // Country / user-role targeting fields now live in NotificationX\Core\Targeting | |
| 1311 | + // and are injected for ALL notification types, not just the bar. See that class. | |
| 1316 | 1312 | |
| 1317 | - // Country Targeting | |
| 1318 | - $fields['targeting']['fields']['country_targeting'] = [ | |
| 1319 | - 'label' => __('Country Targeting', 'notificationx'), | |
| 1320 | - 'name' => 'country_targeting', | |
| 1321 | - 'type' => 'better-select', | |
| 1322 | - 'priority' => 10, | |
| 1323 | - 'is_pro' => true, | |
| 1324 | - 'multiple' => true, | |
| 1325 | - 'values' => [ 'label' => "All Country", 'value' => 'all' ], | |
| 1326 | - 'option' => GlobalFields::get_instance()->normalize_fields(Helper::nx_get_all_country()), | |
| 1327 | - 'ajax' => [ | |
| 1328 | - 'api' => "/notificationx/v1/get-data", | |
| 1329 | - 'data' => [ | |
| 1330 | - 'type' => "@type", | |
| 1331 | - 'source' => "@source", | |
| 1332 | - // 'field' => "country_targeting", | |
| 1333 | - ], | |
| 1334 | - ], | |
| 1335 | - 'rules' => Rules::is('source', $this->id), | |
| 1336 | - 'info' => InfoTooltipManager::get_instance()->render('targeting'), | |
| 1337 | - ]; | |
| 1338 | - | |
| 1339 | - // User Role Targeting | |
| 1340 | - $wp_roles_with_default = []; | |
| 1341 | - if( is_array( $wp_roles ) ) { | |
| 1342 | - $wp_roles_with_default = array_merge( | |
| 1343 | - [ 'all_users' => __('Show for All Users', 'notificationx') ], | |
| 1344 | - $wp_roles | |
| 1345 | - ); | |
| 1346 | - } | |
| 1347 | - $fields['targeting']['fields']['targeting_user_roles'] = [ | |
| 1348 | - 'label' => __('Set Target Audience', 'notificationx'), | |
| 1349 | - 'name' => 'targeting_user_roles', | |
| 1350 | - 'type' => 'select', | |
| 1351 | - 'priority' => 20, | |
| 1352 | - 'is_pro' => true, | |
| 1353 | - 'default' => ['all_users'], | |
| 1354 | - 'options' => GlobalFields::get_instance()->normalize_fields($wp_roles_with_default), | |
| 1355 | - 'multiple' => true, | |
| 1356 | - 'info' => InfoTooltipManager::get_instance()->render('targeting'), | |
| 1357 | - 'rules' => Rules::is('source', $this->id), | |
| 1358 | - ]; | |
| 1359 | - | |
| 1360 | - | |
| 1361 | 1313 | $fields["behaviour"]['fields']['display_last'] = Rules::is('source', $this->id, true, $fields["behaviour"]['fields']['display_last']); |
| 1362 | 1314 | $fields["behaviour"]['fields']['display_from'] = Rules::is('source', $this->id, true, $fields["behaviour"]['fields']['display_from']); |
| 1363 | 1315 | $fields["behaviour"]['fields']['loop'] = Rules::is('source', $this->id, true, $fields["behaviour"]['fields']['loop']); |
| 1364 | 1316 | $fields["behaviour"] = Rules::logicalRule([ |
| @@ -1526,19 +1478,21 @@ | ||
| 1526 | 1478 | } |
| 1527 | 1479 | |
| 1528 | 1480 | public function delete_elementor_post($elementor_id) { |
| 1529 | 1481 | if(!empty($elementor_id)){ |
| 1482 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 1530 | 1483 | $languages = apply_filters( 'wpml_active_languages', NULL ); |
| 1531 | 1484 | if(is_array($languages)){ |
| 1532 | 1485 | foreach ($languages as $lang => $val) { |
| 1486 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 1533 | 1487 | $elementor_post_id = apply_filters( 'wpml_object_id', $elementor_id, 'nx_bar', false, $lang); |
| 1534 | 1488 | if($elementor_post_id){ |
| 1535 | - wp_delete_post($elementor_post_id, true); | |
| 1489 | + Helper::delete_owned_post($elementor_post_id, 'nx_bar'); | |
| 1536 | 1490 | } |
| 1537 | 1491 | } |
| 1538 | 1492 | return; |
| 1539 | 1493 | } |
| 1540 | - wp_delete_post($elementor_id, true); | |
| 1494 | + Helper::delete_owned_post($elementor_id, 'nx_bar'); | |
| 1541 | 1495 | } |
| 1542 | 1496 | } |
| 1543 | 1497 | |
| 1544 | 1498 | /** |
| @@ -1990,9 +1944,9 @@ | ||
| 1990 | 1944 | 'name' => 'countdown_end_date', |
| 1991 | 1945 | 'label' => __('End Date', 'notificationx'), |
| 1992 | 1946 | 'type' => 'date', |
| 1993 | 1947 | // @todo Something |
| 1994 | - 'default' => date('Y-m-d H:i:s', time() + 7 * 24 * 60 * 60), | |
| 1948 | + 'default' => gmdate('Y-m-d H:i:s', time() + 7 * 24 * 60 * 60), | |
| 1995 | 1949 | 'rules' => ["and", ['is', 'evergreen_timer', false], ['is', 'enable_countdown', true]], |
| 1996 | 1950 | ), |
| 1997 | 1951 | 'time_randomize' => array( |
| 1998 | 1952 | 'name' => 'time_randomize', |
| @@ -2072,11 +2026,13 @@ | ||
| 2072 | 2026 | $elementor_post_id = isset($settings->elementor_id) ? $settings->elementor_id : ''; |
| 2073 | 2027 | $gb_post_id = isset($settings->gutenberg_id) ? $settings->gutenberg_id : ''; |
| 2074 | 2028 | |
| 2075 | 2029 | if ($elementor_post_id != '' && get_post_status($elementor_post_id) === 'publish' && class_exists('\Elementor\Plugin')) { |
| 2030 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 2076 | 2031 | $elementor_post_id = apply_filters( 'wpml_object_id', $elementor_post_id, 'nx_bar', true); |
| 2077 | 2032 | return \Elementor\Plugin::$instance->frontend->get_builder_content_for_display($elementor_post_id, false); |
| 2078 | 2033 | } else if (!empty($gb_post_id)) { |
| 2034 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 2079 | 2035 | $gb_post_id = apply_filters( 'wpml_object_id', $gb_post_id, 'wp_block', true); |
| 2080 | 2036 | $post = get_post($gb_post_id); |
| 2081 | 2037 | $content = $post->post_content; |
| 2082 | 2038 | $content = do_blocks($content); |
| @@ -2174,19 +2130,21 @@ | ||
| 2174 | 2130 | } |
| 2175 | 2131 | |
| 2176 | 2132 | public function gutenberg_remove($pid){ |
| 2177 | 2133 | if(!empty($pid)){ |
| 2134 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 2178 | 2135 | $languages = apply_filters( 'wpml_active_languages', NULL ); |
| 2179 | 2136 | if(is_array($languages)){ |
| 2180 | 2137 | foreach ($languages as $lang => $val) { |
| 2138 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 2181 | 2139 | $wpml_pid = apply_filters( 'wpml_object_id', $pid, 'wp_block', false, $lang); |
| 2182 | 2140 | if($wpml_pid){ |
| 2183 | - wp_delete_post($wpml_pid, true); | |
| 2141 | + Helper::delete_owned_post($wpml_pid, 'nx_bar_eb'); | |
| 2184 | 2142 | } |
| 2185 | 2143 | } |
| 2186 | 2144 | return; |
| 2187 | 2145 | } |
| 2188 | - wp_delete_post($pid, true); | |
| 2146 | + Helper::delete_owned_post($pid, 'nx_bar_eb'); | |
| 2189 | 2147 | } |
| 2190 | 2148 | } |
| 2191 | 2149 | |
| 2192 | 2150 | public function templately_cloud_push_post_type($post_type){ |
| @@ -2260,8 +2218,9 @@ | ||
| 2260 | 2218 | } |
| 2261 | 2219 | } |
| 2262 | 2220 | |
| 2263 | 2221 | public function doc() { |
| 2222 | + /* translators: %1$s: Elementor documentation URL, %2$s: Gutenberg documentation URL, %3$s: documentation URL, %4$s: blog post URL, %5$s: blog post URL */ | |
| 2264 | 2223 | return sprintf(__('<p>Supercharge your WordPress site with an <strong>AI-powered Notification Bar</strong> that help you create and launches instant popup campaigns — smarter and faster than ever. Let AI generate compelling bar content for you in seconds. Need help getting started? Explore our step-by-step guides to set up your AI-enhanced notification bars using both <a target="_blank" href="%1$s">Elementor</a> and <a target="_blank" href="%2$s">Gutenberg</a>.</p> |
| 2265 | 2224 | <p>🎦 Check the <a target = "_blank" href = "%3$s">documentation</a> for a quick guide.</p> |
| 2266 | 2225 | <p><strong>Recommended Blog : </strong></p> |
| 2267 | 2226 | <p>🔥<a target="_blank" href="%4$s">How to Design a Notification Bar with AI Using NotificationX (A Comprehensive Guide)</a></p> |