-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Remkus de Vries
committed
May 24, 2020
1 parent
46c5761
commit 3f0af7b
Showing
16 changed files
with
1,164 additions
and
676 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# genindie | ||
Bringing the IndieWeb to the Genesis Framework | ||
# GenIndie | ||
|
||
The [IndieWeb](https://indieweb.org) is a wonderful movement, but it's seriously lacking WordPress themes that are outputting the required Microformats 2.0 schema. This plugin does not aim to solve this issue for all WordPress themes. However, this plugin will turn any Genesis powered Child Theme into a fully IndieWeb ready theme. | ||
|
||
Hope you enjoy it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
=== Plugin Name === | ||
Contributors: (this should be a list of wordpress.org userid's) | ||
Donate link: https://remkus.devries.frl | ||
Tags: Genesis, IndieWeb | ||
Requires at least: 5.2 | ||
Tested up to: 5.4.1 | ||
Stable tag: 0.1.0 | ||
License: GPLv2 or later | ||
License URI: http://www.gnu.org/licenses/gpl-2.0.html | ||
|
||
Introducing the IndieWeb to the Genesis Framework by adding Microformats to Genesis' output. | ||
|
||
== Description == | ||
|
||
The IndieWeb is a wonderful movement, but it's lacking WordPress themes that are outputting the required Microformats 2.0 schema. This plugin does not aim to solve this issue for all WordPress themes. However, this plugin will turn any Genesis powered Child Theme into a fully IndieWeb ready theme. | ||
|
||
Hope you enjoy it. | ||
|
||
|
||
== Installation == | ||
|
||
Installation is as simple as installing any WordPress plugin | ||
|
||
1. Upload `genindie.php` to the `/wp-content/plugins/` directory | ||
2. Activate the plugin through the 'Plugins' menu in WordPress | ||
|
||
== Frequently Asked Questions == | ||
|
||
= Are there any frequently asked questions yet? = | ||
|
||
Not really, why do you ask? | ||
|
||
|
||
== Changelog == | ||
|
||
= 0.1.0 = | ||
* Introducing the GenIndie plugin. | ||
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
/** | ||
* The plugin bootstrap file | ||
* | ||
* This file is read by WordPress to generate the plugin information in the plugin | ||
* admin area. This file also includes all of the dependencies used by the plugin, | ||
* registers the activation and deactivation functions, and defines a function | ||
* that starts the plugin. | ||
* | ||
* @link https://remkus.devries.frl | ||
* @since 0.1.0 | ||
* @package Genindie | ||
* | ||
* @wordpress-plugin | ||
* Plugin Name: GenIndie | ||
* Plugin URI: https://github.com/remkus/genindie | ||
* Description: Bringing the IndieWeb to the Genesis Framework by adding Microformats 2.0 | ||
* Version: 0.1.0 | ||
* Author: Remkus de Vries | ||
* Author URI: https://remkus.devries.frl | ||
* License: GPL-2.0+ | ||
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt | ||
* Text Domain: genindie | ||
* Domain Path: /languages | ||
*/ | ||
|
||
// If this file is called directly, abort. | ||
if ( ! defined( 'WPINC' ) ) { | ||
die; | ||
} | ||
|
||
/** | ||
* Currently plugin version. | ||
*/ | ||
define( 'GENINDIE_VERSION', '0.1.0' ); | ||
|
||
/** | ||
* The code that runs during plugin activation. | ||
* This action is documented in includes/class-genindie-activator.php | ||
*/ | ||
function activate_genindie() { | ||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-genindie-activator.php'; | ||
Genindie_Activator::activate(); | ||
} | ||
|
||
/** | ||
* The code that runs during plugin deactivation. | ||
* This action is documented in includes/class-genindie-deactivator.php | ||
*/ | ||
function deactivate_genindie() { | ||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-genindie-deactivator.php'; | ||
Genindie_Deactivator::deactivate(); | ||
} | ||
|
||
register_activation_hook( __FILE__, 'activate_genindie' ); | ||
register_deactivation_hook( __FILE__, 'deactivate_genindie' ); | ||
|
||
/** | ||
* The core plugin class that is used to define internationalization, | ||
* admin-specific hooks, and public-facing site hooks. | ||
*/ | ||
require plugin_dir_path( __FILE__ ) . 'includes/class-genindie.php'; | ||
|
||
/** | ||
* Begins execution of the plugin. | ||
* | ||
* Since everything within the plugin is registered via hooks, | ||
* then kicking off the plugin from this point in the file does | ||
* not affect the page life cycle. | ||
* | ||
* @since 0.1.0 | ||
*/ | ||
function run_genindie() { | ||
|
||
$plugin = new Genindie(); | ||
$plugin->run(); | ||
|
||
} | ||
run_genindie(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
/** | ||
* Fired during plugin activation | ||
* | ||
* @link https://remkus.devries.frl | ||
* @since 0.1.0 | ||
* | ||
* @package Genindie | ||
* @subpackage Genindie/includes | ||
*/ | ||
|
||
/** | ||
* Fired during plugin activation. | ||
* | ||
* This class defines all code necessary to run during the plugin's activation. | ||
* | ||
* @since 0.1.0 | ||
* @package Genindie | ||
* @subpackage Genindie/includes | ||
* @author Remkus de Vries <[email protected]> | ||
*/ | ||
class Genindie_Activator { | ||
|
||
/** | ||
* Short Description. | ||
* | ||
* Long Description. | ||
* | ||
* @since 0.1.0 | ||
*/ | ||
public static function activate() { | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
/** | ||
* Fired during plugin deactivation | ||
* | ||
* @link https://remkus.devries.frl | ||
* @since 0.1.0 | ||
* | ||
* @package Genindie | ||
* @subpackage Genindie/includes | ||
*/ | ||
|
||
/** | ||
* Fired during plugin deactivation. | ||
* | ||
* This class defines all code necessary to run during the plugin's deactivation. | ||
* | ||
* @since 0.1.0 | ||
* @package Genindie | ||
* @subpackage Genindie/includes | ||
* @author Remkus de Vries <[email protected]> | ||
*/ | ||
class Genindie_Deactivator { | ||
|
||
/** | ||
* Short Description. (use period) | ||
* | ||
* Long Description. | ||
* | ||
* @since 0.1.0 | ||
*/ | ||
public static function deactivate() { | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
/** | ||
* Define the internationalization functionality | ||
* | ||
* Loads and defines the internationalization files for this plugin | ||
* so that it is ready for translation. | ||
* | ||
* @link https://remkus.devries.frl | ||
* @since 0.1.0 | ||
* | ||
* @package Genindie | ||
* @subpackage Genindie/includes | ||
*/ | ||
|
||
/** | ||
* Define the internationalization functionality. | ||
* | ||
* Loads and defines the internationalization files for this plugin | ||
* so that it is ready for translation. | ||
* | ||
* @since 0.1.0 | ||
* @package Genindie | ||
* @subpackage Genindie/includes | ||
* @author Remkus de Vries <[email protected]> | ||
*/ | ||
class Genindie_i18n { | ||
|
||
|
||
/** | ||
* Load the plugin text domain for translation. | ||
* | ||
* @since 0.1.0 | ||
*/ | ||
public function load_plugin_textdomain() { | ||
|
||
load_plugin_textdomain( | ||
'genindie', | ||
false, | ||
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' | ||
); | ||
|
||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
<?php | ||
|
||
/** | ||
* Register all actions and filters for the plugin | ||
* | ||
* @link https://remkus.devries.frl | ||
* @since 1.0.0 | ||
* | ||
* @package Genindie | ||
* @subpackage Genindie/includes | ||
*/ | ||
|
||
/** | ||
* Register all actions and filters for the plugin. | ||
* | ||
* Maintain a list of all hooks that are registered throughout | ||
* the plugin, and register them with the WordPress API. Call the | ||
* run function to execute the list of actions and filters. | ||
* | ||
* @package Genindie | ||
* @subpackage Genindie/includes | ||
* @author Remkus de Vries <[email protected]> | ||
*/ | ||
class Genindie_Loader { | ||
|
||
/** | ||
* The array of actions registered with WordPress. | ||
* | ||
* @since 1.0.0 | ||
* @access protected | ||
* @var array $actions The actions registered with WordPress to fire when the plugin loads. | ||
*/ | ||
protected $actions; | ||
|
||
/** | ||
* The array of filters registered with WordPress. | ||
* | ||
* @since 1.0.0 | ||
* @access protected | ||
* @var array $filters The filters registered with WordPress to fire when the plugin loads. | ||
*/ | ||
protected $filters; | ||
|
||
/** | ||
* Initialize the collections used to maintain the actions and filters. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
public function __construct() { | ||
|
||
$this->actions = array(); | ||
$this->filters = array(); | ||
|
||
} | ||
|
||
/** | ||
* Add a new action to the collection to be registered with WordPress. | ||
* | ||
* @since 1.0.0 | ||
* @param string $hook The name of the WordPress action that is being registered. | ||
* @param object $component A reference to the instance of the object on which the action is defined. | ||
* @param string $callback The name of the function definition on the $component. | ||
* @param int $priority Optional. The priority at which the function should be fired. Default is 10. | ||
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. | ||
*/ | ||
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { | ||
$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); | ||
} | ||
|
||
/** | ||
* Add a new filter to the collection to be registered with WordPress. | ||
* | ||
* @since 1.0.0 | ||
* @param string $hook The name of the WordPress filter that is being registered. | ||
* @param object $component A reference to the instance of the object on which the filter is defined. | ||
* @param string $callback The name of the function definition on the $component. | ||
* @param int $priority Optional. The priority at which the function should be fired. Default is 10. | ||
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1 | ||
*/ | ||
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { | ||
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); | ||
} | ||
|
||
/** | ||
* A utility function that is used to register the actions and hooks into a single | ||
* collection. | ||
* | ||
* @since 1.0.0 | ||
* @access private | ||
* @param array $hooks The collection of hooks that is being registered (that is, actions or filters). | ||
* @param string $hook The name of the WordPress filter that is being registered. | ||
* @param object $component A reference to the instance of the object on which the filter is defined. | ||
* @param string $callback The name of the function definition on the $component. | ||
* @param int $priority The priority at which the function should be fired. | ||
* @param int $accepted_args The number of arguments that should be passed to the $callback. | ||
* @return array The collection of actions and filters registered with WordPress. | ||
*/ | ||
private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { | ||
|
||
$hooks[] = array( | ||
'hook' => $hook, | ||
'component' => $component, | ||
'callback' => $callback, | ||
'priority' => $priority, | ||
'accepted_args' => $accepted_args | ||
); | ||
|
||
return $hooks; | ||
|
||
} | ||
|
||
/** | ||
* Register the filters and actions with WordPress. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
public function run() { | ||
|
||
foreach ( $this->filters as $hook ) { | ||
add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); | ||
} | ||
|
||
foreach ( $this->actions as $hook ) { | ||
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.