Changeset 508254
- Timestamp:
- 02/21/2012 02:43:41 PM (14 years ago)
- Location:
- theme-updater/trunk
- Files:
-
- 1 added
- 1 deleted
- 1 edited
-
readme.markdown (added)
-
readme.txt (deleted)
-
updater.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
theme-updater/trunk/updater.php
r396665 r508254 6 6 Author: Douglas Beck 7 7 Author: UCF Web Communications 8 Version: 1.3. 38 Version: 1.3.4 9 9 */ 10 10 11 11 require_once('assets.php'); 12 13 // register the custom stylesheet header 14 add_action( 'extra_theme_headers', 'github_extra_theme_headers' ); 15 function github_extra_theme_headers( $headers ) { 16 $headers['Github Theme URI'] = 'Github Theme URI'; 17 return $headers; 18 } 12 19 13 20 add_filter('site_transient_update_themes', 'transient_update_themes_filter'); … … 17 24 foreach ( (array) $installed_themes as $theme_title => $theme ) { 18 25 19 // Get Theme's URI26 // get the Github URI header, skip if not set 20 27 if(isset($theme['Stylesheet Files'][0]) && is_readable($theme['Stylesheet Files'][0])){ 21 $theme_file = $theme['Stylesheet Dir'] . '/style.css'; 22 $default_headers = array('UpdateURI' => 'Github Theme URI'); 23 $theme_data = get_file_data( $theme_file, $default_headers, 'theme' ); 24 if(empty($theme_data['UpdateURI'])){ 28 $stylesheet = $theme['Stylesheet Dir'] . '/style.css'; 29 $theme_data = get_theme_data($stylesheet); 30 if(empty($theme_data['Github Theme URI'])){ 25 31 continue; 26 32 } 27 $theme['UpdateURI'] = $theme_data['UpdateURI'];28 $theme_key = $theme['Stylesheet'];29 33 } 30 34 35 $theme['Github Theme URI'] = $theme_data['Github Theme URI']; 36 $theme_key = $theme['Stylesheet']; 31 37 32 38 // Add Github Theme Updater to return $data and hook into admin … … 37 43 preg_match( 38 44 '/http(s)?:\/\/github.com\/(?<username>[\w-]+)\/(?<repo>[\w-]+)$/', 39 $theme[' UpdateURI'],45 $theme['Github Theme URI'], 40 46 $matches); 41 47 if(!isset($matches['username']) or !isset($matches['repo'])){ … … 84 90 // check for rollback 85 91 if(isset($_GET['rollback'])){ 86 $data->response[$theme_key]['package'] = $theme['UpdateURI'] . '/zipball/' . urlencode($_GET['rollback']); 92 $data->response[$theme_key]['package'] = 93 $theme['Github Theme URI'] . '/zipball/' . urlencode($_GET['rollback']); 87 94 continue; 88 95 } … … 99 106 100 107 // new update available, add to $data 101 $download_link = $theme[' UpdateURI'] . '/zipball/' . $newest_tag;108 $download_link = $theme['Github Theme URI'] . '/zipball/' . $newest_tag; 102 109 $update = array(); 103 110 $update['new_version'] = $newest_tag; 104 $update['url'] = $theme[' UpdateURI'];111 $update['url'] = $theme['Github Theme URI']; 105 112 $update['package'] = $download_link; 106 113 $data->response[$theme_key] = $update; … … 129 136 return $source; 130 137 } 138 139 /* 140 Function to address the issue that users in a standalone WordPress installation 141 were receiving SSL errors and were unable to install themes. 142 https://github.com/UCF/Theme-Updater/issues/3 143 */ 144 add_action('http_request_args', 'no_ssl_http_request_args', 10, 2); 145 function no_ssl_http_request_args($args, $url) { 146 $args['sslverify'] = false; 147 return $args; 148 }
Note: See TracChangeset
for help on using the changeset viewer.