| @@ -1,142 +1,144 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Merchant - Cookie Banner | |
| 4 | - */ | |
| 5 | - | |
| 6 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 7 | - exit; // Exit if accessed directly | |
| 8 | -} | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * Settings | |
| 12 | - */ | |
| 13 | -Merchant_Admin_Options::create( array( | |
| 14 | - 'title' => esc_html__( 'Settings', 'merchant' ), | |
| 15 | - 'module' => 'cookie-banner', | |
| 16 | - 'fields' => array( | |
| 17 | - | |
| 18 | - array( | |
| 19 | - 'id' => 'theme', | |
| 20 | - 'type' => 'select', | |
| 21 | - 'title' => esc_html__( 'Theme', 'merchant' ), | |
| 22 | - 'options' => array( | |
| 23 | - 'merchant-cookie-banner-floating' => esc_html__( 'Floating', 'merchant' ), | |
| 24 | - 'merchant-cookie-banner-fixed-bottom' => esc_html__( 'Fixed bottom', 'merchant' ), | |
| 25 | - ), | |
| 26 | - 'default' => 'merchant-cookie-banner-floating', | |
| 27 | - ), | |
| 28 | - | |
| 29 | - array( | |
| 30 | - 'id' => 'bar_text', | |
| 31 | - 'type' => 'text', | |
| 32 | - 'title' => esc_html__( 'Bar text', 'merchant' ), | |
| 33 | - 'default' => esc_html__( '🍪 We\'re using cookies to give you the best experience on our site.', 'merchant' ), | |
| 34 | - ), | |
| 35 | - | |
| 36 | - array( | |
| 37 | - 'id' => 'privacy_policy_text', | |
| 38 | - 'type' => 'text', | |
| 39 | - 'title' => esc_html__( 'Privacy policy text', 'merchant' ), | |
| 40 | - 'desc' => esc_html__( 'The error will be shown if the user tries to go to checkout without accepting terms & conditions.', 'merchant' ), | |
| 41 | - 'default' => esc_html__( 'Learn More', 'merchant' ), | |
| 42 | - ), | |
| 43 | - | |
| 44 | - array( | |
| 45 | - 'id' => 'privacy_policy_url', | |
| 46 | - 'type' => 'text', | |
| 47 | - 'title' => esc_html__( 'Privacy policy URL', 'merchant' ), | |
| 48 | - 'default' => get_privacy_policy_url(), | |
| 49 | - ), | |
| 50 | - | |
| 51 | - array( | |
| 52 | - 'id' => 'button_text', | |
| 53 | - 'type' => 'text', | |
| 54 | - 'title' => esc_html__( 'Button text', 'merchant' ), | |
| 55 | - 'default' => esc_html__( 'I Understand', 'merchant' ), | |
| 56 | - ), | |
| 57 | - | |
| 58 | - array( | |
| 59 | - 'id' => 'cookie_duration', | |
| 60 | - 'type' => 'number', | |
| 61 | - 'title' => esc_html__( 'Cookie duration (days)', 'merchant' ), | |
| 62 | - 'default' => '365', | |
| 63 | - ), | |
| 64 | - | |
| 65 | - array( | |
| 66 | - 'id' => 'close_button', | |
| 67 | - 'type' => 'switcher', | |
| 68 | - 'title' => esc_html__( 'Show close \'x\' button', 'merchant' ), | |
| 69 | - 'default' => 1, | |
| 70 | - ), | |
| 71 | - | |
| 72 | - ), | |
| 73 | -) ); | |
| 74 | - | |
| 75 | -/** | |
| 76 | - * Style | |
| 77 | - */ | |
| 78 | -Merchant_Admin_Options::create( array( | |
| 79 | - 'title' => esc_html__( 'Style', 'merchant' ), | |
| 80 | - 'module' => 'cookie-banner', | |
| 81 | - 'fields' => array( | |
| 82 | - | |
| 83 | - array( | |
| 84 | - 'id' => 'modal_width', | |
| 85 | - 'type' => 'range', | |
| 86 | - 'title' => esc_html__( 'Modal width', 'merchant' ), | |
| 87 | - 'min' => 1, | |
| 88 | - 'max' => 2000, | |
| 89 | - 'step' => 1, | |
| 90 | - 'default' => 750, | |
| 91 | - 'unit' => 'px', | |
| 92 | - 'condition' => array( 'theme', '==', 'floating' ), | |
| 93 | - ), | |
| 94 | - | |
| 95 | - array( | |
| 96 | - 'id' => 'modal_height', | |
| 97 | - 'type' => 'range', | |
| 98 | - 'title' => esc_html__( 'Modal height', 'merchant' ), | |
| 99 | - 'min' => 1, | |
| 100 | - 'max' => 1000, | |
| 101 | - 'step' => 1, | |
| 102 | - 'default' => 80, | |
| 103 | - 'unit' => 'px', | |
| 104 | - ), | |
| 105 | - | |
| 106 | - array( | |
| 107 | - 'id' => 'background_color', | |
| 108 | - 'type' => 'color', | |
| 109 | - 'title' => esc_html__( 'Modal background color', 'merchant' ), | |
| 110 | - 'default' => '#000000', | |
| 111 | - ), | |
| 112 | - | |
| 113 | - array( | |
| 114 | - 'id' => 'text_color', | |
| 115 | - 'type' => 'color', | |
| 116 | - 'title' => esc_html__( 'Text color', 'merchant' ), | |
| 117 | - 'default' => '#ffffff', | |
| 118 | - ), | |
| 119 | - | |
| 120 | - array( | |
| 121 | - 'id' => 'link_color', | |
| 122 | - 'type' => 'color', | |
| 123 | - 'title' => esc_html__( 'Link color', 'merchant' ), | |
| 124 | - 'default' => '#aeaeae', | |
| 125 | - ), | |
| 126 | - | |
| 127 | - array( | |
| 128 | - 'id' => 'button_background_color', | |
| 129 | - 'type' => 'color', | |
| 130 | - 'title' => esc_html__( 'Button background color', 'merchant' ), | |
| 131 | - 'default' => '#dddddd', | |
| 132 | - ), | |
| 133 | - | |
| 134 | - array( | |
| 135 | - 'id' => 'button_text_color', | |
| 136 | - 'type' => 'color', | |
| 137 | - 'title' => esc_html__( 'Button text color', 'merchant' ), | |
| 138 | - 'default' => '#151515', | |
| 139 | - ), | |
| 140 | - | |
| 141 | - ), | |
| 142 | -) ); | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Merchant - Cookie Banner | |
| 4 | + */ | |
| 5 | + | |
| 6 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 7 | + exit; // Exit if accessed directly | |
| 8 | +} | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * Settings | |
| 12 | + */ | |
| 13 | + | |
| 14 | +return array( | |
| 15 | + array( | |
| 16 | + 'title' => esc_html__( 'Settings', 'merchant' ), | |
| 17 | + 'module' => 'cookie-banner', | |
| 18 | + 'fields' => array( | |
| 19 | + | |
| 20 | + array( | |
| 21 | + 'id' => 'theme', | |
| 22 | + 'type' => 'select', | |
| 23 | + 'title' => esc_html__( 'Theme', 'merchant' ), | |
| 24 | + 'options' => array( | |
| 25 | + 'merchant-cookie-banner-floating' => esc_html__( 'Floating', 'merchant' ), | |
| 26 | + 'merchant-cookie-banner-fixed-bottom' => esc_html__( 'Fixed bottom', 'merchant' ), | |
| 27 | + ), | |
| 28 | + 'default' => 'merchant-cookie-banner-floating', | |
| 29 | + ), | |
| 30 | + | |
| 31 | + array( | |
| 32 | + 'id' => 'bar_text', | |
| 33 | + 'type' => 'text', | |
| 34 | + 'title' => esc_html__( 'Bar text', 'merchant' ), | |
| 35 | + 'default' => esc_html__( '🍪 We\'re using cookies to give you the best experience on our site.', 'merchant' ), | |
| 36 | + ), | |
| 37 | + | |
| 38 | + array( | |
| 39 | + 'id' => 'privacy_policy_text', | |
| 40 | + 'type' => 'text', | |
| 41 | + 'title' => esc_html__( 'Privacy policy text', 'merchant' ), | |
| 42 | + 'desc' => esc_html__( 'The error will be shown if the user tries to go to checkout without accepting terms & conditions.', 'merchant' ), | |
| 43 | + 'default' => esc_html__( 'Learn More', 'merchant' ), | |
| 44 | + ), | |
| 45 | + | |
| 46 | + array( | |
| 47 | + 'id' => 'privacy_policy_url', | |
| 48 | + 'type' => 'url', | |
| 49 | + 'title' => esc_html__( 'Privacy policy URL', 'merchant' ), | |
| 50 | + 'default' => get_privacy_policy_url(), | |
| 51 | + 'placeholder' => 'yoursite.com/privacy-policy', | |
| 52 | + ), | |
| 53 | + | |
| 54 | + array( | |
| 55 | + 'id' => 'button_text', | |
| 56 | + 'type' => 'text', | |
| 57 | + 'title' => esc_html__( 'Button text', 'merchant' ), | |
| 58 | + 'default' => esc_html__( 'I understand', 'merchant' ), | |
| 59 | + ), | |
| 60 | + | |
| 61 | + array( | |
| 62 | + 'id' => 'cookie_duration', | |
| 63 | + 'type' => 'number', | |
| 64 | + 'title' => esc_html__( 'Cookie duration (days)', 'merchant' ), | |
| 65 | + 'min' => 1, | |
| 66 | + 'step' => 1, | |
| 67 | + 'default' => '365', | |
| 68 | + ), | |
| 69 | + | |
| 70 | + array( | |
| 71 | + 'id' => 'close_button', | |
| 72 | + 'type' => 'switcher', | |
| 73 | + 'title' => esc_html__( 'Show close \'x\' button', 'merchant' ), | |
| 74 | + 'default' => 1, | |
| 75 | + ), | |
| 76 | + | |
| 77 | + ), | |
| 78 | +), | |
| 79 | + array( | |
| 80 | + 'title' => esc_html__( 'Style', 'merchant' ), | |
| 81 | + 'module' => 'cookie-banner', | |
| 82 | + 'fields' => array( | |
| 83 | + | |
| 84 | + array( | |
| 85 | + 'id' => 'modal_width', | |
| 86 | + 'type' => 'range', | |
| 87 | + 'title' => esc_html__( 'Modal width', 'merchant' ), | |
| 88 | + 'min' => 1, | |
| 89 | + 'max' => 2000, | |
| 90 | + 'step' => 1, | |
| 91 | + 'default' => 750, | |
| 92 | + 'unit' => 'px', | |
| 93 | + 'condition' => array( 'theme', '==', 'floating' ), | |
| 94 | + ), | |
| 95 | + | |
| 96 | + array( | |
| 97 | + 'id' => 'modal_height', | |
| 98 | + 'type' => 'range', | |
| 99 | + 'title' => esc_html__( 'Modal height', 'merchant' ), | |
| 100 | + 'min' => 1, | |
| 101 | + 'max' => 1000, | |
| 102 | + 'step' => 1, | |
| 103 | + 'default' => 80, | |
| 104 | + 'unit' => 'px', | |
| 105 | + ), | |
| 106 | + | |
| 107 | + array( | |
| 108 | + 'id' => 'background_color', | |
| 109 | + 'type' => 'color', | |
| 110 | + 'title' => esc_html__( 'Modal background color', 'merchant' ), | |
| 111 | + 'default' => '#000000', | |
| 112 | + ), | |
| 113 | + | |
| 114 | + array( | |
| 115 | + 'id' => 'text_color', | |
| 116 | + 'type' => 'color', | |
| 117 | + 'title' => esc_html__( 'Text color', 'merchant' ), | |
| 118 | + 'default' => '#ffffff', | |
| 119 | + ), | |
| 120 | + | |
| 121 | + array( | |
| 122 | + 'id' => 'link_color', | |
| 123 | + 'type' => 'color', | |
| 124 | + 'title' => esc_html__( 'Link color', 'merchant' ), | |
| 125 | + 'default' => '#aeaeae', | |
| 126 | + ), | |
| 127 | + | |
| 128 | + array( | |
| 129 | + 'id' => 'button_background_color', | |
| 130 | + 'type' => 'color', | |
| 131 | + 'title' => esc_html__( 'Button background color', 'merchant' ), | |
| 132 | + 'default' => '#dddddd', | |
| 133 | + ), | |
| 134 | + | |
| 135 | + array( | |
| 136 | + 'id' => 'button_text_color', | |
| 137 | + 'type' => 'color', | |
| 138 | + 'title' => esc_html__( 'Button text color', 'merchant' ), | |
| 139 | + 'default' => '#151515', | |
| 140 | + ), | |
| 141 | + | |
| 142 | + ), | |
| 143 | +), | |
| 144 | +); | |