Unique Headers - Version 1.3.11

Version Description

Download this release

Release Info

Developer ryanhellyer
Plugin Icon wp plugin Unique Headers
Version 1.3.11
Comparing to
See all releases

Code changes from version 1.3.10 to 1.3.11

Files changed (2) hide show
  1. index.php +63 -42
  2. readme.txt +3 -2
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Unique Headers
4
  Plugin URI: https://geek.hellyer.kiwi/plugins/unique-headers/
5
  Description: Unique Headers
6
- Version: 1.3.10
7
  Author: Ryan Hellyer
8
  Author URI: https://geek.hellyer.kiwi/
9
  Text Domain: unique-headers
@@ -54,55 +54,76 @@ require( 'inc/legacy.php' );
54
 
55
 
56
  /**
57
- * Instantiate classes
58
- *
59
- * @since 1.3
 
60
  * @author Ryan Hellyer <ryanhellyer@gmail.com>
 
61
  */
62
- function unique_headers_instantiate_classes() {
63
-
64
- $name = 'custom-header-image'; // This says "custom-header" instead of "unique-header" to ensure compatibilty with Justin Tadlock's Custom Header Extended plugin which originally used a different post meta key value than the Unique Headers plugin
65
- $args = array(
66
- 'name' => $name,
67
- 'dir_uri' => plugin_dir_url( __FILE__ ) . 'assets',
68
- 'title' => __( 'Custom header', 'unique-headers' ),
69
- 'set_custom_image' => __( 'Set Custom Header Image', 'unique-headers' ),
70
- 'remove_custom_image' => __( 'Remove Custom Header Image', 'unique-headers' ),
71
- 'post_types' => apply_filters( 'unique_headers_post_types', array( 'post', 'page' ) ),
72
- );
73
-
74
- // Add support for post-types
75
- if ( is_admin() ) {
76
- new Custom_Image_Meta_Box( $args );
77
- } else {
78
- new Unique_Headers_Display( array( 'name' => $name ) );
79
  }
80
 
81
- // Add support for taxonomies
82
- if ( function_exists( 'get_term_meta' ) ) {
83
- $args['taxonomies'] = apply_filters( 'unique_headers_taxonomies', array( 'category', 'post_tag' ) );
84
- $args['upload_header_image'] = __( 'Upload header image', 'unique-headers' );
85
 
86
- new Unique_Header_Taxonomy_Header_Images( $args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
 
89
- }
90
- add_action( 'plugins_loaded', 'unique_headers_instantiate_classes' );
 
 
 
 
91
 
92
- /*
93
- * Setup localization for translations
94
- *
95
- * @since 1.3
96
- * @author Ryan Hellyer <ryanhellyer@gmail.com>
97
- */
98
- function unique_headers_localization() {
99
 
100
- // Localization
101
- load_plugin_textdomain(
102
- 'unique-headers', // Unique identifier
103
- false, // Deprecated abs path
104
- dirname( plugin_basename( __FILE__ ) ) . '/languages/' // Languages folder
105
- );
106
 
107
  }
108
- unique_headers_localization();
3
  Plugin Name: Unique Headers
4
  Plugin URI: https://geek.hellyer.kiwi/plugins/unique-headers/
5
  Description: Unique Headers
6
+ Version: 1.3.11
7
  Author: Ryan Hellyer
8
  Author URI: https://geek.hellyer.kiwi/
9
  Text Domain: unique-headers
54
 
55
 
56
  /**
57
+ * Add a custom image meta box
58
+ *
59
+ * @copyright Copyright (c), Ryan Hellyer
60
+ * @license http://www.gnu.org/licenses/gpl.html GPL
61
  * @author Ryan Hellyer <ryanhellyer@gmail.com>
62
+ * @since 1.3
63
  */
64
+ class Unique_Headers_Instantiate {
65
+
66
+ /**
67
+ * Class constructor
68
+ * Adds methods to appropriate hooks
69
+ *
70
+ * @since 1.3.10
71
+ */
72
+ public function __construct() {
73
+ add_action( 'plugins_loaded', array( $this, 'localization' ), 5 );
74
+ add_action( 'plugins_loaded', array( $this, 'instantiate_classes' ) );
 
 
 
 
 
 
75
  }
76
 
 
 
 
 
77
 
78
+ /**
79
+ * Instantiate classes
80
+ *
81
+ * @since 1.3
82
+ */
83
+ public function instantiate_classes() {
84
+
85
+ $name = 'custom-header-image'; // This says "custom-header" instead of "unique-header" to ensure compatibilty with Justin Tadlock's Custom Header Extended plugin which originally used a different post meta key value than the Unique Headers plugin
86
+ $args = array(
87
+ 'name' => $name,
88
+ 'dir_uri' => plugin_dir_url( __FILE__ ) . 'assets',
89
+ 'title' => __( 'Custom header', 'unique-headers' ),
90
+ 'set_custom_image' => __( 'Set Custom Header Image', 'unique-headers' ),
91
+ 'remove_custom_image' => __( 'Remove Custom Header Image', 'unique-headers' ),
92
+ 'post_types' => apply_filters( 'unique_headers_post_types', array( 'post', 'page' ) ),
93
+ );
94
+
95
+ // Add support for post-types
96
+ if ( is_admin() ) {
97
+ new Custom_Image_Meta_Box( $args );
98
+ } else {
99
+ new Unique_Headers_Display( array( 'name' => $name ) );
100
+ }
101
+
102
+ // Add support for taxonomies
103
+ if ( function_exists( 'get_term_meta' ) ) {
104
+ $args['taxonomies'] = apply_filters( 'unique_headers_taxonomies', array( 'category', 'post_tag' ) );
105
+ $args['upload_header_image'] = __( 'Upload header image', 'unique-headers' );
106
+
107
+ new Unique_Header_Taxonomy_Header_Images( $args );
108
+ }
109
+
110
  }
111
 
112
+ /*
113
+ * Setup localization for translations
114
+ *
115
+ * @since 1.3
116
+ */
117
+ public function localization() {
118
 
119
+ // Localization
120
+ load_plugin_textdomain(
121
+ 'unique-headers', // Unique identifier
122
+ false, // Deprecated abs path
123
+ dirname( plugin_basename( __FILE__ ) ) . '/languages/' // Languages folder
124
+ );
 
125
 
126
+ }
 
 
 
 
 
127
 
128
  }
129
+ new Unique_Headers_Instantiate;
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Unique Headers ===
2
  Contributors: ryanhellyer
3
- Tags: custom-header, header, headers, image, header-image, header-images, taxonomy, tag, category, posts, pages, taxonomies, post, page, unique, custom
4
  Donate link: https://geek.hellyer.kiwi/donate/
5
  Requires at least: 4.1
6
  Tested up to: 4.2
7
- Stable tag: 1.3.10
8
 
9
 
10
 
@@ -128,6 +128,7 @@ No, I'm too busy. Having said that, if you are willing to pay me a small fortune
128
 
129
  == Changelog ==
130
 
 
131
  Version 1.3.10: Added Deutsch (German) language translation.
132
  Version 1.3.9: Fixing error which caused header images to disappear on upgrading (data was still available just not accessed correctly).<br />
133
  Version 1.3.8: Modification translation system to work with changes on WordPress.org.<br />
1
  === Unique Headers ===
2
  Contributors: ryanhellyer
3
+ Tags: custom-header, header, headers, images, page, post, plugin, image, images, categories, gallery, media, header-image, header-images, taxonomy, tag, category, posts, pages, taxonomies, post, page, unique, custom
4
  Donate link: https://geek.hellyer.kiwi/donate/
5
  Requires at least: 4.1
6
  Tested up to: 4.2
7
+ Stable tag: 1.3.11
8
 
9
 
10
 
128
 
129
  == Changelog ==
130
 
131
+ Version 1.3.11: Moved instantiation and localization code into a class.
132
  Version 1.3.10: Added Deutsch (German) language translation.
133
  Version 1.3.9: Fixing error which caused header images to disappear on upgrading (data was still available just not accessed correctly).<br />
134
  Version 1.3.8: Modification translation system to work with changes on WordPress.org.<br />