WordPress.org

Plugin Directory

Changeset 1739220


Ignore:
Timestamp:
10/01/17 20:48:56 (3 months ago)
Author:
greenshady
Message:

Uploading version 2.0.0 of the Series plugin.

Location:
series
Files:
42 added
7 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • series/trunk/changelog.md

    r1198198 r1739220  
    11# Change Log 
     2 
     3## [2.0.0] - 2017-10-01 
     4 
     5### Added 
     6 
     7* New "Series" settings page for configuring the plugin. 
     8* Reading settings, which include posts per page, order by, and order options. 
     9* Permalink setting for changing the series rewrite slug. 
     10* `[series_list_posts]` shortcode. 
     11* `[series_list_related]` shortcode. 
     12 
     13### Changed 
     14 
     15* Plugin now requires PHP 5.3.0+. 
     16* Overhauled the entire plugin code.  Very little of the original code is left. 
     17 
     18### Deprecated 
     19 
     20* `[the-series]` shortcode. 
    221 
    322## [1.0.0] - 2015-07-13 
  • series/trunk/readme.md

    r1198198 r1739220  
    1 #Series 
     1# Series 
    22 
    33Adds a new taxonomy called "series" to your blog that allows you to link together several posts in a series. 
     
    77## Professional Support 
    88 
    9 If you need professional plugin support from me, the plugin author, you can access the support forums at [Theme Hybrid](http://themehybrid.com/support), which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 60,000+ users (and growing). 
     9If you need professional plugin support from me, the plugin author, you can access the support forums at [Theme Hybrid](https://themehybrid.com/support), which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 75,000+ users (and growing). 
    1010 
    1111## Copyright and License 
     
    1313This project is licensed under the [GNU GPL](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html), version 2 or later. 
    1414 
    15 2009 – 2015 © [Justin Tadlock](http://justintadlock.com). 
     152009 - 2017 © [Justin Tadlock](http://justintadlock.com). 
  • series/trunk/readme.txt

    r1198198 r1739220  
    22 
    33Contributors: greenshady 
    4 Donate link: http://themehybrid.com/donate 
    5 Tags: widget, taxonomy, shortcode, posts, series 
    6 Requires at least: 3.6 
    7 Stable tag: 1.0.0 
     4Donate link: https://themehybrid.com/donate 
     5Tags: series, widgets, shortcodes 
     6Requires at least: 4.8 
     7Tested up to: 4.8.2 
     8Requires PHP: 5.3 
     9Stable tag: 2.0.0 
    810License: GPLv2 or later 
    911License URI: http://www.gnu.org/licenses/gpl-2.0.html 
    1012 
    11 Adds a new taxonomy called "series" to your blog that allows you to link together several posts in a series. 
     13Plugin that allows you to collect posts in a series. 
    1214 
    1315== Description == 
     
    1719### Professional Support 
    1820 
    19 If you need professional plugin support from me, the plugin author, you can access the support forums at [Theme Hybrid](http://themehybrid.com/support), which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 60,000+ users (and growing). 
     21If you need professional plugin support from me, the plugin author, you can access the support forums at [Theme Hybrid](https://themehybrid.com/support), which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 75,000+ users (and growing). 
    2022 
    2123### Plugin Development 
    2224 
    23 If you're a theme author, plugin author, or just a code hobbyist, you can follow the development of this plugin on it's [GitHub repository](https://github.com/justintadlock/series).  
     25If you're a theme author, plugin author, or just a code hobbyist, you can follow the development of this plugin on it's [GitHub repository](https://github.com/justintadlock/series). 
    2426 
    2527### Donations 
    2628 
    27 Yes, I do accept donations.  If you want to buy me a beer or whatever, you can do so from my [donations page](http://themehybrid.com/donate).  I appreciate all donations, no matter the size.  Further development of this plugin is not contingent on donations, but they are always a nice incentive. 
     29Yes, I do accept donations.  If you want to donate, you can do so from my [donations page](https://themehybrid.com/donate) or grab me something from my [Amazon Wish List](http://a.co/flUb0ns). 
    2830 
    29 == Installation == 
    30  
    31 1. Unzip the `series.zip` folder. 
    32 2. Upload the `series` folder to your `/wp-content/plugins` directory. 
    33 3. In your WordPress dashboard, head over to the *Plugins* section. 
    34 4. Activate *Series*. 
     31I appreciate all donations, no matter the size.  Further development of this plugin is not contingent on donations, but they are always a nice incentive. 
    3532 
    3633== Frequently Asked Questions == 
     
    4845Basically, you get a new meta box on the edit post screen titled "Series" that works just like regular tags.  You can input a series name to add a post to a series.  You also get a "Series" screen under the "Posts" menu in the WordPress admin. 
    4946 
     47### Why am I getting a 404 error on series pages? 
     48 
     49You just need to set up the plugin.  Go to Settings > Series in your WordPress admin and save the settings.  It'll let WordPress know about your series permalink, which is necessary for showing series on the front end of the site. 
     50 
    5051### What widgets are available to use? 
    5152 
    52 * **Series: List Posts** - This widget allows you to list posts from any series you've created. 
    53 * **Series: List Related** - This widget displays posts within the current post's series.  So, it only shows up under two conditions: 1) you're viewing a single post and 2) the current post is within a series. 
     53* **Series - List Posts** - This widget allows you to list posts from any series you've created. 
     54* **Series - List Related** - This widget displays posts within the current post's series.  So, it only shows up under two conditions: 1) you're viewing a single post and 2) the current post is within a series. 
    5455 
    5556### Are there other functions to use in my theme? 
     
    8586### Can you add feature X? 
    8687 
    87 I'll consider it.  Let me know what features you'd like to see added to the plugin.  Just keep in mind that I want this plugin to stay relatively lightweight.  Any features added should be useful for most of the plugin's users. 
     88I'll consider it.  Let me know what features you'd like to see added to the plugin. 
    8889 
    8990### This is way too complicated for me! 
  • series/trunk/series.php

    r1198198 r1739220  
    22/** 
    33 * Plugin Name: Series 
    4  * Plugin URI: http://themehybrid.com/plugins/series 
    5  * Description: Creates a new taxonomy called "Series" that allows you to tie posts together in a series. 
    6  * Version: 1.0.0 
    7  * Author: Justin Tadlock 
    8  * Author URI: http://justintadlock.com 
    9  * 
    10  * This program is free software; you can redistribute it and/or modify it under the terms of the GNU  
    11  * General Public License as published by the Free Software Foundation; either version 2 of the License,  
     4 * Plugin URI:  https://themehybrid.com/plugins/series 
     5 * Description: Plugin that allows you to collect posts in a series. 
     6 * Version:     2.0.0 
     7 * Author:      Justin Tadlock 
     8 * Author URI:  https://themehybrid.com 
     9 * Text Domain: series 
     10 * Domain Path: /lang 
     11 * 
     12 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU 
     13 * General Public License as published by the Free Software Foundation; either version 2 of the License, 
    1214 * or (at your option) any later version. 
    1315 * 
    14  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without  
     16 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
    1517 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    1618 * 
    17  * You should have received a copy of the GNU General Public License along with this program; if not, write  
    18  * to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 
     19 * You should have received a copy of the GNU General Public License along with this program; if not, 
     20 * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 
    1921 * 
    2022 * @package   Series 
    21  * @version   1.0.0 
    22  * @since     0.1.0 
    23  * @author    Justin Tadlock <justin@justintadlock.com> 
    24  * @copyright Copyright (c) 2009 - 2015, Justin Tadlock 
    25  * @link      http://themehybrid.com/plugins/series 
     23 * @author    Justin Tadlock <justintadlock@gmail.com> 
     24 * @copyright Copyright (c) 2009 - 2017, Justin Tadlock 
     25 * @link      https://themehybrid.com/plugins/series 
    2626 * @license   http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
    2727 */ 
    2828 
    29 final class Series_Plugin { 
    30  
    31     /** 
    32      * Holds the instance of this class. 
    33     * 
    34      * @since  0.2.0 
    35      * @access private 
    36      * @var    object 
    37     */ 
    38     private static $instance; 
    39  
    40     /** 
    41      * Stores the directory path for this plugin. 
    42      * 
    43      * @since  0.2.0 
    44      * @access private 
     29namespace Series; 
     30 
     31/** 
     32 * Singleton class that sets up and initializes the plugin. 
     33 * 
     34 * @since  2.0.0 
     35 * @access public 
     36 * @return void 
     37 */ 
     38final class Plugin { 
     39 
     40    /** 
     41     * Plugin directory path. 
     42     * 
     43     * @since  2.0.0 
     44     * @access public 
    4545     * @var    string 
    4646     */ 
    47     private $directory_path; 
    48  
    49     /** 
    50      * Stores the directory URI for this plugin. 
    51      * 
    52      * @since  0.2.0 
    53      * @access private 
     47    public $dir = ''; 
     48 
     49    /** 
     50     * Plugin directory URI. 
     51     * 
     52     * @since  2.0.0 
     53     * @access public 
    5454     * @var    string 
    5555     */ 
    56     private $directory_uri; 
    57  
    58     /** 
    59      * Plugin setup. 
    60      * 
    61      * @since  0.2.0 
    62      * @access public 
    63      * @return void 
    64      */ 
    65     public function __construct() { 
    66  
    67         /* Set the properties needed by the plugin. */ 
    68         add_action( 'plugins_loaded', array( $this, 'setup' ), 1 ); 
    69  
    70         /* Internationalize the text strings used. */ 
     56    public $uri = ''; 
     57 
     58    /** 
     59     * Returns the instance. 
     60     * 
     61     * @since  2.0.0 
     62     * @access public 
     63     * @return object 
     64     */ 
     65    public static function get_instance() { 
     66 
     67        static $instance = null; 
     68 
     69        if ( is_null( $instance ) ) { 
     70            $instance = new self; 
     71            $instance->setup(); 
     72            $instance->includes(); 
     73            $instance->setup_actions(); 
     74        } 
     75 
     76        return $instance; 
     77    } 
     78 
     79    /** 
     80     * Constructor method. 
     81     * 
     82     * @since  2.0.0 
     83     * @access private 
     84     * @return void 
     85     */ 
     86    private function __construct() {} 
     87 
     88    /** 
     89     * Magic method to output a string if trying to use the object as a string. 
     90     * 
     91     * @since  2.0.0 
     92     * @access public 
     93     * @return void 
     94     */ 
     95    public function __toString() { 
     96        return 'series'; 
     97    } 
     98 
     99    /** 
     100     * Sets up globals. 
     101     * 
     102     * @since  2.0.0 
     103     * @access private 
     104     * @return void 
     105     */ 
     106    private function setup() { 
     107 
     108        // Main plugin directory path and URI. 
     109        $this->dir = trailingslashit( plugin_dir_path( __FILE__ ) ); 
     110        $this->uri  = trailingslashit( plugin_dir_url(  __FILE__ ) ); 
     111    } 
     112 
     113    /** 
     114     * Loads files needed by the plugin. 
     115     * 
     116     * @since  2.0.0 
     117     * @access private 
     118     * @return void 
     119     */ 
     120    private function includes() { 
     121 
     122        // Include functions files. 
     123        require_once( $this->dir . 'inc/functions-filters.php'    ); 
     124        require_once( $this->dir . 'inc/functions-options.php'    ); 
     125        require_once( $this->dir . 'inc/functions-rewrite.php'    ); 
     126        require_once( $this->dir . 'inc/functions-shortcodes.php' ); 
     127        require_once( $this->dir . 'inc/functions-taxonomies.php' ); 
     128        require_once( $this->dir . 'inc/functions-deprecated.php' ); 
     129 
     130        // Include template files. 
     131        require_once( $this->dir . 'inc/template-general.php' ); 
     132 
     133        // Load widget classes. 
     134        require_once( $this->dir . 'inc/widgets/class-list-posts.php'   ); 
     135        require_once( $this->dir . 'inc/widgets/class-list-related.php' ); 
     136 
     137        // Load admin files. 
     138        if ( is_admin() ) { 
     139 
     140            require_once( $this->dir . 'admin/class-settings.php' ); 
     141        } 
     142    } 
     143 
     144    /** 
     145     * Sets up main plugin actions and filters. 
     146     * 
     147     * @since  1.0.0 
     148     * @access private 
     149     * @return void 
     150     */ 
     151    private function setup_actions() { 
     152 
     153        // Internationalize the text strings used. 
    71154        add_action( 'plugins_loaded', array( $this, 'i18n' ), 2 ); 
    72  
    73         /* Load the functions files. */ 
    74         add_action( 'plugins_loaded', array( $this, 'includes' ), 3 ); 
    75155 
    76156        /* Register widgets. */ 
    77157        add_action( 'widgets_init', array( $this, 'register_widgets' ) ); 
    78158 
    79         /* Register activation hook. */ 
     159        // Register activation hook. 
    80160        register_activation_hook( __FILE__, array( $this, 'activation' ) ); 
    81161    } 
    82162 
    83163    /** 
    84      * Defines the directory path and URI for the plugin. 
    85      * 
    86      * @since  0.2.0 
    87      * @access public 
    88      * @return void 
    89      */ 
    90     public function setup() { 
    91         $this->directory_path = trailingslashit( plugin_dir_path( __FILE__ ) ); 
    92         $this->directory_uri  = trailingslashit( plugin_dir_url(  __FILE__ ) ); 
    93     } 
    94  
    95     /** 
    96      * Loads the initial files needed by the plugin. 
    97      * 
    98      * @since  0.2.0 
    99      * @access public 
    100      * @return void 
    101      */ 
    102     public function includes() { 
    103  
    104         require_once( "{$this->directory_path}inc/taxonomies.php"                ); 
    105         require_once( "{$this->directory_path}inc/template.php"                  ); 
    106         require_once( "{$this->directory_path}inc/shortcodes.php"                ); 
    107         require_once( "{$this->directory_path}inc/class-widget-list-posts.php"   ); 
    108         require_once( "{$this->directory_path}inc/class-widget-list-related.php" ); 
    109     } 
    110  
    111     /** 
    112164     * Loads the translation files. 
    113165     * 
    114      * @since  0.2.0 
     166     * @since  2.0.0 
    115167     * @access public 
    116168     * @return void 
     
    118170    public function i18n() { 
    119171 
    120         /* Load the translation of the plugin. */ 
    121         load_plugin_textdomain( 'series', false, 'series/languages' ); 
     172        load_plugin_textdomain( 'series', false, trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) . 'lang' ); 
    122173    } 
    123174 
     
    125176     * Loads the admin functions and files. 
    126177     * 
    127      * @since  0.2.0 
     178     * @since  2.0.0 
    128179     * @access public 
    129180     * @return void 
    130181     */ 
    131182    public function register_widgets() { 
    132         register_widget( 'Series_Widget_List_Posts'   ); 
    133         register_widget( 'Series_Widget_List_Related' ); 
     183 
     184        register_widget( __NAMESPACE__ . '\Widgets\List_Posts'   ); 
     185        register_widget( __NAMESPACE__ . '\Widgets\List_Related' ); 
    134186    } 
    135187 
     
    137189     * Method that runs only when the plugin is activated. 
    138190     * 
    139      * @since  0.2.0 
     191     * @since  2.0.0 
    140192     * @access public 
    141193     * @return void 
     
    143195    public function activation() { 
    144196 
    145         /* Get the administrator role. */ 
     197        // Get the administrator role. 
    146198        $role = get_role( 'administrator' ); 
    147199 
    148         /* If the administrator role exists, add required capabilities for the plugin. */ 
    149         if ( !empty( $role ) ) 
     200        // If the administrator role exists, add required capabilities for the plugin. 
     201        if ( ! empty( $role ) ) { 
     202 
    150203            $role->add_cap( 'manage_series' ); 
    151     } 
    152  
    153     /** 
    154      * Returns the instance. 
    155      * 
    156      * @since  0.2.0 
    157      * @access public 
    158      * @return object 
    159      */ 
    160     public static function get_instance() { 
    161  
    162         if ( !self::$instance ) 
    163             self::$instance = new self; 
    164  
    165         return self::$instance; 
     204        } 
    166205    } 
    167206} 
    168207 
    169 Series_Plugin::get_instance(); 
     208/** 
     209 * Gets the instance of the `Plugin` class.  This function is useful for quickly grabbing data 
     210 * used throughout the plugin. 
     211 * 
     212 * @since  2.0.0 
     213 * @access public 
     214 * @return object 
     215 */ 
     216function plugin() { 
     217 
     218    return Plugin::get_instance(); 
     219} 
     220 
     221// Let's roll! 
     222plugin(); 
Note: See TracChangeset for help on using the changeset viewer.