1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
<?php
/* Provides details formatted for use in "View version *** details" boxes. Written by Chris Jean for iThemes.com Version 1.1.0
Version History 1.0.0 - 2013-04-11 - Chris Jean Release ready 1.0.1 - 2013-09-19 - Chris Jean Updated requires to not use dirname(). 1.1.0 - 2013-10-02 - Chris Jean Added get_theme_information(). */
class Ithemes_Updater_Information { public static function get_theme_information( $path ) { return self::get_plugin_information( "$path/style.css" ); } public static function get_plugin_information( $path ) { require_once( $GLOBALS['ithemes_updater_path'] . '/packages.php' ); $details = Ithemes_Updater_Packages::get_full_details(); if ( ! isset( $details['packages'][$path] ) ) return false; $package = $details['packages'][$path]; $url = "http://package-info.ithemes.com/{$package['package']}/information.json"; $response = wp_remote_get( $url ); if ( ! is_wp_error( $response ) && isset( $response['body'] ) ) { $info = json_decode( $response['body'] ); if ( is_object( $info ) && ! empty( $info->name ) && ! empty( $info->version ) ) { $info->slug = dirname( $path ); $info->download_link = $package['package-url']; return $info; } } require_once( $GLOBALS['ithemes_updater_path'] . '/functions.php' ); require_once( $GLOBALS['ithemes_updater_path'] . '/information.php' ); $changelog = Ithemes_Updater_API::get_package_changelog( $package['package'], $details['packages'][$path]['installed'] ); $info = array( 'name' => Ithemes_Updater_Functions::get_package_name( $package['package'] ), 'slug' => dirname( $path ), 'version' => $package['available'], 'author' => '<a href="http://ithemes.com/">iThemes</a>', 'download_link' => $package['package-url'], 'sections' => array( 'changelog' => $changelog, ), ); return (object) $info; } }
|