'lp-completed' ) ); $total = 0; if ( $orders ) { foreach ( $orders as $order ) { $order = learn_press_get_order( $order->ID ); $total = $total + floatval( $order->order_total ); } } return learn_press_format_price( $total, true ); } /** * @param String $item_id - The ID of an Envato Marketplace item * * @returns mixed */ private function _get_theme_info( $item_id ) { $alls = LP_Plugins_Helper::get_related_themes(); if ( ! $alls ) { return false; } foreach ( $alls as $k => $types ) { if ( isset( $types[ $item_id ] ) ) { return $types[ $item_id ]; } } return false; } /** * Get data from wordpress.org * * @since 2.0 */ private function _get_data() { require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; require_once ABSPATH . 'wp-admin/includes/plugin.php'; $api = get_transient( 'lp_plugin_status' ); if ( false === $api || is_wp_error( $api ) ) { $api = plugins_api( 'plugin_information', array( 'slug' => 'learnpress', 'fields' => array( 'active_installs' => true, 'short_description' => true, 'description' => true, 'ratings' => true, 'downloaded' => true, ), ) ); if ( ! is_wp_error( $api ) ) { set_transient( 'lp_plugin_status', $api, 12 * HOUR_IN_SECONDS ); } } return $api; } /** * Plugin status widget */ public function plugin_status() { $plugin_data = $this->_get_data(); if ( ! $plugin_data || is_wp_error( $plugin_data ) ) { learn_press_admin_view( 'dashboard/plugin-status/html-no-data' ); } else { learn_press_admin_view( 'dashboard/plugin-status/html-results', array( 'plugin_data' => $plugin_data ) ); } } } } new LP_Admin_Dashboard();