| 1 |
<?php |
| 2 |
namespace WeDevs\ERP; |
| 3 |
|
| 4 |
/** |
| 5 |
* ERP Status menu |
| 6 |
*/ |
| 7 |
class Status { |
| 8 |
|
| 9 |
/** |
| 10 |
* Kick-in the class |
| 11 |
*/ |
| 12 |
public function __construct() { |
| 13 |
$this->status_scripts(); |
| 14 |
|
| 15 |
include dirname( __FILE__ ) . '/framework/views/status-page.php'; |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Get status scripts |
| 20 |
* |
| 21 |
* @return void |
| 22 |
*/ |
| 23 |
public function status_scripts() { |
| 24 |
wp_enqueue_script( 'erp-system-status' ); |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Include status report file |
| 29 |
* |
| 30 |
* @return void |
| 31 |
*/ |
| 32 |
public static function status_report() { |
| 33 |
include_once( dirname( __FILE__ ) . '/framework/views/status-report.php' ); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Get latest version of a theme by slug. |
| 38 |
* @param object $theme WP_Theme object. |
| 39 |
* @return string Version number if found. |
| 40 |
*/ |
| 41 |
public static function get_latest_theme_version( $theme ) { |
| 42 |
include_once( ABSPATH . 'wp-admin/includes/theme.php' ); |
| 43 |
|
| 44 |
$api = themes_api( 'theme_information', array( |
| 45 |
'slug' => $theme->get_stylesheet(), |
| 46 |
'fields' => array( |
| 47 |
'sections' => false, |
| 48 |
'tags' => false, |
| 49 |
), |
| 50 |
) ); |
| 51 |
|
| 52 |
$update_theme_version = 0; |
| 53 |
|
| 54 |
// Check .org for updates. |
| 55 |
if ( is_object( $api ) && ! is_wp_error( $api ) ) { |
| 56 |
$update_theme_version = $api->version; |
| 57 |
} |
| 58 |
|
| 59 |
return $update_theme_version; |
| 60 |
} |
| 61 |
|
| 62 |
} |
| 63 |
|
| 64 |
|