Skip to content

Commit

Permalink
version 3.1.0, github updater
Browse files Browse the repository at this point in the history
  • Loading branch information
billerickson committed Oct 14, 2024
1 parent bc84776 commit ad6b4cf
Show file tree
Hide file tree
Showing 120 changed files with 11,006 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Change Log
All notable changes to this project will be documented in this file, formatted via [this recommendation](http://keepachangelog.com/).

### [3.1.0]
#### Added
* Plugin updates from GitHub
* Support custom post statuses, props @nabrown
* German translation, props @HenryJobst

### [3.0.3]
#### Changed
* Bumped the "Tested To" number to WP 6.6
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
**Tags:** shortcode, pages, posts, page, query, display, list
**Requires at least:** 3.0
**Tested up to:** 6.6
**Stable tag:** 3.0.3
**Stable tag:** 3.1.0
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -28,7 +28,7 @@ See [these tutorials](https://displayposts.com/tutorials/) for many examples of

### Extensions
* [Display Posts – Pagination](https://github.com/billerickson/Display-Posts-Pagination) – Allow results of Display Posts to be paginated
* [Display Posts – Date View](https://wordpress.org/plugins/display-posts-date-view/) – Lets you break your content down by month or year.
* [Display Posts – Date View](https://github.com/billerickson/display-posts-date-view/) – Lets you break your content down by month or year.
* [Display Posts – Alpha View](https://github.com/billerickson/Display-Posts-Alpha-View) – Display an alphabetical listing of your content, broken down by letter
* [Display Posts – Transient Cache](https://github.com/billerickson/Display-Posts-Transient-Cache) – Cache the output using transients
* [Co-Authors Plus Addon](https://github.com/billerickson/dps-coauthor-addon) – multiple authors on posts
Expand Down
20 changes: 18 additions & 2 deletions display-posts-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Display Posts
* Plugin URI: https://displayposts.com
* Description: Display a listing of posts using the [display-posts] shortcode
* Version: 3.0.3
* Version: 3.1.0
* Author: Bill Erickson
* Author URI: https://www.billerickson.net
* Text Domain: display-posts
Expand All @@ -16,7 +16,7 @@
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* @package Display Posts
* @version 3.0.3
* @version 3.1.0
* @author Bill Erickson <[email protected]>
* @copyright Copyright (c) 2011, Bill Erickson
* @link https://displayposts.com
Expand Down Expand Up @@ -893,3 +893,19 @@ function be_dps_survey_dismiss() {
update_option( 'display_posts_survey_2', $survey );
}
add_action( 'wp_ajax_display_posts_survey_dismiss', 'be_dps_survey_dismiss' );

/**
* Plugin Updates
*/
function dps_plugin_updates() {
require dirname( __FILE__ ) . '/updater/plugin-update-checker.php';

$myUpdateChecker = \YahnisElsts\PluginUpdateChecker\v5\PucFactory::buildUpdateChecker(
'https://github.com/billerickson/display-posts-shortcode',
__FILE__, //Full path to the main plugin file or functions.php.
'display-posts-shortcode'
);

$myUpdateChecker->setBranch('master');
}
add_action( 'admin_init', 'dps_plugin_updates' );
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Here are [tutorials for popular event calendar plugins](https://displayposts.com
**Extensions**

* [Display Posts – Pagination](https://github.com/billerickson/Display-Posts-Pagination) – Allow results of Display Posts to be paginated
* [Display Posts – Date View](https://wordpress.org/plugins/display-posts-date-view/) – Lets you break your content down by month or year.
* [Display Posts – Date View](https://github.com/billerickson/display-posts-date-view/) – Lets you break your content down by month or year.
* [Display Posts – Alpha View](https://github.com/billerickson/Display-Posts-Alpha-View) – Display an alphabetical listing of your content, broken down by letter
* [Display Posts – Transient Cache](https://github.com/billerickson/Display-Posts-Transient-Cache) – Cache the output using transients
* [Co-Authors Plus Addon](https://github.com/billerickson/dps-coauthor-addon) – multiple authors on posts
Expand All @@ -78,6 +78,11 @@ Here are [tutorials for popular event calendar plugins](https://displayposts.com

== Changelog ==

**Version 3.1.0**
* Plugin updates from GitHub
* Support custom post statuses, props @nabrown
* German translation, props @HenryJobst

**Version 3.0.3**
* Bumped the "Tested To" number to WP 6.6
* Updated text of the plugin notice
Expand Down
Binary file added updater/.DS_Store
Binary file not shown.
15 changes: 15 additions & 0 deletions updater/.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

Binary file added updater/Puc/.DS_Store
Binary file not shown.
10 changes: 10 additions & 0 deletions updater/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\v5p4\PucFactory {
}

endif;
Binary file added updater/Puc/v5p4/.DS_Store
Binary file not shown.
86 changes: 86 additions & 0 deletions updater/Puc/v5p4/Autoloader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php

namespace YahnisElsts\PluginUpdateChecker\v5p4;

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 ad6b4cf

Please sign in to comment.