PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.24
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.24
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/controllers/FrmDashboardController.php +11 -38 6.266.24 View file →
@@ -20,9 +20,9 @@
20 20 *
21 21 * @return void
22 22 */
23 23 public static function load_admin_hooks() {
24 - add_action( 'admin_menu', self::class . '::menu', 9 );
24 + add_action( 'admin_menu', __CLASS__ . '::menu', 9 );
25 25 }
26 26
27 27 /**
28 28 * Register Dashboard page tp Formidable admin menu.
@@ -79,15 +79,14 @@
79 79 );
80 80
81 81 return new FrmDashboardHelper(
82 82 array(
83 - 'counters' => array(
83 + 'counters' => array(
84 84 'counters' => self::view_args_counters( $latest_available_form, $counters_value ),
85 85 ),
86 - 'license' => array(),
87 - 'get_free_templates' => array(),
88 - 'inbox' => self::view_args_inbox(),
89 - 'entries' => array(
86 + 'license' => array(),
87 + 'inbox' => self::view_args_inbox(),
88 + 'entries' => array(
90 89 'widget-heading' => __( 'Latest Entries', 'formidable' ),
91 90 'cta' => array(
92 91 'label' => __( 'View All Entries', 'formidable' ),
93 92 'link' => admin_url( 'admin.php?page=formidable-entries' ),
@@ -95,9 +94,9 @@
95 94 'show-placeholder' => 0 >= (int) $counters_value['entries'],
96 95 'count' => $counters_value['entries'],
97 96 'placeholder' => self::view_args_entries_placeholder( $counters_value['forms'] ),
98 97 ),
99 - 'payments' => array(
98 + 'payments' => array(
100 99 'show-placeholder' => empty( $total_payments ),
101 100 'placeholder' => array(
102 101 'copy' => __( 'You don\'t have a payment form setup yet.', 'formidable' ),
103 102 'cta' => array(
@@ -112,9 +111,9 @@
112 111 'items' => $total_payments,
113 112 ),
114 113 ),
115 114 ),
116 - 'video' => array( 'id' => self::get_youtube_embed_video( $counters_value['entries'] ) ),
115 + 'video' => array( 'id' => self::get_youtube_embed_video( $counters_value['entries'] ) ),
117 116 )
118 117 );
119 118 }
120 119
@@ -196,9 +195,8 @@
196 195 'heading' => $heading,
197 196 'counter' => $value,
198 197 'type' => 'default',
199 198 );
200 -
201 199 if ( ! empty( $cta ) ) {
202 200 $counter_args['cta'] = $cta;
203 201 }
204 202
@@ -232,9 +230,8 @@
232 230 $prepared_data = array();
233 231
234 232 $model_payments = new FrmTransLitePayment();
235 233 $payments = $model_payments->get_payments_stats();
236 -
237 234 foreach ( $payments['total'] as $currency => $total_payments ) {
238 235 if ( 0 < (int) $total_payments ) {
239 236 $prepared_data[] = array(
240 237 'counter_label' => FrmCurrencyHelper::get_currency( $currency ),
@@ -249,9 +246,8 @@
249 246 /**
250 247 * Init view args for entries placeholder.
251 248 *
252 249 * @param array $forms_count The total forms count. If there are no any forms yet, we'll have CTA pointing to creating a form.
253 - *
254 250 * @return array
255 251 */
256 252 private static function view_args_entries_placeholder( $forms_count ) {
257 253
@@ -258,9 +254,9 @@
258 254 if ( ! $forms_count ) {
259 255 $copy = sprintf(
260 256 /* translators: %1$s: HTML start of a tag, %2$s: HTML close a tag */
261 257 __( 'See the %1$sform documentation%2$s for instructions on publishing your form', 'formidable' ),
262 - '<a target="_blank" href="' . esc_url( FrmAppHelper::admin_upgrade_link( '', 'knowledgebase/publish-a-form/' ) ) . '">',
258 + '<a target="_blank" href="' . FrmAppHelper::admin_upgrade_link( '', 'knowledgebase/publish-a-form/' ) . '">',
263 259 '</a>'
264 260 );
265 261 return array(
266 262 'background' => 'entries-placeholder',
@@ -292,9 +288,8 @@
292 288 *
293 289 * @param string $counter_type
294 290 * @param int $counter_value
295 291 * @param false|object $latest_available_form The form object of the latest form available. If there are at least one form available we show "Add Entry" cta for entries counter.
296 - *
297 292 * @return array
298 293 */
299 294 public static function display_counter_cta( $counter_type, $counter_value, $latest_available_form = false ) {
300 295 if ( $counter_value > 0 || ( 'entries' === $counter_type && false === $latest_available_form ) ) {
@@ -314,9 +309,8 @@
314 309 return;
315 310 }
316 311
317 312 global $wp_filter;
318 -
319 313 if ( isset( $wp_filter['admin_notices'] ) ) {
320 314 unset( $wp_filter['admin_notices'] );
321 315 }
322 316 }
@@ -349,9 +343,8 @@
349 343 * Handle the entries list. Called via add_filter.
350 344 * Hook name: manage_formidable_page_formidable-dashboard_columns.
351 345 *
352 346 * @param array $columns An associative array of column headings.
353 - *
354 347 * @return array
355 348 */
356 349 public static function entries_columns( $columns = array() ) {
357 350 $columns['0_form_id'] = esc_html__( 'Form', 'formidable' );
@@ -388,9 +381,8 @@
388 381 /**
389 382 * Detect if the logged user's email is subscribed. Used for inbox email subscribe.
390 383 *
391 384 * @param string $email The logged user's email.
392 - *
393 385 * @return bool
394 386 */
395 387 public static function email_is_subscribed( $email ) {
396 388 $subscribed_emails = self::get_subscribed_emails();
@@ -434,10 +426,8 @@
434 426
435 427 /**
436 428 * Prepare inbox messages data.
437 429 *
438 - * @param array $data
439 - *
440 430 * @return array
441 431 */
442 432 private static function inbox_prepare_messages( $data ) {
443 433 foreach ( $data as $key => $messages ) {
@@ -449,15 +439,8 @@
449 439 }
450 440 return $data;
451 441 }
452 442
453 - /**
454 - * Clean messages CTA.
455 - *
456 - * @param string $cta
457 - *
458 - * @return string
459 - */
460 443 private static function inbox_clean_messages_cta( $cta ) {
461 444
462 445 // remove dismiss button
463 446 $pattern = '/<a[^>]*class="[^"]*frm_inbox_dismiss[^"]*"[^>]*>.*?<\/a>/is';
@@ -466,10 +449,9 @@
466 449
467 450 /**
468 451 * Get the embed YouTube video from YouTube feed api. If there are 0 entries we show the welcome video otherwise latest video from FF YouTube channel is displayed.
469 452 *
470 - * @param int|string $entries_count The total entries available.
471 - *
453 + * @param int $entries_count The total entries available.
472 454 * @return string|null The YouTube video ID.
473 455 */
474 456 private static function get_youtube_embed_video( $entries_count ) {
475 457 $youtube_api = new FrmYoutubeFeedApi();
@@ -478,19 +460,16 @@
478 460
479 461 if ( 0 === (int) $entries_count && false === $welcome_video && false === $featured_video ) {
480 462 return null;
481 463 }
482 -
483 464 if ( 0 === (int) $entries_count && false !== $welcome_video ) {
484 - return $welcome_video['video-id'] ?? null;
465 + return isset( $welcome_video['video-id'] ) ? $welcome_video['video-id'] : null;
485 466 }
486 -
487 467 // We might receive the most recent video feed as the featured selection.
488 468 if ( isset( $featured_video[0] ) ) {
489 469 return $featured_video[0]['video-id'];
490 470 }
491 -
492 - return $featured_video['video-id'] ?? null;
471 + return isset( $featured_video['video-id'] ) ? $featured_video['video-id'] : null;
493 472 }
494 473
495 474 /**
496 475 * Save subscribed user's email to dashboard options.
@@ -496,14 +475,12 @@
496 475 * Save subscribed user's email to dashboard options.
497 476 * Used for Inbox widget - email subscribe.
498 477 *
499 478 * @param string $email The user email address.
500 - *
501 479 * @return void
502 480 */
503 481 private static function save_subscribed_email( $email ) {
504 482 $subscribed_emails = self::get_subscribed_emails();
505 -
506 483 if ( ! in_array( $email, $subscribed_emails, true ) ) {
507 484 $subscribed_emails[] = $email;
508 485 self::update_dashboard_options( $subscribed_emails, 'inbox-subscribed-emails' );
509 486 }
@@ -530,18 +507,15 @@
530 507 /**
531 508 * Get the dashboard options from db.
532 509 *
533 510 * @param string|null $option_name The dashboard option name. If null it will return all dashboard options.
534 - *
535 511 * @return array
536 512 */
537 513 private static function get_dashboard_options( $option_name = null ) {
538 514 $options = get_option( self::OPTION_META_NAME, array() );
539 -
540 515 if ( null !== $option_name && ! isset( $options[ $option_name ] ) ) {
541 516 return array();
542 517 }
543 -
544 518 if ( null !== $option_name ) {
545 519 return $options[ $option_name ];
546 520 }
547 521 return $options;
@@ -568,9 +542,8 @@
568 542 */
569 543 private static function add_welcome_closed_banner_user_id() {
570 544 $users_list = self::get_closed_welcome_banner_user_ids();
571 545 $user_id = get_current_user_id();
572 -
573 546 if ( ! in_array( $user_id, $users_list, true ) ) {
574 547 $users_list[] = $user_id;
575 548 self::update_dashboard_options( $users_list, 'closed-welcome-banner-user-ids' );
576 549 }