| @@ -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. |
| @@ -43,11 +43,9 @@ | ||
| 43 | 43 | public static function load_page() { |
| 44 | 44 | self::remove_admin_notices_on_dashboard(); |
| 45 | 45 | self::load_assets(); |
| 46 | 46 | |
| 47 | - $unread_count = FrmEntriesHelper::get_visible_unread_inbox_count(); | |
| 48 | - | |
| 49 | - add_filter( 'manage_' . sanitize_title( FrmAppHelper::get_menu_name() ) . ( $unread_count ? '-' . $unread_count : '' ) . '_page_formidable-dashboard_columns', 'FrmDashboardController::entries_columns' ); | |
| 47 | + add_filter( 'manage_' . sanitize_title( FrmAppHelper::get_menu_name() ) . '_page_formidable-dashboard_columns', 'FrmDashboardController::entries_columns' ); | |
| 50 | 48 | add_filter( 'frm_show_footer_links', '__return_false' ); |
| 51 | 49 | add_filter( 'screen_options_show_screen', '__return_false' ); |
| 52 | 50 | } |
| 53 | 51 | |
| @@ -63,15 +61,13 @@ | ||
| 63 | 61 | self::enqueue_assets(); |
| 64 | 62 | } |
| 65 | 63 | |
| 66 | 64 | /** |
| 67 | - * Gets dashboard helper instance. | |
| 65 | + * Init dashboard page. | |
| 68 | 66 | * |
| 69 | - * @since 6.17 | |
| 70 | - * | |
| 71 | - * @return FrmDashboardHelper | |
| 67 | + * @return void | |
| 72 | 68 | */ |
| 73 | - public static function get_dashboard_helper() { | |
| 69 | + public static function route() { | |
| 74 | 70 | $latest_available_form = FrmForm::get_latest_form(); |
| 75 | 71 | $total_payments = self::view_args_payments(); |
| 76 | 72 | $counters_value = array( |
| 77 | 73 | 'forms' => FrmForm::get_forms_count(), |
| @@ -77,17 +73,16 @@ | ||
| 77 | 73 | 'forms' => FrmForm::get_forms_count(), |
| 78 | 74 | 'entries' => FrmEntry::get_entries_count(), |
| 79 | 75 | ); |
| 80 | 76 | |
| 81 | - return new FrmDashboardHelper( | |
| 77 | + $dashboard_view = new FrmDashboardHelper( | |
| 82 | 78 | array( |
| 83 | - 'counters' => array( | |
| 79 | + 'counters' => array( | |
| 84 | 80 | 'counters' => self::view_args_counters( $latest_available_form, $counters_value ), |
| 85 | 81 | ), |
| 86 | - 'license' => array(), | |
| 87 | - 'get_free_templates' => array(), | |
| 88 | - 'inbox' => self::view_args_inbox(), | |
| 89 | - 'entries' => array( | |
| 82 | + 'license' => array(), | |
| 83 | + 'inbox' => self::view_args_inbox(), | |
| 84 | + 'entries' => array( | |
| 90 | 85 | 'widget-heading' => __( 'Latest Entries', 'formidable' ), |
| 91 | 86 | 'cta' => array( |
| 92 | 87 | 'label' => __( 'View All Entries', 'formidable' ), |
| 93 | 88 | 'link' => admin_url( 'admin.php?page=formidable-entries' ), |
| @@ -95,9 +90,9 @@ | ||
| 95 | 90 | 'show-placeholder' => 0 >= (int) $counters_value['entries'], |
| 96 | 91 | 'count' => $counters_value['entries'], |
| 97 | 92 | 'placeholder' => self::view_args_entries_placeholder( $counters_value['forms'] ), |
| 98 | 93 | ), |
| 99 | - 'payments' => array( | |
| 94 | + 'payments' => array( | |
| 100 | 95 | 'show-placeholder' => empty( $total_payments ), |
| 101 | 96 | 'placeholder' => array( |
| 102 | 97 | 'copy' => __( 'You don\'t have a payment form setup yet.', 'formidable' ), |
| 103 | 98 | 'cta' => array( |
| @@ -112,21 +107,12 @@ | ||
| 112 | 107 | 'items' => $total_payments, |
| 113 | 108 | ), |
| 114 | 109 | ), |
| 115 | 110 | ), |
| 116 | - 'video' => array( 'id' => self::get_youtube_embed_video( $counters_value['entries'] ) ), | |
| 111 | + 'video' => array( 'id' => self::get_youtube_embed_video( $counters_value['entries'] ) ), | |
| 117 | 112 | ) |
| 118 | 113 | ); |
| 119 | - } | |
| 120 | 114 | |
| 121 | - /** | |
| 122 | - * Init dashboard page. | |
| 123 | - * | |
| 124 | - * @return void | |
| 125 | - */ | |
| 126 | - public static function route() { | |
| 127 | - $dashboard_view = self::get_dashboard_helper(); | |
| 128 | - | |
| 129 | 115 | $should_display_videos = is_callable( 'FrmProDashboardHelper::should_display_videos' ) ? FrmProDashboardHelper::should_display_videos() : true; |
| 130 | 116 | |
| 131 | 117 | require FrmAppHelper::plugin_path() . '/classes/views/dashboard/dashboard.php'; |
| 132 | 118 | } |
| @@ -462,15 +448,15 @@ | ||
| 462 | 448 | if ( 0 === (int) $entries_count && false === $welcome_video && false === $featured_video ) { |
| 463 | 449 | return null; |
| 464 | 450 | } |
| 465 | 451 | if ( 0 === (int) $entries_count && false !== $welcome_video ) { |
| 466 | - return $welcome_video['video-id'] ?? null; | |
| 452 | + return isset( $welcome_video['video-id'] ) ? $welcome_video['video-id'] : null; | |
| 467 | 453 | } |
| 468 | 454 | // We might receive the most recent video feed as the featured selection. |
| 469 | 455 | if ( isset( $featured_video[0] ) ) { |
| 470 | 456 | return $featured_video[0]['video-id']; |
| 471 | 457 | } |
| 472 | - return $featured_video['video-id'] ?? null; | |
| 458 | + return isset( $featured_video['video-id'] ) ? $featured_video['video-id'] : null; | |
| 473 | 459 | } |
| 474 | 460 | |
| 475 | 461 | /** |
| 476 | 462 | * Save subscribed user's email to dashboard options. |