| @@ -5,8 +5,17 @@ | ||
| 5 | 5 | |
| 6 | 6 | class FrmSettingsController { |
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | + * Icon for the API section, used whether the add-on is active or only a placeholder. | |
| 10 | + * | |
| 11 | + * @since 6.35 | |
| 12 | + * | |
| 13 | + * @var string | |
| 14 | + */ | |
| 15 | + private static $api_section_icon = 'frmfont frm_cloud_icon'; | |
| 16 | + | |
| 17 | + /** | |
| 9 | 18 | * Payments sections are removed from the top level and added to a payments section. |
| 10 | 19 | * |
| 11 | 20 | * @since 6.22.1 |
| 12 | 21 | * |
| @@ -13,13 +22,16 @@ | ||
| 13 | 22 | * @var array |
| 14 | 23 | */ |
| 15 | 24 | private static $removed_payments_sections = array(); |
| 16 | 25 | |
| 26 | + /** | |
| 27 | + * @return void | |
| 28 | + */ | |
| 17 | 29 | public static function menu() { |
| 18 | 30 | // Make sure admins can see the menu items |
| 19 | 31 | FrmAppHelper::force_capability( 'frm_change_settings' ); |
| 20 | 32 | |
| 21 | - add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' ); | |
| 33 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 22 | 34 | } |
| 23 | 35 | |
| 24 | 36 | /** |
| 25 | 37 | * Include license box template on demand. |
| @@ -32,19 +44,23 @@ | ||
| 32 | 44 | } |
| 33 | 45 | include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php'; |
| 34 | 46 | } |
| 35 | 47 | |
| 48 | + /** | |
| 49 | + * @param array $errors | |
| 50 | + * @param string $message | |
| 51 | + * | |
| 52 | + * @return void | |
| 53 | + */ | |
| 36 | 54 | public static function display_form( $errors = array(), $message = '' ) { |
| 37 | 55 | global $frm_vars; |
| 38 | 56 | |
| 39 | 57 | $frm_settings = FrmAppHelper::get_settings(); |
| 58 | + $uploads = wp_upload_dir(); | |
| 59 | + $target_path = $uploads['basedir'] . '/formidable/css'; | |
| 60 | + $sections = self::get_settings_tabs(); | |
| 61 | + $current = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); | |
| 40 | 62 | |
| 41 | - $uploads = wp_upload_dir(); | |
| 42 | - $target_path = $uploads['basedir'] . '/formidable/css'; | |
| 43 | - | |
| 44 | - $sections = self::get_settings_tabs(); | |
| 45 | - $current = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); | |
| 46 | - | |
| 47 | 63 | if ( in_array( $current, array( 'stripe_settings', 'square_settings', 'authorize_net_settings', 'paypal_settings' ), true ) ) { |
| 48 | 64 | $current = 'payments_settings'; |
| 49 | 65 | } |
| 50 | 66 | |
| @@ -61,25 +77,25 @@ | ||
| 61 | 77 | 'general' => array( |
| 62 | 78 | 'class' => self::class, |
| 63 | 79 | 'function' => 'general_settings', |
| 64 | 80 | 'name' => __( 'General Settings', 'formidable' ), |
| 65 | - 'icon' => 'frm_icon_font frm_settings_icon', | |
| 81 | + 'icon' => 'frmfont frm_settings_icon', | |
| 66 | 82 | ), |
| 67 | 83 | 'messages' => array( |
| 68 | 84 | 'class' => self::class, |
| 69 | 85 | 'function' => 'message_settings', |
| 70 | 86 | 'name' => __( 'Message Defaults', 'formidable' ), |
| 71 | - 'icon' => 'frm_icon_font frm_stamp_icon', | |
| 87 | + 'icon' => 'frmfont frm_stamp_icon', | |
| 72 | 88 | ), |
| 73 | 89 | 'permissions' => array( |
| 74 | 90 | 'class' => self::class, |
| 75 | 91 | 'function' => 'permission_settings', |
| 76 | 92 | 'name' => __( 'Permissions', 'formidable' ), |
| 77 | - 'icon' => 'frm_icon_font frm_lock_icon', | |
| 93 | + 'icon' => 'frmfont frm_lock_icon', | |
| 78 | 94 | ), |
| 79 | 95 | 'payments' => array( |
| 80 | 96 | 'name' => __( 'Payments', 'formidable' ), |
| 81 | - 'icon' => 'frm_icon_font frm_simple_cc_icon', | |
| 97 | + 'icon' => 'frmfont frm_simple_cc_icon', | |
| 82 | 98 | 'class' => self::class, |
| 83 | 99 | 'function' => 'payments_settings', |
| 84 | 100 | ), |
| 85 | 101 | 'custom_css' => array( |
| @@ -85,46 +101,48 @@ | ||
| 85 | 101 | 'custom_css' => array( |
| 86 | 102 | 'class' => 'FrmStylesController', |
| 87 | 103 | 'function' => 'custom_css', |
| 88 | 104 | 'name' => __( 'Custom CSS', 'formidable' ), |
| 89 | - 'icon' => 'frm_icon_font frm_code_icon', | |
| 105 | + 'icon' => 'frmfont frm_code_icon', | |
| 90 | 106 | ), |
| 91 | 107 | 'manage_styles' => array( |
| 92 | 108 | 'class' => 'FrmStylesController', |
| 93 | 109 | 'function' => 'manage', |
| 94 | 110 | 'name' => __( 'Manage Styles', 'formidable' ), |
| 95 | - 'icon' => 'frm_icon_font frm_pallet_icon', | |
| 111 | + 'icon' => 'frmfont frm_pallet_icon', | |
| 96 | 112 | ), |
| 97 | 113 | 'captcha' => array( |
| 98 | 114 | 'class' => self::class, |
| 99 | 115 | 'function' => 'captcha_settings', |
| 100 | 116 | 'name' => __( 'Captcha/Spam', 'formidable' ), |
| 101 | - 'icon' => 'frm_icon_font frm_shield_check_icon', | |
| 117 | + 'icon' => 'frmfont frm_shield_check_icon', | |
| 102 | 118 | ), |
| 103 | 119 | 'email' => array( |
| 104 | 120 | 'class' => self::class, |
| 105 | 121 | 'function' => 'email_settings', |
| 106 | 122 | 'name' => __( 'Email', 'formidable' ), |
| 107 | - 'icon' => 'frm_icon_font frm_email_icon', | |
| 123 | + 'icon' => 'frmfont frm_email_icon', | |
| 108 | 124 | ), |
| 109 | 125 | 'white_label' => array( |
| 110 | 126 | 'name' => __( 'White Labeling', 'formidable' ), |
| 111 | - 'icon' => 'frm_icon_font frm_ghost_icon', | |
| 127 | + 'icon' => 'frmfont frm_ghost_icon', | |
| 112 | 128 | 'html_class' => 'frm_show_upgrade_tab frm_noallow', |
| 113 | 129 | 'data' => array( |
| 114 | 130 | 'medium' => 'white-label', |
| 115 | 131 | 'upgrade' => __( 'White labeling options', 'formidable' ), |
| 116 | 132 | 'screenshot' => 'white-label.png', |
| 133 | + 'learn-more' => FrmAppHelper::get_doc_url( 'features/white-label-form-builder-wordpress', 'white-labeling-global-settings', false ), | |
| 117 | 134 | ), |
| 118 | 135 | ), |
| 119 | 136 | 'inbox' => array( |
| 120 | 137 | 'name' => __( 'Inbox', 'formidable' ), |
| 121 | - 'icon' => 'frm_icon_font frm_email_icon', | |
| 138 | + 'icon' => 'frmfont frm_email_icon', | |
| 122 | 139 | 'html_class' => 'frm_show_upgrade_tab frm_noallow', |
| 123 | 140 | 'data' => array( |
| 124 | 141 | 'medium' => 'inbox-settings', |
| 125 | 142 | 'upgrade' => __( 'Inbox settings', 'formidable' ), |
| 126 | 143 | 'screenshot' => 'inbox.png', |
| 144 | + 'learn-more' => FrmAppHelper::get_doc_url( 'global-settings-overview/#kb-inbox', 'inbox-global-settings' ), | |
| 127 | 145 | ), |
| 128 | 146 | ), |
| 129 | 147 | ); |
| 130 | 148 | |
| @@ -131,10 +149,11 @@ | ||
| 131 | 149 | if ( apply_filters( 'frm_include_addon_page', false ) ) { |
| 132 | 150 | // If no addons need a license, skip this page |
| 133 | 151 | $show_licenses = false; |
| 134 | 152 | $installed_addons = apply_filters( 'frm_installed_addons', array() ); |
| 153 | + | |
| 135 | 154 | foreach ( $installed_addons as $installed_addon ) { |
| 136 | - if ( ! $installed_addon->is_parent_licence && $installed_addon->plugin_name != 'Formidable Pro' && $installed_addon->needs_license ) { | |
| 155 | + if ( ! $installed_addon->is_parent_licence && $installed_addon->plugin_name !== 'Formidable Pro' && $installed_addon->needs_license ) { | |
| 137 | 156 | $show_licenses = true; |
| 138 | 157 | break; |
| 139 | 158 | } |
| 140 | 159 | } |
| @@ -153,13 +172,14 @@ | ||
| 153 | 172 | /** |
| 154 | 173 | * @param array<array> $sections |
| 155 | 174 | */ |
| 156 | 175 | $sections = apply_filters( 'frm_add_settings_section', $sections ); |
| 176 | + self::add_inactive_addon_sections( $sections ); | |
| 157 | 177 | self::remove_payments_sections( $sections ); |
| 158 | 178 | |
| 159 | 179 | $sections['misc'] = array( |
| 160 | 180 | 'name' => __( 'Miscellaneous', 'formidable' ), |
| 161 | - 'icon' => 'frm_icon_font frm_shuffle_icon', | |
| 181 | + 'icon' => 'frmfont frm_shuffle_icon', | |
| 162 | 182 | 'class' => self::class, |
| 163 | 183 | 'function' => 'misc_settings', |
| 164 | 184 | ); |
| 165 | 185 | |
| @@ -167,9 +187,9 @@ | ||
| 167 | 187 | $original = $section; |
| 168 | 188 | $defaults = array( |
| 169 | 189 | 'html_class' => '', |
| 170 | 190 | 'name' => ucfirst( $key ), |
| 171 | - 'icon' => 'frm_icon_font frm_settings_icon', | |
| 191 | + 'icon' => 'frmfont frm_settings_icon', | |
| 172 | 192 | 'anchor' => $key . '_settings', |
| 173 | 193 | 'data' => array(), |
| 174 | 194 | ); |
| 175 | 195 | |
| @@ -190,8 +210,107 @@ | ||
| 190 | 210 | return $sections; |
| 191 | 211 | } |
| 192 | 212 | |
| 193 | 213 | /** |
| 214 | + * Add a placeholder section for each add-on that owns a Global Settings | |
| 215 | + * section but is not active. | |
| 216 | + * | |
| 217 | + * A placeholder reads as disabled and opens a page offering to activate the | |
| 218 | + * add-on or to upgrade, depending on what the license allows. It goes at the | |
| 219 | + * head of the add-on sections, right after Inbox, so it sits with the rest of | |
| 220 | + * the add-on settings instead of trailing them. A section already claimed by | |
| 221 | + * an active plugin is left alone, so nothing stands in for a section that is | |
| 222 | + * really there. | |
| 223 | + * | |
| 224 | + * @since 6.35 | |
| 225 | + * | |
| 226 | + * @param array<array> $sections Sections registered for the Global Settings page so far. | |
| 227 | + * | |
| 228 | + * @return void | |
| 229 | + */ | |
| 230 | + private static function add_inactive_addon_sections( &$sections ) { | |
| 231 | + if ( isset( $sections['api'] ) ) { | |
| 232 | + // The add-on is active, so it owns the section. Only the icon is taken over, | |
| 233 | + // so the tab looks the same whether or not the add-on is installed. | |
| 234 | + $sections['api']['icon'] = self::$api_section_icon; | |
| 235 | + return; | |
| 236 | + } | |
| 237 | + | |
| 238 | + self::insert_section_after( $sections, 'inbox', 'api', self::get_api_placeholder_section() ); | |
| 239 | + } | |
| 240 | + | |
| 241 | + /** | |
| 242 | + * Insert a section directly after another one, leaving the rest of the order alone. | |
| 243 | + * | |
| 244 | + * Assigning a new key lands the section at the end of the array, so the array | |
| 245 | + * is rebuilt to put it where it belongs. | |
| 246 | + * | |
| 247 | + * @since 6.35 | |
| 248 | + * | |
| 249 | + * @param array<array> $sections Sections registered for the Global Settings page so far. | |
| 250 | + * @param string $after Key of the section the new one follows. The new section goes last when this key is not there. | |
| 251 | + * @param string $key Key for the new section. | |
| 252 | + * @param array $section The section to insert. | |
| 253 | + * | |
| 254 | + * @return void | |
| 255 | + */ | |
| 256 | + private static function insert_section_after( &$sections, $after, $key, $section ) { | |
| 257 | + if ( ! isset( $sections[ $after ] ) ) { | |
| 258 | + $sections[ $key ] = $section; | |
| 259 | + return; | |
| 260 | + } | |
| 261 | + | |
| 262 | + $ordered = array(); | |
| 263 | + | |
| 264 | + foreach ( $sections as $section_key => $existing_section ) { | |
| 265 | + $ordered[ $section_key ] = $existing_section; | |
| 266 | + | |
| 267 | + if ( $section_key === $after ) { | |
| 268 | + $ordered[ $key ] = $section; | |
| 269 | + } | |
| 270 | + } | |
| 271 | + | |
| 272 | + $sections = $ordered; | |
| 273 | + } | |
| 274 | + | |
| 275 | + /** | |
| 276 | + * Get the placeholder that stands in for the API add-on's section. | |
| 277 | + * | |
| 278 | + * The upgrade data decides which call to action the page shows. When the | |
| 279 | + * license covers the add-on, it carries the one click install or activate | |
| 280 | + * link. Otherwise it carries the plan the add-on needs, and the page asks | |
| 281 | + * the user to upgrade to it, on a gradient button that sets the upgrade | |
| 282 | + * apart from a one click install. | |
| 283 | + * | |
| 284 | + * @since 6.35 | |
| 285 | + * | |
| 286 | + * @return array | |
| 287 | + */ | |
| 288 | + private static function get_api_placeholder_section() { | |
| 289 | + $data = FrmAppHelper::get_upgrade_data_params( | |
| 290 | + 'api', | |
| 291 | + array( | |
| 292 | + 'medium' => 'api-settings', | |
| 293 | + 'upgrade' => __( 'API settings', 'formidable' ), | |
| 294 | + 'message' => __( 'Send entries to any site with a REST API, and let AI assistants build your forms. Upgrade to get the API add-on.', 'formidable' ), | |
| 295 | + 'learn-more' => FrmAppHelper::get_doc_url( 'formidable-api', 'api-global-settings' ), | |
| 296 | + 'upsell-images' => 'api-settings-1.png,api-settings-2.png,api-settings-3.png', | |
| 297 | + ) | |
| 298 | + ); | |
| 299 | + | |
| 300 | + if ( ! FrmAppHelper::pro_is_installed() ) { | |
| 301 | + $data['gradient-upgrade'] = 1; | |
| 302 | + } | |
| 303 | + | |
| 304 | + return array( | |
| 305 | + 'name' => __( 'API', 'formidable' ), | |
| 306 | + 'icon' => self::$api_section_icon, | |
| 307 | + 'html_class' => 'frm_show_upgrade_tab frm_noallow', | |
| 308 | + 'data' => $data, | |
| 309 | + ); | |
| 310 | + } | |
| 311 | + | |
| 312 | + /** | |
| 194 | 313 | * Remove the payments sections (PayPal, Square, Stripe, Authorize.Net) |
| 195 | 314 | * and show them all on the payments section in separate tabs. |
| 196 | 315 | * |
| 197 | 316 | * @since 6.22.1 |
| @@ -196,8 +315,9 @@ | ||
| 196 | 315 | * |
| 197 | 316 | * @since 6.22.1 |
| 198 | 317 | * |
| 199 | 318 | * @param array $sections |
| 319 | + * | |
| 200 | 320 | * @return void |
| 201 | 321 | */ |
| 202 | 322 | private static function remove_payments_sections( &$sections ) { |
| 203 | 323 | $payment_section_keys = array( 'paypal', 'square', 'stripe', 'authorize_net' ); |
| @@ -202,12 +322,14 @@ | ||
| 202 | 322 | private static function remove_payments_sections( &$sections ) { |
| 203 | 323 | $payment_section_keys = array( 'paypal', 'square', 'stripe', 'authorize_net' ); |
| 204 | 324 | |
| 205 | 325 | foreach ( $sections as $key => $section ) { |
| 206 | - if ( in_array( $key, $payment_section_keys, true ) ) { | |
| 207 | - self::$removed_payments_sections[ $key ] = $section; | |
| 208 | - unset( $sections[ $key ] ); | |
| 326 | + if ( ! in_array( $key, $payment_section_keys, true ) ) { | |
| 327 | + continue; | |
| 209 | 328 | } |
| 329 | + | |
| 330 | + self::$removed_payments_sections[ $key ] = $section; | |
| 331 | + unset( $sections[ $key ] ); | |
| 210 | 332 | } |
| 211 | 333 | |
| 212 | 334 | uksort( self::$removed_payments_sections, array( self::class, 'payment_sections_sort_callback' ) ); |
| 213 | 335 | } |
| @@ -218,17 +340,20 @@ | ||
| 218 | 340 | * @since 6.22.1 |
| 219 | 341 | * |
| 220 | 342 | * @param string $a |
| 221 | 343 | * @param string $b |
| 344 | + * | |
| 222 | 345 | * @return int |
| 223 | 346 | */ |
| 224 | 347 | private static function payment_sections_sort_callback( $a, $b ) { |
| 225 | 348 | $order = array( 'stripe', 'square', 'paypal', 'authorize_net' ); |
| 226 | - $first_key = array_search( $a, $order ); | |
| 227 | - $second_key = array_search( $b, $order ); | |
| 349 | + $first_key = array_search( $a, $order, true ); | |
| 350 | + $second_key = array_search( $b, $order, true ); | |
| 351 | + | |
| 228 | 352 | if ( false === $first_key || false === $second_key ) { |
| 229 | 353 | return 0; |
| 230 | 354 | } |
| 355 | + | |
| 231 | 356 | return $first_key - $second_key; |
| 232 | 357 | } |
| 233 | 358 | |
| 234 | 359 | public static function load_settings_tab() { |
| @@ -236,8 +361,9 @@ | ||
| 236 | 361 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 237 | 362 | |
| 238 | 363 | $section = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' ); |
| 239 | 364 | $sections = self::get_settings_tabs(); |
| 365 | + | |
| 240 | 366 | if ( ! isset( $sections[ $section ] ) ) { |
| 241 | 367 | wp_die(); |
| 242 | 368 | } |
| 243 | 369 | |
| @@ -245,10 +371,11 @@ | ||
| 245 | 371 | |
| 246 | 372 | if ( isset( $section['class'] ) ) { |
| 247 | 373 | call_user_func( array( $section['class'], $section['function'] ) ); |
| 248 | 374 | } else { |
| 249 | - call_user_func( ( $section['function'] ?? $section ) ); | |
| 375 | + call_user_func( $section['function'] ?? $section ); | |
| 250 | 376 | } |
| 377 | + | |
| 251 | 378 | wp_die(); |
| 252 | 379 | } |
| 253 | 380 | |
| 254 | 381 | /** |
| @@ -269,12 +396,12 @@ | ||
| 269 | 396 | /** |
| 270 | 397 | * Render the global currency selector if Pro is up to date. |
| 271 | 398 | * |
| 272 | 399 | * @param FrmSettings $frm_settings |
| 273 | - * @param string $more_html | |
| 400 | + * | |
| 274 | 401 | * @return void |
| 275 | 402 | */ |
| 276 | - public static function maybe_render_currency_selector( $frm_settings, $more_html ) { | |
| 403 | + public static function maybe_render_currency_selector( $frm_settings ) { | |
| 277 | 404 | if ( is_callable( 'FrmProSettingsController::add_currency_settings' ) ) { |
| 278 | 405 | FrmProSettingsController::add_currency_settings(); |
| 279 | 406 | return; |
| 280 | 407 | } |
| @@ -284,17 +411,20 @@ | ||
| 284 | 411 | } |
| 285 | 412 | |
| 286 | 413 | /** |
| 287 | 414 | * @since 4.0 |
| 415 | + * | |
| 416 | + * @return void | |
| 288 | 417 | */ |
| 289 | 418 | public static function message_settings() { |
| 290 | 419 | $frm_settings = FrmAppHelper::get_settings(); |
| 291 | - | |
| 292 | 420 | include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/messages.php'; |
| 293 | 421 | } |
| 294 | 422 | |
| 295 | 423 | /** |
| 296 | 424 | * @since 4.0 |
| 425 | + * | |
| 426 | + * @return void | |
| 297 | 427 | */ |
| 298 | 428 | public static function captcha_settings() { |
| 299 | 429 | $frm_settings = FrmAppHelper::get_settings(); |
| 300 | 430 | $captcha_lang = FrmAppHelper::locales( 'captcha' ); |
| @@ -305,17 +435,20 @@ | ||
| 305 | 435 | /** |
| 306 | 436 | * Shows email settings. |
| 307 | 437 | * |
| 308 | 438 | * @since 6.25 |
| 439 | + * | |
| 440 | + * @return void | |
| 309 | 441 | */ |
| 310 | 442 | public static function email_settings() { |
| 311 | 443 | $frm_settings = FrmAppHelper::get_settings(); |
| 312 | - | |
| 313 | 444 | include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/email/email-styles.php'; |
| 314 | 445 | } |
| 315 | 446 | |
| 316 | 447 | /** |
| 317 | 448 | * @since 4.0 |
| 449 | + * | |
| 450 | + * @return void | |
| 318 | 451 | */ |
| 319 | 452 | public static function permission_settings() { |
| 320 | 453 | $frm_settings = FrmAppHelper::get_settings(); |
| 321 | 454 | $frm_roles = FrmAppHelper::frm_capabilities(); |
| @@ -322,12 +455,15 @@ | ||
| 322 | 455 | |
| 323 | 456 | include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php'; |
| 324 | 457 | } |
| 325 | 458 | |
| 459 | + /** | |
| 460 | + * @return void | |
| 461 | + */ | |
| 326 | 462 | public static function payments_settings() { |
| 327 | 463 | $payment_sections = self::$removed_payments_sections; |
| 464 | + $tab = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); | |
| 328 | 465 | |
| 329 | - $tab = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); | |
| 330 | 466 | if ( $tab && in_array( $tab, array( 'stripe_settings', 'square_settings', 'authorize_net_settings', 'paypal_settings' ), true ) ) { |
| 331 | 467 | $tab = str_replace( '_settings', '', $tab ); |
| 332 | 468 | } else { |
| 333 | 469 | $tab = 'stripe'; |
| @@ -337,12 +473,13 @@ | ||
| 337 | 473 | } |
| 338 | 474 | |
| 339 | 475 | /** |
| 340 | 476 | * @since 4.0 |
| 477 | + * | |
| 478 | + * @return void | |
| 341 | 479 | */ |
| 342 | 480 | public static function misc_settings() { |
| 343 | 481 | $frm_settings = FrmAppHelper::get_settings(); |
| 344 | - | |
| 345 | 482 | include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php'; |
| 346 | 483 | } |
| 347 | 484 | |
| 348 | 485 | /** |
| @@ -395,8 +532,10 @@ | ||
| 395 | 532 | /** |
| 396 | 533 | * Include the Update button on the global settings page. |
| 397 | 534 | * |
| 398 | 535 | * @since 4.0.02 |
| 536 | + * | |
| 537 | + * @return void | |
| 399 | 538 | */ |
| 400 | 539 | public static function save_button() { |
| 401 | 540 | echo '<input class="button-primary frm-button-primary" type="submit" |
| 402 | 541 | value="' . esc_attr__( 'Update', 'formidable' ) . '"/>'; |
| @@ -401,8 +540,13 @@ | ||
| 401 | 540 | echo '<input class="button-primary frm-button-primary" type="submit" |
| 402 | 541 | value="' . esc_attr__( 'Update', 'formidable' ) . '"/>'; |
| 403 | 542 | } |
| 404 | 543 | |
| 544 | + /** | |
| 545 | + * @param bool|string $stop_load | |
| 546 | + * | |
| 547 | + * @return void | |
| 548 | + */ | |
| 405 | 549 | public static function route( $stop_load = false ) { |
| 406 | 550 | $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
| 407 | 551 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
| 408 | 552 | FrmAppHelper::include_svg(); |
| @@ -408,9 +552,9 @@ | ||
| 408 | 552 | FrmAppHelper::include_svg(); |
| 409 | 553 | |
| 410 | 554 | if ( $action === 'process-form' ) { |
| 411 | 555 | self::process_form( $stop_load ); |
| 412 | - } elseif ( $stop_load != 'stop_load' ) { | |
| 556 | + } elseif ( $stop_load !== 'stop_load' ) { | |
| 413 | 557 | self::display_form(); |
| 414 | 558 | } |
| 415 | 559 | } |
| 416 | 560 | |
| @@ -417,10 +561,12 @@ | ||
| 417 | 561 | /** |
| 418 | 562 | * Add CTA to the bottom on the plugin settings pages. |
| 419 | 563 | * |
| 420 | 564 | * @since 3.04.02 |
| 565 | + * | |
| 566 | + * @return void | |
| 421 | 567 | */ |
| 422 | - public static function settings_cta( $view ) { | |
| 568 | + public static function settings_cta() { | |
| 423 | 569 | if ( get_option( 'frm_lite_settings_upgrade', false ) ) { |
| 424 | 570 | return; |
| 425 | 571 | } |
| 426 | 572 | |
| @@ -435,9 +581,9 @@ | ||
| 435 | 581 | public static function settings_cta_dismiss() { |
| 436 | 582 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 437 | 583 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 438 | 584 | |
| 439 | - update_option( 'frm_lite_settings_upgrade', time(), 'no' ); | |
| 585 | + update_option( 'frm_lite_settings_upgrade', time(), false ); | |
| 440 | 586 | |
| 441 | 587 | wp_send_json_success(); |
| 442 | 588 | } |
| 443 | 589 | |
| @@ -465,11 +611,11 @@ | ||
| 465 | 611 | 'limit' => 25, |
| 466 | 612 | 'order_by' => 'post_title', |
| 467 | 613 | ); |
| 468 | 614 | |
| 469 | - $pages = FrmDb::get_results( $wpdb->posts, $where, 'ID, post_title', $atts ); | |
| 615 | + $pages = FrmDb::get_results( $wpdb->posts, $where, 'ID, post_title', $atts ); | |
| 616 | + $results = array(); | |
| 470 | 617 | |
| 471 | - $results = array(); | |
| 472 | 618 | foreach ( $pages as $page ) { |
| 473 | 619 | $results[] = array( |
| 474 | 620 | 'value' => $page->ID, |
| 475 | 621 | 'label' => $page->post_title, |
| @@ -484,13 +630,15 @@ | ||
| 484 | 630 | * |
| 485 | 631 | * @since 6.25 |
| 486 | 632 | * |
| 487 | 633 | * @param string $color Color value. |
| 634 | + * | |
| 635 | + * @return void | |
| 488 | 636 | */ |
| 489 | 637 | public static function fake_color_picker( $color ) { |
| 490 | 638 | ?> |
| 491 | 639 | <div class="wp-picker-container"> |
| 492 | - <button type="button" class="button wp-color-result" aria-expanded="false" aria-disabled="true" tabindex="-1" style="background-color:<?php echo esc_attr( $color ); ?>;"> | |
| 640 | + <button type="button" class="button wp-color-result" aria-expanded="false" aria-disabled="true" tabindex="-1" style="background-color:<?php echo esc_attr( $color ); ?>;"><?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?> | |
| 493 | 641 | <span class="wp-color-result-text" style="color:#a7aaad;"><?php esc_html_e( 'Select Color', 'formidable' ); ?></span> |
| 494 | 642 | </button> |
| 495 | 643 | </div> |
| 496 | 644 | <?php |