| @@ -1,0 +1,2379 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Register Global Fields | |
| 5 | + * | |
| 6 | + * @package NotificationX\Extensions | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace NotificationX\Extensions; | |
| 10 | + | |
| 11 | +use NotificationX\Admin\InfoTooltipManager; | |
| 12 | +use NotificationX\Admin\Settings; | |
| 13 | +use NotificationX\Core\Rules; | |
| 14 | +use NotificationX\Core\Database; | |
| 15 | +use NotificationX\Core\Helper; | |
| 16 | +use NotificationX\Core\Locations; | |
| 17 | +use NotificationX\GetInstance; | |
| 18 | +use NotificationX\Core\Modules; | |
| 19 | +use NotificationX\NotificationX; | |
| 20 | +use NotificationX\Types\TypeFactory; | |
| 21 | +use Sabberworm\CSS\Value\Value; | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * @method static GlobalFields get_instance($args = null) | |
| 25 | + */ | |
| 26 | +class GlobalFields { | |
| 27 | + /** | |
| 28 | + * Instance of GlobalFields | |
| 29 | + * | |
| 30 | + * @var GlobalFields | |
| 31 | + */ | |
| 32 | + use GetInstance; | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * Initially Invoked when initialized. | |
| 36 | + */ | |
| 37 | + public function __construct() { | |
| 38 | + | |
| 39 | + // dump(Rules::logicalRule([ Rules::is('test'), Rules::is('test2') ])); | |
| 40 | + } | |
| 41 | + | |
| 42 | + public function tabs() { | |
| 43 | + if(defined('NX_DEBUG') && NX_DEBUG){ | |
| 44 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 45 | + do_action( 'qm/start', __METHOD__ ); | |
| 46 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 47 | + do_action( 'qm/debug', __METHOD__ ); | |
| 48 | + } | |
| 49 | + | |
| 50 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 51 | + do_action('nx_before_metabox_load'); | |
| 52 | + | |
| 53 | + $tabs = [ | |
| 54 | + 'id' => 'notificationx_metabox_wrapper', | |
| 55 | + 'title' => __('NotificationX', 'notificationx'), | |
| 56 | + 'object_types' => array('notificationx'), | |
| 57 | + 'context' => 'normal', | |
| 58 | + 'priority' => 'high', | |
| 59 | + 'show_header' => false, | |
| 60 | + 'tabnumber' => true, | |
| 61 | + 'layout' => 'horizontal', | |
| 62 | + 'version' => defined('NOTIFICATIONX_VERSION') ? NOTIFICATIONX_VERSION : null, | |
| 63 | + 'pro_version' => defined('NOTIFICATIONX_PRO_VERSION') ? NOTIFICATIONX_PRO_VERSION : null, | |
| 64 | + 'is_pro_active' => NotificationX::get_instance()->is_pro(), | |
| 65 | + 'cus_imp_limit' => Settings::get_instance()->get('settings.custom_notification_import_limit', 100), | |
| 66 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 67 | + 'is_pro_sources' => apply_filters('nx_is_pro_sources', []), | |
| 68 | + 'config' => [ | |
| 69 | + 'active' => "source_tab", | |
| 70 | + 'completionTrack' => true, | |
| 71 | + 'sidebar' => true, | |
| 72 | + 'content_heading' => [], | |
| 73 | + 'step' => [ | |
| 74 | + 'show' => true, | |
| 75 | + 'buttons' => [ | |
| 76 | + 'prev' => __('Previous', 'notificationx'), | |
| 77 | + 'next' => __('Next', 'notificationx'), | |
| 78 | + ] | |
| 79 | + ], | |
| 80 | + | |
| 81 | + ], | |
| 82 | + 'submit' => [ | |
| 83 | + 'show' => false, | |
| 84 | + ], | |
| 85 | + 'tabs' => [ | |
| 86 | + "source_tab" => [ | |
| 87 | + 'label' => __("Source", 'notificationx'), | |
| 88 | + 'id' => "source_tab", | |
| 89 | + 'name' => "source_tab", | |
| 90 | + 'icon' => [ | |
| 91 | + 'type' => 'tabs', | |
| 92 | + 'name' => 'source' | |
| 93 | + ], | |
| 94 | + 'classes' => "source_tab", | |
| 95 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 96 | + 'fields' => apply_filters('nx_source_fields', [ | |
| 97 | + 'type_section' => [ | |
| 98 | + 'label' => __("Notification Type", 'notificationx'), | |
| 99 | + 'name' => "type_section", | |
| 100 | + 'type' => "section", | |
| 101 | + 'fields' => [ | |
| 102 | + 'type' => [ | |
| 103 | + // 'label' => "Notification Type", | |
| 104 | + 'name' => "type", | |
| 105 | + 'type' => "radio-card", | |
| 106 | + 'default' => "notification_bar", | |
| 107 | + 'style' => [ | |
| 108 | + 'label' => [ | |
| 109 | + 'position' => 'top' | |
| 110 | + ] | |
| 111 | + ], | |
| 112 | + 'options' => (array) array_map(function ($type) { | |
| 113 | + return [ | |
| 114 | + 'value' => $type->id, | |
| 115 | + 'label' => $type->title, | |
| 116 | + 'is_pro' => $type->is_pro && ! NotificationX::is_pro(), | |
| 117 | + 'priority' => $type->priority, | |
| 118 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 119 | + 'popup' => apply_filters('nx_pro_alert_popup', $type->popup), | |
| 120 | + ]; | |
| 121 | + }, array_values(TypeFactory::get_instance()->get_all())), | |
| 122 | + 'validation_rules' => [ | |
| 123 | + 'required' => true, | |
| 124 | + 'label' => "Type", | |
| 125 | + ], | |
| 126 | + // 'trigger' => [ | |
| 127 | + // 'defaults' => apply_filters( 'nx_type_trigger', [] ), | |
| 128 | + // ] | |
| 129 | + ], | |
| 130 | + ] | |
| 131 | + ], | |
| 132 | + 'source_section' => [ | |
| 133 | + 'label' => __("Source", 'notificationx'), | |
| 134 | + 'name' => "source_section", | |
| 135 | + 'type' => "section", | |
| 136 | + 'fields' => [ | |
| 137 | + 'source_error' => [ | |
| 138 | + 'type' => 'message', | |
| 139 | + 'name' => 'source_error', | |
| 140 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 141 | + 'messages' => apply_filters('source_error_message', []), | |
| 142 | + 'rules' => '', | |
| 143 | + ], | |
| 144 | + 'source' => [ | |
| 145 | + // 'label' => "Source", | |
| 146 | + 'name' => "source", | |
| 147 | + 'type' => "radio-card", | |
| 148 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 149 | + 'options' => apply_filters('nx_sources', []), | |
| 150 | + 'default' => 'woocommerce', | |
| 151 | + 'style' => [ | |
| 152 | + 'label' => [ | |
| 153 | + 'position' => 'top' | |
| 154 | + ] | |
| 155 | + ], | |
| 156 | + 'validation_rules' => [ | |
| 157 | + 'required' => true, | |
| 158 | + 'label' => "Source", | |
| 159 | + ], | |
| 160 | + 'trigger' => [ | |
| 161 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 162 | + 'defaults' => apply_filters( 'nx_source_trigger', [ | |
| 163 | + "custom_notification" => [ | |
| 164 | + 'show_notification_image' => '@show_notification_image:featured_image', | |
| 165 | + ], | |
| 166 | + "custom_notification_conversions" => [ | |
| 167 | + 'show_notification_image' => '@show_notification_image:featured_image', | |
| 168 | + ], | |
| 169 | + "edd" => [ | |
| 170 | + 'show_notification_image' => '@show_notification_image:featured_image', | |
| 171 | + ], | |
| 172 | + "envato" => [ | |
| 173 | + 'show_notification_image' => '@show_notification_image:featured_image', | |
| 174 | + ], | |
| 175 | + "give" => [ | |
| 176 | + 'show_notification_image' => '@show_notification_image:featured_image', | |
| 177 | + ], | |
| 178 | + "learndash" => [ | |
| 179 | + 'show_notification_image' => '@show_notification_image:featured_image', | |
| 180 | + ], | |
| 181 | + "tutor" => [ | |
| 182 | + 'show_notification_image' => '@show_notification_image:featured_image', | |
| 183 | + ], | |
| 184 | + "reviewx" => [ | |
| 185 | + 'show_notification_image' => '@show_notification_image:featured_image', | |
| 186 | + ], | |
| 187 | + "woocommerce" => [ | |
| 188 | + 'show_notification_image' => '@show_notification_image:featured_image', | |
| 189 | + ], | |
| 190 | + "surecart" => [ | |
| 191 | + 'show_notification_image' => '@show_notification_image:featured_image', | |
| 192 | + ], | |
| 193 | + "woo_reviews" => [ | |
| 194 | + 'show_notification_image' => '@show_notification_image:featured_image', | |
| 195 | + ], | |
| 196 | + "wp_reviews" => [ | |
| 197 | + 'show_notification_image' => '@show_notification_image:featured_image', | |
| 198 | + ], | |
| 199 | + "freemius_conversions" => [ | |
| 200 | + 'show_notification_image' => '@show_notification_image:featured_image', | |
| 201 | + ], | |
| 202 | + "freemius_reviews" => [ | |
| 203 | + 'show_notification_image' => '@show_notification_image:featured_image', | |
| 204 | + ], | |
| 205 | + "freemius_stats" => [ | |
| 206 | + 'show_notification_image' => '@show_notification_image:featured_image', | |
| 207 | + ], | |
| 208 | + "convertkit" => [ | |
| 209 | + 'show_notification_image' => '@show_notification_image:gravatar', | |
| 210 | + ], | |
| 211 | + "zapier" => [ | |
| 212 | + 'show_notification_image' => '@show_notification_image:gravatar', | |
| 213 | + ], | |
| 214 | + "mailchimp" => [ | |
| 215 | + 'show_notification_image' => '@show_notification_image:gravatar', | |
| 216 | + ], | |
| 217 | + "wp_comments" => [ | |
| 218 | + 'show_notification_image' => '@show_notification_image:gravatar', | |
| 219 | + ], | |
| 220 | + "cf7" => [ | |
| 221 | + 'show_notification_image' => '@show_notification_image:gravatar', | |
| 222 | + ], | |
| 223 | + "njf" => [ | |
| 224 | + 'show_notification_image' => '@show_notification_image:gravatar', | |
| 225 | + ], | |
| 226 | + "grvf" => [ | |
| 227 | + 'show_notification_image' => '@show_notification_image:gravatar', | |
| 228 | + ], | |
| 229 | + "wpf" => [ | |
| 230 | + 'show_notification_image' => '@show_notification_image:gravatar', | |
| 231 | + ], | |
| 232 | + "woocommerce_sales" => [ | |
| 233 | + 'show_notification_image' => '@show_notification_image:featured_image', | |
| 234 | + ], | |
| 235 | + ] ), | |
| 236 | + ] | |
| 237 | + ], | |
| 238 | + ], | |
| 239 | + // 'rules' => Rules::logicalRule([ | |
| 240 | + // Rules::is('type', 'notification_bar', true), | |
| 241 | + // ]), | |
| 242 | + ], | |
| 243 | + ]), | |
| 244 | + // 'rules' => Rules::is('source', false) | |
| 245 | + ], | |
| 246 | + "design_tab" => [ | |
| 247 | + 'label' => __("Design", 'notificationx'), | |
| 248 | + 'id' => "design_tab", | |
| 249 | + 'name' => "design_tab", | |
| 250 | + 'icon' => [ | |
| 251 | + 'type' => 'tabs', | |
| 252 | + 'name' => 'design' | |
| 253 | + ], | |
| 254 | + 'classes' => "design_tab", | |
| 255 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 256 | + 'fields' => apply_filters('nx_design_tab_fields', [ | |
| 257 | + 'design_error' => [ | |
| 258 | + 'type' => 'message', | |
| 259 | + 'name' => 'design_error', | |
| 260 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 261 | + 'messages' => apply_filters('design_error_message', []), | |
| 262 | + 'rules' => '', | |
| 263 | + ], | |
| 264 | + "main_preview" => [ | |
| 265 | + 'label' => __("Preview", 'notificationx'), | |
| 266 | + 'name' => "main_preview", | |
| 267 | + 'type' => "section", | |
| 268 | + 'priority' => 1, | |
| 269 | + 'fields' => [ | |
| 270 | + 'preview_field' => [ | |
| 271 | + 'name' => "preview_field", | |
| 272 | + 'type' => "preview", | |
| 273 | + 'label' => __('Preview', 'notificationx'), | |
| 274 | + 'priority' => 10, | |
| 275 | + ], | |
| 276 | + ], | |
| 277 | + 'rules' => Rules::logicalRule([ | |
| 278 | + Rules::is( 'type', 'notification_bar' ), | |
| 279 | + ]), | |
| 280 | + ], | |
| 281 | + "themes" => [ | |
| 282 | + 'label' => __("Themes", 'notificationx'), | |
| 283 | + 'name' => "themes", | |
| 284 | + 'type' => "section", | |
| 285 | + 'fields' => [ | |
| 286 | + // [ | |
| 287 | + // 'label' => __("Select Theme", 'notificationx'), | |
| 288 | + // 'name' => "gdpr_s_theme", | |
| 289 | + // 'type' => "select", | |
| 290 | + // 'default' => 'light', | |
| 291 | + // 'options' => GlobalFields::get_instance()->normalize_fields([ | |
| 292 | + // 'light' => __('Light', 'notificationx'), | |
| 293 | + // 'dark' => __('Dark', 'notificationx'), | |
| 294 | + // ]), | |
| 295 | + // 'rules' => Rules::logicalRule([ | |
| 296 | + // Rules::is( 'type', 'gdpr' ), | |
| 297 | + // ]), | |
| 298 | + // ], | |
| 299 | + [ | |
| 300 | + 'label' => __("Select Theme", 'notificationx'), | |
| 301 | + 'name' => "gdpr_theme", | |
| 302 | + 'type' => "better-toggle", | |
| 303 | + 'default' => false, | |
| 304 | + 'toggle_label' => ['toggle_label_1' => __('Light', 'notificationx'), 'toggle_label_2' => __('Dark', 'notificationx')], | |
| 305 | + 'rules' => Rules::logicalRule([ | |
| 306 | + Rules::is( 'type', 'gdpr' ), | |
| 307 | + ]), | |
| 308 | + ], | |
| 309 | + "themes_section" => [ | |
| 310 | + 'type' => 'section', | |
| 311 | + 'name' => 'themes_section', | |
| 312 | + 'classes' => NotificationX::is_pro() ? 'pro-activated' : 'pro-deactivated','rules' => Rules::logicalRule([ | |
| 313 | + Rules::is( 'type', 'gdpr', true ), | |
| 314 | + ]), | |
| 315 | + 'fields' => [ | |
| 316 | + 'themes_tab' => [ | |
| 317 | + 'type' => 'tab', | |
| 318 | + 'name' => 'themes_tab', | |
| 319 | + 'submit' => [ | |
| 320 | + 'show' => false, | |
| 321 | + ], | |
| 322 | + 'default' => 'for_desktop', | |
| 323 | + 'fields' => [ | |
| 324 | + 'for_desktop' => [ | |
| 325 | + 'label' => __("For Desktop", 'notificationx'), | |
| 326 | + 'name' => 'for_desktop', | |
| 327 | + 'id' => 'for_desktop', | |
| 328 | + 'type' => 'section', | |
| 329 | + 'icon' => NOTIFICATIONX_ADMIN_URL . 'images/responsive/desktop.svg', | |
| 330 | + ], | |
| 331 | + 'for_mobile' => [ | |
| 332 | + 'label' => __("For Mobile", 'notificationx'), | |
| 333 | + 'type' => 'section', | |
| 334 | + 'name' => 'for_mobile', | |
| 335 | + 'id' => 'for_mobile', | |
| 336 | + 'icon' => NOTIFICATIONX_ADMIN_URL . 'images/responsive/mobile.svg', | |
| 337 | + 'rules' => Rules::logicalRule([ | |
| 338 | + Rules::is( 'source', ['woocommerce_sales_inline'], true ), | |
| 339 | + Rules::includes('type', [ 'notification_bar', 'flashing_tab', 'inline', 'sales_inline', 'offer_announcement', 'custom' ], true), | |
| 340 | + ]), | |
| 341 | + ], | |
| 342 | + ] | |
| 343 | + ], | |
| 344 | + ], | |
| 345 | + ], | |
| 346 | + 'themes' => [ | |
| 347 | + // 'label' => "Themes", | |
| 348 | + 'name' => "themes", | |
| 349 | + 'type' => "radio-card", | |
| 350 | + // 'default' => "conversions_theme-one", | |
| 351 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 352 | + 'options' => apply_filters('nx_themes', []), | |
| 353 | + 'priority' => 10, | |
| 354 | + 'style' => [ | |
| 355 | + 'label' => [ | |
| 356 | + 'position' => 'top' | |
| 357 | + ] | |
| 358 | + ], | |
| 359 | + 'validation_rules' => [ | |
| 360 | + 'required' => true, | |
| 361 | + 'label' => "Theme", | |
| 362 | + ], | |
| 363 | + 'trigger' => [ | |
| 364 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 365 | + 'defaults' => apply_filters('nx_themes_trigger', []), | |
| 366 | + ], | |
| 367 | + 'rules' => Rules::logicalRule([ | |
| 368 | + Rules::is('themes_tab', 'for_desktop'), | |
| 369 | + ]), | |
| 370 | + ], | |
| 371 | + "responsive_themes" => [ | |
| 372 | + // 'label' => __("Mobile Responsive Themes", 'notificationx'), | |
| 373 | + 'name' => "responsive_themes", | |
| 374 | + 'type' => "section", | |
| 375 | + 'priority' => 10, | |
| 376 | + 'classes' => NotificationX::is_pro() ? 'pro-activated' : 'pro-deactivated', | |
| 377 | + 'rules' => Rules::logicalRule([ | |
| 378 | + Rules::is('themes_tab', 'for_mobile'), | |
| 379 | + ]), | |
| 380 | + 'fields' => [ | |
| 381 | + 'res_get_pro_btn' => array( | |
| 382 | + 'name' => 'res_get_pro_btn', | |
| 383 | + 'text' => __( 'Get PRO to Unlock', 'notificationx' ), | |
| 384 | + 'type' => 'button', | |
| 385 | + 'href' => esc_url('https://notificationx.com/#pricing'), | |
| 386 | + 'target' => '_blank', | |
| 387 | + 'classes' => 'res_get_pro_btn', | |
| 388 | + ), | |
| 389 | + 'responsive_themes' => [ | |
| 390 | + 'name' => "responsive_themes", | |
| 391 | + 'type' => "radio-card", | |
| 392 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 393 | + 'options' => apply_filters('nx_res_themes', []), | |
| 394 | + 'priority' => 10, | |
| 395 | + 'style' => [ | |
| 396 | + 'label' => [ | |
| 397 | + 'position' => 'top' | |
| 398 | + ] | |
| 399 | + ], | |
| 400 | + 'validation_rules' => [ | |
| 401 | + 'required' => true, | |
| 402 | + 'label' => __("Mobile Responsive Themes",'notificationx'), | |
| 403 | + ], | |
| 404 | + 'trigger' => [ | |
| 405 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 406 | + 'defaults' => apply_filters('nx_themes_trigger_for_responsive', []), | |
| 407 | + ], | |
| 408 | + ], | |
| 409 | + 'is_mobile_responsive' => [ | |
| 410 | + 'label' => __("Enable Mobile Responsive", 'notificationx'), | |
| 411 | + 'name' => "is_mobile_responsive", | |
| 412 | + 'type' => "toggle", | |
| 413 | + 'default' => true, | |
| 414 | + 'priority' => 20, | |
| 415 | + 'is_pro' => true, | |
| 416 | + ], | |
| 417 | + ] | |
| 418 | + ], | |
| 419 | + [ | |
| 420 | + 'label' => __("Position", 'notificationx'), | |
| 421 | + 'name' => "gdpr_position", | |
| 422 | + 'type' => "select", | |
| 423 | + 'default' => 'cookie_notice_bottom_right', | |
| 424 | + 'options' => GlobalFields::get_instance()->normalize_fields([ | |
| 425 | + 'cookie_notice_bottom_left' => __('Bottom Left', 'notificationx'), | |
| 426 | + 'cookie_notice_bottom_right' => __('Bottom Right', 'notificationx'), | |
| 427 | + 'cookie_notice_center' => __('Center', 'notificationx'), | |
| 428 | + ]), | |
| 429 | + 'rules' => Rules::logicalRule([ | |
| 430 | + Rules::is( 'type', 'gdpr' ), | |
| 431 | + Rules::includes('themes', [ 'gdpr_theme-light-one', 'gdpr_theme-light-two', 'gdpr_theme-light-three', | |
| 432 | + 'gdpr_theme-light-four', 'gdpr_theme-dark-one', 'gdpr_theme-dark-two', 'gdpr_theme-dark-three', 'gdpr_theme-dark-four' ], false), | |
| 433 | + ]), | |
| 434 | + ], | |
| 435 | + [ | |
| 436 | + 'label' => __("Position", 'notificationx'), | |
| 437 | + 'name' => "gdpr_banner_position", | |
| 438 | + 'type' => "select", | |
| 439 | + 'default' => 'cookie_banner_bottom', | |
| 440 | + 'options' => GlobalFields::get_instance()->normalize_fields([ | |
| 441 | + 'cookie_banner_bottom' => __('Bottom', 'notificationx'), | |
| 442 | + 'cookie_banner_top' => __('Top', 'notificationx'), | |
| 443 | + ]), | |
| 444 | + 'rules' => Rules::logicalRule([ | |
| 445 | + Rules::is( 'type', 'gdpr' ), | |
| 446 | + Rules::includes('themes', [ 'gdpr_theme-banner-light-one', 'gdpr_theme-banner-light-two', 'gdpr_theme-banner-dark-one', 'gdpr_theme-banner-dark-two' ], false), | |
| 447 | + ]), | |
| 448 | + ], | |
| 449 | + 'advance_edit' => [ | |
| 450 | + 'label' => __("Advanced Design", 'notificationx'), | |
| 451 | + 'name' => "advance_edit", | |
| 452 | + 'type' => "toggle", | |
| 453 | + 'default' => false, | |
| 454 | + 'priority' => 20, | |
| 455 | + 'rules' => Rules::logicalRule([ | |
| 456 | + Rules::is('themes_tab', 'for_desktop'), | |
| 457 | + Rules::is('themes_tab', 'nxbar_build_with_ai'), | |
| 458 | + ], 'or'), | |
| 459 | + ], | |
| 460 | + ] | |
| 461 | + ], | |
| 462 | + 'advance_design_section' => [ | |
| 463 | + 'label' => __('Advanced Design', 'notificationx'), | |
| 464 | + 'type' => 'section', | |
| 465 | + 'name' => 'advance_design_section', | |
| 466 | + 'dependency_class' => [ | |
| 467 | + 'name' => 'advance_edit', | |
| 468 | + 'is' => true, | |
| 469 | + 'classes' => 'advanced_active', | |
| 470 | + 'selector' => '#advance_design_section', | |
| 471 | + ], | |
| 472 | + 'fields' => [ | |
| 473 | + "advance_edit" => [ | |
| 474 | + 'label' => __("Advanced Toggle", 'notificationx'), | |
| 475 | + 'name' => "advance_edit", | |
| 476 | + 'type' => "toggle", | |
| 477 | + 'default' => false, | |
| 478 | + 'priority' => 1, | |
| 479 | + ], | |
| 480 | + "design" => [ | |
| 481 | + 'label' => __("Design", 'notificationx'), | |
| 482 | + 'name' => "design", | |
| 483 | + 'type' => "section", | |
| 484 | + 'priority' => 5, | |
| 485 | + 'rules' => Rules::is('advance_edit', true), | |
| 486 | + // 'rules' => Rules::is( 'advance_edit', true ), | |
| 487 | + 'fields' => [ | |
| 488 | + [ | |
| 489 | + 'label' => __("Background Color", 'notificationx'), | |
| 490 | + 'name' => "bg_color", | |
| 491 | + 'type' => "colorpicker", | |
| 492 | + 'default' => "#fff", | |
| 493 | + ], | |
| 494 | + [ | |
| 495 | + 'label' => __("Text Color", 'notificationx'), | |
| 496 | + 'name' => "text_color", | |
| 497 | + 'type' => "colorpicker", | |
| 498 | + 'default' => "#000", | |
| 499 | + ], | |
| 500 | + [ | |
| 501 | + 'label' => __("Want Border?", 'notificationx'), | |
| 502 | + 'name' => "border", | |
| 503 | + 'type' => "checkbox", | |
| 504 | + 'default' => 0, | |
| 505 | + ], | |
| 506 | + [ | |
| 507 | + 'label' => __("Border Size", 'notificationx'), | |
| 508 | + 'name' => "border_size", | |
| 509 | + 'type' => "number", | |
| 510 | + 'default' => 1, | |
| 511 | + 'rules' => Rules::is( 'border', true ), | |
| 512 | + ], | |
| 513 | + [ | |
| 514 | + 'label' => __("Border Style", 'notificationx'), | |
| 515 | + 'name' => "border_style", | |
| 516 | + 'type' => "select", | |
| 517 | + 'default' => 'solid', | |
| 518 | + 'options' => $this->normalize_fields([ | |
| 519 | + 'solid' => __('Solid', 'notificationx'), | |
| 520 | + 'dashed' => __('Dashed', 'notificationx'), | |
| 521 | + 'dotted' => __('Dotted', 'notificationx'), | |
| 522 | + ]), | |
| 523 | + 'rules' => Rules::is( 'border', true ), | |
| 524 | + ], | |
| 525 | + [ | |
| 526 | + 'label' => __('Border Color', 'notificationx'), | |
| 527 | + 'name' => "border_color", | |
| 528 | + 'type' => "colorpicker", | |
| 529 | + 'default' => "#000", | |
| 530 | + 'rules' => Rules::is( 'border', true ), | |
| 531 | + ], | |
| 532 | + [ | |
| 533 | + 'label' => __('Discount Text Color', 'notificationx'), | |
| 534 | + 'name' => "discount_text_color", | |
| 535 | + 'type' => "colorpicker", | |
| 536 | + 'default' => "#fff", | |
| 537 | + 'rules' => Rules::logicalRule([ | |
| 538 | + Rules::is( 'type', 'offer_announcement' ), | |
| 539 | + Rules::includes('themes', [ 'announcements_theme-1', 'announcements_theme-2' ], false), | |
| 540 | + ]), | |
| 541 | + ], | |
| 542 | + [ | |
| 543 | + 'label' => __('Discount Background', 'notificationx'), | |
| 544 | + 'name' => "discount_background", | |
| 545 | + 'type' => "colorpicker", | |
| 546 | + 'rules' => Rules::logicalRule([ | |
| 547 | + Rules::is( 'type', 'offer_announcement' ), | |
| 548 | + Rules::includes('themes', [ 'announcements_theme-1', 'announcements_theme-2' ], false), | |
| 549 | + ]), | |
| 550 | + ], | |
| 551 | + ] | |
| 552 | + ], | |
| 553 | + "typography" => [ | |
| 554 | + 'label' => __('Typography', 'notificationx'), | |
| 555 | + 'name' => "typography", | |
| 556 | + 'type' => "section", | |
| 557 | + 'priority' => 10, | |
| 558 | + 'rules' => Rules::is( 'advance_edit', true ), | |
| 559 | + 'fields' => [ | |
| 560 | + [ | |
| 561 | + 'label' => __('Font Size', 'notificationx'), | |
| 562 | + 'name' => "first_font_size", | |
| 563 | + 'type' => "number", | |
| 564 | + 'default' => '13', | |
| 565 | + 'description' => 'px', | |
| 566 | + 'help' => __('This font size will be applied for <mark>first</mark> row', 'notificationx'), | |
| 567 | + ], | |
| 568 | + [ | |
| 569 | + 'label' => __('Font Size', 'notificationx'), | |
| 570 | + 'name' => "second_font_size", | |
| 571 | + 'type' => "number", | |
| 572 | + 'default' => '14', | |
| 573 | + 'description' => 'px', | |
| 574 | + 'help' => __('This font size will be applied for <mark>second</mark> row', 'notificationx'), | |
| 575 | + ], | |
| 576 | + [ | |
| 577 | + 'label' => __('Font Size', 'notificationx'), | |
| 578 | + 'name' => "third_font_size", | |
| 579 | + 'type' => "number", | |
| 580 | + 'default' => '11', | |
| 581 | + 'description' => 'px', | |
| 582 | + 'help' => __('This font size will be applied for <mark>third</mark> row', 'notificationx'), | |
| 583 | + ], | |
| 584 | + ] | |
| 585 | + ], | |
| 586 | + "image-appearance" => [ | |
| 587 | + 'label' => __('Image Appearance', 'notificationx'), | |
| 588 | + 'name' => "image-appearance", | |
| 589 | + 'type' => "section", | |
| 590 | + 'priority' => 15, | |
| 591 | + 'rules' => Rules::is( 'advance_edit', true ), | |
| 592 | + 'fields' => [ | |
| 593 | + 'image_shape' => [ | |
| 594 | + 'label' => __('Image Shape', 'notificationx'), | |
| 595 | + 'name' => "image_shape", | |
| 596 | + 'type' => "select", | |
| 597 | + 'default' => 'circle', | |
| 598 | + 'priority' => 5, | |
| 599 | + 'options' => $this->normalize_fields([ | |
| 600 | + 'circle' => __('Circle', 'notificationx'), | |
| 601 | + 'rounded' => __('Rounded', 'notificationx'), | |
| 602 | + 'square' => __('Square', 'notificationx'), | |
| 603 | + ]), | |
| 604 | + ], | |
| 605 | + 'image_position' => [ | |
| 606 | + 'label' => __('Position', 'notificationx'), | |
| 607 | + 'name' => "image_position", | |
| 608 | + 'type' => "select", | |
| 609 | + 'default' => 'left', | |
| 610 | + 'priority' => 15, | |
| 611 | + 'options' => $this->normalize_fields([ | |
| 612 | + 'left' => __('Left', 'notificationx'), | |
| 613 | + 'right' => __('Right', 'notificationx'), | |
| 614 | + ]), | |
| 615 | + ], | |
| 616 | + ] | |
| 617 | + ], | |
| 618 | + "custom_css" => [ | |
| 619 | + 'label' => __('Custom CSS', 'notificationx'), | |
| 620 | + 'name' => "custom_css", | |
| 621 | + 'type' => "section", | |
| 622 | + 'priority' => 150, | |
| 623 | + 'rules' => Rules::is( 'advance_edit', true ), | |
| 624 | + 'fields' => [ | |
| 625 | + [ | |
| 626 | + 'label' => __('Add Custom CSS', 'notificationx'), | |
| 627 | + 'name' => "add_custom_css", | |
| 628 | + 'type' => "advanced-codeviewer", | |
| 629 | + 'button_text' => __( 'Click to Copy', 'notificationx' ), | |
| 630 | + 'success_text' => __( 'Copied to clipboard.', 'notificationx' ), | |
| 631 | + 'is_pro' => true, | |
| 632 | + 'copyOnClick' => false, | |
| 633 | + 'priority' => 5, | |
| 634 | + 'info' => InfoTooltipManager::get_instance()->render('custom_css'), | |
| 635 | + 'help' => __('Use custom CSS to style this Notification.', 'notificationx'), | |
| 636 | + ], | |
| 637 | + ] | |
| 638 | + ], | |
| 639 | + ] | |
| 640 | + ] | |
| 641 | + ]) | |
| 642 | + ], | |
| 643 | + "content_tab" => [ | |
| 644 | + 'label' => __("Content", 'notificationx'), | |
| 645 | + 'id' => "content_tab", | |
| 646 | + 'name' => "content_tab", | |
| 647 | + 'icon' => [ | |
| 648 | + 'type' => 'tabs', | |
| 649 | + 'name' => 'content' | |
| 650 | + ], | |
| 651 | + 'classes' => "content_tab", | |
| 652 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 653 | + 'fields' => apply_filters('nx_content_fields', [ | |
| 654 | + "main_preview" => [ | |
| 655 | + 'label' => __("Preview", 'notificationx'), | |
| 656 | + 'name' => "main_preview", | |
| 657 | + 'type' => "section", | |
| 658 | + 'priority' => 1, | |
| 659 | + 'fields' => [ | |
| 660 | + 'preview_field' => [ | |
| 661 | + 'name' => "preview_field", | |
| 662 | + 'type' => "preview", | |
| 663 | + 'label' => __('Preview', 'notificationx'), | |
| 664 | + 'priority' => 10, | |
| 665 | + ], | |
| 666 | + ], | |
| 667 | + 'rules' => Rules::logicalRule([ | |
| 668 | + Rules::is( 'type', 'notification_bar' ), | |
| 669 | + ]), | |
| 670 | + ], | |
| 671 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 672 | + 'content' => apply_filters('nx_content_field', [ | |
| 673 | + 'label' => __("Content", 'notificationx'), | |
| 674 | + 'name' => "content", | |
| 675 | + 'type' => "section", | |
| 676 | + 'priority' => 90, | |
| 677 | + 'fields' => [ | |
| 678 | + "notification-template" => [ | |
| 679 | + 'label' => __("Notification Template", 'notificationx'), | |
| 680 | + 'name' => "notification-template", | |
| 681 | + 'type' => "group", | |
| 682 | + 'display' => 'inline', | |
| 683 | + 'priority' => 90, | |
| 684 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 685 | + 'fields' => apply_filters('nx_notification_template', [ | |
| 686 | + "first_param" => [ | |
| 687 | + // 'label' => __("First Parameter", 'notificationx'), | |
| 688 | + 'name' => "first_param", | |
| 689 | + 'type' => "select", | |
| 690 | + 'priority' => 3, | |
| 691 | + 'default' => 'tag_name', | |
| 692 | + 'options' => $this->normalize_fields([ | |
| 693 | + 'tag_custom' => __('Custom', 'notificationx'), | |
| 694 | + ]), | |
| 695 | + ], | |
| 696 | + "custom_first_param" => [ | |
| 697 | + // 'label' => __("Custom First Parameter", 'notificationx'), | |
| 698 | + 'name' => "custom_first_param", | |
| 699 | + 'type' => "text", | |
| 700 | + 'priority' => 5, | |
| 701 | + 'default' => __('Someone', 'notificationx'), | |
| 702 | + 'rules' => Rules::is( 'notification-template.first_param', 'tag_custom' ), | |
| 703 | + ], | |
| 704 | + "second_param" => [ | |
| 705 | + // 'label' => __("Second Param", 'notificationx'), | |
| 706 | + 'name' => "second_param", | |
| 707 | + 'type' => "text", | |
| 708 | + 'priority' => 10, | |
| 709 | + 'default' => __('recently purchased', 'notificationx'), | |
| 710 | + ], | |
| 711 | + "third_param" => [ | |
| 712 | + // 'label' => __("Third Parameter", 'notificationx'), | |
| 713 | + 'name' => "third_param", | |
| 714 | + 'type' => "select", | |
| 715 | + 'priority' => 20, | |
| 716 | + 'default' => 'tag_title', | |
| 717 | + 'options' => $this->normalize_fields([ | |
| 718 | + 'tag_custom' => __('Custom', 'notificationx'), | |
| 719 | + ]), | |
| 720 | + ], | |
| 721 | + "custom_third_param" => [ | |
| 722 | + // 'label' => __("Custom Third Param", 'notificationx'), | |
| 723 | + 'name' => "custom_third_param", | |
| 724 | + 'type' => "text", | |
| 725 | + 'priority' => 25, | |
| 726 | + 'default' => __('Some time ago', 'notificationx'), | |
| 727 | + 'rules' => Rules::is( 'notification-template.third_param', 'tag_custom' ), | |
| 728 | + ], | |
| 729 | + "fourth_param" => [ | |
| 730 | + // 'label' => __("Fourth Parameter", 'notificationx'), | |
| 731 | + 'name' => "fourth_param", | |
| 732 | + 'type' => "select", | |
| 733 | + 'priority' => 30, | |
| 734 | + 'default' => 'tag_time', | |
| 735 | + 'options' => $this->normalize_fields([ | |
| 736 | + 'tag_custom' => __('Custom', 'notificationx'), | |
| 737 | + ]), | |
| 738 | + ], | |
| 739 | + "custom_fourth_param" => [ | |
| 740 | + // 'label' => __("Custom Fourth Parameter", 'notificationx'), | |
| 741 | + 'name' => "custom_fourth_param", | |
| 742 | + 'type' => "text", | |
| 743 | + 'priority' => 35, | |
| 744 | + 'default' => __('Some time ago', 'notificationx'), | |
| 745 | + 'rules' => Rules::is( 'notification-template.fourth_param', 'tag_custom' ), | |
| 746 | + ], | |
| 747 | + "fifth_param" => [ | |
| 748 | + // 'label' => __("Fifth Parameter", 'notificationx'), | |
| 749 | + 'name' => "fifth_param", | |
| 750 | + 'type' => "select", | |
| 751 | + 'priority' => 40, | |
| 752 | + 'options' => $this->normalize_fields([ | |
| 753 | + 'tag_custom' => __('Custom', 'notificationx'), | |
| 754 | + ]), | |
| 755 | + ], | |
| 756 | + "custom_fifth_param" => [ | |
| 757 | + // 'label' => __("Custom Fifth Parameter", 'notificationx'), | |
| 758 | + 'name' => "custom_fifth_param", | |
| 759 | + 'type' => "text", | |
| 760 | + 'priority' => 45, | |
| 761 | + 'rules' => Rules::is( 'notification-template.fifth_param', 'tag_custom' ), | |
| 762 | + ], | |
| 763 | + "sixth_param" => [ | |
| 764 | + // 'label' => __("Sixth Parameter", 'notificationx'), | |
| 765 | + 'name' => "sixth_param", | |
| 766 | + 'type' => "select", | |
| 767 | + 'priority' => 50, | |
| 768 | + // 'default' => 'tag_custom', | |
| 769 | + 'options' => $this->normalize_fields([ | |
| 770 | + 'tag_custom' => __('Custom', 'notificationx'), | |
| 771 | + ]), | |
| 772 | + ], | |
| 773 | + "custom_sixth_param" => [ | |
| 774 | + // 'label' => __("Custom Sixth Parameter", 'notificationx'), | |
| 775 | + 'name' => "custom_sixth_param", | |
| 776 | + 'type' => "text", | |
| 777 | + 'priority' => 55, | |
| 778 | + 'rules' => Rules::is( 'notification-template.sixth_param', 'tag_custom' ), | |
| 779 | + ], | |
| 780 | + | |
| 781 | + ]), | |
| 782 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 783 | + 'rules' => Rules::includes( 'source', apply_filters('nx_notification_template_dependency', []) ), | |
| 784 | + ], | |
| 785 | + 'template_adv' => [ | |
| 786 | + 'label' => __("Advanced Template", 'notificationx'), | |
| 787 | + 'name' => "template_adv", | |
| 788 | + 'type' => "toggle", | |
| 789 | + 'default' => false, | |
| 790 | + 'is_pro' => true, | |
| 791 | + 'priority' => 91, | |
| 792 | + 'info' => InfoTooltipManager::get_instance()->render('advanced_template'), | |
| 793 | + ], | |
| 794 | + 'advanced_template' => [ | |
| 795 | + 'name' => 'advanced_template', | |
| 796 | + 'type' => 'advanced-template', | |
| 797 | + 'label' => __('Advanced Template', 'notificationx'), | |
| 798 | + 'priority' => 92, | |
| 799 | + 'rules' => ['is', 'template_adv', true], | |
| 800 | + ], | |
| 801 | + 'random_order' => array( | |
| 802 | + 'name' => 'random_order', | |
| 803 | + 'label' => __('Random Order', 'notificationx'), | |
| 804 | + 'type' => 'checkbox', | |
| 805 | + 'priority' => 93, | |
| 806 | + 'default' => 0, | |
| 807 | + 'is_pro' => true, | |
| 808 | + 'description' => __('Enable to show notification in random order.', 'notificationx'), | |
| 809 | + 'rules' => Rules::includes('source', ['woocommerce', 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline","surecart","custom_notification", 'woocommerce_sales','woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart']), | |
| 810 | + 'info' => InfoTooltipManager::get_instance()->render('random_order'), | |
| 811 | + ), | |
| 812 | + 'product_control' => array( | |
| 813 | + 'label' => __('Show Purchase Of', 'notificationx'), | |
| 814 | + 'name' => 'product_control', | |
| 815 | + 'type' => 'select', | |
| 816 | + 'priority' => 94, | |
| 817 | + 'default' => 'none', | |
| 818 | + // 'is_pro' => true, | |
| 819 | + // 'disable' => true, | |
| 820 | + 'options' => GlobalFields::get_instance()->normalize_fields([ | |
| 821 | + 'none' => __('All', 'notificationx'), | |
| 822 | + 'product_category' => __('Product Category', 'notificationx'), | |
| 823 | + 'manual_selection' => __('Selected Product', 'notificationx'), | |
| 824 | + ]), | |
| 825 | + 'info' => InfoTooltipManager::get_instance()->render('show_purchase_of'), | |
| 826 | + 'rules' => Rules::includes('source', ['woocommerce','woocommerce_sales', 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline","surecart",'woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart','fluentcart_inline']), | |
| 827 | + ), | |
| 828 | + 'category_list' => array( | |
| 829 | + 'label' => __('Select Product Category', 'notificationx'), | |
| 830 | + 'name' => 'category_list', | |
| 831 | + 'type' => 'select', | |
| 832 | + 'multiple' => true, | |
| 833 | + 'priority' => 95, | |
| 834 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 835 | + 'options' => apply_filters('nx_conversion_category_list', []), | |
| 836 | + 'rules' => Rules::logicalRule([ | |
| 837 | + Rules::includes('source', ['woocommerce' , 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline", "surecart", 'woocommerce_sales','woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart','fluentcart_inline']), | |
| 838 | + Rules::is( 'product_control', 'product_category' ), | |
| 839 | + ]), | |
| 840 | + ), | |
| 841 | + 'product_list' => array( | |
| 842 | + 'label' => __('Select Product', 'notificationx'), | |
| 843 | + 'name' => 'product_list', | |
| 844 | + 'type' => 'select-async', | |
| 845 | + 'multiple' => true, | |
| 846 | + 'priority' => 96, | |
| 847 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 848 | + 'options' => apply_filters('nx_conversion_product_list', [ | |
| 849 | + [ | |
| 850 | + 'label' => "Type for more result...", | |
| 851 | + 'value' => null, | |
| 852 | + 'disabled' => true, | |
| 853 | + ], | |
| 854 | + ]), | |
| 855 | + 'rules' => Rules::logicalRule([ | |
| 856 | + Rules::includes('source', ['woocommerce', 'woocommerce_sales', 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline","surecart",'woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart','fluentcart_inline']), | |
| 857 | + Rules::is( 'product_control', 'manual_selection' ), | |
| 858 | + ]), | |
| 859 | + 'ajax' => [ | |
| 860 | + 'api' => "/notificationx/v1/get-data", | |
| 861 | + 'data' => [ | |
| 862 | + 'type' => "@type", | |
| 863 | + 'source' => "@source", | |
| 864 | + 'field' => "product_list", | |
| 865 | + ], | |
| 866 | + // 'target' => "product_list", | |
| 867 | + 'rules' => Rules::logicalRule([ | |
| 868 | + Rules::includes('source', ['woocommerce', 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline", "surecart", 'woocommerce_sales','woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart','fluentcart_inline']), | |
| 869 | + Rules::is( 'product_control', 'manual_selection' ), | |
| 870 | + ]), | |
| 871 | + ], | |
| 872 | + ), | |
| 873 | + 'product_exclude_by' => array( | |
| 874 | + 'label' => __('Exclude By', 'notificationx'), | |
| 875 | + 'name' => 'product_exclude_by', | |
| 876 | + 'type' => 'select', | |
| 877 | + 'priority' => 97, | |
| 878 | + 'default' => 'none', | |
| 879 | + // 'is_pro' => true, | |
| 880 | + // 'disable' => true, | |
| 881 | + 'options' => GlobalFields::get_instance()->normalize_fields([ | |
| 882 | + 'none' => __('None', 'notificationx'), | |
| 883 | + 'product_category' => __('Product Category', 'notificationx'), | |
| 884 | + 'manual_selection' => __('Selected Product', 'notificationx'), | |
| 885 | + ]), | |
| 886 | + 'info' => InfoTooltipManager::get_instance()->render('exclude_by'), | |
| 887 | + 'rules' => Rules::includes('source', ['woocommerce', 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline","surecart", 'woocommerce_sales','woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart','fluentcart_inline']), | |
| 888 | + ), | |
| 889 | + 'exclude_categories' => array( | |
| 890 | + 'label' => __('Select Product Category', 'notificationx'), | |
| 891 | + 'name' => 'exclude_categories', | |
| 892 | + 'type' => 'select', | |
| 893 | + 'multiple' => true, | |
| 894 | + 'priority' => 98, | |
| 895 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 896 | + 'options' => apply_filters('nx_conversion_category_list', []), | |
| 897 | + 'rules' => Rules::logicalRule([ | |
| 898 | + Rules::includes('source', ['woocommerce', 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline", "surecart", 'woocommerce_sales','woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart','fluentcart_inline']), | |
| 899 | + Rules::is( 'product_exclude_by', 'product_category' ), | |
| 900 | + ]), | |
| 901 | + ), | |
| 902 | + 'exclude_products' => array( | |
| 903 | + 'label' => __('Select Product', 'notificationx'), | |
| 904 | + 'name' => 'exclude_products', | |
| 905 | + 'type' => 'select-async', | |
| 906 | + 'multiple' => true, | |
| 907 | + 'priority' => 99, | |
| 908 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 909 | + 'options' => apply_filters('nx_conversion_product_list', [ | |
| 910 | + [ | |
| 911 | + 'label' => "Type for more result...", | |
| 912 | + 'value' => null, | |
| 913 | + 'disabled' => true, | |
| 914 | + ], | |
| 915 | + ]), | |
| 916 | + 'rules' => Rules::logicalRule([ | |
| 917 | + Rules::includes('source', ['woocommerce', 'woocommerce_sales', 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline","surecart",'woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart','fluentcart_inline']), | |
| 918 | + Rules::is( 'product_exclude_by', 'manual_selection' ), | |
| 919 | + ]), | |
| 920 | + 'ajax' => [ | |
| 921 | + 'api' => "/notificationx/v1/get-data", | |
| 922 | + 'data' => [ | |
| 923 | + 'type' => "@type", | |
| 924 | + 'source' => "@source", | |
| 925 | + 'field' => "exclude_products", | |
| 926 | + ], | |
| 927 | + 'rules' => Rules::logicalRule([ | |
| 928 | + Rules::includes('source', ['woocommerce', 'woo_reviews', "edd", "reviewx", "woo_inline", "edd_inline", 'woocommerce_sales','woocommerce_sales_reviews','woocommerce_sales_inline','fluentcart','fluentcart_inline']), | |
| 929 | + Rules::is( 'product_exclude_by', 'manual_selection' ), | |
| 930 | + ]), | |
| 931 | + ], | |
| 932 | + ), | |
| 933 | + 'order_status' => array( | |
| 934 | + 'label' => __('Order Status', 'notificationx'), | |
| 935 | + 'name' => 'order_status', | |
| 936 | + 'type' => 'select', | |
| 937 | + 'multiple' => true, | |
| 938 | + 'is_pro' => true, | |
| 939 | + 'priority' => 99.5, | |
| 940 | + 'default' => ['wc-completed', 'wc-processing'], | |
| 941 | + 'help' => __("By default it will show Processing & Completed status.",'notificationx'), | |
| 942 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 943 | + 'options' => apply_filters('nx_woo_order_status', []), | |
| 944 | + 'info' => InfoTooltipManager::get_instance()->render('order_status'), | |
| 945 | + 'rules' => Rules::logicalRule([ | |
| 946 | + Rules::includes('source', ['woocommerce', 'woocommerce_sales', "woo_inline","woocommerce_sales_inline"]), | |
| 947 | + Rules::includes('themes', [ 'woo_inline_stock-theme-one', 'woo_inline_stock-theme-two', 'woocommerce_sales_inline_stock-theme-one', 'woocommerce_sales_inline_stock-theme-two'], true), | |
| 948 | + ]), | |
| 949 | + | |
| 950 | + ), | |
| 951 | + 'surecart_order_status' => array( | |
| 952 | + 'label' => __('Order Status', 'notificationx'), | |
| 953 | + 'name' => 'surecart_order_status', | |
| 954 | + 'type' => 'select', | |
| 955 | + 'multiple' => true, | |
| 956 | + 'is_pro' => true, | |
| 957 | + 'priority' => 99.6, | |
| 958 | + 'default' => ['processing','fulfilled'], | |
| 959 | + 'help' => __("By default it will show Processing & Fulfilled status.",'notificationx'), | |
| 960 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 961 | + 'options' => apply_filters('nx_surecart_order_status', []), | |
| 962 | + 'info' => InfoTooltipManager::get_instance()->render('order_status'), | |
| 963 | + 'rules' => Rules::logicalRule([ | |
| 964 | + Rules::includes('source', ["surecart"]), | |
| 965 | + ]), | |
| 966 | + ), | |
| 967 | + 'fluentcart_order_status' => array( | |
| 968 | + 'label' => __('Order Status', 'notificationx'), | |
| 969 | + 'name' => 'fluentcart_order_status', | |
| 970 | + 'type' => 'select', | |
| 971 | + 'multiple' => true, | |
| 972 | + 'is_pro' => true, | |
| 973 | + 'priority' => 99.8, | |
| 974 | + 'default' => ['on-hold','completed','processing'], | |
| 975 | + 'help' => __("By default it will show Processing & Fulfilled status.",'notificationx'), | |
| 976 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 977 | + 'options' => apply_filters('nx_fluentcart_order_status', []), | |
| 978 | + 'info' => InfoTooltipManager::get_instance()->render('order_status'), | |
| 979 | + 'rules' => Rules::logicalRule([ | |
| 980 | + Rules::includes('source', ["fluentcart"]), | |
| 981 | + ]), | |
| 982 | + ), | |
| 983 | + 'combine_multiorder' => [ | |
| 984 | + 'label' => __('Combine Multi Order', 'notificationx'), | |
| 985 | + 'name' => 'combine_multiorder', | |
| 986 | + 'type' => 'checkbox', | |
| 987 | + 'priority' => 99.7, | |
| 988 | + 'default' => true, | |
| 989 | + 'description' => __('Combine order like, 2 more products.', 'notificationx'), | |
| 990 | + 'rules' => Rules::logicalRule([ | |
| 991 | + Rules::is('notification-template.first_param', 'tag_sales_count', true), | |
| 992 | + Rules::includes('source', [ 'woocommerce', 'edd', 'woocommerce_sales' ]), | |
| 993 | + ]), | |
| 994 | + ], | |
| 995 | + 'combine_multiorder_display' => [ | |
| 996 | + 'label' => __('Combine Display', 'notificationx'), | |
| 997 | + 'name' => 'combine_multiorder_display', | |
| 998 | + 'type' => 'select', | |
| 999 | + 'priority' => 99.71, | |
| 1000 | + 'default' => 'count', | |
| 1001 | + 'description' => __('Show the number of other products, or list their names.', 'notificationx'), | |
| 1002 | + 'options' => $this->normalize_fields([ | |
| 1003 | + 'count' => __('Show count (e.g. & 2 more products)', 'notificationx'), | |
| 1004 | + 'list' => __('List product names (e.g. & Product B & Product C)', 'notificationx'), | |
| 1005 | + ]), | |
| 1006 | + 'rules' => Rules::logicalRule([ | |
| 1007 | + Rules::is('notification-template.first_param', 'tag_sales_count', true), | |
| 1008 | + Rules::includes('source', [ 'woocommerce', 'edd', 'woocommerce_sales' ]), | |
| 1009 | + Rules::is('combine_multiorder', true), | |
| 1010 | + ]), | |
| 1011 | + ], | |
| 1012 | + ], | |
| 1013 | + ]), | |
| 1014 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 1015 | + 'gdpr_content' => apply_filters('nx_content_gdpr', [ | |
| 1016 | + 'label' => __("Cookies Content", 'notificationx'), | |
| 1017 | + 'name' => "content", | |
| 1018 | + 'type' => "section", | |
| 1019 | + 'priority' => 95, | |
| 1020 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 1021 | + 'fields' => apply_filters('nx_content_fields_gdpr', []), | |
| 1022 | + 'rules' => Rules::is('type', 'gdpr' ), | |
| 1023 | + ]), | |
| 1024 | + 'link_options' => [ | |
| 1025 | + 'label' => __('Link Options', 'notificationx'), | |
| 1026 | + 'name' => "link_options", | |
| 1027 | + 'type' => "section", | |
| 1028 | + 'priority' => 105, | |
| 1029 | + 'fields' => [ | |
| 1030 | + "link_type" => [ | |
| 1031 | + 'label' => __("Link Type", 'notificationx'), | |
| 1032 | + 'name' => "link_type", | |
| 1033 | + 'type' => "select", | |
| 1034 | + 'default' => 'none', | |
| 1035 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 1036 | + 'options' => apply_filters('nx_link_types', $this->normalize_fields([ | |
| 1037 | + 'none' => __('None', 'notificationx'), | |
| 1038 | + ])), | |
| 1039 | + ], | |
| 1040 | + 'link_button' => [ | |
| 1041 | + 'label' => __('Button', 'notificationx'), | |
| 1042 | + 'name' => 'link_button', | |
| 1043 | + 'type' => 'checkbox', | |
| 1044 | + 'priority' => 100, | |
| 1045 | + 'is_pro' => true, | |
| 1046 | + 'default' => false, | |
| 1047 | + // 'default' => [ | |
| 1048 | + // 'youtube_channel-1' => true, | |
| 1049 | + // 'youtube_channel-2' => true, | |
| 1050 | + // 'youtube_video-3' => true, | |
| 1051 | + // 'youtube_video-4' => true, | |
| 1052 | + // ], | |
| 1053 | + 'info' => InfoTooltipManager::get_instance()->render('button'), | |
| 1054 | + 'description' => __('Enable button with link', 'notificationx'), | |
| 1055 | + 'rules' => Rules::logicalRule([ | |
| 1056 | + Rules::includes('type', ['conversions','video','woocommerce', 'woocommerce_sales','page_analytics']), | |
| 1057 | + Rules::is('link_type','none',true), | |
| 1058 | + ]), | |
| 1059 | + ], | |
| 1060 | + ], | |
| 1061 | + // must be called after nx_link_types filter. | |
| 1062 | + 'rules' => Rules::logicalRule([ | |
| 1063 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 1064 | + [ 'includes', 'source', apply_filters('nx_link_types_dependency', []) ], | |
| 1065 | + Rules::is( 'type', 'gdpr', true ), | |
| 1066 | + ]), | |
| 1067 | + ], | |
| 1068 | + ]), | |
| 1069 | + ], | |
| 1070 | + "manager_tab" => [ | |
| 1071 | + 'label' => __("Manager", 'notificationx'), | |
| 1072 | + 'id' => "manager_tab", | |
| 1073 | + 'name' => "manager_tab", | |
| 1074 | + 'rules' => Rules::is('type', 'gdpr'), | |
| 1075 | + 'icon' => [ | |
| 1076 | + 'type' => 'tabs', | |
| 1077 | + 'name' => 'manager' | |
| 1078 | + ], | |
| 1079 | + 'classes' => "manager_tab", | |
| 1080 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 1081 | + 'fields' => apply_filters('nx_manager_fields', [ | |
| 1082 | + "main_preview" => [ | |
| 1083 | + 'label' => __("Preview", 'notificationx'), | |
| 1084 | + 'name' => "main_preview", | |
| 1085 | + 'type' => "section", | |
| 1086 | + 'priority' => 1, | |
| 1087 | + 'fields' => [ | |
| 1088 | + 'preview_field' => [ | |
| 1089 | + 'name' => "preview_field", | |
| 1090 | + 'type' => "preview", | |
| 1091 | + 'label' => __('Preview', 'notificationx'), | |
| 1092 | + 'priority' => 10, | |
| 1093 | + ], | |
| 1094 | + ], | |
| 1095 | + 'rules' => Rules::logicalRule([ | |
| 1096 | + Rules::is( 'type', 'notification_bar' ), | |
| 1097 | + ]), | |
| 1098 | + ], | |
| 1099 | + 'general_settngs' => [ | |
| 1100 | + 'label' => __("General Settings", 'notificationx'), | |
| 1101 | + 'id' => "general_settngs", | |
| 1102 | + 'name' => "general_settngs", | |
| 1103 | + 'type' => 'section', | |
| 1104 | + 'fields'=> [ | |
| 1105 | + 'gdpr_force_reload' => [ | |
| 1106 | + 'label' => __("Force Reload", 'notificationx'), | |
| 1107 | + 'name' => "gdpr_force_reload", | |
| 1108 | + 'type' => "better-toggle", | |
| 1109 | + 'default' => false, | |
| 1110 | + 'toggle_label' => ['toggle_label_1' => __('Enable Force Reload', 'notificationx'), 'toggle_label_2' => ''], | |
| 1111 | + 'rules' => Rules::logicalRule([ | |
| 1112 | + Rules::is( 'type', 'gdpr' ), | |
| 1113 | + ]), | |
| 1114 | + 'info' => __('Choose whether the page should reload after the user accepts cookies. If not, your analytics software won’t register the current page visit, as cookies will only be loaded during the next page load', 'notificationx'), | |
| 1115 | + ], | |
| 1116 | + 'gdpr_cookie_removal' => [ | |
| 1117 | + 'label' => __("Cookie Removal", 'notificationx'), | |
| 1118 | + 'name' => "gdpr_cookie_removal", | |
| 1119 | + 'type' => "better-toggle", | |
| 1120 | + 'default' => false, | |
| 1121 | + 'toggle_label' => ['toggle_label_1' => __('Enable Cookie Removal', 'notificationx'), 'toggle_label_2' => ''], | |
| 1122 | + 'rules' => Rules::logicalRule([ | |
| 1123 | + Rules::is( 'type', 'gdpr' ), | |
| 1124 | + ]), | |
| 1125 | + 'info' => __('When cookies are not accepted, non-essential cookies are removed, ensuring compliance with GDPR requirements.', 'notificationx'), | |
| 1126 | + ], | |
| 1127 | + 'gdpr_consent_expiry' => [ | |
| 1128 | + 'label' => __("Consent Expiry", 'notificationx'), | |
| 1129 | + 'name' => "gdpr_consent_expiry", | |
| 1130 | + 'type' => "number", | |
| 1131 | + 'min' => 1, | |
| 1132 | + 'description' => __('Days', 'notificationx'), | |
| 1133 | + 'default' => 30, | |
| 1134 | + 'suggestions' => [ | |
| 1135 | + [ | |
| 1136 | + 'value' => 30, | |
| 1137 | + 'unit' => 'days', | |
| 1138 | + ], | |
| 1139 | + [ | |
| 1140 | + 'value' => 90, | |
| 1141 | + 'unit' => 'days', | |
| 1142 | + ], | |
| 1143 | + [ | |
| 1144 | + 'value' => 180, | |
| 1145 | + 'unit' => 'days', | |
| 1146 | + ], | |
| 1147 | + [ | |
| 1148 | + 'value' => 365, | |
| 1149 | + 'unit' => 'days', | |
| 1150 | + ], | |
| 1151 | + ], | |
| 1152 | + 'rules' => Rules::logicalRule([ | |
| 1153 | + Rules::is( 'type', 'gdpr' ), | |
| 1154 | + ]), | |
| 1155 | + 'info' => __('By default, consent expires after 30 days. If needed, you can adjust this number to your preference', 'notificationx'), | |
| 1156 | + ], | |
| 1157 | + ] | |
| 1158 | + ], | |
| 1159 | + 'scan_cookies' => [ | |
| 1160 | + 'label' => 'Scan Cookies', | |
| 1161 | + 'type' => 'section', | |
| 1162 | + 'name' => 'scan_cookies', | |
| 1163 | + 'fields' => [ | |
| 1164 | + 'cookie_scanner' => [ | |
| 1165 | + 'type' => 'cookie-scanner', | |
| 1166 | + 'name' => 'cookie_scanner', | |
| 1167 | + 'id' => 'cookie_scanner', | |
| 1168 | + 'label' => 'Cookie Scanner', | |
| 1169 | + ], | |
| 1170 | + ] | |
| 1171 | + ], | |
| 1172 | + 'cookies_list_section' => [ | |
| 1173 | + 'label' => 'Cookies List', | |
| 1174 | + 'type' => 'section', | |
| 1175 | + 'name' => 'cookies_list_section', | |
| 1176 | + 'fields' => [ | |
| 1177 | + 'cookies_lists' => [ | |
| 1178 | + 'type' => 'tab', | |
| 1179 | + 'name' => 'cookies_lists', | |
| 1180 | + 'submit' => [ | |
| 1181 | + 'show' => false, | |
| 1182 | + ], | |
| 1183 | + 'default' => 'necessary_tab', | |
| 1184 | + 'dataShare' => true, | |
| 1185 | + 'fields' => [ | |
| 1186 | + 'necessary_tab' => [ | |
| 1187 | + 'label' => __("Necessary", 'notificationx'), | |
| 1188 | + 'name' => 'necessary_tab', | |
| 1189 | + 'id' => 'necessary_tab', | |
| 1190 | + 'type' => 'section', | |
| 1191 | + 'icon' => [ | |
| 1192 | + 'type' => 'tabs', | |
| 1193 | + 'name' => 'necessary' | |
| 1194 | + ], | |
| 1195 | + 'fields' => [ | |
| 1196 | + 'necessary_tab_info_modal' => [ | |
| 1197 | + 'name' => 'necessary_tab_info_modal', | |
| 1198 | + 'type' => 'modal', | |
| 1199 | + 'show_body' => true, | |
| 1200 | + 'close_on_body' => true, | |
| 1201 | + 'button' => [ | |
| 1202 | + 'name' => 'tab_info_edit', | |
| 1203 | + 'text' => ' ', | |
| 1204 | + 'icon' => [ | |
| 1205 | + 'type' => 'tabs', | |
| 1206 | + 'name' => 'edit_modal' | |
| 1207 | + ], | |
| 1208 | + ], | |
| 1209 | + 'confirm_button' => [ | |
| 1210 | + 'type' => 'button', | |
| 1211 | + 'text' => 'Save', | |
| 1212 | + 'name' => 'necessary_close_tab_info_modal', | |
| 1213 | + "default" => false, | |
| 1214 | + 'close_action' => true, | |
| 1215 | + ], | |
| 1216 | + 'cancel' => "necessary_close_tab_info_modal", | |
| 1217 | + 'body' => [ | |
| 1218 | + 'header' => __('Edit Category ', 'notificationx'), | |
| 1219 | + 'fields' => [ | |
| 1220 | + 'tab_title' => Helper::tab_info_title('necessary', 'Necessary'), | |
| 1221 | + 'tab_description' => Helper::tab_info_desc('necessary', 'Necessary cookies are needed to ensure the basic functions of this site, like allowing secure log-ins and managing your consent settings. These cookies do not collect any personal information.'), | |
| 1222 | + ], | |
| 1223 | + ], | |
| 1224 | + ], | |
| 1225 | + 'necessary_cookie_lists' => [ | |
| 1226 | + 'label' => '', | |
| 1227 | + 'name' => 'necessary_cookie_lists', | |
| 1228 | + 'type' => 'better-repeater', | |
| 1229 | + 'priority' => 10, | |
| 1230 | + 'placeholder_img'=> NOTIFICATIONX_ADMIN_URL . 'images/extensions/empty-cookie.png', | |
| 1231 | + 'button' => [ | |
| 1232 | + 'label' => __('Add New', 'notificationx'), | |
| 1233 | + 'position' => 'top', | |
| 1234 | + ], | |
| 1235 | + 'default' => Helper::default_cookie_list(), | |
| 1236 | + 'visible_fields' => ['cookies_id','load_inside', 'script_url_pattern', 'description'], | |
| 1237 | + '_fields' => Helper::gdpr_common_fields(), | |
| 1238 | + ] | |
| 1239 | + ], | |
| 1240 | + ], | |
| 1241 | + 'functional_tab' => [ | |
| 1242 | + 'label' => __("Functional", 'notificationx'), | |
| 1243 | + 'type' => 'section', | |
| 1244 | + 'name' => 'functional_tab', | |
| 1245 | + 'id' => 'functional_tab', | |
| 1246 | + 'icon' => [ | |
| 1247 | + 'type' => 'tabs', | |
| 1248 | + 'name' => 'functional' | |
| 1249 | + ], | |
| 1250 | + 'fields' => [ | |
| 1251 | + 'functional_tab_info_modal' => [ | |
| 1252 | + 'name' => 'functional_tab_info_modal', | |
| 1253 | + 'type' => 'modal', | |
| 1254 | + 'show_body' => true, | |
| 1255 | + 'close_on_body' => true, | |
| 1256 | + 'button' => [ | |
| 1257 | + 'name' => 'tab_info_edit', | |
| 1258 | + 'text' => ' ', | |
| 1259 | + 'icon' => [ | |
| 1260 | + 'type' => 'tabs', | |
| 1261 | + 'name' => 'edit_modal' | |
| 1262 | + ], | |
| 1263 | + ], | |
| 1264 | + 'confirm_button' => [ | |
| 1265 | + 'type' => 'button', | |
| 1266 | + 'text' => 'Save', | |
| 1267 | + 'name' => 'functional_close_tab_info_modal', | |
| 1268 | + "default" => false, | |
| 1269 | + 'close_action' => true, | |
| 1270 | + ], | |
| 1271 | + 'cancel' => "functional_close_tab_info_modal", | |
| 1272 | + 'body' => [ | |
| 1273 | + 'header' => __('Edit Category ', 'notificationx'), | |
| 1274 | + 'fields' => [ | |
| 1275 | + 'tab_title' => Helper::tab_info_title('functional', 'Functional'), | |
| 1276 | + 'tab_description' => Helper::tab_info_desc('functional', 'Functional cookies assist in performing tasks like sharing website content on social media, collecting feedback, and enabling other third-party features.'), | |
| 1277 | + ], | |
| 1278 | + ], | |
| 1279 | + ], | |
| 1280 | + 'functional_cookie_lists' => [ | |
| 1281 | + 'label' => '', | |
| 1282 | + 'name' => 'functional_cookie_lists', | |
| 1283 | + 'type' => 'better-repeater', | |
| 1284 | + 'priority' => 10, | |
| 1285 | + 'placeholder_img'=> NOTIFICATIONX_ADMIN_URL . 'images/extensions/empty-cookie.png', | |
| 1286 | + 'button' => [ | |
| 1287 | + 'label' => __('Add New', 'notificationx'), | |
| 1288 | + 'position' => 'top', | |
| 1289 | + ], | |
| 1290 | + 'visible_fields' => Helper::gdpr_cookie_list_visible_fields(), | |
| 1291 | + '_fields' => Helper::gdpr_common_fields(), | |
| 1292 | + ] | |
| 1293 | + ], | |
| 1294 | + ], | |
| 1295 | + 'analytics_tab' => [ | |
| 1296 | + 'label' => __("Analytics", 'notificationx'), | |
| 1297 | + 'type' => 'section', | |
| 1298 | + 'name' => 'analytics_tab', | |
| 1299 | + 'id' => 'analytics_tab', | |
| 1300 | + 'icon' => [ | |
| 1301 | + 'type' => 'tabs', | |
| 1302 | + 'name' => 'analytics' | |
| 1303 | + ], | |
| 1304 | + 'fields' => [ | |
| 1305 | + 'analytics_tab_info_modal' => [ | |
| 1306 | + 'name' => 'analytics_tab_info_modal', | |
| 1307 | + 'type' => 'modal', | |
| 1308 | + 'show_body' => true, | |
| 1309 | + 'close_on_body' => true, | |
| 1310 | + 'button' => [ | |
| 1311 | + 'name' => 'tab_info_edit', | |
| 1312 | + 'text' => ' ', | |
| 1313 | + 'icon' => [ | |
| 1314 | + 'type' => 'tabs', | |
| 1315 | + 'name' => 'edit_modal' | |
| 1316 | + ], | |
| 1317 | + ], | |
| 1318 | + 'confirm_button' => [ | |
| 1319 | + 'type' => 'button', | |
| 1320 | + 'text' => 'Save', | |
| 1321 | + 'name' => 'analytics_close_tab_info_modal', | |
| 1322 | + "default" => false, | |
| 1323 | + 'close_action' => true, | |
| 1324 | + ], | |
| 1325 | + 'cancel' => "analytics_close_tab_info_modal", | |
| 1326 | + 'body' => [ | |
| 1327 | + 'header' => __('Edit Category ', 'notificationx'), | |
| 1328 | + 'fields' => [ | |
| 1329 | + 'tab_title' => Helper::tab_info_title('analytics', 'Analytics'), | |
| 1330 | + 'tab_description' => Helper::tab_info_desc('analytics', 'Analytical cookies help us understand how visitors use the website. They provide data on metrics like the number of visitors, bounce rate, traffic sources etc.'), | |
| 1331 | + ], | |
| 1332 | + ], | |
| 1333 | + ], | |
| 1334 | + 'analytics_cookie_lists' => [ | |
| 1335 | + 'label' => '', | |
| 1336 | + 'name' => 'analytics_cookie_lists', | |
| 1337 | + 'type' => 'better-repeater', | |
| 1338 | + 'priority' => 10, | |
| 1339 | + 'placeholder_img'=> NOTIFICATIONX_ADMIN_URL . 'images/extensions/empty-cookie.png', | |
| 1340 | + 'button' => [ | |
| 1341 | + 'label' => __('Add New', 'notificationx'), | |
| 1342 | + 'position' => 'top', | |
| 1343 | + ], | |
| 1344 | + 'visible_fields' => Helper::gdpr_cookie_list_visible_fields(), | |
| 1345 | + '_fields' => Helper::gdpr_common_fields(), | |
| 1346 | + ] | |
| 1347 | + ], | |
| 1348 | + ], | |
| 1349 | + 'performance_tab' => [ | |
| 1350 | + 'label' => __("Performance", 'notificationx'), | |
| 1351 | + 'type' => 'section', | |
| 1352 | + 'name' => 'performance_tab', | |
| 1353 | + 'id' => 'performance_tab', | |
| 1354 | + 'icon' => [ | |
| 1355 | + 'type' => 'tabs', | |
| 1356 | + 'name' => 'performance' | |
| 1357 | + ], | |
| 1358 | + 'fields' => [ | |
| 1359 | + 'performance_tab_info_modal' => [ | |
| 1360 | + 'name' => 'performance_tab_info_modal', | |
| 1361 | + 'type' => 'modal', | |
| 1362 | + 'show_body' => true, | |
| 1363 | + 'close_on_body' => true, | |
| 1364 | + 'button' => [ | |
| 1365 | + 'name' => 'tab_info_edit', | |
| 1366 | + 'text' => ' ', | |
| 1367 | + 'icon' => [ | |
| 1368 | + 'type' => 'tabs', | |
| 1369 | + 'name' => 'edit_modal' | |
| 1370 | + ], | |
| 1371 | + ], | |
| 1372 | + 'confirm_button' => [ | |
| 1373 | + 'type' => 'button', | |
| 1374 | + 'text' => 'Save', | |
| 1375 | + 'name' => 'performance_close_tab_info_modal', | |
| 1376 | + "default" => false, | |
| 1377 | + 'close_action' => true, | |
| 1378 | + ], | |
| 1379 | + 'cancel' => "performance_close_tab_info_modal", | |
| 1380 | + 'body' => [ | |
| 1381 | + 'header' => __('Edit Category ', 'notificationx'), | |
| 1382 | + 'fields' => [ | |
| 1383 | + 'tab_title' => Helper::tab_info_title('performance', 'Performance'), | |
| 1384 | + 'tab_description' => Helper::tab_info_desc('performance', "Performance cookies help analyze the website's key performance indicators, which in turn helps improve the user experience for visitors."), | |
| 1385 | + ], | |
| 1386 | + ], | |
| 1387 | + ], | |
| 1388 | + 'performance_cookie_lists' => [ | |
| 1389 | + 'label' => '', | |
| 1390 | + 'name' => 'performance_cookie_lists', | |
| 1391 | + 'type' => 'better-repeater', | |
| 1392 | + 'priority' => 10, | |
| 1393 | + 'placeholder_img'=> NOTIFICATIONX_ADMIN_URL . 'images/extensions/empty-cookie.png', | |
| 1394 | + 'button' => [ | |
| 1395 | + 'label' => __('Add New', 'notificationx'), | |
| 1396 | + 'position' => 'top', | |
| 1397 | + ], | |
| 1398 | + 'visible_fields' => Helper::gdpr_cookie_list_visible_fields(), | |
| 1399 | + '_fields' => Helper::gdpr_common_fields(), | |
| 1400 | + ] | |
| 1401 | + ], | |
| 1402 | + ], | |
| 1403 | + 'advertisement_tab' => [ | |
| 1404 | + 'label' => __("Advertisement", 'notificationx'), | |
| 1405 | + 'type' => 'section', | |
| 1406 | + 'name' => 'advertisement_tab', | |
| 1407 | + 'id' => 'advertisement_tab', | |
| 1408 | + 'icon' => [ | |
| 1409 | + 'type' => 'tabs', | |
| 1410 | + 'name' => 'performance' | |
| 1411 | + ], | |
| 1412 | + 'fields' => [ | |
| 1413 | + 'advertising_tab_info_modal' => [ | |
| 1414 | + 'name' => 'advertising_tab_info_modal', | |
| 1415 | + 'type' => 'modal', | |
| 1416 | + 'show_body' => true, | |
| 1417 | + 'close_on_body' => true, | |
| 1418 | + 'button' => [ | |
| 1419 | + 'name' => 'tab_info_edit', | |
| 1420 | + 'text' => ' ', | |
| 1421 | + 'icon' => [ | |
| 1422 | + 'type' => 'tabs', | |
| 1423 | + 'name' => 'edit_modal' | |
| 1424 | + ], | |
| 1425 | + ], | |
| 1426 | + 'confirm_button' => [ | |
| 1427 | + 'type' => 'button', | |
| 1428 | + 'text' => 'Save', | |
| 1429 | + 'name' => 'advertising_close_tab_info_modal', | |
| 1430 | + "default" => false, | |
| 1431 | + 'close_action' => true, | |
| 1432 | + ], | |
| 1433 | + 'cancel' => "advertising_close_tab_info_modal", | |
| 1434 | + 'body' => [ | |
| 1435 | + 'header' => __('Edit Category ', 'notificationx'), | |
| 1436 | + 'fields' => [ | |
| 1437 | + 'tab_title' => Helper::tab_info_title('advertising', 'Advertisement'), | |
| 1438 | + 'tab_description' => Helper::tab_info_desc('advertising', "Advertisement cookies help analyze the website's key performance indicators, which in turn helps improve the user experience for visitors."), | |
| 1439 | + ], | |
| 1440 | + ], | |
| 1441 | + ], | |
| 1442 | + 'advertising_cookie_lists' => [ | |
| 1443 | + 'label' => '', | |
| 1444 | + 'name' => 'advertising_cookie_lists', | |
| 1445 | + 'type' => 'better-repeater', | |
| 1446 | + 'priority' => 10, | |
| 1447 | + 'placeholder_img'=> NOTIFICATIONX_ADMIN_URL . 'images/extensions/empty-cookie.png', | |
| 1448 | + 'button' => [ | |
| 1449 | + 'label' => __('Add New', 'notificationx'), | |
| 1450 | + 'position' => 'top', | |
| 1451 | + ], | |
| 1452 | + 'visible_fields' => Helper::gdpr_cookie_list_visible_fields(), | |
| 1453 | + '_fields' => Helper::gdpr_common_fields(), | |
| 1454 | + ] | |
| 1455 | + ], | |
| 1456 | + ], | |
| 1457 | + 'uncategorized_tab' => [ | |
| 1458 | + 'label' => __("Uncategorized", 'notificationx'), | |
| 1459 | + 'type' => 'section', | |
| 1460 | + 'name' => 'uncategorized_tab', | |
| 1461 | + 'id' => 'uncategorized_tab', | |
| 1462 | + 'icon' => [ | |
| 1463 | + 'type' => 'tabs', | |
| 1464 | + 'name' => 'uncategorized' | |
| 1465 | + ], | |
| 1466 | + 'fields' => [ | |
| 1467 | + 'uncategorized_tab_info_modal' => [ | |
| 1468 | + 'name' => 'uncategorized_tab_info_modal', | |
| 1469 | + 'type' => 'modal', | |
| 1470 | + 'show_body' => true, | |
| 1471 | + 'close_on_body' => true, | |
| 1472 | + 'button' => [ | |
| 1473 | + 'name' => 'tab_info_edit', | |
| 1474 | + 'text' => ' ', | |
| 1475 | + 'icon' => [ | |
| 1476 | + 'type' => 'tabs', | |
| 1477 | + 'name' => 'edit_modal' | |
| 1478 | + ], | |
| 1479 | + ], | |
| 1480 | + 'confirm_button' => [ | |
| 1481 | + 'type' => 'button', | |
| 1482 | + 'text' => 'Save', | |
| 1483 | + 'name' => 'uncategorized_close_tab_info', | |
| 1484 | + "default" => false, | |
| 1485 | + 'close_action' => true, | |
| 1486 | + ], | |
| 1487 | + 'cancel' => "uncategorized_close_tab_info", | |
| 1488 | + 'body' => [ | |
| 1489 | + 'header' => __('Edit Category ', 'notificationx'), | |
| 1490 | + 'fields' => [ | |
| 1491 | + 'tab_title' => Helper::tab_info_title('uncategorized', 'Uncategorized'), | |
| 1492 | + 'tab_description' => Helper::tab_info_desc('uncategorized', "Uncategorized cookies are those that don't fall into any specific category but may still be used for various purposes on the site. These cookies help us improve user experience by tracking interactions that don't fit into other cookie types."), | |
| 1493 | + ], | |
| 1494 | + ], | |
| 1495 | + ], | |
| 1496 | + 'uncategorized_cookie_lists' => [ | |
| 1497 | + 'label' => '', | |
| 1498 | + 'name' => 'uncategorized_cookie_lists', | |
| 1499 | + 'type' => 'better-repeater', | |
| 1500 | + 'priority' => 10, | |
| 1501 | + 'placeholder_img'=> NOTIFICATIONX_ADMIN_URL . 'images/extensions/empty-cookie.png', | |
| 1502 | + 'button' => [ | |
| 1503 | + 'label' => __('Add New', 'notificationx'), | |
| 1504 | + 'position' => 'top', | |
| 1505 | + ], | |
| 1506 | + 'visible_fields' => Helper::gdpr_cookie_list_visible_fields(), | |
| 1507 | + '_fields' => Helper::gdpr_common_fields(), | |
| 1508 | + ] | |
| 1509 | + ], | |
| 1510 | + ], | |
| 1511 | + ] | |
| 1512 | + ], | |
| 1513 | + ] | |
| 1514 | + ] | |
| 1515 | + ]), | |
| 1516 | + ], | |
| 1517 | + "display_tab" => [ | |
| 1518 | + 'label' => __("Display", 'notificationx'), | |
| 1519 | + 'id' => "display_tab", | |
| 1520 | + 'name' => "display_tab", | |
| 1521 | + 'rules' => Rules::is('type', 'gdpr', true), | |
| 1522 | + 'icon' => [ | |
| 1523 | + 'type' => 'tabs', | |
| 1524 | + 'name' => 'display' | |
| 1525 | + ], | |
| 1526 | + 'classes' => "display_tab", | |
| 1527 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 1528 | + 'fields' => apply_filters('nx_display_fields', [ | |
| 1529 | + "main_preview" => [ | |
| 1530 | + 'label' => __("Preview", 'notificationx'), | |
| 1531 | + 'name' => "main_preview", | |
| 1532 | + 'type' => "section", | |
| 1533 | + 'priority' => 1, | |
| 1534 | + 'fields' => [ | |
| 1535 | + 'preview_field' => [ | |
| 1536 | + 'name' => "preview_field", | |
| 1537 | + 'type' => "preview", | |
| 1538 | + 'label' => __('Preview', 'notificationx'), | |
| 1539 | + 'priority' => 10, | |
| 1540 | + ], | |
| 1541 | + ], | |
| 1542 | + 'rules' => Rules::logicalRule([ | |
| 1543 | + Rules::is( 'type', 'notification_bar' ), | |
| 1544 | + ]), | |
| 1545 | + ], | |
| 1546 | + "image-section" => [ | |
| 1547 | + 'label' => __("IMAGE", 'notificationx'), | |
| 1548 | + 'name' => "image-section", | |
| 1549 | + 'type' => "section", | |
| 1550 | + // 'condition' => [ | |
| 1551 | + // 'type' => '', | |
| 1552 | + // ], | |
| 1553 | + 'fields' => [ | |
| 1554 | + 'show_default_image' => [ | |
| 1555 | + 'label' => __("Show Default Image", 'notificationx'), | |
| 1556 | + 'name' => "show_default_image", | |
| 1557 | + 'type' => "checkbox", | |
| 1558 | + 'default' => false, | |
| 1559 | + ], | |
| 1560 | + 'default_avatar' => [ | |
| 1561 | + 'label' =>__( "Choose an Image", 'notificationx'), | |
| 1562 | + 'name' => "default_avatar", | |
| 1563 | + 'type' => "radio-card", | |
| 1564 | + 'default' => "verified.svg", | |
| 1565 | + 'description' => __('If checked, this will show in notifications.', 'notificationx'), | |
| 1566 | + 'rules' => Rules::is( 'show_default_image', true ), | |
| 1567 | + 'style' => [ | |
| 1568 | + 'size' => 'medium' | |
| 1569 | + ], | |
| 1570 | + 'options' => array( | |
| 1571 | + array( | |
| 1572 | + 'value' => 'verified.svg', | |
| 1573 | + 'label' => __('Verified', 'notificationx'), | |
| 1574 | + 'icon' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/verified.svg', | |
| 1575 | + ), | |
| 1576 | + array( | |
| 1577 | + 'value' => 'flames.svg', | |
| 1578 | + 'label' => __('Flames', 'notificationx'), | |
| 1579 | + 'icon' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/flames.svg', | |
| 1580 | + ), | |
| 1581 | + array( | |
| 1582 | + 'value' => 'flames.gif', | |
| 1583 | + 'label' => __('Flames GIF', 'notificationx'), | |
| 1584 | + 'icon' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/flames.gif', | |
| 1585 | + ), | |
| 1586 | + array( | |
| 1587 | + 'value' => 'pink-face-looped.gif', | |
| 1588 | + 'label' => __('Pink Face', 'notificationx'), | |
| 1589 | + 'icon' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/pink-face-looped.gif', | |
| 1590 | + ), | |
| 1591 | + array( | |
| 1592 | + 'value' => 'blue-face-non-looped.gif', | |
| 1593 | + 'label' => __('Blue Face', 'notificationx'), | |
| 1594 | + 'icon' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/blue-face-non-looped.gif', | |
| 1595 | + ), | |
| 1596 | + //TODO: none | |
| 1597 | + ) | |
| 1598 | + ], | |
| 1599 | + [ | |
| 1600 | + 'label' => __("Upload an Image", 'notificationx'), | |
| 1601 | + 'name' => "image_url", | |
| 1602 | + 'button' => __('Upload', 'notificationx'), | |
| 1603 | + 'type' => "media", | |
| 1604 | + 'default' => "", | |
| 1605 | + 'rules' => Rules::is( 'show_default_image', true ), | |
| 1606 | + ], | |
| 1607 | + 'show_notification_image' => [ | |
| 1608 | + 'label' => __("Image", 'notificationx'), | |
| 1609 | + 'name' => "show_notification_image", | |
| 1610 | + 'type' => "select", | |
| 1611 | + 'default' => "none", | |
| 1612 | + 'rules' => Rules::includes( 'source', [ | |
| 1613 | + "fluentform", | |
| 1614 | + "cf7", | |
| 1615 | + "custom_notification", | |
| 1616 | + "custom_notification_conversions", | |
| 1617 | + "edd", | |
| 1618 | + "envato", | |
| 1619 | + "grvf", | |
| 1620 | + "give", | |
| 1621 | + // "ifttt", | |
| 1622 | + "learndash", | |
| 1623 | + "njf", | |
| 1624 | + "tutor", | |
| 1625 | + "wpf", | |
| 1626 | + "reviewx", | |
| 1627 | + "woocommerce", | |
| 1628 | + "surecart", | |
| 1629 | + "woo_reviews", | |
| 1630 | + "wp_comments", | |
| 1631 | + "wp_reviews", | |
| 1632 | + "zapier", | |
| 1633 | + "mailchimp", | |
| 1634 | + "convertkit", | |
| 1635 | + "freemius_conversions", | |
| 1636 | + "freemius_reviews", | |
| 1637 | + "freemius_stats", | |
| 1638 | + "youtube", | |
| 1639 | + "woocommerce_sales", | |
| 1640 | + 'woocommerce_sales_reviews', | |
| 1641 | + ] ), | |
| 1642 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 1643 | + 'options' => apply_filters('nx_show_image_options', array( | |
| 1644 | + 'none' => [ | |
| 1645 | + 'value' => 'none', | |
| 1646 | + 'label' => __('None', 'notificationx'), | |
| 1647 | + ], | |
| 1648 | + 'featured_image' => [ | |
| 1649 | + 'value' => 'featured_image', | |
| 1650 | + 'label' => __('Featured Image', 'notificationx'), | |
| 1651 | + 'rules' => [ | |
| 1652 | + 'includes', | |
| 1653 | + 'source', | |
| 1654 | + [ | |
| 1655 | + "cf7", | |
| 1656 | + "custom_notification", | |
| 1657 | + "custom_notification_conversions", | |
| 1658 | + "edd", | |
| 1659 | + "envato", | |
| 1660 | + "grvf", | |
| 1661 | + "give", | |
| 1662 | + // "ifttt", | |
| 1663 | + "learndash", | |
| 1664 | + "njf", | |
| 1665 | + "tutor", | |
| 1666 | + "wpf", | |
| 1667 | + "reviewx", | |
| 1668 | + "woocommerce", | |
| 1669 | + "surecart", | |
| 1670 | + "woo_reviews", | |
| 1671 | + "wp_reviews", | |
| 1672 | + "freemius_conversions", | |
| 1673 | + "freemius_reviews", | |
| 1674 | + "freemius_stats", | |
| 1675 | + "woocommerce_sales", | |
| 1676 | + 'woocommerce_sales_reviews', | |
| 1677 | + ] | |
| 1678 | + ], | |
| 1679 | + ], | |
| 1680 | + 'gravatar' => [ | |
| 1681 | + // @todo move the rules to a filter. | |
| 1682 | + 'value' => 'gravatar', | |
| 1683 | + 'label' => __('Gravatar', 'notificationx'), | |
| 1684 | + 'rules' => [ | |
| 1685 | + 'includes', | |
| 1686 | + 'source',[ | |
| 1687 | + "fluentform", | |
| 1688 | + "cf7", | |
| 1689 | + "custom_notification", | |
| 1690 | + "custom_notification_conversions", | |
| 1691 | + "edd", | |
| 1692 | + "grvf", | |
| 1693 | + "give", | |
| 1694 | + // "ifttt", | |
| 1695 | + "learndash", | |
| 1696 | + "njf", | |
| 1697 | + "tutor", | |
| 1698 | + "wpf", | |
| 1699 | + "reviewx", | |
| 1700 | + "woocommerce", | |
| 1701 | + "surecart", | |
| 1702 | + "woo_reviews", | |
| 1703 | + "wp_comments", | |
| 1704 | + "wp_reviews", | |
| 1705 | + "zapier", | |
| 1706 | + "mailchimp", | |
| 1707 | + "convertkit", | |
| 1708 | + "freemius_conversions", | |
| 1709 | + "freemius_reviews", | |
| 1710 | + "freemius_stats", | |
| 1711 | + "woocommerce_sales", | |
| 1712 | + 'woocommerce_sales_reviews', | |
| 1713 | + ], | |
| 1714 | + ], | |
| 1715 | + ], | |
| 1716 | + )), | |
| 1717 | + ], | |
| 1718 | + ], | |
| 1719 | + ], | |
| 1720 | + "visibility" => [ | |
| 1721 | + 'label' => __("Visibility", 'notificationx'), | |
| 1722 | + 'name' => "visibility", | |
| 1723 | + 'type' => "section", | |
| 1724 | + 'fields' => [ | |
| 1725 | + "show_on" => [ | |
| 1726 | + 'label' => __("Show On", 'notificationx'), | |
| 1727 | + 'name' => "show_on", | |
| 1728 | + 'type' => "select", | |
| 1729 | + 'default' => "everywhere", | |
| 1730 | + 'priority' => 5, | |
| 1731 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 1732 | + 'options' => apply_filters('nx_show_on_options', $this->normalize_fields([ | |
| 1733 | + 'everywhere' => __('Show Everywhere', 'notificationx'), | |
| 1734 | + 'on_selected' => __('Show On Selected', 'notificationx'), | |
| 1735 | + 'hide_on_selected' => __('Hide On Selected', 'notificationx'), | |
| 1736 | + ])), | |
| 1737 | + ], | |
| 1738 | + "all_locations" => [ | |
| 1739 | + 'label' => __("Locations", 'notificationx'), | |
| 1740 | + 'name' => "all_locations", | |
| 1741 | + 'type' => "select", | |
| 1742 | + 'default' => "", | |
| 1743 | + 'multiple' => true, | |
| 1744 | + 'priority' => 10, | |
| 1745 | + 'rules' => [ 'includes', 'show_on', [ | |
| 1746 | + 'on_selected', | |
| 1747 | + 'hide_on_selected', | |
| 1748 | + ] ], | |
| 1749 | + 'options' => $this->normalize_fields(Locations::get_instance()->get_locations()), | |
| 1750 | + ], | |
| 1751 | + "show_on_display" => [ | |
| 1752 | + 'label' => __("Display For", 'notificationx'), | |
| 1753 | + 'name' => "show_on_display", | |
| 1754 | + 'type' => "select", | |
| 1755 | + 'default' => "always", | |
| 1756 | + 'priority' => 15, | |
| 1757 | + 'options' => $this->normalize_fields([ | |
| 1758 | + 'always' => __('Everyone', 'notificationx'), | |
| 1759 | + 'logged_out_user' => __('Logged Out User', 'notificationx'), | |
| 1760 | + 'logged_in_user' => __('Logged In User', 'notificationx'), | |
| 1761 | + ]), | |
| 1762 | + 'help' => sprintf('<a target="_blank" rel="nofollow" href="https://notificationx.com/in/pro-display-control">%s</a>', __('More Control in Pro', 'notificationx')), | |
| 1763 | + ], | |
| 1764 | + ], | |
| 1765 | + ], | |
| 1766 | + ]), | |
| 1767 | + ], | |
| 1768 | + "customize_tab" => [ | |
| 1769 | + 'label' => __("Customize", 'notificationx'), | |
| 1770 | + 'id' => "customize_tab", | |
| 1771 | + 'name' => "customize_tab", | |
| 1772 | + 'icon' => [ | |
| 1773 | + 'type' => 'tabs', | |
| 1774 | + 'name' => 'customize' | |
| 1775 | + ], | |
| 1776 | + 'classes' => "customize_tab", | |
| 1777 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 1778 | + 'fields' => apply_filters('nx_customize_fields', [ | |
| 1779 | + "main_preview" => [ | |
| 1780 | + 'label' => __("Preview", 'notificationx'), | |
| 1781 | + 'name' => "main_preview", | |
| 1782 | + 'type' => "section", | |
| 1783 | + 'priority' => 1, | |
| 1784 | + 'fields' => [ | |
| 1785 | + 'preview_field' => [ | |
| 1786 | + 'name' => "preview_field", | |
| 1787 | + 'type' => "preview", | |
| 1788 | + 'label' => __('Preview', 'notificationx'), | |
| 1789 | + 'priority' => 10, | |
| 1790 | + ], | |
| 1791 | + ], | |
| 1792 | + 'rules' => Rules::logicalRule([ | |
| 1793 | + Rules::is( 'type', 'notification_bar' ), | |
| 1794 | + ]), | |
| 1795 | + ], | |
| 1796 | + 'appearance' => [ | |
| 1797 | + 'label' => __("Appearance", 'notificationx'), | |
| 1798 | + 'name' => "appearance", | |
| 1799 | + 'type' => "section", | |
| 1800 | + 'fields' => [ | |
| 1801 | + 'position' => [ | |
| 1802 | + 'label' => __("Position", 'notificationx'), | |
| 1803 | + 'name' => "position", // combined "pressbar_position" && "conversion_position" | |
| 1804 | + 'type' => "select", | |
| 1805 | + 'default' => 'bottom_left', | |
| 1806 | + 'priority' => 50, | |
| 1807 | + 'options' => [ | |
| 1808 | + 'bottom_left' => [ | |
| 1809 | + 'label' => __('Bottom Left', 'notificationx'), | |
| 1810 | + 'value' => 'bottom_left', | |
| 1811 | + ], | |
| 1812 | + 'bottom_right' => [ | |
| 1813 | + 'label' => __('Bottom Right', 'notificationx'), | |
| 1814 | + 'value' => 'bottom_right', | |
| 1815 | + ], | |
| 1816 | + ], | |
| 1817 | + ], | |
| 1818 | + 'close_icon_position' => [ | |
| 1819 | + 'label' => __("Close Icon Position", 'notificationx'), | |
| 1820 | + 'name' => "close_icon_position", | |
| 1821 | + 'type' => "select", | |
| 1822 | + 'default' => 'top_right', | |
| 1823 | + 'priority' => 51, | |
| 1824 | + 'options' => [ | |
| 1825 | + 'top_right' => [ | |
| 1826 | + 'label' => __('Top Right', 'notificationx'), | |
| 1827 | + 'value' => 'top_right', | |
| 1828 | + ], | |
| 1829 | + 'top_left' => [ | |
| 1830 | + 'label' => __('Top Left', 'notificationx'), | |
| 1831 | + 'value' => 'top_left', | |
| 1832 | + ] | |
| 1833 | + ], | |
| 1834 | + 'rules' => Rules::includes('source', ['press_bar']), | |
| 1835 | + ], | |
| 1836 | + 'size' => [ | |
| 1837 | + 'label' => __("Notification Size", 'notificationx'), | |
| 1838 | + 'name' => "size", | |
| 1839 | + 'type' => "responsive-number", | |
| 1840 | + 'default' => [ | |
| 1841 | + "desktop" => 500, | |
| 1842 | + "tablet" => 500, | |
| 1843 | + "mobile" => 500, | |
| 1844 | + ], | |
| 1845 | + 'priority' => 51, | |
| 1846 | + 'min' => 300, | |
| 1847 | + 'controls' => [ | |
| 1848 | + "desktop" => [ | |
| 1849 | + "icon" => NOTIFICATIONX_ADMIN_URL . 'images/responsive/desktop.svg', | |
| 1850 | + 'size' => 18, | |
| 1851 | + ], | |
| 1852 | + "tablet" => [ | |
| 1853 | + "icon" => NOTIFICATIONX_ADMIN_URL . 'images/responsive/tablet.svg', | |
| 1854 | + 'size' => 14, | |
| 1855 | + ], | |
| 1856 | + "mobile" => [ | |
| 1857 | + "icon" => NOTIFICATIONX_ADMIN_URL . 'images/responsive/mobile.svg', | |
| 1858 | + 'size' => 12, | |
| 1859 | + ], | |
| 1860 | + ], | |
| 1861 | + 'help' => __('Set a max width for notification.', 'notificationx'), | |
| 1862 | + ], | |
| 1863 | + 'close_button' => [ | |
| 1864 | + 'label' => __("Display Close Option", 'notificationx'), | |
| 1865 | + 'name' => "close_button", | |
| 1866 | + 'type' => "checkbox", | |
| 1867 | + 'default' => 1, | |
| 1868 | + 'priority' => 70, | |
| 1869 | + 'description' => __('Display a close button.', 'notificationx'), | |
| 1870 | + ], | |
| 1871 | + 'hide_on_mobile' => [ | |
| 1872 | + 'label' => __("Mobile Visibility", 'notificationx'), | |
| 1873 | + 'name' => "hide_on_mobile", | |
| 1874 | + 'type' => "checkbox", | |
| 1875 | + 'default' => false, | |
| 1876 | + 'priority' => 200, | |
| 1877 | + 'description' => __('Hide NotificationX on mobile.', 'notificationx'), | |
| 1878 | + ], | |
| 1879 | + ] | |
| 1880 | + ], | |
| 1881 | + 'appearance' => [ | |
| 1882 | + 'label' => __("Appearance", 'notificationx'), | |
| 1883 | + 'name' => "appearance", | |
| 1884 | + 'type' => "section", | |
| 1885 | + 'fields' => [ | |
| 1886 | + 'position' => [ | |
| 1887 | + 'label' => __("Position", 'notificationx'), | |
| 1888 | + 'name' => "position", // combined "pressbar_position" && "conversion_position" | |
| 1889 | + 'type' => "select", | |
| 1890 | + 'default' => 'bottom_left', | |
| 1891 | + 'priority' => 50, | |
| 1892 | + 'options' => [ | |
| 1893 | + 'bottom_left' => [ | |
| 1894 | + 'label' => __('Bottom Left', 'notificationx'), | |
| 1895 | + 'value' => 'bottom_left', | |
| 1896 | + ], | |
| 1897 | + 'bottom_right' => [ | |
| 1898 | + 'label' => __('Bottom Right', 'notificationx'), | |
| 1899 | + 'value' => 'bottom_right', | |
| 1900 | + ], | |
| 1901 | + ], | |
| 1902 | + ], | |
| 1903 | + 'size' => [ | |
| 1904 | + 'label' => __("Notification Size", 'notificationx'), | |
| 1905 | + 'name' => "size", | |
| 1906 | + 'type' => "responsive-number", | |
| 1907 | + 'default' => [ | |
| 1908 | + "desktop" => 500, | |
| 1909 | + "tablet" => 500, | |
| 1910 | + "mobile" => 500, | |
| 1911 | + ], | |
| 1912 | + 'priority' => 51, | |
| 1913 | + 'min' => 300, | |
| 1914 | + 'controls' => [ | |
| 1915 | + "desktop" => [ | |
| 1916 | + "icon" => NOTIFICATIONX_ADMIN_URL . 'images/responsive/desktop.svg', | |
| 1917 | + 'size' => 18, | |
| 1918 | + ], | |
| 1919 | + "tablet" => [ | |
| 1920 | + "icon" => NOTIFICATIONX_ADMIN_URL . 'images/responsive/tablet.svg', | |
| 1921 | + 'size' => 14, | |
| 1922 | + ], | |
| 1923 | + "mobile" => [ | |
| 1924 | + "icon" => NOTIFICATIONX_ADMIN_URL . 'images/responsive/mobile.svg', | |
| 1925 | + 'size' => 12, | |
| 1926 | + ], | |
| 1927 | + ], | |
| 1928 | + 'help' => __('Set a max width for notification.', 'notificationx'), | |
| 1929 | + ], | |
| 1930 | + 'close_button_control' => [ | |
| 1931 | + 'label' => __("Display Close Button", 'notificationx'), | |
| 1932 | + 'name' => "close_button_control", | |
| 1933 | + 'type' => "section", | |
| 1934 | + 'fields' => [ | |
| 1935 | + 'close_button' => [ | |
| 1936 | + 'name' => "close_button", | |
| 1937 | + 'type' => "checkbox", | |
| 1938 | + 'default' => 1, | |
| 1939 | + 'priority' => 70, | |
| 1940 | + 'description' => __('Desktop', 'notificationx'), | |
| 1941 | + ], | |
| 1942 | + 'close_button_tab' => [ | |
| 1943 | + 'name' => "close_button_tab", | |
| 1944 | + 'type' => "checkbox", | |
| 1945 | + 'default' => 1, | |
| 1946 | + 'priority' => 71, | |
| 1947 | + 'description' => __('Tablet', 'notificationx'), | |
| 1948 | + ], | |
| 1949 | + 'close_button_mobile' => [ | |
| 1950 | + 'name' => "close_button_mobile", | |
| 1951 | + 'type' => "checkbox", | |
| 1952 | + 'default' => 1, | |
| 1953 | + 'priority' => 72, | |
| 1954 | + 'description' => __('Mobile', 'notificationx'), | |
| 1955 | + ], | |
| 1956 | + ] | |
| 1957 | + ], | |
| 1958 | + 'nx_visibility_control' => [ | |
| 1959 | + 'label' => __("Notification Visibility", 'notificationx'), | |
| 1960 | + 'name' => "close_button_control", | |
| 1961 | + 'type' => "section", | |
| 1962 | + 'fields' => [ | |
| 1963 | + 'hide_on_desktop' => [ | |
| 1964 | + 'name' => "hide_on_desktop", | |
| 1965 | + 'type' => "checkbox", | |
| 1966 | + 'default' => true, | |
| 1967 | + 'priority' => 201, | |
| 1968 | + 'description' => __('Desktop', 'notificationx'), | |
| 1969 | + ], | |
| 1970 | + 'hide_on_tab' => [ | |
| 1971 | + 'name' => "hide_on_tab", | |
| 1972 | + 'type' => "checkbox", | |
| 1973 | + 'default' => true, | |
| 1974 | + 'priority' => 202, | |
| 1975 | + 'description' => __('Tablet', 'notificationx'), | |
| 1976 | + ], | |
| 1977 | + 'hide_on_mobile' => [ | |
| 1978 | + 'name' => "hide_on_mobile", | |
| 1979 | + 'type' => "checkbox", | |
| 1980 | + 'default' => true, | |
| 1981 | + 'priority' => 205, | |
| 1982 | + 'description' => __('Mobile', 'notificationx'), | |
| 1983 | + ], | |
| 1984 | + ] | |
| 1985 | + ], | |
| 1986 | + 'notification_reappearance' => array( | |
| 1987 | + 'label' => __( 'Notification Reappearance', 'notificationx' ), | |
| 1988 | + 'type' => 'select', | |
| 1989 | + 'name' => 'notification_reappearance', | |
| 1990 | + 'default' => 'show_notification_next_visit', | |
| 1991 | + 'rules' => Rules::logicalRule([ | |
| 1992 | + Rules::is('source', 'press_bar', true), | |
| 1993 | + ]), | |
| 1994 | + 'options' => GlobalFields::get_instance()->normalize_fields([ | |
| 1995 | + 'dont_show_notification' => __( "Don't show the Notification again for the user", 'notificationx' ), | |
| 1996 | + 'show_notification_next_visit' => __( 'Show the Notification again when the user visits the website next time', 'notificationx' ), | |
| 1997 | + 'show_notification_every_page' => __( 'Show the Notification when the user refreshes/goes to another page', 'notificationx' ), | |
| 1998 | + ]), | |
| 1999 | + ), | |
| 2000 | + 'cache_duration_for_dont_show' => [ | |
| 2001 | + 'label' => __( 'Cache Duration for "Don\'t show again"', 'notificationx' ), | |
| 2002 | + 'name' => 'cache_duration_for_dont_show', | |
| 2003 | + 'type' => 'number', | |
| 2004 | + 'default' => 10, | |
| 2005 | + 'min' => 1, | |
| 2006 | + 'max' => 365, | |
| 2007 | + 'step' => 1, | |
| 2008 | + 'description' => __('Days', 'notificationx'), | |
| 2009 | + 'rules' => Rules::logicalRule([ | |
| 2010 | + Rules::is('notification_reappearance', 'dont_show_notification'), | |
| 2011 | + ]), | |
| 2012 | + ], | |
| 2013 | + ] | |
| 2014 | + ], | |
| 2015 | + 'animation' => [ | |
| 2016 | + 'label' => __("Animation", 'notificationx'), | |
| 2017 | + 'name' => "animation", | |
| 2018 | + 'type' => "section", | |
| 2019 | + 'priority'=> 15, | |
| 2020 | + 'fields' => [ | |
| 2021 | + 'animation_notification_show' => [ | |
| 2022 | + 'label' => __("Notification Show", 'notificationx'), | |
| 2023 | + 'name' => "animation_notification_show", | |
| 2024 | + 'type' => "select", | |
| 2025 | + 'default' => 'default', | |
| 2026 | + 'classes' => NotificationX::is_pro() ? '' : 'animation-pro-disabled', | |
| 2027 | + 'priority' => 5, | |
| 2028 | + 'info' => InfoTooltipManager::get_instance()->render('animation'), | |
| 2029 | + 'options' => [ | |
| 2030 | + 'default' => [ | |
| 2031 | + 'label' => __('Default', 'notificationx'), | |
| 2032 | + 'value' => 'default', | |
| 2033 | + 'selected' => 'selected', | |
| 2034 | + ], | |
| 2035 | + 'animate__fadeIn' => [ | |
| 2036 | + 'label' => __('Fade In', 'notificationx'), | |
| 2037 | + 'value' => 'animate__fadeIn', | |
| 2038 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2039 | + ], | |
| 2040 | + 'animate__fadeInUp' => [ | |
| 2041 | + 'label' => __('Fade In Up', 'notificationx'), | |
| 2042 | + 'value' => 'animate__fadeInUp', | |
| 2043 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2044 | + ], | |
| 2045 | + 'animate__fadeInDown' => [ | |
| 2046 | + 'label' => __('Fade In Down', 'notificationx'), | |
| 2047 | + 'value' => 'animate__fadeInDown', | |
| 2048 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2049 | + ], | |
| 2050 | + 'animate__fadeInDownBig' => [ | |
| 2051 | + 'label' => __('Fade In Down Big', 'notificationx'), | |
| 2052 | + 'value' => 'animate__fadeInDownBig', | |
| 2053 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2054 | + ], | |
| 2055 | + 'animate__fadeInLeft' => [ | |
| 2056 | + 'label' => __('Fade In Left', 'notificationx'), | |
| 2057 | + 'value' => 'animate__fadeInLeft', | |
| 2058 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2059 | + ], | |
| 2060 | + 'animate__fadeInRight' => [ | |
| 2061 | + 'label' => __('Fade In Right', 'notificationx'), | |
| 2062 | + 'value' => 'animate__fadeInRight', | |
| 2063 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2064 | + ], | |
| 2065 | + 'animate__lightSpeedInLeft' => [ | |
| 2066 | + 'label' => __('Light Speed In Left', 'notificationx'), | |
| 2067 | + 'value' => 'animate__lightSpeedInLeft', | |
| 2068 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2069 | + ], | |
| 2070 | + 'animate__lightSpeedInRight' => [ | |
| 2071 | + 'label' => __('Light Speed In Right', 'notificationx'), | |
| 2072 | + 'value' => 'animate__lightSpeedInRight', | |
| 2073 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2074 | + ], | |
| 2075 | + 'animate__zoomIn' => [ | |
| 2076 | + 'label' => __('Zoom In', 'notificationx'), | |
| 2077 | + 'value' => 'animate__zoomIn', | |
| 2078 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2079 | + ], | |
| 2080 | + 'animate__slideInUp' => [ | |
| 2081 | + 'label' => __('Slide In Up', 'notificationx'), | |
| 2082 | + 'value' => 'animate__slideInUp', | |
| 2083 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2084 | + ], | |
| 2085 | + 'animate__slideInLeft' => [ | |
| 2086 | + 'label' => __('Slide In Left', 'notificationx'), | |
| 2087 | + 'value' => 'animate__slideInLeft', | |
| 2088 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2089 | + ], | |
| 2090 | + 'animate__slideInRight' => [ | |
| 2091 | + 'label' => __('Slide In Right', 'notificationx'), | |
| 2092 | + 'value' => 'animate__slideInRight', | |
| 2093 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2094 | + ], | |
| 2095 | + 'animate__slideInDown' => [ | |
| 2096 | + 'label' => __('Slide In Down', 'notificationx'), | |
| 2097 | + 'value' => 'animate__slideInDown', | |
| 2098 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2099 | + ], | |
| 2100 | + ], | |
| 2101 | + ], | |
| 2102 | + 'animation_notification_hide' => [ | |
| 2103 | + 'label' => __("Notification Hide", 'notificationx'), | |
| 2104 | + 'name' => "animation_notification_hide", | |
| 2105 | + 'type' => "select", | |
| 2106 | + 'default' => 'default', | |
| 2107 | + 'classes' => NotificationX::is_pro() ? '' : 'animation-pro-disabled', | |
| 2108 | + 'priority' => 10, | |
| 2109 | + 'info' => InfoTooltipManager::get_instance()->render('animation'), | |
| 2110 | + 'options' => [ | |
| 2111 | + 'default' => [ | |
| 2112 | + 'label' => __('Default', 'notificationx'), | |
| 2113 | + 'value' => 'default', | |
| 2114 | + ], | |
| 2115 | + 'animate__fadeOut' => [ | |
| 2116 | + 'label' => __('Fade Out', 'notificationx'), | |
| 2117 | + 'value' => 'animate__fadeOut', | |
| 2118 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2119 | + ], | |
| 2120 | + 'animate__fadeOutDown' => [ | |
| 2121 | + 'label' => __('Fade Out Down', 'notificationx'), | |
| 2122 | + 'value' => 'animate__fadeOutDown', | |
| 2123 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2124 | + ], | |
| 2125 | + 'animate__fadeOutRight' => [ | |
| 2126 | + 'label' => __('Fade Out Right', 'notificationx'), | |
| 2127 | + 'value' => 'animate__fadeOutRight', | |
| 2128 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2129 | + ], | |
| 2130 | + 'animate__fadeOutUp' => [ | |
| 2131 | + 'label' => __('Fade Out Up', 'notificationx'), | |
| 2132 | + 'value' => 'animate__fadeOutUp', | |
| 2133 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2134 | + ], | |
| 2135 | + 'animate__lightSpeedOutLeft' => [ | |
| 2136 | + 'label' => __('Light Speed Out Left', 'notificationx'), | |
| 2137 | + 'value' => 'animate__lightSpeedOutLeft', | |
| 2138 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2139 | + ], | |
| 2140 | + 'animate__zoomOut' => [ | |
| 2141 | + 'label' => __('Zoom Out', 'notificationx'), | |
| 2142 | + 'value' => 'animate__zoomOut', | |
| 2143 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2144 | + ], | |
| 2145 | + 'animate__slideOutDown' => [ | |
| 2146 | + 'label' => __('Slide Out Down', 'notificationx'), | |
| 2147 | + 'value' => 'animate__slideOutDown', | |
| 2148 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2149 | + ], | |
| 2150 | + 'animate__slideOutLeft' => [ | |
| 2151 | + 'label' => __('Slide Out Left', 'notificationx'), | |
| 2152 | + 'value' => 'animate__slideOutLeft', | |
| 2153 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2154 | + ], | |
| 2155 | + 'animate__slideOutRight' => [ | |
| 2156 | + 'label' => __('Slide Out Right', 'notificationx'), | |
| 2157 | + 'value' => 'animate__slideOutRight', | |
| 2158 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2159 | + ], | |
| 2160 | + 'animate__slideOutUp' => [ | |
| 2161 | + 'label' => __('Slide Out Up', 'notificationx'), | |
| 2162 | + 'value' => 'animate__slideOutUp', | |
| 2163 | + 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2164 | + ], | |
| 2165 | + ], | |
| 2166 | + ], | |
| 2167 | + // 'animation_notification_duration' => [ | |
| 2168 | + // 'label' => __("Duration", 'notificationx'), | |
| 2169 | + // 'name' => "animation_notification_duration", | |
| 2170 | + // 'type' => "select", | |
| 2171 | + // 'default' => 'default', | |
| 2172 | + // 'priority' => 15, | |
| 2173 | + // 'options' => [ | |
| 2174 | + // 'default' => [ | |
| 2175 | + // 'label' => __('Default', 'notificationx'), | |
| 2176 | + // 'value' => 'default', | |
| 2177 | + // ], | |
| 2178 | + // 'animate__faster' => [ | |
| 2179 | + // 'label' => __('Faster', 'notificationx'), | |
| 2180 | + // 'value' => 'animate__faster', | |
| 2181 | + // 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2182 | + // ], | |
| 2183 | + // 'animate__fast' => [ | |
| 2184 | + // 'label' => __('Fast', 'notificationx'), | |
| 2185 | + // 'value' => 'animate__fast', | |
| 2186 | + // 'disabled' => NotificationX::is_pro() ? false : true, | |
| 2187 | + // ], | |
| 2188 | + // ], | |
| 2189 | + // ], | |
| 2190 | + ] | |
| 2191 | + ], | |
| 2192 | + 'queue_management' => [ | |
| 2193 | + 'label' => __("Queue Management", 'notificationx'), | |
| 2194 | + 'name' => "queue_management", | |
| 2195 | + 'type' => "section", | |
| 2196 | + 'priority' => 150, | |
| 2197 | + // @todo is_pro | |
| 2198 | + 'is_pro' => true, | |
| 2199 | + 'fields' => [ | |
| 2200 | + [ | |
| 2201 | + 'label' => __("Enable Global Queue", 'notificationx'), | |
| 2202 | + 'name' => "global_queue", | |
| 2203 | + 'type' => "checkbox", | |
| 2204 | + 'priority' => 0, | |
| 2205 | + 'default' => false, | |
| 2206 | + 'is_pro' => true, | |
| 2207 | + 'info' => InfoTooltipManager::get_instance()->render('global_queue_management'), | |
| 2208 | + 'description' => sprintf('%s <a href="%s" target="_blank">%s</a>', __('Activate global queue system for this notification.', 'notificationx'), 'https://notificationx.com/docs/centralized-queue', __('Check out this doc.', 'notificationx')), | |
| 2209 | + ], | |
| 2210 | + ] | |
| 2211 | + ], | |
| 2212 | + 'timing' => [ | |
| 2213 | + 'label' => __("Timing", 'notificationx'), | |
| 2214 | + 'name' => "timing", | |
| 2215 | + 'type' => "section", | |
| 2216 | + 'priority' => 200, | |
| 2217 | + // 'rules' => Rules::is( 'global_queue', false ), | |
| 2218 | + 'rules' => Rules::is( 'global_queue', true, true ), | |
| 2219 | + 'fields' => [ | |
| 2220 | + 'delay_before' => [ | |
| 2221 | + 'label' => __("Delay Before First Notification", 'notificationx'), | |
| 2222 | + 'name' => "delay_before", | |
| 2223 | + 'type' => "number", | |
| 2224 | + 'priority' => 40, | |
| 2225 | + 'default' => defined('NX_DEBUG') && NX_DEBUG ? 1 : 5, | |
| 2226 | + 'help' => __('Initial Delay', 'notificationx'), | |
| 2227 | + 'description' => __('seconds', 'notificationx'), | |
| 2228 | + | |
| 2229 | + ], | |
| 2230 | + 'display_for' => [ | |
| 2231 | + 'name' => "display_for", | |
| 2232 | + 'type' => "number", | |
| 2233 | + 'label' => __("Display For", 'notificationx'), | |
| 2234 | + 'description' => __('seconds', 'notificationx'), | |
| 2235 | + 'help' => __('Display each notification for * seconds', 'notificationx'), | |
| 2236 | + 'priority' => 60, | |
| 2237 | + 'default' => defined('NX_DEBUG') && NX_DEBUG ? 2 : 5, | |
| 2238 | + ], | |
| 2239 | + 'delay_between' => [ | |
| 2240 | + 'name' => "delay_between", | |
| 2241 | + 'type' => "number", | |
| 2242 | + 'label' => __("Delay Between", 'notificationx'), | |
| 2243 | + 'description' => __('seconds', 'notificationx'), | |
| 2244 | + 'help' => __('Delay between each notification', 'notificationx'), | |
| 2245 | + 'priority' => 70, | |
| 2246 | + 'default' => defined('NX_DEBUG') && NX_DEBUG ? 1 : 5, | |
| 2247 | + ], | |
| 2248 | + ] | |
| 2249 | + ], | |
| 2250 | + 'behaviour' => [ | |
| 2251 | + 'label' => __("Behavior", 'notificationx'), | |
| 2252 | + 'name' => "behaviour", | |
| 2253 | + 'type' => "section", | |
| 2254 | + 'priority' => 300, | |
| 2255 | + 'collapsable' => true, | |
| 2256 | + 'fields' => [ | |
| 2257 | + "display_last" => [ | |
| 2258 | + 'name' => "display_last", | |
| 2259 | + 'type' => 'number', | |
| 2260 | + 'label' => __('Display The Last', 'notificationx'), | |
| 2261 | + 'description' => 'conversions', | |
| 2262 | + 'default' => 20, | |
| 2263 | + 'priority' => 40, | |
| 2264 | + 'max' => 20, | |
| 2265 | + ], | |
| 2266 | + 'display_from' => [ | |
| 2267 | + 'name' => 'display_from', | |
| 2268 | + 'type' => 'number', | |
| 2269 | + 'label' => __('Display From The Last', 'notificationx'), | |
| 2270 | + 'priority' => 45, | |
| 2271 | + 'default' => 30, | |
| 2272 | + 'description' => 'Days', | |
| 2273 | + 'min' => 0, | |
| 2274 | + ], | |
| 2275 | + 'hour_minutes_section' => [ | |
| 2276 | + 'name' => "hour_minutes_section", | |
| 2277 | + 'type' => "section", | |
| 2278 | + 'rules' => Rules::logicalRule([ | |
| 2279 | + Rules::includes('source', ['woocommerce', 'woocommerce_sales', 'woocommerce_sales_reviews', 'custom_notification_conversions', 'surecart', 'edd', 'tutor', 'learndash', 'learnpress', 'cf7', 'wp_comments', 'njf', 'wpf', 'fluentform', 'elementor_form', 'custom_notification', 'grvf', 'mailchimp', 'convertkit', 'ActiveCampaign', 'brevo', 'zapier_email_subscription', 'give', 'woo_reviews', 'freemius_conversions', 'freemius_reviews', 'zapier_conversions', 'zapier_reviews']), | |
| 2280 | + ]), | |
| 2281 | + 'fields' => [ | |
| 2282 | + [ | |
| 2283 | + 'help' => __('Hours', 'notificationx'), | |
| 2284 | + 'name' => "display_from_hour", | |
| 2285 | + 'type' => "number", | |
| 2286 | + 'default' => '0', | |
| 2287 | + 'description' => '', | |
| 2288 | + 'max' => 23, | |
| 2289 | + 'min' => 0, | |
| 2290 | + ], | |
| 2291 | + [ | |
| 2292 | + 'help' => __('Minutes', 'notificationx'), | |
| 2293 | + 'name' => "display_from_minute", | |
| 2294 | + 'type' => "number", | |
| 2295 | + 'default' => '0', | |
| 2296 | + 'description' => '', | |
| 2297 | + 'max' => 59, | |
| 2298 | + 'min' => 0, | |
| 2299 | + ], | |
| 2300 | + ] | |
| 2301 | + ], | |
| 2302 | + 'loop' => [ | |
| 2303 | + 'name' => 'loop', | |
| 2304 | + 'type' => 'checkbox', | |
| 2305 | + 'label' => __('Loop Notification', 'notificationx'), | |
| 2306 | + 'priority' => 50, | |
| 2307 | + 'default' => true, | |
| 2308 | + 'rules' => Rules::is( 'global_queue', true, true ), | |
| 2309 | + ], | |
| 2310 | + 'link_open' => [ | |
| 2311 | + 'name' => 'link_open', | |
| 2312 | + 'type' => 'checkbox', | |
| 2313 | + 'label' => __('Open Link In New Tab', 'notificationx'), | |
| 2314 | + 'priority' => 60, | |
| 2315 | + 'default' => false, | |
| 2316 | + ], | |
| 2317 | + ] | |
| 2318 | + ], | |
| 2319 | + ]), | |
| 2320 | + ], | |
| 2321 | + ], | |
| 2322 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 2323 | + 'instructions' => apply_filters( 'nx_instructions', [] ), | |
| 2324 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 2325 | + 'pro_popup' => apply_filters( 'nx_popup_alert', [] ), | |
| 2326 | + ]; | |
| 2327 | + | |
| 2328 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 2329 | + $tabs['tabs'] = apply_filters('nx_metabox_tabs', $tabs['tabs']); | |
| 2330 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 2331 | + $tabs = apply_filters('nx_metabox_config', $tabs); | |
| 2332 | + | |
| 2333 | + if(defined('NX_DEBUG') && NX_DEBUG){ | |
| 2334 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 2335 | + do_action( 'qm/stop', __METHOD__ ); | |
| 2336 | + } | |
| 2337 | + return $tabs; | |
| 2338 | + } | |
| 2339 | + | |
| 2340 | + | |
| 2341 | + public function normalize_fields($fields, $key = '', $value = [], $return = []) { | |
| 2342 | + foreach ($fields as $val => $label) { | |
| 2343 | + $val = !empty( $label['value'] ) ? $label['value'] : $val; | |
| 2344 | + if (empty($return[$val]) && !is_array($label)) { | |
| 2345 | + $return[$val] = [ | |
| 2346 | + 'value' => $val, | |
| 2347 | + 'label' => $label, | |
| 2348 | + ]; | |
| 2349 | + } | |
| 2350 | + elseif (empty($return[$val])){ | |
| 2351 | + $return[$val] = $label; | |
| 2352 | + } | |
| 2353 | + if(!empty($key)){ | |
| 2354 | + $return[$val] = Rules::includes($key, $value, false, $return[$val]); | |
| 2355 | + } | |
| 2356 | + } | |
| 2357 | + | |
| 2358 | + return $return; | |
| 2359 | + } | |
| 2360 | + | |
| 2361 | + public function common_name_fields($display_name = false) { | |
| 2362 | + $fields = [ | |
| 2363 | + 'tag_name' => __('Full Name', 'notificationx'), | |
| 2364 | + 'tag_first_name' => __('First Name', 'notificationx'), | |
| 2365 | + 'tag_last_name' => __('Last Name', 'notificationx'), | |
| 2366 | + ]; | |
| 2367 | + if ($display_name) | |
| 2368 | + $fields['tag_display_name'] = __('Display Name', 'notificationx'); | |
| 2369 | + return $fields; | |
| 2370 | + } | |
| 2371 | + | |
| 2372 | + public function common_time_fields() { | |
| 2373 | + return [ | |
| 2374 | + 'tag_time' => __('Definite Time', 'notificationx'), | |
| 2375 | + 'tag_custom' => __('Some time ago', 'notificationx'), | |
| 2376 | + ]; | |
| 2377 | + } | |
| 2378 | + | |
| 2379 | +} | |