Skip to content

Commit

Permalink
Add Github release updater
Browse files Browse the repository at this point in the history
Allows us to update using automatic updates from Github releases.
  • Loading branch information
joedolson committed Nov 2, 2023
1 parent 802a97b commit 18b6e1d
Show file tree
Hide file tree
Showing 121 changed files with 10,985 additions and 7 deletions.
20 changes: 20 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.eslintrc.json export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.github export-ignore
.github/** export-ignore
.nvmrc export-ignore
.wp-env.json export-ignore
composer.lock export-ignore
hookdoc-conf.json export-ignore
package.json export-ignore
bin export-ignore
bin/** export-ignore
docs export-ignore
docs/** export-ignore
.scripts export-ignore
.scripts/** export-ignore
phpcs.xml.dist export-ignore
phpunit.xml.dist export-ignore
phpstan.neon.dist export-ignore
readme.md export-ignore
14 changes: 13 additions & 1 deletion init.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Plugin Name: WP Accessibility Day - Conference Schedule
* Plugin URI: https://wpconferenceschedule.com
* Description: Forked from WP Conference Schedule by Road Warrior Creative.
* Version: 1.0.4
* Version: 2.0.0
* Author: WP Accessibility Day
* Author URI: https://wpaccessibility.day
* License: GPL-2.0+
Expand All @@ -24,6 +24,18 @@
exit;
}

require 'src/plugin-update-checker/plugin-update-checker.php';
use YahnisElsts\PluginUpdateChecker\v5\PucFactory;

$wpcsp_update_checker = PucFactory::buildUpdateChecker(
'https://github.com/wpa11yday/conference/',
__FILE__,
'wpad-conference-schedule'
);

// Set the branch that contains the stable release.
$wpcsp_update_checker->setBranch( 'master' );

include( dirname( __FILE__ ) . '/src/wp-conference-schedule.php' );

/**
Expand Down
13 changes: 9 additions & 4 deletions src/readme.txt → readme.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
=== Conference Schedule ===
Contributors: equalizedigital, alh0319, stevejonesdev, joedolson, nickthegeek, alexstine
Donate link: https://wpaccessibility.day/donate/
Tags: conference schedule, conference, schedule, event schedule, event, events, block, blocks, gutenberg, sessions, speakers, events, events calendar
Requires at least: 5.0.0
Tested up to: 6.2
Stable tag: 1.0.0
Tags: conference schedule, conference, schedule, event schedule, event, events, sessions, speakers
Requires at least: 6.0
Tested up to: 6.4
Stable tag: 2.0.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Update URI: https://wpaccessibility.day

Forked from WP Conference Schedule and customized for use by WP Accessibility Day.

Expand All @@ -33,5 +34,9 @@ Easily add a custom conference schedule or event schedule (in responsive table f

== Changelog ==

= 2.0.0 =

* Add Github automatic updating by releases.

= 1.0.0 =
* Initial fork.
15 changes: 15 additions & 0 deletions src/plugin-update-checker/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[*]
charset=utf-8
end_of_line=lf
insert_final_newline=false
indent_style=tab
tab_width=4

[{phpunit.xml.dist,*.jhm,*.xslt,*.xul,*.rng,*.xsl,*.xsd,*.ant,*.tld,*.fxml,*.jrxml,*.xml,*.jnlp,*.wsdl}]
indent_style=space
indent_size=4

[*.svg]
indent_style=space
indent_size=4

1 change: 1 addition & 0 deletions src/plugin-update-checker/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build export-ignore
40 changes: 40 additions & 0 deletions src/plugin-update-checker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# The entire IDEA/PhpStorm directory
.idea/

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
10 changes: 10 additions & 0 deletions src/plugin-update-checker/Puc/v5/PucFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace YahnisElsts\PluginUpdateChecker\v5;

if ( !class_exists(PucFactory::class, false) ):

class PucFactory extends \YahnisElsts\PluginUpdateChecker\v5p2\PucFactory {
}

endif;
86 changes: 86 additions & 0 deletions src/plugin-update-checker/Puc/v5p2/Autoloader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php

namespace YahnisElsts\PluginUpdateChecker\v5p2;

if ( !class_exists(Autoloader::class, false) ):

class Autoloader {
const DEFAULT_NS_PREFIX = 'YahnisElsts\\PluginUpdateChecker\\';

private $prefix;
private $rootDir;
private $libraryDir;

private $staticMap;

public function __construct() {
$this->rootDir = dirname(__FILE__) . '/';

$namespaceWithSlash = __NAMESPACE__ . '\\';
$this->prefix = $namespaceWithSlash;

$this->libraryDir = $this->rootDir . '../..';
if ( !self::isPhar() ) {
$this->libraryDir = realpath($this->libraryDir);
}
$this->libraryDir = $this->libraryDir . '/';

//Usually, dependencies like Parsedown are in the global namespace,
//but if someone adds a custom namespace to the entire library, they
//will be in the same namespace as this class.
$isCustomNamespace = (
substr($namespaceWithSlash, 0, strlen(self::DEFAULT_NS_PREFIX)) !== self::DEFAULT_NS_PREFIX
);
$libraryPrefix = $isCustomNamespace ? $namespaceWithSlash : '';

$this->staticMap = array(
$libraryPrefix . 'PucReadmeParser' => 'vendor/PucReadmeParser.php',
$libraryPrefix . 'Parsedown' => 'vendor/Parsedown.php',
);

//Add the generic, major-version-only factory class to the static map.
$versionSeparatorPos = strrpos(__NAMESPACE__, '\\v');
if ( $versionSeparatorPos !== false ) {
$versionSegment = substr(__NAMESPACE__, $versionSeparatorPos + 1);
$pointPos = strpos($versionSegment, 'p');
if ( ($pointPos !== false) && ($pointPos > 1) ) {
$majorVersionSegment = substr($versionSegment, 0, $pointPos);
$majorVersionNs = __NAMESPACE__ . '\\' . $majorVersionSegment;
$this->staticMap[$majorVersionNs . '\\PucFactory'] =
'Puc/' . $majorVersionSegment . '/Factory.php';
}
}

spl_autoload_register(array($this, 'autoload'));
}

/**
* Determine if this file is running as part of a Phar archive.
*
* @return bool
*/
private static function isPhar() {
//Check if the current file path starts with "phar://".
static $pharProtocol = 'phar://';
return (substr(__FILE__, 0, strlen($pharProtocol)) === $pharProtocol);
}

public function autoload($className) {
if ( isset($this->staticMap[$className]) && file_exists($this->libraryDir . $this->staticMap[$className]) ) {
include($this->libraryDir . $this->staticMap[$className]);
return;
}

if ( strpos($className, $this->prefix) === 0 ) {
$path = substr($className, strlen($this->prefix));
$path = str_replace(array('_', '\\'), '/', $path);
$path = $this->rootDir . $path . '.php';

if ( file_exists($path) ) {
include $path;
}
}
}
}

endif;
Loading

0 comments on commit 18b6e1d

Please sign in to comment.