Plugin Directory

Changeset 508254


Ignore:
Timestamp:
02/21/2012 02:43:41 PM (14 years ago)
Author:
ucfwebcom
Message:

updated to 1.3.4

Location:
theme-updater/trunk
Files:
1 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • theme-updater/trunk/updater.php

    r396665 r508254  
    66Author: Douglas Beck
    77Author: UCF Web Communications
    8 Version: 1.3.3
     8Version: 1.3.4
    99*/
    1010
    1111require_once('assets.php');
     12
     13// register the custom stylesheet header
     14add_action( 'extra_theme_headers', 'github_extra_theme_headers' );
     15function github_extra_theme_headers( $headers ) {
     16    $headers['Github Theme URI'] = 'Github Theme URI';
     17    return $headers;
     18}
    1219
    1320add_filter('site_transient_update_themes', 'transient_update_themes_filter');
     
    1724    foreach ( (array) $installed_themes as $theme_title => $theme ) {
    1825       
    19         // Get Theme's URI
     26        // get the Github URI header, skip if not set
    2027        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'])){
    2531                continue;
    2632            }
    27             $theme['UpdateURI'] = $theme_data['UpdateURI'];
    28             $theme_key = $theme['Stylesheet'];
    2933        }
    30        
     34
     35        $theme['Github Theme URI'] = $theme_data['Github Theme URI'];
     36        $theme_key = $theme['Stylesheet'];
    3137       
    3238        // Add Github Theme Updater to return $data and hook into admin
     
    3743        preg_match(
    3844            '/http(s)?:\/\/github.com\/(?<username>[\w-]+)\/(?<repo>[\w-]+)$/',
    39             $theme['UpdateURI'],
     45            $theme['Github Theme URI'],
    4046            $matches);
    4147        if(!isset($matches['username']) or !isset($matches['repo'])){
     
    8490        // check for rollback
    8591        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']);
    8794            continue;
    8895        }
     
    99106       
    100107        // new update available, add to $data
    101         $download_link = $theme['UpdateURI'] . '/zipball/' . $newest_tag;
     108        $download_link = $theme['Github Theme URI'] . '/zipball/' . $newest_tag;
    102109        $update = array();
    103110        $update['new_version'] = $newest_tag;
    104         $update['url']         = $theme['UpdateURI'];
     111        $update['url']         = $theme['Github Theme URI'];
    105112        $update['package']     = $download_link;
    106113        $data->response[$theme_key] = $update;
     
    129136    return $source;
    130137}
     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*/
     144add_action('http_request_args', 'no_ssl_http_request_args', 10, 2);
     145function 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.