-
Notifications
You must be signed in to change notification settings - Fork 17
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
Showing
4 changed files
with
78 additions
and
68 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
/** | ||
* Genesis Header Nav | ||
* | ||
* @package GenesisHeaderNav | ||
* @author Gary Jones <[email protected]> | ||
* @package Genesis_Header_Nav | ||
* @author Gary Jones | ||
* @license GPL-2.0+ | ||
* @link https://github.com/GaryJones/genesis-header-nav | ||
* @copyright 2013 Gary Jones, Gamajo Tech | ||
|
@@ -12,7 +12,7 @@ | |
* Plugin Name: Genesis Header Nav | ||
* Plugin URI: https://github.com/GaryJones/genesis-header-nav | ||
* Description: Registers a menu location and displays it inside the header for a Genesis Framework child theme. | ||
* Version: 1.3.1 | ||
* Version: 2.0.0 | ||
* Author: Gary Jones | ||
* Author URI: http://gamajo.com/ | ||
* Text Domain: genesis-header-nav | ||
|
@@ -23,19 +23,50 @@ | |
* GitHub Branch: master | ||
*/ | ||
|
||
namespace Gamajo\GenesisHeaderNav; | ||
|
||
// If this file is called directly, abort. | ||
if ( ! defined( 'WPINC' ) ) { | ||
die; | ||
} | ||
|
||
require_once plugin_dir_path( __FILE__ ) . 'class-genesis-header-nav.php'; | ||
// Main class file. | ||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-genesis-header-nav.php'; | ||
|
||
/** | ||
* Get plugin object. | ||
* | ||
* Instantiates it if necessary. | ||
* | ||
* @since 2.0.0 | ||
* | ||
* @return Gamajo\GenesisHeaderNav\Plugin | ||
*/ | ||
function get_plugin() { | ||
static $plugin = NULL; | ||
if ( is_null( $plugin ) ) { | ||
$plugin = new Plugin; | ||
} | ||
return $plugin; | ||
} | ||
|
||
add_action( 'plugins_loaded', __NAMESPACE__ . '\\genesis_header_nav_i18n' ); | ||
/** | ||
* Load Genesis Header Nav plugin text domain. | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
function genesis_header_nav_i18n() { | ||
load_plugin_textdomain( 'genesis-header-nav', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); | ||
} | ||
|
||
add_action( 'after_setup_theme', 'genesis_header_nav_run' ); | ||
add_action( 'after_setup_theme', __NAMESPACE__ . '\\genesis_header_nav_run' ); | ||
/** | ||
* Run the plugin. | ||
* Run Genesis Header Nav plugin. | ||
* | ||
* @since 1.3.1 | ||
* @since 2.0.0 | ||
*/ | ||
function genesis_header_nav_run() { | ||
Genesis_Header_Nav::get_instance(); | ||
$plugin = get_plugin(); | ||
$plugin->run(); | ||
} |
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 |
---|---|---|
|
@@ -2,30 +2,22 @@ | |
/** | ||
* Genesis Header Nav | ||
* | ||
* @package GenesisHeaderNav | ||
* @author Gary Jones <[email protected]> | ||
* @package Genesis_Header_Nav | ||
* @author Gary Jones | ||
* @license GPL-2.0+ | ||
* @link https://github.com/GaryJones/genesis-header-nav | ||
* @copyright 2013 Gary Jones, Gamajo Tech | ||
*/ | ||
|
||
namespace Gamajo\GenesisHeaderNav; | ||
|
||
/** | ||
* Plugin class. | ||
* | ||
* @package GenesisHeaderNav | ||
* @author Gary Jones <[email protected]> | ||
* @package Genesis_Header_Nav | ||
* @author Gary Jones | ||
*/ | ||
class Genesis_Header_Nav { | ||
|
||
/** | ||
* Instance of this class. | ||
* | ||
* @since 1.0.0 | ||
* | ||
* @var object | ||
*/ | ||
protected static $instance = null; | ||
|
||
class Plugin { | ||
/** | ||
* Initialize the plugin by setting localization, filters, and administration functions. | ||
* | ||
|
@@ -35,49 +27,19 @@ class Genesis_Header_Nav { | |
* | ||
* @since 1.0.0 | ||
*/ | ||
private function __construct() { | ||
add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ) ); | ||
public function run() { | ||
add_action( 'init', array( $this, 'register_nav_menu' ) ); | ||
add_action( 'genesis_header', array( $this, 'show_menu' ), apply_filters( 'genesis_header_nav_priority', 12 ) ); | ||
add_filter( 'body_class', array( $this, 'body_classes' ), 15 ); | ||
} | ||
|
||
/** | ||
* Return an instance of this class. | ||
* | ||
* @since 1.0.0 | ||
* | ||
* @return object A single instance of this class. | ||
*/ | ||
public static function get_instance() { | ||
// If the single instance hasn't been set, set it now. | ||
if ( null == self::$instance ) { | ||
self::$instance = new self; | ||
} | ||
|
||
return self::$instance; | ||
} | ||
|
||
/** | ||
* Load the plugin text domain for translation. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
public function load_plugin_textdomain() { | ||
$domain = 'genesis-header-nav'; | ||
$locale = apply_filters( 'plugin_locale', get_locale(), $domain ); | ||
|
||
load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' ); | ||
load_plugin_textdomain( $domain, FALSE, basename( dirname( __FILE__ ) ) . '/languages' ); | ||
} | ||
|
||
/** | ||
* Register the menu location. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
public function register_nav_menu() { | ||
register_nav_menus( array( 'header' => __( 'Header', 'genesis-header-nav' ) ) ); | ||
register_nav_menu( 'header', __( 'Header', 'genesis-header-nav' ) ); | ||
} | ||
|
||
/** | ||
|
@@ -129,5 +91,4 @@ public function body_classes( array $classes ) { | |
|
||
return $classes; | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -2,11 +2,11 @@ | |
# This file is distributed under the GPL-2.0+. | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Genesis Header Nav v1.3.0\n" | ||
"POT-Creation-Date: 2014-10-30 00:13:00+0000\n" | ||
"PO-Revision-Date: 2014-10-30 00:13:00+0000\n" | ||
"Project-Id-Version: Genesis Header Nav v2.0.0\n" | ||
"POT-Creation-Date: 2014-11-12 22:13:00+0000\n" | ||
"PO-Revision-Date: 2014-11-12 22:13:00+0000\n" | ||
"Report-Msgid-Bugs-To: https://github.com/GaryJones/genesis-header-nav/issues \n" | ||
"Last-Translator: Gary Jones <[email protected]>\n" | ||
"Last-Translator: Gary Jones\n" | ||
"Language-Team: English https://github.com/GaryJones/genesis-header-nav \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
|
@@ -22,6 +22,6 @@ msgstr "" | |
"X-Poedit-SearchPath-0: .\n" | ||
"X-Textdomain-Support: yes" | ||
|
||
#: class-genesis-header-nav.php:76 | ||
#: includes/class-genesis-header-nav.php:42 | ||
msgid "Header" | ||
msgstr "" |