芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/public_html/wp-content/plugins/elementor/modules/apps/admin-apps-page.php
*
elementor_container(); if ( $container->has( Wordpress_Adapter::class ) ) { self::$wordpress_adapter = $container->get( Wordpress_Adapter::class ); } else if ( ! self::$wordpress_adapter ) { self::$wordpress_adapter = new Wordpress_Adapter(); } if ( ! self::$plugin_status_adapter ) { self::$plugin_status_adapter = new Plugin_Status_Adapter( self::$wordpress_adapter ); } $apps = static::get_remote_apps(); return static::filter_apps( $apps ); } private static function get_remote_apps() { $apps = wp_remote_get( static::APPS_URL ); if ( is_wp_error( $apps ) ) { return []; } $apps = json_decode( wp_remote_retrieve_body( $apps ), true ); if ( empty( $apps['apps'] ) || ! is_array( $apps['apps'] ) ) { return []; } return $apps['apps']; } private static function filter_apps( $apps ) { $filtered_apps = []; foreach ( $apps as $app ) { if ( static::is_wporg_app( $app ) ) { $app = static::filter_wporg_app( $app ); } if ( static::is_ecom_app( $app ) ) { $app = static::filter_ecom_app( $app ); } if ( empty( $app ) ) { continue; } $filtered_apps[] = $app; } return $filtered_apps; } private static function is_wporg_app( $app ) { return isset( $app['type'] ) && 'wporg' === $app['type']; } private static function filter_wporg_app( $app ) { if ( self::$wordpress_adapter->is_plugin_active( $app['file_path'] ) ) { return null; } if ( self::$plugin_status_adapter->is_plugin_installed( $app['file_path'] ) ) { if ( current_user_can( 'activate_plugins' ) ) { $app['action_label'] = esc_html__( 'Activate', 'elementor' ); $app['action_url'] = self::$plugin_status_adapter->get_activate_plugin_url( $app['file_path'] ); } else { $app['action_label'] = esc_html__( 'Cannot Activate', 'elementor' ); $app['action_url'] = '#'; } } else { if ( current_user_can( 'install_plugins' ) ) { $app['action_label'] = esc_html__( 'Install', 'elementor' ); $app['action_url'] = self::$plugin_status_adapter->get_install_plugin_url( $app['file_path'] ); } else { $app['action_label'] = esc_html__( 'Cannot Install', 'elementor' ); $app['action_url'] = '#'; } } return $app; } private static function is_ecom_app( $app ) { return isset( $app['type'] ) && 'ecom' === $app['type']; } private static function filter_ecom_app( $app ) { if ( self::$wordpress_adapter->is_plugin_active( $app['file_path'] ) ) { return null; } if ( ! self::$plugin_status_adapter->is_plugin_installed( $app['file_path'] ) ) { return $app; } if ( current_user_can( 'activate_plugins' ) ) { $app['action_label'] = esc_html__( 'Activate', 'elementor' ); $app['action_url'] = self::$plugin_status_adapter->get_activate_plugin_url( $app['file_path'] ); } else { $app['action_label'] = esc_html__( 'Cannot Activate', 'elementor' ); $app['action_url'] = '#'; } $app['target'] = '_self'; return $app; } private static function get_images_url() { return ELEMENTOR_URL . 'modules/apps/images/'; } private static function is_elementor_pro_installed() { return defined( 'ELEMENTOR_PRO_VERSION' ); } private static function render_plugin_item( $plugin ) { ?>
>