| @@ -27,9 +27,9 @@ | ||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | if ( ! isset( $slug ) ) { |
| 30 | 30 | $slug = 'formidable-applications'; |
| 31 | - $callback = array( self::class, 'landing_page' ); | |
| 31 | + $callback = array( __CLASS__, 'landing_page' ); | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | add_submenu_page( 'formidable', 'Formidable | ' . $label, $label, $cap, $slug, $callback ); |
| 35 | 35 | } |
| @@ -71,11 +71,8 @@ | ||
| 71 | 71 | * |
| 72 | 72 | * @return void |
| 73 | 73 | */ |
| 74 | 74 | public static function get_applications_data() { |
| 75 | - FrmAppHelper::permission_check( 'frm_view_forms' ); | |
| 76 | - check_ajax_referer( 'frm_ajax', 'nonce' ); | |
| 77 | - | |
| 78 | 75 | $view = FrmAppHelper::get_param( 'view', '', 'get', 'sanitize_text_field' ); |
| 79 | 76 | $data = array(); |
| 80 | 77 | |
| 81 | 78 | if ( 'applications' !== $view ) { |
| @@ -130,9 +127,9 @@ | ||
| 130 | 127 | } |
| 131 | 128 | |
| 132 | 129 | FrmApplicationTemplate::init(); |
| 133 | 130 | |
| 134 | - return array_reduce( $applications, array( self::class, 'reduce_template' ), array() ); | |
| 131 | + return array_reduce( $applications, array( __CLASS__, 'reduce_template' ), array() ); | |
| 135 | 132 | } |
| 136 | 133 | |
| 137 | 134 | /** |
| 138 | 135 | * @param array $total the accumulated array of reduced application data. |
| @@ -140,14 +137,9 @@ | ||
| 140 | 137 | * @return array<array> |
| 141 | 138 | */ |
| 142 | 139 | private static function reduce_template( $total, $current ) { |
| 143 | 140 | $template = new FrmApplicationTemplate( $current ); |
| 144 | - | |
| 145 | - $js_object = $template->as_js_object(); | |
| 146 | - if ( $js_object ) { | |
| 147 | - $total[] = $js_object; | |
| 148 | - } | |
| 149 | - | |
| 141 | + $total[] = $template->as_js_object(); | |
| 150 | 142 | return $total; |
| 151 | 143 | } |
| 152 | 144 | |
| 153 | 145 | /** |
| @@ -158,9 +150,9 @@ | ||
| 158 | 150 | */ |
| 159 | 151 | private static function sort_templates( $applications ) { |
| 160 | 152 | usort( |
| 161 | 153 | $applications, |
| 162 | - function ( $a, $b ) { | |
| 154 | + function( $a, $b ) { | |
| 163 | 155 | return strcmp( $a['name'], $b['name'] ); |
| 164 | 156 | } |
| 165 | 157 | ); |
| 166 | 158 | return $applications; |
| @@ -166,21 +158,10 @@ | ||
| 166 | 158 | return $applications; |
| 167 | 159 | } |
| 168 | 160 | |
| 169 | 161 | /** |
| 170 | - * @usedby FrmAppController::admin_init(). | |
| 171 | - * | |
| 172 | - * @since 6.8 | |
| 173 | - * | |
| 174 | 162 | * @return void |
| 175 | 163 | */ |
| 176 | - public static function load_page() { | |
| 177 | - self::load_assets(); | |
| 178 | - } | |
| 179 | - | |
| 180 | - /** | |
| 181 | - * @return void | |
| 182 | - */ | |
| 183 | 164 | public static function load_assets() { |
| 184 | 165 | $plugin_url = FrmAppHelper::plugin_url(); |
| 185 | 166 | $version = FrmAppHelper::plugin_version(); |
| 186 | 167 | |
| @@ -188,10 +169,9 @@ | ||
| 188 | 169 | wp_enqueue_style( 'formidable-grids' ); |
| 189 | 170 | |
| 190 | 171 | $js_dependencies = array( |
| 191 | 172 | 'wp-i18n', |
| 192 | - // This prevents a console error "wp.hooks is undefined" in WP versions older than 5.7. | |
| 193 | - 'wp-hooks', | |
| 173 | + 'wp-hooks', // This prevents a console error "wp.hooks is undefined" in WP versions older than 5.7. | |
| 194 | 174 | 'formidable_dom', |
| 195 | 175 | ); |
| 196 | 176 | wp_register_script( 'formidable_applications', $plugin_url . '/js/admin/applications.js', $js_dependencies, $version, true ); |
| 197 | 177 | wp_register_style( 'formidable_applications', $plugin_url . '/css/admin/applications.css', array(), $version ); |
| @@ -201,9 +181,8 @@ | ||
| 201 | 181 | ); |
| 202 | 182 | wp_localize_script( 'formidable_applications', 'frmApplicationsVars', $js_vars ); |
| 203 | 183 | |
| 204 | 184 | wp_enqueue_script( 'formidable_applications' ); |
| 205 | - wp_set_script_translations( 'formidable_applications', 'formidable' ); | |
| 206 | 185 | wp_enqueue_style( 'formidable_applications' ); |
| 207 | 186 | |
| 208 | 187 | do_action( 'frm_applications_assets' ); |
| 209 | 188 | } |
| @@ -212,9 +191,11 @@ | ||
| 212 | 191 | * @return void |
| 213 | 192 | */ |
| 214 | 193 | public static function dequeue_scripts() { |
| 215 | 194 | if ( 'formidable-applications' === FrmAppHelper::simple_get( 'page', 'sanitize_title' ) ) { |
| 216 | - FrmAppHelper::dequeue_extra_global_scripts(); | |
| 195 | + // Avoid extra scripts loading on applications index that aren't needed. | |
| 196 | + wp_dequeue_script( 'frm-surveys-admin' ); | |
| 197 | + wp_dequeue_script( 'frm-quizzes-form-action' ); | |
| 217 | 198 | } |
| 218 | 199 | } |
| 219 | 200 | |
| 220 | 201 | /** |