1
1
<?php
2
2
/**
3
3
* @package Ajax_Dropdowns
4
- * @version 0.9.5
4
+ * @version 0.9.6
5
5
*/
6
6
/*
7
7
Plugin Name: Ajax Dropdowns
8
8
Plugin URI: http://wordpress.org/plugins/ajax-dropdowns/
9
9
Description: Display a group of posts that can be switched using dropdowns.
10
10
Author: ThemeBoy
11
- Version: 0.9.5
11
+ Version: 0.9.6
12
12
Author URI: http://themeboy.com/
13
13
*/
14
14
@@ -36,7 +36,7 @@ public function __construct() {
36
36
add_action ( 'init ' , array ( $ this , 'register_post_type ' ) );
37
37
add_action ( 'init ' , array ( $ this , 'register_shortcode ' ) );
38
38
add_filter ( 'plugin_action_links_ ' . plugin_basename ( __FILE__ ), array ( $ this , 'action_links ' ) );
39
- add_action ( 'wp_enqueue_scripts ' , array ( $ this , 'styles ' ) );
39
+ add_action ( 'wp_enqueue_scripts ' , array ( $ this , 'scripts ' ) );
40
40
add_action ( 'admin_head ' , array ( $ this , 'menu_highlight ' ) );
41
41
add_action ( 'admin_enqueue_scripts ' , array ( $ this , 'admin_scripts ' ) );
42
42
add_action ( 'add_meta_boxes ' , array ( $ this , 'add_meta_boxes ' ), 10 );
@@ -51,7 +51,7 @@ public function __construct() {
51
51
*/
52
52
private function define_constants () {
53
53
if ( !defined ( 'AJAX_DROPDOWNS_VERSION ' ) )
54
- define ( 'AJAX_DROPDOWNS_VERSION ' , '0.9.5 ' );
54
+ define ( 'AJAX_DROPDOWNS_VERSION ' , '0.9.6 ' );
55
55
56
56
if ( !defined ( 'AJAX_DROPDOWNS_URL ' ) )
57
57
define ( 'AJAX_DROPDOWNS_URL ' , plugin_dir_url ( __FILE__ ) );
@@ -74,10 +74,10 @@ public function init() {
74
74
* Note: the first-loaded translation file overrides any following ones if the same translation is present
75
75
*/
76
76
public static function load_plugin_textdomain () {
77
- $ locale = apply_filters ( 'plugin_locale ' , get_locale (), ' ajaxd ' ) ;
77
+ $ locale = apply_filters ( 'plugin_locale ' , get_locale (), ajax-dropdowns ;
78
78
79
79
// Global + Frontend Locale
80
- load_plugin_textdomain ( 'ajaxd ' , false , plugin_basename ( dirname ( __FILE__ ) . "/languages " ) );
80
+ load_plugin_textdomain ( 'ajax-dropdowns ' , false , plugin_basename ( dirname ( __FILE__ ) . "/languages " ) );
81
81
}
82
82
83
83
/**
@@ -88,7 +88,7 @@ public static function load_plugin_textdomain() {
88
88
*/
89
89
public function action_links ( $ links ) {
90
90
return array_merge ( array (
91
- '<a href=" ' . admin_url ( 'edit.php?post_type=ajax_dropdown ' ) . '"> ' . __ ( 'Manage ' , ' ajaxd ' ) . '</a> ' ,
91
+ '<a href=" ' . admin_url ( 'edit.php?post_type=ajax_dropdown ' ) . '"> ' . __ ( 'Manage ' , ajax-dropdowns . '</a> ' ,
92
92
), $ links );
93
93
}
94
94
@@ -99,15 +99,15 @@ public static function register_post_type() {
99
99
register_post_type( 'ajax_dropdown ' ,
100
100
array(
101
101
'labels ' => array(
102
- 'name ' => __ ( 'Dropdowns ' , ' ajaxd ' ) ,
103
- 'singular_name ' => __ ( 'Dropdown ' , ' ajaxd ' ) ,
104
- 'add_new_item ' => __ ( 'Add New Dropdown ' , ' ajaxd ' ) ,
105
- 'edit_item ' => __ ( 'Edit Dropdown ' , ' ajaxd ' ) ,
106
- 'new_item ' => __ ( 'New Dropdown ' , ' ajaxd ' ) ,
107
- 'view_item ' => __ ( 'View Dropdown ' , ' ajaxd ' ) ,
108
- 'search_items ' => __ ( 'Search Dropdowns ' , ' ajaxd ' ) ,
109
- 'not_found ' => __ ( 'No dropdowns found. ' , ' ajaxd ' ) ,
110
- 'not_found_in_trash ' => __ ( 'No dropdowns found in trash. ' , ' ajaxd ' ) ,
102
+ 'name ' => __( 'Dropdowns ' , ajax-dropdowns ,
103
+ 'singular_name ' => __( 'Dropdown ' , ajax-dropdowns ,
104
+ 'add_new_item ' => __( 'Add New Dropdown ' , ajax-dropdowns ,
105
+ 'edit_item ' => __( 'Edit Dropdown ' , ajax-dropdowns ,
106
+ 'new_item ' => __( 'New Dropdown ' , ajax-dropdowns ,
107
+ 'view_item ' => __( 'View Dropdown ' , ajax-dropdowns ,
108
+ 'search_items ' => __ ( 'Search Dropdowns ' , ajax-dropdowns ,
109
+ 'not_found ' => __ ( 'No dropdowns found. ' , ajax-dropdowns ,
110
+ 'not_found_in_trash ' => __ ( 'No dropdowns found in trash. ' , ajax-dropdowns ,
111
111
),
112
112
'public ' => false,
113
113
'show_ui ' => true,
@@ -134,9 +134,10 @@ public function register_shortcode() {
134
134
}
135
135
136
136
/**
137
- * Enqueue styles
137
+ * Enqueue scripts
138
138
*/
139
- public static function styles () {
139
+ public static function scripts () {
140
+ wp_enqueue_script ( 'jquery ' );
140
141
wp_enqueue_style ( 'ajaxd-styles ' , AJAX_DROPDOWNS_URL . '/assets/css/ajaxd.css ' , array (), AJAX_DROPDOWNS_VERSION );
141
142
}
142
143
@@ -155,7 +156,7 @@ public static function menu_highlight() {
155
156
}
156
157
157
158
/**
158
- * Enqueue admin styles
159
+ * Enqueue admin scripts
159
160
*/
160
161
public static function admin_scripts () {
161
162
$ screen = get_current_screen ();
@@ -173,9 +174,9 @@ public static function admin_scripts() {
173
174
* Add meta boxes
174
175
*/
175
176
public function add_meta_boxes () {
176
- add_meta_box ( 'ajaxd_postsdiv ' , __ ( 'Posts ' , ' ajaxd ' ) , array ( $ this , 'posts_meta_box ' ), 'ajax_dropdown ' , 'advanced ' , 'high ' );
177
- add_meta_box ( 'ajaxd_methoddiv ' , __ ( 'Method ' , ' ajaxd ' ) , array ( $ this , 'method_meta_box ' ), 'ajax_dropdown ' , 'side ' , 'default ' );
178
- add_meta_box ( 'ajaxd_shortcodediv ' , __ ( 'Shortcode ' , ' ajaxd ' ) , array ( $ this , 'shortcode_meta_box ' ), 'ajax_dropdown ' , 'side ' , 'default ' );
177
+ add_meta_box( 'ajaxd_postsdiv', __ ( 'Posts ' , ajax-dropdowns , array ( $ this , 'posts_meta_box ' ), 'ajax_dropdown ' , 'advanced ' , 'high ' );
178
+ add_meta_box( 'ajaxd_methoddiv ' , __ ( 'Method ' , ajax-dropdowns , array ( $ this , 'method_meta_box ' ), 'ajax_dropdown ' , 'side ' , 'default ' );
179
+ add_meta_box( 'ajaxd_shortcodediv ' , __ ( 'Shortcode ' , ajax-dropdowns , array ( $ this , 'shortcode_meta_box ' ), 'ajax_dropdown ' , 'side ' , 'default ' );
179
180
}
180
181
181
182
/**
@@ -186,7 +187,7 @@ public static function posts_meta_box( $post, $args ) {
186
187
$ ajax_posts = get_post_meta ( $ post ->ID , 'ajax_post ' );
187
188
?>
188
189
<p>
189
- <select name="add_ajax_post" id="add_ajax_post" class="postform ajaxd-posts chosen-select<?php if ( is_rtl () ): ?> chosen-rtl<?php endif ; ?> " data-placeholder="<?php _e ( 'Add a post to this dropdown ' , ' ajaxd ' ) ; ?> ">
190
+ <select name="add_ajax_post" id="add_ajax_post" class="postform ajaxd-posts chosen-select<?php if ( is_rtl () ): ?> chosen-rtl<?php endif ; ?> " data-placeholder="<?php _e( 'Add a post to this dropdown ' , ajax-dropdowns ; ?> ">
190
191
<option value=""></option>
191
192
<?php
192
193
foreach ( $ post_types as $ post_type ):
@@ -197,7 +198,7 @@ public static function posts_meta_box( $post, $args ) {
197
198
?>
198
199
<optgroup label="<?php echo $ object ->labels ->name ; ?> ">
199
200
<?php
200
- printf ( '<option value="%s" data-post-type="%s">%s</option> ' , 0 , $ object ->labels ->singular_name , sprintf ( __ ( '— Add All %1$s (%2$s) — ' , ' ajaxd ' ) , $ object ->labels ->name , sizeof ( $ posts ) ) );
201
+ printf( '<option value="%s" data-post-type="%s">%s</option> ' , 0 , $ object ->labels ->singular_name , sprintf ( __ ( '— Add All %1$s (%2$s) — ' , ajax-dropdowns , $ object ->labels ->name , sizeof ( $ posts ) ) );
201
202
foreach ( $ posts as $ post ):
202
203
printf ( '<option value="%s" data-post-type="%s">%s</option> ' , $ post ->ID , $ object ->labels ->singular_name , $ post ->post_title );
203
204
endforeach ;
@@ -213,16 +214,16 @@ public static function posts_meta_box( $post, $args ) {
213
214
<thead>
214
215
<tr>
215
216
<th style="width:1px;"> </th>
216
- <th><?php _e ( 'Title ' , ' ajaxd ' ) ; ?> </th>
217
- <th style="width:20%;"><?php _e ( 'Post Type ' , ' ajaxd ' ) ; ?> </th>
217
+ <th><?php _e ( 'Title ' , ajax-dropdowns ; ?> </th>
218
+ <th style="width:20%;"><?php _e ( 'Post Type ' , ajax-dropdowns ; ?> </th>
218
219
<th style="width:1px;"> </th>
219
220
</tr>
220
221
</thead>
221
222
<tbody>
222
223
<tr class="ajaxd-placeholder"<?php if ( sizeof ( $ ajax_posts ) ): ?> style="display:none;"<?php endif ; ?> >
223
224
<td colspan="4">
224
- <?php _e ( 'No posts found. ' , ' ajaxd ' ) ; ?>
225
- <?php _e ( 'Use the menu above to add a post to this dropdown. ' , ' ajaxd ' ) ; ?>
225
+ <?php _e ( 'No posts found. ' , ajax-dropdowns ; ?>
226
+ <?php _e ( 'Use the menu above to add a post to this dropdown. ' , ajax-dropdowns ; ?>
226
227
</td>
227
228
</tr>
228
229
<?php if ( sizeof ( $ ajax_posts ) ): foreach ( $ ajax_posts as $ post_id ): ?>
@@ -236,11 +237,11 @@ public static function posts_meta_box( $post, $args ) {
236
237
</tbody>
237
238
</table>
238
239
<p class="howto">
239
- <?php _e ( 'Drag and drop to reorder posts. ' , ' ajaxd ' ) ; ?>
240
+ <?php _e ( 'Drag and drop to reorder posts. ' , ajax-dropdowns ; ?>
240
241
</p>
241
242
<p>
242
243
<a href="http://wordpress.org/support/view/plugin-reviews/ajax-dropdowns?rate=5#postform">
243
- <?php _e ( 'Love Ajax Dropdowns? Help spread the word by rating us 5★ on WordPress.org ' , ' ajaxd ' ) ; ?>
244
+ <?php _e ( 'Love Ajax Dropdowns? Help spread the word by rating us 5★ on WordPress.org ' , ajax-dropdowns ; ?>
244
245
</a>
245
246
</p>
246
247
<?php
@@ -252,7 +253,7 @@ public static function posts_meta_box( $post, $args ) {
252
253
public static function shortcode_meta_box ( $ post ) {
253
254
?>
254
255
<p class="howto">
255
- <?php _e ( 'Copy this code and paste it into your post, page or text widget content. ' , ' ajaxd ' ) ; ?>
256
+ <?php _e ( 'Copy this code and paste it into your post, page or text widget content. ' , ajax-dropdowns ; ?>
256
257
</p>
257
258
<p><input type="text" value="[ajax_dropdown <?php echo $ post ->ID ; ?> ]" readonly="readonly" class="code"></p>
258
259
<?php
@@ -265,10 +266,10 @@ public static function method_meta_box( $post, $args ) {
265
266
wp_nonce_field( 'ajaxd_save_data', 'ajaxd_meta_nonce ' );
266
267
$ method = get_post_meta ( $ post ->ID , 'ajaxd_method ' , true );
267
268
$ no_content = get_post_meta ( $ post ->ID , 'ajaxd_no_content ' , true ) == 'yes ' ? true : false ;
268
- $ method_options = array ( 'ajax ' => __ ( 'Ajax ' , ' ajaxd ' ) , 'inline ' => __ ( 'Inline ' , ' ajaxd ' ) , 'parameter ' => __ ( 'URL Parameter ' , ' ajaxd ' ) , 'redirect ' => __ ( 'Redirect ' , ' ajaxd ' ) );
269
+ $ method_options = array ( 'ajax ' => __ ( 'Ajax ' , ajax-dropdowns , 'inline ' => __ ( 'Inline ' , ajax-dropdowns , 'parameter ' => __ ( 'URL Parameter ' , ajax-dropdowns , 'redirect ' => __ ( 'Redirect ' , ajax-dropdowns );
269
270
?>
270
271
<p class="howto">
271
- <?php _e ( 'Select the method to query posts. ' , ' ajaxd ' ) ; ?>
272
+ <?php _e ( 'Select the method to query posts. ' , ajax-dropdowns ; ?>
272
273
</p>
273
274
<p>
274
275
<select name="ajaxd_method" id="ajaxd_method" class="postform ajaxd-method widefat">
@@ -283,7 +284,7 @@ public static function method_meta_box( $post, $args ) {
283
284
<label>
284
285
<input type="hidden" name="ajaxd_no_content" value="no">
285
286
<input type="checkbox" name="ajaxd_no_content" class="ajaxd-no-content" value="yes" <?php checked ( $ no_content ); ?> >
286
- <?php _e ( 'Dropdown only (no content) ' , ' ajaxd ' ) ; ?>
287
+ <?php _e ( 'Dropdown only (no content) ' , ajax-dropdowns ; ?>
287
288
</label>
288
289
</p>
289
290
<?php
@@ -328,7 +329,7 @@ public static function post_updated_messages( $messages ) {
328
329
329
330
if ( 'ajax_dropdown ' == $ typenow ):
330
331
for ( $ i = 0 ; $ i <= 10 ; $ i ++ ):
331
- $ messages ['post ' ][ $ i ] = '<strong> ' . __ ( 'Settings saved. ' , ' ajaxd ' ) . '</strong> ' ;
332
+ $ messages ['post ' ][ $ i ] = '<strong> ' . __ ( 'Settings saved. ' , ajax-dropdowns . '</strong> ' ;
332
333
endfor ;
333
334
endif ;
334
335
0 commit comments