| @@ -14,16 +14,16 @@ | ||
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Check if the overlay will run again periodically. |
| 17 | 17 | * |
| 18 | - * @var boolean If the condition is true, the overlay will execute only following a specified time interval. | |
| 18 | + * @var bool If the condition is true, the overlay will execute only following a specified time interval. | |
| 19 | 19 | */ |
| 20 | 20 | private $recurring_execution = false; |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * The controller configs passed through construct. If empty the overlay will run normaly, it will open every time when open_overlay is called. | |
| 23 | + * The controller configs passed through construct. If empty the overlay will run normally, it will open every time when open_overlay is called. | |
| 24 | 24 | * |
| 25 | - * @var array $config { | |
| 25 | + * @var array Config { | |
| 26 | 26 | * |
| 27 | 27 | * @type string $execution-frequency Example values: '1 day', '10 days', '1 week', etc. |
| 28 | 28 | * @type string $config-option-name A handle name that will be used to store the controller options_data. |
| 29 | 29 | * |
| @@ -40,13 +40,13 @@ | ||
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * The controller data. It will handle the options from multiple instances of the controller |
| 43 | 43 | * |
| 44 | - * @var array $options_data { | |
| 44 | + * @var array Option data { | |
| 45 | + * | |
| 45 | 46 | * @type array $options_data[ '[instance1-option_name_provided_via-->config-option-name]' ] { |
| 46 | 47 | * @type string $execution-frequency Values example: '1 day' | '10 days' | '1 week' | '10 weeks' | '1 month' | '10 months' | '1 year' | '10 years' |
| 47 | 48 | * } |
| 48 | - * | |
| 49 | 49 | * @type array $options_data[ '[instance2-option_name_provided_via-->config-option-name]' ] { |
| 50 | 50 | * @type string $execution-frequency Values example: '1 day' | '10 days' | '1 week' | '10 weeks' | '1 month' | '10 months' | '1 year' | '10 years' |
| 51 | 51 | * } |
| 52 | 52 | * } |
| @@ -52,8 +52,11 @@ | ||
| 52 | 52 | * } |
| 53 | 53 | */ |
| 54 | 54 | private $options_data = array(); |
| 55 | 55 | |
| 56 | + /** | |
| 57 | + * @param array $config | |
| 58 | + */ | |
| 56 | 59 | public function __construct( $config = array() ) { |
| 57 | 60 | if ( ! isset( $config['config-option-name'] ) || ! isset( $config['execution-frequency'] ) ) { |
| 58 | 61 | return; |
| 59 | 62 | } |
| @@ -100,9 +103,9 @@ | ||
| 100 | 103 | |
| 101 | 104 | /** |
| 102 | 105 | * Ascertain whether the overlay needs to be executed or not. |
| 103 | 106 | * |
| 104 | - * @return boolean | |
| 107 | + * @return bool | |
| 105 | 108 | */ |
| 106 | 109 | private function is_time_to_execute() { |
| 107 | 110 | if ( ! isset( $this->options_data[ $this->config['config-option-name'] ] ) ) { |
| 108 | 111 | return true; |
| @@ -127,9 +130,9 @@ | ||
| 127 | 130 | * |
| 128 | 131 | * @return void |
| 129 | 132 | */ |
| 130 | 133 | private function update_options_data() { |
| 131 | - update_option( $this->option_meta_name, $this->options_data, 'no' ); | |
| 134 | + update_option( $this->option_meta_name, $this->options_data, false ); | |
| 132 | 135 | } |
| 133 | 136 | |
| 134 | 137 | /** |
| 135 | 138 | * Open overlay. |
| @@ -144,9 +147,10 @@ | ||
| 144 | 147 | * @type string $buttons[]['url'] URL for the button. |
| 145 | 148 | * @type string $buttons[]['target'] Target attribute for the button link. |
| 146 | 149 | * @type string $buttons[]['label'] Label/text of the button. |
| 147 | 150 | * } |
| 148 | - * @return boolean | |
| 151 | + * | |
| 152 | + * @return bool | |
| 149 | 153 | */ |
| 150 | 154 | public function open_overlay( $data = array() ) { |
| 151 | 155 | if ( true === $this->recurring_execution ) { |
| 152 | 156 | if ( false === $this->is_time_to_execute() ) { |
| @@ -177,9 +181,9 @@ | ||
| 177 | 181 | * |
| 178 | 182 | * @return void |
| 179 | 183 | */ |
| 180 | 184 | private function enqueue_assets() { |
| 185 | + wp_enqueue_style( 'formidable-animations' ); | |
| 181 | 186 | wp_enqueue_style( self::$assets_handle_name ); |
| 182 | 187 | wp_enqueue_script( self::$assets_handle_name ); |
| 183 | 188 | } |
| 184 | - | |
| 185 | 189 | } |