| @@ -4,34 +4,13 @@ | ||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | class FrmSettingsController { |
| 7 | 7 | |
| 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 | - /** | |
| 18 | - * Payments sections are removed from the top level and added to a payments section. | |
| 19 | - * | |
| 20 | - * @since 6.22.1 | |
| 21 | - * | |
| 22 | - * @var array | |
| 23 | - */ | |
| 24 | - private static $removed_payments_sections = array(); | |
| 25 | - | |
| 26 | - /** | |
| 27 | - * @return void | |
| 28 | - */ | |
| 29 | 8 | public static function menu() { |
| 30 | 9 | // Make sure admins can see the menu items |
| 31 | 10 | FrmAppHelper::force_capability( 'frm_change_settings' ); |
| 32 | 11 | |
| 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 | |
| 12 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' ); | |
| 34 | 13 | } |
| 35 | 14 | |
| 36 | 15 | /** |
| 37 | 16 | * Include license box template on demand. |
| @@ -44,27 +23,19 @@ | ||
| 44 | 23 | } |
| 45 | 24 | include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php'; |
| 46 | 25 | } |
| 47 | 26 | |
| 48 | - /** | |
| 49 | - * @param array $errors | |
| 50 | - * @param string $message | |
| 51 | - * | |
| 52 | - * @return void | |
| 53 | - */ | |
| 54 | 27 | public static function display_form( $errors = array(), $message = '' ) { |
| 55 | 28 | global $frm_vars; |
| 56 | 29 | |
| 57 | 30 | $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' ); | |
| 62 | 31 | |
| 63 | - if ( in_array( $current, array( 'stripe_settings', 'square_settings', 'authorize_net_settings', 'paypal_settings' ), true ) ) { | |
| 64 | - $current = 'payments_settings'; | |
| 65 | - } | |
| 32 | + $uploads = wp_upload_dir(); | |
| 33 | + $target_path = $uploads['basedir'] . '/formidable/css'; | |
| 66 | 34 | |
| 35 | + $sections = self::get_settings_tabs(); | |
| 36 | + $current = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); | |
| 37 | + | |
| 67 | 38 | require FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php'; |
| 68 | 39 | } |
| 69 | 40 | |
| 70 | 41 | /** |
| @@ -74,75 +45,61 @@ | ||
| 74 | 45 | */ |
| 75 | 46 | private static function get_settings_tabs() { |
| 76 | 47 | $sections = array( |
| 77 | 48 | 'general' => array( |
| 78 | - 'class' => self::class, | |
| 49 | + 'class' => __CLASS__, | |
| 79 | 50 | 'function' => 'general_settings', |
| 80 | 51 | 'name' => __( 'General Settings', 'formidable' ), |
| 81 | - 'icon' => 'frmfont frm_settings_icon', | |
| 52 | + 'icon' => 'frm_icon_font frm_settings_icon', | |
| 82 | 53 | ), |
| 83 | 54 | 'messages' => array( |
| 84 | - 'class' => self::class, | |
| 55 | + 'class' => __CLASS__, | |
| 85 | 56 | 'function' => 'message_settings', |
| 86 | 57 | 'name' => __( 'Message Defaults', 'formidable' ), |
| 87 | - 'icon' => 'frmfont frm_stamp_icon', | |
| 58 | + 'icon' => 'frm_icon_font frm_stamp_icon', | |
| 88 | 59 | ), |
| 89 | 60 | 'permissions' => array( |
| 90 | - 'class' => self::class, | |
| 61 | + 'class' => __CLASS__, | |
| 91 | 62 | 'function' => 'permission_settings', |
| 92 | 63 | 'name' => __( 'Permissions', 'formidable' ), |
| 93 | - 'icon' => 'frmfont frm_lock_icon', | |
| 64 | + 'icon' => 'frm_icon_font frm_lock_icon', | |
| 94 | 65 | ), |
| 95 | - 'payments' => array( | |
| 96 | - 'name' => __( 'Payments', 'formidable' ), | |
| 97 | - 'icon' => 'frmfont frm_simple_cc_icon', | |
| 98 | - 'class' => self::class, | |
| 99 | - 'function' => 'payments_settings', | |
| 100 | - ), | |
| 101 | 66 | 'custom_css' => array( |
| 102 | 67 | 'class' => 'FrmStylesController', |
| 103 | 68 | 'function' => 'custom_css', |
| 104 | 69 | 'name' => __( 'Custom CSS', 'formidable' ), |
| 105 | - 'icon' => 'frmfont frm_code_icon', | |
| 70 | + 'icon' => 'frm_icon_font frm_code_icon', | |
| 106 | 71 | ), |
| 107 | 72 | 'manage_styles' => array( |
| 108 | 73 | 'class' => 'FrmStylesController', |
| 109 | 74 | 'function' => 'manage', |
| 110 | 75 | 'name' => __( 'Manage Styles', 'formidable' ), |
| 111 | - 'icon' => 'frmfont frm_pallet_icon', | |
| 76 | + 'icon' => 'frm_icon_font frm_pallet_icon', | |
| 112 | 77 | ), |
| 113 | 78 | 'captcha' => array( |
| 114 | - 'class' => self::class, | |
| 79 | + 'class' => __CLASS__, | |
| 115 | 80 | 'function' => 'captcha_settings', |
| 116 | 81 | 'name' => __( 'Captcha/Spam', 'formidable' ), |
| 117 | - 'icon' => 'frmfont frm_shield_check_icon', | |
| 82 | + 'icon' => 'frm_icon_font frm_shield_check_icon', | |
| 118 | 83 | ), |
| 119 | - 'email' => array( | |
| 120 | - 'class' => self::class, | |
| 121 | - 'function' => 'email_settings', | |
| 122 | - 'name' => __( 'Email', 'formidable' ), | |
| 123 | - 'icon' => 'frmfont frm_email_icon', | |
| 124 | - ), | |
| 125 | 84 | 'white_label' => array( |
| 126 | 85 | 'name' => __( 'White Labeling', 'formidable' ), |
| 127 | - 'icon' => 'frmfont frm_ghost_icon', | |
| 86 | + 'icon' => 'frm_icon_font frm_ghost_icon', | |
| 128 | 87 | 'html_class' => 'frm_show_upgrade_tab frm_noallow', |
| 129 | 88 | 'data' => array( |
| 130 | 89 | 'medium' => 'white-label', |
| 131 | 90 | 'upgrade' => __( 'White labeling options', 'formidable' ), |
| 132 | 91 | 'screenshot' => 'white-label.png', |
| 133 | - 'learn-more' => FrmAppHelper::get_doc_url( 'features/white-label-form-builder-wordpress', 'white-labeling-global-settings', false ), | |
| 134 | 92 | ), |
| 135 | 93 | ), |
| 136 | 94 | 'inbox' => array( |
| 137 | 95 | 'name' => __( 'Inbox', 'formidable' ), |
| 138 | - 'icon' => 'frmfont frm_email_icon', | |
| 96 | + 'icon' => 'frm_icon_font frm_email_icon', | |
| 139 | 97 | 'html_class' => 'frm_show_upgrade_tab frm_noallow', |
| 140 | 98 | 'data' => array( |
| 141 | 99 | 'medium' => 'inbox-settings', |
| 142 | 100 | 'upgrade' => __( 'Inbox settings', 'formidable' ), |
| 143 | 101 | 'screenshot' => 'inbox.png', |
| 144 | - 'learn-more' => FrmAppHelper::get_doc_url( 'global-settings-overview/#kb-inbox', 'inbox-global-settings' ), | |
| 145 | 102 | ), |
| 146 | 103 | ), |
| 147 | 104 | ); |
| 148 | 105 | |
| @@ -149,11 +106,10 @@ | ||
| 149 | 106 | if ( apply_filters( 'frm_include_addon_page', false ) ) { |
| 150 | 107 | // If no addons need a license, skip this page |
| 151 | 108 | $show_licenses = false; |
| 152 | 109 | $installed_addons = apply_filters( 'frm_installed_addons', array() ); |
| 153 | - | |
| 154 | 110 | foreach ( $installed_addons as $installed_addon ) { |
| 155 | - if ( ! $installed_addon->is_parent_licence && $installed_addon->plugin_name !== 'Formidable Pro' && $installed_addon->needs_license ) { | |
| 111 | + if ( ! $installed_addon->is_parent_licence && $installed_addon->plugin_name != 'Formidable Pro' && $installed_addon->needs_license ) { | |
| 156 | 112 | $show_licenses = true; |
| 157 | 113 | break; |
| 158 | 114 | } |
| 159 | 115 | } |
| @@ -172,15 +128,13 @@ | ||
| 172 | 128 | /** |
| 173 | 129 | * @param array<array> $sections |
| 174 | 130 | */ |
| 175 | 131 | $sections = apply_filters( 'frm_add_settings_section', $sections ); |
| 176 | - self::add_inactive_addon_sections( $sections ); | |
| 177 | - self::remove_payments_sections( $sections ); | |
| 178 | 132 | |
| 179 | 133 | $sections['misc'] = array( |
| 180 | 134 | 'name' => __( 'Miscellaneous', 'formidable' ), |
| 181 | - 'icon' => 'frmfont frm_shuffle_icon', | |
| 182 | - 'class' => self::class, | |
| 135 | + 'icon' => 'frm_icon_font frm_shuffle_icon', | |
| 136 | + 'class' => __CLASS__, | |
| 183 | 137 | 'function' => 'misc_settings', |
| 184 | 138 | ); |
| 185 | 139 | |
| 186 | 140 | foreach ( $sections as $key => $section ) { |
| @@ -187,9 +141,9 @@ | ||
| 187 | 141 | $original = $section; |
| 188 | 142 | $defaults = array( |
| 189 | 143 | 'html_class' => '', |
| 190 | 144 | 'name' => ucfirst( $key ), |
| 191 | - 'icon' => 'frmfont frm_settings_icon', | |
| 145 | + 'icon' => 'frm_icon_font frm_settings_icon', | |
| 192 | 146 | 'anchor' => $key . '_settings', |
| 193 | 147 | 'data' => array(), |
| 194 | 148 | ); |
| 195 | 149 | |
| @@ -209,154 +163,8 @@ | ||
| 209 | 163 | |
| 210 | 164 | return $sections; |
| 211 | 165 | } |
| 212 | 166 | |
| 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 | - /** | |
| 313 | - * Remove the payments sections (PayPal, Square, Stripe, Authorize.Net) | |
| 314 | - * and show them all on the payments section in separate tabs. | |
| 315 | - * | |
| 316 | - * @since 6.22.1 | |
| 317 | - * | |
| 318 | - * @param array $sections | |
| 319 | - * | |
| 320 | - * @return void | |
| 321 | - */ | |
| 322 | - private static function remove_payments_sections( &$sections ) { | |
| 323 | - $payment_section_keys = array( 'paypal', 'square', 'stripe', 'authorize_net' ); | |
| 324 | - | |
| 325 | - foreach ( $sections as $key => $section ) { | |
| 326 | - if ( ! in_array( $key, $payment_section_keys, true ) ) { | |
| 327 | - continue; | |
| 328 | - } | |
| 329 | - | |
| 330 | - self::$removed_payments_sections[ $key ] = $section; | |
| 331 | - unset( $sections[ $key ] ); | |
| 332 | - } | |
| 333 | - | |
| 334 | - uksort( self::$removed_payments_sections, array( self::class, 'payment_sections_sort_callback' ) ); | |
| 335 | - } | |
| 336 | - | |
| 337 | - /** | |
| 338 | - * Sort the payments sections (PayPal, Square, Stripe, Authorize.Net) | |
| 339 | - * | |
| 340 | - * @since 6.22.1 | |
| 341 | - * | |
| 342 | - * @param string $a | |
| 343 | - * @param string $b | |
| 344 | - * | |
| 345 | - * @return int | |
| 346 | - */ | |
| 347 | - private static function payment_sections_sort_callback( $a, $b ) { | |
| 348 | - $order = array( 'stripe', 'square', 'paypal', 'authorize_net' ); | |
| 349 | - $first_key = array_search( $a, $order, true ); | |
| 350 | - $second_key = array_search( $b, $order, true ); | |
| 351 | - | |
| 352 | - if ( false === $first_key || false === $second_key ) { | |
| 353 | - return 0; | |
| 354 | - } | |
| 355 | - | |
| 356 | - return $first_key - $second_key; | |
| 357 | - } | |
| 358 | - | |
| 359 | 167 | public static function load_settings_tab() { |
| 360 | 168 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 361 | 169 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 362 | 170 | |
| @@ -361,9 +169,8 @@ | ||
| 361 | 169 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 362 | 170 | |
| 363 | 171 | $section = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' ); |
| 364 | 172 | $sections = self::get_settings_tabs(); |
| 365 | - | |
| 366 | 173 | if ( ! isset( $sections[ $section ] ) ) { |
| 367 | 174 | wp_die(); |
| 368 | 175 | } |
| 369 | 176 | |
| @@ -371,11 +178,10 @@ | ||
| 371 | 178 | |
| 372 | 179 | if ( isset( $section['class'] ) ) { |
| 373 | 180 | call_user_func( array( $section['class'], $section['function'] ) ); |
| 374 | 181 | } else { |
| 375 | - call_user_func( $section['function'] ?? $section ); | |
| 182 | + call_user_func( ( isset( $section['function'] ) ? $section['function'] : $section ) ); | |
| 376 | 183 | } |
| 377 | - | |
| 378 | 184 | wp_die(); |
| 379 | 185 | } |
| 380 | 186 | |
| 381 | 187 | /** |
| @@ -396,12 +202,12 @@ | ||
| 396 | 202 | /** |
| 397 | 203 | * Render the global currency selector if Pro is up to date. |
| 398 | 204 | * |
| 399 | 205 | * @param FrmSettings $frm_settings |
| 400 | - * | |
| 206 | + * @param string $more_html | |
| 401 | 207 | * @return void |
| 402 | 208 | */ |
| 403 | - public static function maybe_render_currency_selector( $frm_settings ) { | |
| 209 | + public static function maybe_render_currency_selector( $frm_settings, $more_html ) { | |
| 404 | 210 | if ( is_callable( 'FrmProSettingsController::add_currency_settings' ) ) { |
| 405 | 211 | FrmProSettingsController::add_currency_settings(); |
| 406 | 212 | return; |
| 407 | 213 | } |
| @@ -411,20 +217,17 @@ | ||
| 411 | 217 | } |
| 412 | 218 | |
| 413 | 219 | /** |
| 414 | 220 | * @since 4.0 |
| 415 | - * | |
| 416 | - * @return void | |
| 417 | 221 | */ |
| 418 | 222 | public static function message_settings() { |
| 419 | 223 | $frm_settings = FrmAppHelper::get_settings(); |
| 224 | + | |
| 420 | 225 | include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/messages.php'; |
| 421 | 226 | } |
| 422 | 227 | |
| 423 | 228 | /** |
| 424 | 229 | * @since 4.0 |
| 425 | - * | |
| 426 | - * @return void | |
| 427 | 230 | */ |
| 428 | 231 | public static function captcha_settings() { |
| 429 | 232 | $frm_settings = FrmAppHelper::get_settings(); |
| 430 | 233 | $captcha_lang = FrmAppHelper::locales( 'captcha' ); |
| @@ -432,23 +235,9 @@ | ||
| 432 | 235 | include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php'; |
| 433 | 236 | } |
| 434 | 237 | |
| 435 | 238 | /** |
| 436 | - * Shows email settings. | |
| 437 | - * | |
| 438 | - * @since 6.25 | |
| 439 | - * | |
| 440 | - * @return void | |
| 441 | - */ | |
| 442 | - public static function email_settings() { | |
| 443 | - $frm_settings = FrmAppHelper::get_settings(); | |
| 444 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/email/email-styles.php'; | |
| 445 | - } | |
| 446 | - | |
| 447 | - /** | |
| 448 | 239 | * @since 4.0 |
| 449 | - * | |
| 450 | - * @return void | |
| 451 | 240 | */ |
| 452 | 241 | public static function permission_settings() { |
| 453 | 242 | $frm_settings = FrmAppHelper::get_settings(); |
| 454 | 243 | $frm_roles = FrmAppHelper::frm_capabilities(); |
| @@ -456,30 +245,13 @@ | ||
| 456 | 245 | include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php'; |
| 457 | 246 | } |
| 458 | 247 | |
| 459 | 248 | /** |
| 460 | - * @return void | |
| 461 | - */ | |
| 462 | - public static function payments_settings() { | |
| 463 | - $payment_sections = self::$removed_payments_sections; | |
| 464 | - $tab = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); | |
| 465 | - | |
| 466 | - if ( $tab && in_array( $tab, array( 'stripe_settings', 'square_settings', 'authorize_net_settings', 'paypal_settings' ), true ) ) { | |
| 467 | - $tab = str_replace( '_settings', '', $tab ); | |
| 468 | - } else { | |
| 469 | - $tab = 'stripe'; | |
| 470 | - } | |
| 471 | - | |
| 472 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/payments.php'; | |
| 473 | - } | |
| 474 | - | |
| 475 | - /** | |
| 476 | 249 | * @since 4.0 |
| 477 | - * | |
| 478 | - * @return void | |
| 479 | 250 | */ |
| 480 | 251 | public static function misc_settings() { |
| 481 | 252 | $frm_settings = FrmAppHelper::get_settings(); |
| 253 | + | |
| 482 | 254 | include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php'; |
| 483 | 255 | } |
| 484 | 256 | |
| 485 | 257 | /** |
| @@ -532,10 +304,8 @@ | ||
| 532 | 304 | /** |
| 533 | 305 | * Include the Update button on the global settings page. |
| 534 | 306 | * |
| 535 | 307 | * @since 4.0.02 |
| 536 | - * | |
| 537 | - * @return void | |
| 538 | 308 | */ |
| 539 | 309 | public static function save_button() { |
| 540 | 310 | echo '<input class="button-primary frm-button-primary" type="submit" |
| 541 | 311 | value="' . esc_attr__( 'Update', 'formidable' ) . '"/>'; |
| @@ -540,13 +310,8 @@ | ||
| 540 | 310 | echo '<input class="button-primary frm-button-primary" type="submit" |
| 541 | 311 | value="' . esc_attr__( 'Update', 'formidable' ) . '"/>'; |
| 542 | 312 | } |
| 543 | 313 | |
| 544 | - /** | |
| 545 | - * @param bool|string $stop_load | |
| 546 | - * | |
| 547 | - * @return void | |
| 548 | - */ | |
| 549 | 314 | public static function route( $stop_load = false ) { |
| 550 | 315 | $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
| 551 | 316 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
| 552 | 317 | FrmAppHelper::include_svg(); |
| @@ -552,9 +317,9 @@ | ||
| 552 | 317 | FrmAppHelper::include_svg(); |
| 553 | 318 | |
| 554 | 319 | if ( $action === 'process-form' ) { |
| 555 | 320 | self::process_form( $stop_load ); |
| 556 | - } elseif ( $stop_load !== 'stop_load' ) { | |
| 321 | + } elseif ( $stop_load != 'stop_load' ) { | |
| 557 | 322 | self::display_form(); |
| 558 | 323 | } |
| 559 | 324 | } |
| 560 | 325 | |
| @@ -561,12 +326,10 @@ | ||
| 561 | 326 | /** |
| 562 | 327 | * Add CTA to the bottom on the plugin settings pages. |
| 563 | 328 | * |
| 564 | 329 | * @since 3.04.02 |
| 565 | - * | |
| 566 | - * @return void | |
| 567 | 330 | */ |
| 568 | - public static function settings_cta() { | |
| 331 | + public static function settings_cta( $view ) { | |
| 569 | 332 | if ( get_option( 'frm_lite_settings_upgrade', false ) ) { |
| 570 | 333 | return; |
| 571 | 334 | } |
| 572 | 335 | |
| @@ -581,9 +344,9 @@ | ||
| 581 | 344 | public static function settings_cta_dismiss() { |
| 582 | 345 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 583 | 346 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 584 | 347 | |
| 585 | - update_option( 'frm_lite_settings_upgrade', time(), false ); | |
| 348 | + update_option( 'frm_lite_settings_upgrade', time(), 'no' ); | |
| 586 | 349 | |
| 587 | 350 | wp_send_json_success(); |
| 588 | 351 | } |
| 589 | 352 | |
| @@ -611,11 +374,11 @@ | ||
| 611 | 374 | 'limit' => 25, |
| 612 | 375 | 'order_by' => 'post_title', |
| 613 | 376 | ); |
| 614 | 377 | |
| 615 | - $pages = FrmDb::get_results( $wpdb->posts, $where, 'ID, post_title', $atts ); | |
| 378 | + $pages = FrmDb::get_results( $wpdb->posts, $where, 'ID, post_title', $atts ); | |
| 379 | + | |
| 616 | 380 | $results = array(); |
| 617 | - | |
| 618 | 381 | foreach ( $pages as $page ) { |
| 619 | 382 | $results[] = array( |
| 620 | 383 | 'value' => $page->ID, |
| 621 | 384 | 'label' => $page->post_title, |
| @@ -622,25 +385,6 @@ | ||
| 622 | 385 | ); |
| 623 | 386 | } |
| 624 | 387 | |
| 625 | 388 | wp_send_json( $results ); |
| 626 | - } | |
| 627 | - | |
| 628 | - /** | |
| 629 | - * Shows a fake color picker. | |
| 630 | - * | |
| 631 | - * @since 6.25 | |
| 632 | - * | |
| 633 | - * @param string $color Color value. | |
| 634 | - * | |
| 635 | - * @return void | |
| 636 | - */ | |
| 637 | - public static function fake_color_picker( $color ) { | |
| 638 | - ?> | |
| 639 | - <div class="wp-picker-container"> | |
| 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 ?> | |
| 641 | - <span class="wp-color-result-text" style="color:#a7aaad;"><?php esc_html_e( 'Select Color', 'formidable' ); ?></span> | |
| 642 | - </button> | |
| 643 | - </div> | |
| 644 | - <?php | |
| 645 | 389 | } |
| 646 | 390 | } |