| @@ -18,9 +18,8 @@ | ||
| 18 | 18 | $cap = self::get_required_capability(); |
| 19 | 19 | |
| 20 | 20 | if ( ! current_user_can( $cap ) && is_callable( 'FrmProApplicationsHelper::get_custom_applications_capability' ) ) { |
| 21 | 21 | $custom_applications_cap = FrmProApplicationsHelper::get_custom_applications_capability(); |
| 22 | - | |
| 23 | 22 | if ( current_user_can( $custom_applications_cap ) ) { |
| 24 | 23 | $cap = $custom_applications_cap; |
| 25 | 24 | $slug = 'edit-tags.php?taxonomy=frm_application'; |
| 26 | 25 | $callback = ''; |
| @@ -28,9 +27,9 @@ | ||
| 28 | 27 | } |
| 29 | 28 | |
| 30 | 29 | if ( ! isset( $slug ) ) { |
| 31 | 30 | $slug = 'formidable-applications'; |
| 32 | - $callback = array( self::class, 'landing_page' ); | |
| 31 | + $callback = array( __CLASS__, 'landing_page' ); | |
| 33 | 32 | } |
| 34 | 33 | |
| 35 | 34 | add_submenu_page( 'formidable', 'Formidable | ' . $label, $label, $cap, $slug, $callback ); |
| 36 | 35 | } |
| @@ -108,9 +107,8 @@ | ||
| 108 | 107 | $applications = array_filter( $applications, 'is_array' ); |
| 109 | 108 | |
| 110 | 109 | $unlocked_templates = array(); |
| 111 | 110 | $locked_templates = array(); |
| 112 | - | |
| 113 | 111 | foreach ( $applications as $key => $application ) { |
| 114 | 112 | if ( ! is_numeric( $key ) ) { |
| 115 | 113 | // Skip "error" or any other non-numeric key. |
| 116 | 114 | continue; |
| @@ -125,9 +123,8 @@ | ||
| 125 | 123 | |
| 126 | 124 | $unlocked_templates = self::sort_templates( $unlocked_templates ); |
| 127 | 125 | |
| 128 | 126 | $applications = $unlocked_templates; |
| 129 | - | |
| 130 | 127 | if ( current_user_can( 'administrator' ) || current_user_can( 'frm_change_settings' ) ) { |
| 131 | 128 | $locked_templates = self::sort_templates( $locked_templates ); |
| 132 | 129 | $applications = array_merge( $applications, $locked_templates ); |
| 133 | 130 | } |
| @@ -133,15 +130,14 @@ | ||
| 133 | 130 | } |
| 134 | 131 | |
| 135 | 132 | FrmApplicationTemplate::init(); |
| 136 | 133 | |
| 137 | - return array_reduce( $applications, array( self::class, 'reduce_template' ), array() ); | |
| 134 | + return array_reduce( $applications, array( __CLASS__, 'reduce_template' ), array() ); | |
| 138 | 135 | } |
| 139 | 136 | |
| 140 | 137 | /** |
| 141 | 138 | * @param array $total the accumulated array of reduced application data. |
| 142 | 139 | * @param array $current data for the current template from the API. |
| 143 | - * | |
| 144 | 140 | * @return array<array> |
| 145 | 141 | */ |
| 146 | 142 | private static function reduce_template( $total, $current ) { |
| 147 | 143 | $template = new FrmApplicationTemplate( $current ); |
| @@ -146,9 +142,8 @@ | ||
| 146 | 142 | private static function reduce_template( $total, $current ) { |
| 147 | 143 | $template = new FrmApplicationTemplate( $current ); |
| 148 | 144 | |
| 149 | 145 | $js_object = $template->as_js_object(); |
| 150 | - | |
| 151 | 146 | if ( $js_object ) { |
| 152 | 147 | $total[] = $js_object; |
| 153 | 148 | } |
| 154 | 149 | |
| @@ -158,9 +153,8 @@ | ||
| 158 | 153 | /** |
| 159 | 154 | * Sort applications alphabetically. |
| 160 | 155 | * |
| 161 | 156 | * @param array<array> $applications |
| 162 | - * | |
| 163 | 157 | * @return array<array> |
| 164 | 158 | */ |
| 165 | 159 | private static function sort_templates( $applications ) { |
| 166 | 160 | usort( |
| @@ -225,9 +219,8 @@ | ||
| 225 | 219 | |
| 226 | 220 | /** |
| 227 | 221 | * @param string $title |
| 228 | 222 | * @param string $context values include 'index', 'list', and 'edit'. |
| 229 | - * | |
| 230 | 223 | * @return void |
| 231 | 224 | */ |
| 232 | 225 | public static function render_applications_header( $title, $context ) { |
| 233 | 226 | FrmAppHelper::print_admin_banner( true ); |