Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Slimmer config array #40

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

bainternet
Copy link

this Pull request allows a slimmer $config array, by building the api_url, raw_url and zip_url URLs in the constructor since the are usually the same.

So instead of this:

 $config = array(
        'slug' => plugin_basename(__FILE__), // this is the slug of your plugin
        'proper_folder_name' => 'plugin-name', // this is the name of the folder your plugin lives in
        'api_url' => 'https://api.github.com/repos/username/repository-name', // the github API url of your github repo
        'raw_url' => 'https://raw.github.com/username/repository-name/master', // the github raw url of your github repo
        'github_url' => 'https://github.com/username/repository-name', // the github url of your github repo
        'zip_url' => 'https://github.com/username/repository-name/zipball/master', // the zip url of the github repo
        'sslverify' => true // wether WP should check the validity of the SSL cert when getting an update, see https://github.com/jkudish/WordPress-GitHub-Plugin-Updater/issues/2 and https://github.com/jkudish/WordPress-GitHub-Plugin-Updater/issues/4 for details
        'requires' => '3.0', // which version of WordPress does your plugin require?
        'tested' => '3.3', // which version of WordPress is your plugin tested up to?
        'readme' => 'README.md', // which file to use as the readme for the version number
        'access_token' => '', // Access private repositories by authorizing under Appearance > Github Updates when this example plugin is installed
    );
$config = array(
        'slug' => plugin_basename(__FILE__), // this is the slug of your plugin
        'proper_folder_name' => 'plugin-name', // this is the name of the folder your plugin lives in
        'github_url' => 'https://github.com/username/repository-name', // the github url of your github repo
        'requires' => '3.0', // which version of WordPress does your plugin require?
        'tested' => '3.3', // which version of WordPress is your plugin tested up to?
        'readme' => 'README.md', // which file to use as the readme for the version number
      );

Most of this was already possible but just not for these parameters, so i turned them into optional parameters to keep backwards capability and allow customization.
Also i added a new parameter branch which defaults to master but it's nice to have the ability to change that so the zip file downloaded is of another branch.

@jkudish
Copy link
Contributor

jkudish commented Jun 23, 2013

Sorry for the delay. This looks good. Can you please update this pull request so I can merge it in?

@afragen
Copy link

afragen commented Aug 8, 2013

I think I figured out how to slim down the $config array to nothing. I've created a similar project GitHub Updater that just uses a new header in the plugin GitHub Plugin URI: https://github.com/afragen/github-updater and parses the config from that. It also works for themes in a similar manner.

It doesn't have as many bells and whistles as this project but it works for my purposes. If anyone's interested head on over. Sorry I don't mean to seek help or hijack a thread but using an additional plugin header might be a nice way to eliminate the config altogether. Additional headers can be added for tokens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants