Projects by WooThemes - Version 1.2.2

Version Description

  • 2014-06-06
  • Tweak - Product linking label now includes sku / id.
  • Tweak - Widgets now called via a single function and other minor refactoring.
  • Tweak - Project Category taxonomy names filterable. (Props @abouolia)
  • Fix - Reset post data in projects widget.
Download this release

Release Info

Developer jameskoster
Plugin Icon wp plugin Projects by WooThemes
Version 1.2.2
Comparing to
See all releases

Code changes from version 1.2.1 to 1.2.2

classes/class-projects-integrations.php CHANGED
@@ -89,7 +89,10 @@ class Projects_Integrations {
89
 
90
  if ( $testimonials ) {
91
  foreach ( $testimonials as $testimonial ) {
92
- $found_testimonials[] = array( 'id' => $testimonial->ID, 'title' => $testimonial->post_title );
 
 
 
93
  }
94
  }
95
 
@@ -200,7 +203,7 @@ class Projects_Integrations {
200
  } // End projects_woocommerce_init()
201
 
202
  public function woocommerce_admin_scripts () {
203
- wp_enqueue_script( 'jquery-ui-autocomplete', null, array( 'jquery' ), null, false);
204
  } // End projects_woocommerce_admin_scripts()
205
 
206
  /**
@@ -210,12 +213,11 @@ class Projects_Integrations {
210
  * @return json Search Results.
211
  */
212
  public function get_products_callback() {
213
-
214
  check_ajax_referer( 'projects_ajax_get_products', 'security' );
215
 
216
  $term = urldecode( stripslashes( strip_tags( $_GET['term'] ) ) );
217
 
218
- if ( !empty( $term ) ) {
219
 
220
  header( 'Content-Type: application/json; charset=utf-8' );
221
 
@@ -231,13 +233,26 @@ class Projects_Integrations {
231
  $found_products = array();
232
 
233
  if ( $products ) {
 
234
  foreach ( $products as $product ) {
235
- $found_products[] = array( 'id' => $product->ID, 'title' => $product->post_title );
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  }
237
  }
238
 
239
  echo json_encode( $found_products );
240
-
241
  }
242
 
243
  die();
@@ -274,7 +289,7 @@ class Projects_Integrations {
274
  success: function( data ) {
275
  response( jQuery.map( data, function( item ) {
276
  return {
277
- label: item.title,
278
  value: item.id
279
  }
280
  }));
89
 
90
  if ( $testimonials ) {
91
  foreach ( $testimonials as $testimonial ) {
92
+ $found_testimonials[] = array(
93
+ 'id' => $testimonial->ID,
94
+ 'title' => $testimonial->post_title
95
+ );
96
  }
97
  }
98
 
203
  } // End projects_woocommerce_init()
204
 
205
  public function woocommerce_admin_scripts () {
206
+ wp_enqueue_script( 'jquery-ui-autocomplete', null, array( 'jquery' ), null, false );
207
  } // End projects_woocommerce_admin_scripts()
208
 
209
  /**
213
  * @return json Search Results.
214
  */
215
  public function get_products_callback() {
 
216
  check_ajax_referer( 'projects_ajax_get_products', 'security' );
217
 
218
  $term = urldecode( stripslashes( strip_tags( $_GET['term'] ) ) );
219
 
220
+ if ( ! empty( $term ) ) {
221
 
222
  header( 'Content-Type: application/json; charset=utf-8' );
223
 
233
  $found_products = array();
234
 
235
  if ( $products ) {
236
+
237
  foreach ( $products as $product ) {
238
+
239
+ $_product = new WC_Product( $product->ID );
240
+
241
+ if ( $_product->get_sku() ) {
242
+ $identifier = $_product->get_sku();
243
+ } else {
244
+ $identifier = '#' . $_product->id;
245
+ }
246
+
247
+ $found_products[] = array(
248
+ 'id' => $product->ID,
249
+ 'title' => $product->post_title,
250
+ 'identifier' => $identifier,
251
+ );
252
  }
253
  }
254
 
255
  echo json_encode( $found_products );
 
256
  }
257
 
258
  die();
289
  success: function( data ) {
290
  response( jQuery.map( data, function( item ) {
291
  return {
292
+ label: item.identifier + ' – ' + item.title,
293
  value: item.id
294
  }
295
  }));
classes/class-projects-taxonomy.php CHANGED
@@ -65,8 +65,8 @@ class Projects_Taxonomy {
65
  public function __construct ( $token = 'project-category', $singular = '', $plural = '', $args = array() ) {
66
  $this->post_type = 'project';
67
  $this->token = esc_attr( $token );
68
- $this->singular = esc_html( $singular );
69
- $this->plural = esc_html( $plural );
70
 
71
  if ( '' == $this->singular ) $this->singular = __( 'Category', 'projects-by-woothemes' );
72
  if ( '' == $this->plural ) $this->plural = __( 'Categories', 'projects-by-woothemes' );
@@ -125,4 +125,4 @@ class Projects_Taxonomy {
125
  $args = apply_filters( 'projects_register_taxonomy', $this->args );
126
  register_taxonomy( esc_attr( $this->token ), esc_attr( $this->post_type ), (array) $args );
127
  } // End register()
128
- } // End Class
65
  public function __construct ( $token = 'project-category', $singular = '', $plural = '', $args = array() ) {
66
  $this->post_type = 'project';
67
  $this->token = esc_attr( $token );
68
+ $this->singular = apply_filters( 'projects_taxonomy_' . $this->token . '_singular_name', esc_html($singular) );
69
+ $this->plural = apply_filters( 'projects_taxonomy_' . $this->token . '_plural_name', esc_html($plural) );
70
 
71
  if ( '' == $this->singular ) $this->singular = __( 'Category', 'projects-by-woothemes' );
72
  if ( '' == $this->plural ) $this->plural = __( 'Categories', 'projects-by-woothemes' );
125
  $args = apply_filters( 'projects_register_taxonomy', $this->args );
126
  register_taxonomy( esc_attr( $this->token ), esc_attr( $this->post_type ), (array) $args );
127
  } // End register()
128
+ } // End Class
classes/class-projects.php DELETED
@@ -1,402 +0,0 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
3
-
4
- /**
5
- * WooThemes Projects Class
6
- *
7
- * All functionality pertaining to the projects.
8
- *
9
- * @package WordPress
10
- * @subpackage Projects
11
- * @category Plugin
12
- * @author Matty
13
- * @since 1.0.0
14
- */
15
- class Projects {
16
- private $dir;
17
- private $assets_dir;
18
- private $assets_url;
19
- private $token;
20
- private $post_type;
21
- private $file;
22
- public $singular_name;
23
- public $plural_name;
24
- public $taxonomy_category;
25
-
26
- public $template_url;
27
-
28
- public $admin;
29
- public $frontend;
30
-
31
- /**
32
- * @var string
33
- */
34
- public $version = '1.2.0';
35
-
36
- /**
37
- * Constructor function.
38
- *
39
- * @access public
40
- * @since 1.0.0
41
- * @return void
42
- */
43
- public function __construct( $file ) {
44
- $this->dir = dirname( $file );
45
- $this->file = $file;
46
- $this->assets_dir = trailingslashit( $this->dir ) . 'assets';
47
- $this->assets_url = esc_url( trailingslashit( plugins_url( '/assets/', $file ) ) );
48
- $this->token = 'projects';
49
- $this->post_type = 'project';
50
-
51
- // Variables
52
- $this->template_url = apply_filters( 'projects_template_url', 'projects/' );
53
-
54
- $this->load_plugin_textdomain();
55
- add_action( 'init', array( $this, 'load_localisation' ), 0 );
56
-
57
- // Define constants
58
- $this->define_constants();
59
-
60
- // Run this on activation.
61
- register_activation_hook( $this->file, array( $this, 'activation' ) );
62
-
63
- // Run this on deactivation.
64
- register_deactivation_hook( $this->file, array( $this, 'deactivation' ) );
65
-
66
- add_action( 'init', array( $this, 'post_type_names' ) );
67
- add_action( 'init', array( $this, 'register_rewrite_tags' ) );
68
- add_action( 'init', array( $this, 'register_post_type' ) );
69
- add_action( 'init', array( $this, 'register_taxonomy' ) );
70
-
71
- add_action( 'after_setup_theme', array( $this, 'ensure_post_thumbnails_support' ) );
72
- add_action( 'after_setup_theme', array( $this, 'register_image_sizes' ) );
73
-
74
- if ( is_admin() ) {
75
- require_once( 'class-projects-admin.php' );
76
- $this->admin = new Projects_Admin( $file );
77
- } else {
78
- require_once( 'class-projects-frontend.php' );
79
- $this->frontend = new Projects_Frontend( $file );
80
- }
81
-
82
- } // End __construct()
83
-
84
- /**
85
- * Register custom rewrite tags.
86
- * @access public
87
- * @since 1.0.0
88
- * @return void
89
- */
90
- public function register_rewrite_tags () {
91
- add_rewrite_tag( '%project_category%','([^&]+)' );
92
- } // End register_rewrite_tags()
93
-
94
- /**
95
- * Define Projects Constants
96
- */
97
- private function define_constants() {
98
- define( 'PROJECTS_PLUGIN_FILE', __FILE__ );
99
- define( 'PROJECTS_VERSION', $this->version );
100
- }
101
-
102
- /**
103
- * Change the UI names in the admin
104
- *
105
- * @access public
106
- * @since 1.1.0
107
- * @return void
108
- */
109
- public function post_type_names () {
110
- $this->singular_name = apply_filters( 'projects_post_type_singular_name', _x( 'Project', 'post type singular name', 'projects-by-woothemes' ) );
111
- $this->plural_name = apply_filters( 'projects_post_type_plural_name', _x( 'Projects', 'post type general name', 'projects-by-woothemes' ) );
112
- }
113
-
114
- /**
115
- * Register the post type.
116
- *
117
- * @access public
118
- * @return void
119
- */
120
- public function register_post_type () {
121
- $labels = array(
122
- 'name' => $this->plural_name,
123
- 'singular_name' => $this->singular_name,
124
- 'add_new' => _x( 'Add New', $this->post_type, 'projects-by-woothemes' ),
125
- 'add_new_item' => sprintf( __( 'Add New %s', 'projects-by-woothemes' ), $this->singular_name ),
126
- 'edit_item' => sprintf( __( 'Edit %s', 'projects-by-woothemes' ), $this->singular_name ),
127
- 'new_item' => sprintf( __( 'New %s', 'projects-by-woothemes' ), $this->singular_name ),
128
- 'all_items' => sprintf( _x( 'All %s', $this->post_type, 'projects-by-woothemes' ), $this->plural_name ),
129
- 'view_item' => sprintf( __( 'View %s', 'projects-by-woothemes' ), $this->singular_name ),
130
- 'search_items' => sprintf( __( 'Search %a', 'projects-by-woothemes' ), $this->plural_name ),
131
- 'not_found' => sprintf( __( 'No %s Found', 'projects-by-woothemes' ), $this->plural_name ),
132
- 'not_found_in_trash' => sprintf( __( 'No %s Found In Trash', 'projects-by-woothemes' ), $this->plural_name ),
133
- 'parent_item_colon' => '',
134
- 'menu_name' => $this->plural_name
135
-
136
- );
137
- $args = array(
138
- 'labels' => $labels,
139
- 'public' => true,
140
- 'publicly_queryable' => true,
141
- 'show_ui' => true,
142
- 'show_in_menu' => true,
143
- 'query_var' => true,
144
- 'rewrite' => array(
145
- 'slug' => trailingslashit ( strtolower( $this->singular_name ) ) . '%project_category%',
146
- 'with_front' => false
147
- ),
148
- 'capability_type' => 'post',
149
- 'has_archive' => ( $projects_page_id = projects_get_page_id( 'projects' ) ) && get_page( $projects_page_id ) ? get_page_uri( $projects_page_id ) : 'projects',
150
- 'hierarchical' => false,
151
- 'supports' => array(
152
- 'title',
153
- 'editor',
154
- 'thumbnail',
155
- 'excerpt'
156
- ),
157
- 'menu_position' => 5,
158
- 'menu_icon' => 'dashicons-portfolio'
159
- );
160
-
161
- $args = apply_filters( 'projects_register_post_type', $args );
162
-
163
- register_post_type( $this->post_type, (array) $args );
164
- } // End register_post_type()
165
-
166
- /**
167
- * Register the "project-category" taxonomy.
168
- * @access public
169
- * @since 1.3.0
170
- * @return void
171
- */
172
- public function register_taxonomy () {
173
- $this->taxonomy_category = new Projects_Taxonomy(); // Leave arguments empty, to use the default arguments.
174
- $this->taxonomy_category->register();
175
- } // End register_taxonomy()
176
-
177
- /**
178
- * Register image sizes.
179
- * @since 1.0.0
180
- * @return void
181
- */
182
- public function register_image_sizes () {
183
- if ( function_exists( 'add_image_size' ) ) {
184
-
185
- $options = get_option( 'projects' );
186
-
187
- $defaults = apply_filters( 'projects_default_image_size', array(
188
- 'project-archive' => array(
189
- 'width' => 300,
190
- 'height' => 300,
191
- 'crop' => 'no'
192
- ),
193
- 'project-single' => array(
194
- 'width' => 1024,
195
- 'height' => 1024,
196
- 'crop' => 'no'
197
- ),
198
- 'project-thumbnail' => array(
199
- 'width' => 100,
200
- 'height' => 100,
201
- 'crop' => 'yes'
202
- )
203
- ) );
204
-
205
- // Parse incomming $options into an array and merge it with $defaults
206
- $options = wp_parse_args( $options, $defaults );
207
-
208
- // Register each image size
209
- foreach ( $options as $image_size => $size ) {
210
- $crop = isset( $size['crop'] ) && 'yes' == $size['crop'] ? true : false;
211
- add_image_size( $image_size, $size['width'], $size['height'], $crop );
212
- }
213
-
214
- }
215
- } // End register_image_sizes()
216
-
217
- /**
218
- * Get projects.
219
- * @param string/array $args Arguments to be passed to the query.
220
- * @since 1.0.0
221
- * @return array/boolean Array if true, boolean if false.
222
- */
223
- public function get_projects ( $args = '' ) {
224
- $defaults = array(
225
- 'limit' => 5,
226
- 'orderby' => 'menu_order',
227
- 'order' => 'DESC',
228
- 'id' => 0
229
- );
230
-
231
- $args = wp_parse_args( $args, $defaults );
232
-
233
- // Allow child themes/plugins to filter here.
234
- $args = apply_filters( 'projects_get_projects_args', $args );
235
-
236
- // The Query Arguments.
237
- $query_args = array();
238
- $query_args['post_type'] = 'project';
239
- $query_args['numberposts'] = $args['limit'];
240
- $query_args['orderby'] = $args['orderby'];
241
- $query_args['order'] = $args['order'];
242
-
243
- if ( is_numeric( $args['id'] ) && ( intval( $args['id'] ) > 0 ) ) {
244
- $query_args['p'] = intval( $args['id'] );
245
- }
246
-
247
- // Whitelist checks.
248
- if ( ! in_array( $query_args['orderby'], array( 'none', 'ID', 'author', 'title', 'date', 'modified', 'parent', 'rand', 'comment_count', 'menu_order', 'meta_value', 'meta_value_num' ) ) ) {
249
- $query_args['orderby'] = 'date';
250
- }
251
-
252
- if ( ! in_array( $query_args['order'], array( 'ASC', 'DESC' ) ) ) {
253
- $query_args['order'] = 'DESC';
254
- }
255
-
256
- if ( ! in_array( $query_args['post_type'], get_post_types() ) ) {
257
- $query_args['post_type'] = 'project';
258
- }
259
-
260
- // The Query.
261
- $query = get_posts( $query_args );
262
-
263
- // The Display.
264
- if ( ! is_wp_error( $query ) && is_array( $query ) && count( $query ) > 0 ) {
265
- foreach ( $query as $k => $v ) {
266
- $meta = get_post_custom( $v->ID );
267
-
268
- // Get the image.
269
- $query[$k]->image = projects_get_image( $v->ID, $args['size'] );
270
-
271
- // Get the URL.
272
- if ( isset( $meta['_url'][0] ) && '' != $meta['_url'][0] ) {
273
- $query[$k]->url = esc_url( $meta['_url'][0] );
274
- } else {
275
- $query[$k]->url = get_permalink( $v->ID );
276
- }
277
- }
278
- } else {
279
- $query = false;
280
- }
281
-
282
- return $query;
283
- } // End get_projects()
284
-
285
- /**
286
- * Load the plugin's localisation file.
287
- * @access public
288
- * @since 1.0.0
289
- * @return void
290
- */
291
- public function load_localisation () {
292
- load_plugin_textdomain( 'projects-by-woothemes', false, dirname( plugin_basename( $this->file ) ) . '/lang/' );
293
- } // End load_localisation()
294
-
295
- /**
296
- * Load the plugin textdomain from the main WordPress "languages" folder.
297
- * @since 1.0.0
298
- * @return void
299
- */
300
- public function load_plugin_textdomain () {
301
- $domain = 'projects-by-woothemes';
302
- // The "plugin_locale" filter is also used in load_plugin_textdomain()
303
- $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
304
-
305
- load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' );
306
- load_plugin_textdomain( $domain, FALSE, dirname( plugin_basename( $this->file ) ) . '/lang/' );
307
- } // End load_plugin_textdomain()
308
-
309
- /**
310
- * Run on activation.
311
- * @access public
312
- * @since 1.0.0
313
- * @return void
314
- */
315
- public function activation () {
316
- $this->register_plugin_version();
317
-
318
- // Flush rewrite rules
319
- flush_rewrite_rules();
320
- } // End activation()
321
-
322
- /**
323
- * Run on deactivation.
324
- * @access public
325
- * @since 1.0.0
326
- * @return void
327
- */
328
- public function deactivation () {
329
- // Flush rewrite rules
330
- flush_rewrite_rules();
331
- } // End deactivation()
332
-
333
- /**
334
- * Register the plugin's version.
335
- * @access public
336
- * @since 1.0.0
337
- * @return void
338
- */
339
- private function register_plugin_version () {
340
- if ( $this->version != '' ) {
341
- update_option( 'projects' . '-version', $this->version );
342
- }
343
- } // End register_plugin_version()
344
-
345
- /**
346
- * Ensure that "post-thumbnails" support is available for those themes that don't register it.
347
- * @since 1.0.0
348
- * @return void
349
- */
350
- public function ensure_post_thumbnails_support () {
351
- if ( ! current_theme_supports( 'post-thumbnails' ) ) { add_theme_support( 'post-thumbnails' ); }
352
- } // End ensure_post_thumbnails_support()
353
-
354
- /**
355
- * Get the plugin url.
356
- * @access public
357
- * @since 1.0.0
358
- * @return string
359
- */
360
- public function plugin_url () {
361
- return untrailingslashit( plugins_url( '/', $this->file ) );
362
- } // End plugin_url()
363
-
364
-
365
- /**
366
- * Get the plugin path.
367
- * @access public
368
- * @since 1.0.0
369
- * @return string
370
- */
371
- public function plugin_path () {
372
- return untrailingslashit( plugin_dir_path( $this->file ) );
373
- } // End plugin_path()
374
-
375
-
376
- /**
377
- * Get an image size.
378
- *
379
- * Variable is filtered by projects_get_image_size_{image_size}
380
- *
381
- * @access public
382
- * @since 1.0.0
383
- * @param mixed $image_size
384
- * @return string
385
- */
386
- public function get_image_size ( $image_size ) {
387
- // Only return sizes we define in settings
388
- if ( ! in_array( $image_size, array( 'project-thumbnail', 'project-archive', 'project-single' ) ) )
389
- return apply_filters( 'projects_get_image_size_' . $image_size, '' );
390
-
391
- // Get image size from options
392
- $options = get_option( 'projects', array() );
393
- $size = $options[ $image_size ];
394
-
395
- $size['width'] = isset( $size['width'] ) ? $size['width'] : '300';
396
- $size['height'] = isset( $size['height'] ) ? $size['height'] : '300';
397
- $size['crop'] = isset( $size['crop'] ) ? $size['crop'] : 1;
398
-
399
- return apply_filters( 'projects_get_image_size_' . $image_size, $size );
400
- } // End get_image_size()
401
-
402
- } // End Class
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/class-widget-project-categories.php CHANGED
@@ -181,4 +181,4 @@ class Woothemes_Widget_Project_Categories extends WP_Widget {
181
  } // End Class
182
 
183
  /* Register the widget. */
184
- add_action( 'widgets_init', create_function( '', 'return register_widget( "Woothemes_Widget_Project_Categories" );' ), 1 );
181
  } // End Class
182
 
183
  /* Register the widget. */
184
+ register_widget( 'Woothemes_Widget_Project_Categories' );
classes/class-widget-projects.php CHANGED
@@ -133,6 +133,8 @@ class Woothemes_Widget_Projects extends WP_Widget {
133
  echo '</ul>';
134
 
135
  echo $after_widget;
 
 
136
  }
137
 
138
  // Add actions for plugins/themes to hook onto.
@@ -212,4 +214,4 @@ class Woothemes_Widget_Projects extends WP_Widget {
212
  } // End Class
213
 
214
  /* Register the widget. */
215
- add_action( 'widgets_init', create_function( '', 'return register_widget( "Woothemes_Widget_Projects" );' ), 1 );
133
  echo '</ul>';
134
 
135
  echo $after_widget;
136
+
137
+ wp_reset_postdata();
138
  }
139
 
140
  // Add actions for plugins/themes to hook onto.
214
  } // End Class
215
 
216
  /* Register the widget. */
217
+ register_widget( 'Woothemes_Widget_Projects' );
config.codekit CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "CodeKitInfo": "This is a CodeKit 2.x project configuration file. It is designed to sync project settings across multiple machines. MODIFYING THE CONTENTS OF THIS FILE IS A POOR LIFE DECISION. If you do so, you will likely cause CodeKit to crash. This file is not useful unless accompanied by the project that created it in CodeKit 2. This file is not backwards-compatible with CodeKit 1.x. For more information, see: http:\/\/incident57.com\/codekit",
3
- "creatorBuild": "16895",
4
  "files": {
5
  "\/assets\/css\/_mixins.scss": {
6
  "createSourceMap": 0,
@@ -155,15 +155,6 @@
155
  "outputPathIsOutsideProject": 0,
156
  "outputPathIsSetByUser": 0
157
  },
158
- "\/classes\/class-projects-integrations.php": {
159
- "fileType": 8192,
160
- "ignore": 0,
161
- "ignoreWasSetByUser": 0,
162
- "inputAbbreviatedPath": "\/classes\/class-projects-integrations.php",
163
- "outputAbbreviatedPath": "No Output Path",
164
- "outputPathIsOutsideProject": 0,
165
- "outputPathIsSetByUser": 0
166
- },
167
  "\/classes\/class-projects-settings.php": {
168
  "fileType": 8192,
169
  "ignore": 0,
@@ -182,15 +173,6 @@
182
  "outputPathIsOutsideProject": 0,
183
  "outputPathIsSetByUser": 0
184
  },
185
- "\/classes\/class-projects-taxonomy.php": {
186
- "fileType": 8192,
187
- "ignore": 0,
188
- "ignoreWasSetByUser": 0,
189
- "inputAbbreviatedPath": "\/classes\/class-projects-taxonomy.php",
190
- "outputAbbreviatedPath": "No Output Path",
191
- "outputPathIsOutsideProject": 0,
192
- "outputPathIsSetByUser": 0
193
- },
194
  "\/classes\/class-projects-template-loader.php": {
195
  "fileType": 8192,
196
  "ignore": 0,
@@ -200,33 +182,6 @@
200
  "outputPathIsOutsideProject": 0,
201
  "outputPathIsSetByUser": 0
202
  },
203
- "\/classes\/class-projects.php": {
204
- "fileType": 8192,
205
- "ignore": 0,
206
- "ignoreWasSetByUser": 0,
207
- "inputAbbreviatedPath": "\/classes\/class-projects.php",
208
- "outputAbbreviatedPath": "No Output Path",
209
- "outputPathIsOutsideProject": 0,
210
- "outputPathIsSetByUser": 0
211
- },
212
- "\/classes\/class-widget-project-categories.php": {
213
- "fileType": 8192,
214
- "ignore": 0,
215
- "ignoreWasSetByUser": 0,
216
- "inputAbbreviatedPath": "\/classes\/class-widget-project-categories.php",
217
- "outputAbbreviatedPath": "No Output Path",
218
- "outputPathIsOutsideProject": 0,
219
- "outputPathIsSetByUser": 0
220
- },
221
- "\/classes\/class-widget-projects.php": {
222
- "fileType": 8192,
223
- "ignore": 0,
224
- "ignoreWasSetByUser": 0,
225
- "inputAbbreviatedPath": "\/classes\/class-widget-projects.php",
226
- "outputAbbreviatedPath": "No Output Path",
227
- "outputPathIsOutsideProject": 0,
228
- "outputPathIsSetByUser": 0
229
- },
230
  "\/projects-core-functions.php": {
231
  "fileType": 8192,
232
  "ignore": 0,
@@ -254,15 +209,6 @@
254
  "outputPathIsOutsideProject": 0,
255
  "outputPathIsSetByUser": 0
256
  },
257
- "\/projects.php": {
258
- "fileType": 8192,
259
- "ignore": 0,
260
- "ignoreWasSetByUser": 0,
261
- "inputAbbreviatedPath": "\/projects.php",
262
- "outputAbbreviatedPath": "No Output Path",
263
- "outputPathIsOutsideProject": 0,
264
- "outputPathIsSetByUser": 0
265
- },
266
  "\/templates\/archive-project.php": {
267
  "fileType": 8192,
268
  "ignore": 0,
@@ -425,15 +371,6 @@
425
  "outputPathIsOutsideProject": 0,
426
  "outputPathIsSetByUser": 0
427
  },
428
- "\/templates\/single-project\/project-gallery.php": {
429
- "fileType": 8192,
430
- "ignore": 0,
431
- "ignoreWasSetByUser": 0,
432
- "inputAbbreviatedPath": "\/templates\/single-project\/project-gallery.php",
433
- "outputAbbreviatedPath": "No Output Path",
434
- "outputPathIsOutsideProject": 0,
435
- "outputPathIsSetByUser": 0
436
- },
437
  "\/templates\/single-project\/short-description.php": {
438
  "fileType": 8192,
439
  "ignore": 0,
@@ -530,14 +467,18 @@
530
  "active": 0,
531
  "flagValue": 3
532
  },
533
- "no-unnecessary_fat_arrows": {
534
  "active": 1,
535
  "flagValue": -1
536
  },
537
- "no_backticks": {
538
  "active": 1,
539
  "flagValue": -1
540
  },
 
 
 
 
541
  "no_empty_param_list": {
542
  "active": 0,
543
  "flagValue": -1
@@ -550,6 +491,10 @@
550
  "active": 0,
551
  "flagValue": -1
552
  },
 
 
 
 
553
  "no_plusplus": {
554
  "active": 0,
555
  "flagValue": -1
@@ -574,6 +519,14 @@
574
  "active": 1,
575
  "flagValue": -1
576
  },
 
 
 
 
 
 
 
 
577
  "non_empty_constructor_needs_parens": {
578
  "active": 0,
579
  "flagValue": -1
@@ -692,10 +645,6 @@
692
  "active": 0,
693
  "flagValue": -1
694
  },
695
- "gcl": {
696
- "active": 0,
697
- "flagValue": -1
698
- },
699
  "globalstrict": {
700
  "active": 0,
701
  "flagValue": -1
@@ -808,10 +757,6 @@
808
  "active": 0,
809
  "flagValue": -1
810
  },
811
- "onevar": {
812
- "active": 0,
813
- "flagValue": -1
814
- },
815
  "phantom": {
816
  "active": 0,
817
  "flagValue": -1
@@ -848,10 +793,6 @@
848
  "active": 0,
849
  "flagValue": -1
850
  },
851
- "smarttabs": {
852
- "active": 0,
853
- "flagValue": -1
854
- },
855
  "strict": {
856
  "active": 0,
857
  "flagValue": -1
@@ -864,10 +805,6 @@
864
  "active": 0,
865
  "flagValue": -1
866
  },
867
- "trailing": {
868
- "active": 1,
869
- "flagValue": -1
870
- },
871
  "typed": {
872
  "active": 0,
873
  "flagValue": -1
@@ -880,10 +817,6 @@
880
  "active": 1,
881
  "flagValue": -1
882
  },
883
- "white": {
884
- "active": 0,
885
- "flagValue": -1
886
- },
887
  "withstmt": {
888
  "active": 0,
889
  "flagValue": -1
1
  {
2
  "CodeKitInfo": "This is a CodeKit 2.x project configuration file. It is designed to sync project settings across multiple machines. MODIFYING THE CONTENTS OF THIS FILE IS A POOR LIFE DECISION. If you do so, you will likely cause CodeKit to crash. This file is not useful unless accompanied by the project that created it in CodeKit 2. This file is not backwards-compatible with CodeKit 1.x. For more information, see: http:\/\/incident57.com\/codekit",
3
+ "creatorBuild": "17018",
4
  "files": {
5
  "\/assets\/css\/_mixins.scss": {
6
  "createSourceMap": 0,
155
  "outputPathIsOutsideProject": 0,
156
  "outputPathIsSetByUser": 0
157
  },
 
 
 
 
 
 
 
 
 
158
  "\/classes\/class-projects-settings.php": {
159
  "fileType": 8192,
160
  "ignore": 0,
173
  "outputPathIsOutsideProject": 0,
174
  "outputPathIsSetByUser": 0
175
  },
 
 
 
 
 
 
 
 
 
176
  "\/classes\/class-projects-template-loader.php": {
177
  "fileType": 8192,
178
  "ignore": 0,
182
  "outputPathIsOutsideProject": 0,
183
  "outputPathIsSetByUser": 0
184
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  "\/projects-core-functions.php": {
186
  "fileType": 8192,
187
  "ignore": 0,
209
  "outputPathIsOutsideProject": 0,
210
  "outputPathIsSetByUser": 0
211
  },
 
 
 
 
 
 
 
 
 
212
  "\/templates\/archive-project.php": {
213
  "fileType": 8192,
214
  "ignore": 0,
371
  "outputPathIsOutsideProject": 0,
372
  "outputPathIsSetByUser": 0
373
  },
 
 
 
 
 
 
 
 
 
374
  "\/templates\/single-project\/short-description.php": {
375
  "fileType": 8192,
376
  "ignore": 0,
467
  "active": 0,
468
  "flagValue": 3
469
  },
470
+ "no_backticks": {
471
  "active": 1,
472
  "flagValue": -1
473
  },
474
+ "no_debugger": {
475
  "active": 1,
476
  "flagValue": -1
477
  },
478
+ "no_empty_functions": {
479
+ "active": 0,
480
+ "flagValue": -1
481
+ },
482
  "no_empty_param_list": {
483
  "active": 0,
484
  "flagValue": -1
491
  "active": 0,
492
  "flagValue": -1
493
  },
494
+ "no_interpolation_in_single_quotes": {
495
+ "active": 0,
496
+ "flagValue": -1
497
+ },
498
  "no_plusplus": {
499
  "active": 0,
500
  "flagValue": -1
519
  "active": 1,
520
  "flagValue": -1
521
  },
522
+ "no_unnecessary_double_quotes": {
523
+ "active": 0,
524
+ "flagValue": -1
525
+ },
526
+ "no_unnecessary_fat_arrows": {
527
+ "active": 1,
528
+ "flagValue": -1
529
+ },
530
  "non_empty_constructor_needs_parens": {
531
  "active": 0,
532
  "flagValue": -1
645
  "active": 0,
646
  "flagValue": -1
647
  },
 
 
 
 
648
  "globalstrict": {
649
  "active": 0,
650
  "flagValue": -1
757
  "active": 0,
758
  "flagValue": -1
759
  },
 
 
 
 
760
  "phantom": {
761
  "active": 0,
762
  "flagValue": -1
793
  "active": 0,
794
  "flagValue": -1
795
  },
 
 
 
 
796
  "strict": {
797
  "active": 0,
798
  "flagValue": -1
805
  "active": 0,
806
  "flagValue": -1
807
  },
 
 
 
 
808
  "typed": {
809
  "active": 0,
810
  "flagValue": -1
817
  "active": 1,
818
  "flagValue": -1
819
  },
 
 
 
 
820
  "withstmt": {
821
  "active": 0,
822
  "flagValue": -1
lang/projects-by-woothemes.pot CHANGED
@@ -4,7 +4,7 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/projects-by-woothemes\n"
7
- "POT-Creation-Date: 2014-04-09 11:18:59+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -76,7 +76,7 @@ msgstr ""
76
  msgid "%s Gallery"
77
  msgstr ""
78
 
79
- #: classes/class-projects-admin.php:420 classes/class-projects-admin.php:560
80
  msgid "Delete image"
81
  msgstr ""
82
 
@@ -88,99 +88,99 @@ msgstr ""
88
  msgid "Add %s gallery images"
89
  msgstr ""
90
 
91
- #: classes/class-projects-admin.php:511 templates/single-project/meta.php:43
92
  msgid "Client"
93
  msgstr ""
94
 
95
- #: classes/class-projects-admin.php:512
96
  msgid "Enter the client name. (Optional)"
97
  msgstr ""
98
 
99
- #: classes/class-projects-admin.php:519
100
  msgid "URL"
101
  msgstr ""
102
 
103
- #: classes/class-projects-admin.php:520
104
  msgid "Enter the project URL. (Optional)"
105
  msgstr ""
106
 
107
- #: classes/class-projects-admin.php:540
108
  msgid "Enter the %s title here"
109
  msgstr ""
110
 
111
- #: classes/class-projects-admin.php:558
112
  msgid "Add Images to Project Gallery"
113
  msgstr ""
114
 
115
- #: classes/class-projects-admin.php:559
116
  msgid "Add to gallery"
117
  msgstr ""
118
 
119
- #: classes/class-projects-admin.php:561
120
  msgid "Upload"
121
  msgstr ""
122
 
123
- #: classes/class-projects-admin.php:562
124
  msgid "Select this"
125
  msgstr ""
126
 
127
- #: classes/class-projects-admin.php:582
128
  msgid "%sProjects by WooThemes is almost ready.%s To get started, %sconfigure your projects page%s."
129
  msgstr ""
130
 
131
- #: classes/class-projects-admin.php:596
132
  msgid "%s Cover Image"
133
  msgstr ""
134
 
135
- #: classes/class-projects-admin.php:609
136
  msgid "Set featured image"
137
  msgstr ""
138
 
139
- #: classes/class-projects-admin.php:609 classes/class-projects-admin.php:641
140
  msgid "Set cover image"
141
  msgstr ""
142
 
143
- #: classes/class-projects-admin.php:625
144
  msgid "Remove featured image"
145
  msgstr ""
146
 
147
- #: classes/class-projects-admin.php:625
148
  msgid "Remove cover image"
149
  msgstr ""
150
 
151
- #: classes/class-projects-admin.php:640
152
  msgid "Set Cover Image"
153
  msgstr ""
154
 
155
- #: classes/class-projects-integrations.php:162
156
  msgid "Testimonial"
157
  msgstr ""
158
 
159
- #: classes/class-projects-integrations.php:163
160
  msgid "Search for Testimonial to link to this Project. (Optional)"
161
  msgstr ""
162
 
163
- #: classes/class-projects-integrations.php:170
164
  msgid "Testimonial ID"
165
  msgstr ""
166
 
167
- #: classes/class-projects-integrations.php:171
168
  msgid "Holds the id of the selected testimonial."
169
  msgstr ""
170
 
171
- #: classes/class-projects-integrations.php:305
172
  msgid "Product"
173
  msgstr ""
174
 
175
- #: classes/class-projects-integrations.php:306
176
  msgid "Search for Product to link to this Project. (Optional)"
177
  msgstr ""
178
 
179
- #: classes/class-projects-integrations.php:313
180
  msgid "Product ID"
181
  msgstr ""
182
 
183
- #: classes/class-projects-integrations.php:314
184
  msgid "Holds the id of the selected product."
185
  msgstr ""
186
 
@@ -288,7 +288,7 @@ msgstr ""
288
  msgid "Parent %s:"
289
  msgstr ""
290
 
291
- #: classes/class-projects-taxonomy.php:110 classes/class-projects.php:126
292
  msgid "Edit %s"
293
  msgstr ""
294
 
@@ -296,7 +296,7 @@ msgstr ""
296
  msgid "Update %s"
297
  msgstr ""
298
 
299
- #: classes/class-projects-taxonomy.php:112 classes/class-projects.php:125
300
  msgid "Add New %s"
301
  msgstr ""
302
 
@@ -308,36 +308,6 @@ msgstr ""
308
  msgid "%s"
309
  msgstr ""
310
 
311
- #: classes/class-projects.php:110
312
- msgctxt "post type singular name"
313
- msgid "Project"
314
- msgstr ""
315
-
316
- #: classes/class-projects.php:111
317
- msgctxt "post type general name"
318
- msgid "Projects"
319
- msgstr ""
320
-
321
- #: classes/class-projects.php:127
322
- msgid "New %s"
323
- msgstr ""
324
-
325
- #: classes/class-projects.php:129
326
- msgid "View %s"
327
- msgstr ""
328
-
329
- #: classes/class-projects.php:130
330
- msgid "Search %a"
331
- msgstr ""
332
-
333
- #: classes/class-projects.php:131
334
- msgid "No %s Found"
335
- msgstr ""
336
-
337
- #: classes/class-projects.php:132
338
- msgid "No %s Found In Trash"
339
- msgstr ""
340
-
341
  #: classes/class-widget-project-categories.php:42
342
  #: classes/class-widget-project-categories.php:44
343
  #: classes/class-widget-project-categories.php:154
@@ -345,7 +315,7 @@ msgid "Project Categories"
345
  msgstr ""
346
 
347
  #: classes/class-widget-project-categories.php:163
348
- #: classes/class-widget-projects.php:192
349
  msgid "Title (optional):"
350
  msgstr ""
351
 
@@ -361,11 +331,11 @@ msgstr ""
361
  msgid "Recent projects listed on your site."
362
  msgstr ""
363
 
364
- #: classes/class-widget-projects.php:43 classes/class-widget-projects.php:184
365
  msgid "Recent Projects"
366
  msgstr ""
367
 
368
- #: classes/class-widget-projects.php:197
369
  msgid "Limit:"
370
  msgstr ""
371
 
@@ -386,6 +356,36 @@ msgstr ""
386
  msgid "Purchase"
387
  msgstr ""
388
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  #: templates/loop/no-projects-found.php:14
390
  msgid "No projects found which match your selection."
391
  msgstr ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/projects-by-woothemes\n"
7
+ "POT-Creation-Date: 2014-06-06 14:05:53+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
76
  msgid "%s Gallery"
77
  msgstr ""
78
 
79
+ #: classes/class-projects-admin.php:420 classes/class-projects-admin.php:568
80
  msgid "Delete image"
81
  msgstr ""
82
 
88
  msgid "Add %s gallery images"
89
  msgstr ""
90
 
91
+ #: classes/class-projects-admin.php:514 templates/single-project/meta.php:43
92
  msgid "Client"
93
  msgstr ""
94
 
95
+ #: classes/class-projects-admin.php:515
96
  msgid "Enter the client name. (Optional)"
97
  msgstr ""
98
 
99
+ #: classes/class-projects-admin.php:522
100
  msgid "URL"
101
  msgstr ""
102
 
103
+ #: classes/class-projects-admin.php:523
104
  msgid "Enter the project URL. (Optional)"
105
  msgstr ""
106
 
107
+ #: classes/class-projects-admin.php:543
108
  msgid "Enter the %s title here"
109
  msgstr ""
110
 
111
+ #: classes/class-projects-admin.php:566
112
  msgid "Add Images to Project Gallery"
113
  msgstr ""
114
 
115
+ #: classes/class-projects-admin.php:567
116
  msgid "Add to gallery"
117
  msgstr ""
118
 
119
+ #: classes/class-projects-admin.php:569
120
  msgid "Upload"
121
  msgstr ""
122
 
123
+ #: classes/class-projects-admin.php:570
124
  msgid "Select this"
125
  msgstr ""
126
 
127
+ #: classes/class-projects-admin.php:590
128
  msgid "%sProjects by WooThemes is almost ready.%s To get started, %sconfigure your projects page%s."
129
  msgstr ""
130
 
131
+ #: classes/class-projects-admin.php:604
132
  msgid "%s Cover Image"
133
  msgstr ""
134
 
135
+ #: classes/class-projects-admin.php:617
136
  msgid "Set featured image"
137
  msgstr ""
138
 
139
+ #: classes/class-projects-admin.php:617 classes/class-projects-admin.php:649
140
  msgid "Set cover image"
141
  msgstr ""
142
 
143
+ #: classes/class-projects-admin.php:633
144
  msgid "Remove featured image"
145
  msgstr ""
146
 
147
+ #: classes/class-projects-admin.php:633
148
  msgid "Remove cover image"
149
  msgstr ""
150
 
151
+ #: classes/class-projects-admin.php:648
152
  msgid "Set Cover Image"
153
  msgstr ""
154
 
155
+ #: classes/class-projects-integrations.php:165
156
  msgid "Testimonial"
157
  msgstr ""
158
 
159
+ #: classes/class-projects-integrations.php:166
160
  msgid "Search for Testimonial to link to this Project. (Optional)"
161
  msgstr ""
162
 
163
+ #: classes/class-projects-integrations.php:173
164
  msgid "Testimonial ID"
165
  msgstr ""
166
 
167
+ #: classes/class-projects-integrations.php:174
168
  msgid "Holds the id of the selected testimonial."
169
  msgstr ""
170
 
171
+ #: classes/class-projects-integrations.php:320
172
  msgid "Product"
173
  msgstr ""
174
 
175
+ #: classes/class-projects-integrations.php:321
176
  msgid "Search for Product to link to this Project. (Optional)"
177
  msgstr ""
178
 
179
+ #: classes/class-projects-integrations.php:328
180
  msgid "Product ID"
181
  msgstr ""
182
 
183
+ #: classes/class-projects-integrations.php:329
184
  msgid "Holds the id of the selected product."
185
  msgstr ""
186
 
288
  msgid "Parent %s:"
289
  msgstr ""
290
 
291
+ #: classes/class-projects-taxonomy.php:110 projects.php:145
292
  msgid "Edit %s"
293
  msgstr ""
294
 
296
  msgid "Update %s"
297
  msgstr ""
298
 
299
+ #: classes/class-projects-taxonomy.php:112 projects.php:144
300
  msgid "Add New %s"
301
  msgstr ""
302
 
308
  msgid "%s"
309
  msgstr ""
310
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  #: classes/class-widget-project-categories.php:42
312
  #: classes/class-widget-project-categories.php:44
313
  #: classes/class-widget-project-categories.php:154
315
  msgstr ""
316
 
317
  #: classes/class-widget-project-categories.php:163
318
+ #: classes/class-widget-projects.php:194
319
  msgid "Title (optional):"
320
  msgstr ""
321
 
331
  msgid "Recent projects listed on your site."
332
  msgstr ""
333
 
334
+ #: classes/class-widget-projects.php:43 classes/class-widget-projects.php:186
335
  msgid "Recent Projects"
336
  msgstr ""
337
 
338
+ #: classes/class-widget-projects.php:199
339
  msgid "Limit:"
340
  msgstr ""
341
 
356
  msgid "Purchase"
357
  msgstr ""
358
 
359
+ #: projects.php:129
360
+ msgctxt "post type singular name"
361
+ msgid "Project"
362
+ msgstr ""
363
+
364
+ #: projects.php:130
365
+ msgctxt "post type general name"
366
+ msgid "Projects"
367
+ msgstr ""
368
+
369
+ #: projects.php:146
370
+ msgid "New %s"
371
+ msgstr ""
372
+
373
+ #: projects.php:148
374
+ msgid "View %s"
375
+ msgstr ""
376
+
377
+ #: projects.php:149
378
+ msgid "Search %a"
379
+ msgstr ""
380
+
381
+ #: projects.php:150
382
+ msgid "No %s Found"
383
+ msgstr ""
384
+
385
+ #: projects.php:151
386
+ msgid "No %s Found In Trash"
387
+ msgstr ""
388
+
389
  #: templates/loop/no-projects-found.php:14
390
  msgid "No projects found which match your selection."
391
  msgstr ""
projects.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: http://woothemes.com/
5
  * Description: Hi, I'm your project showcase plugin for WordPress. Show off your recent work using our shortcode, widget or template tag.
6
  * Author: WooThemes
7
- * Version: 1.2.1
8
  * Author URI: http://woothemes.com/
9
  *
10
  * @package WordPress
@@ -13,17 +13,439 @@
13
  * @since 1.0.0
14
  */
15
 
16
- require_once( 'classes/class-projects.php' );
17
- require_once( 'classes/class-projects-taxonomy.php' );
18
- require_once( 'classes/class-projects-shortcodes.php' );
19
- require_once( 'classes/class-projects-settings.php' );
20
- require_once( 'classes/class-widget-projects.php' );
21
- require_once( 'classes/class-widget-project-categories.php' );
22
- require_once( 'classes/class-projects-integrations.php' );
23
 
24
- require_once( 'projects-template.php' );
25
- require_once( 'projects-core-functions.php' );
26
- require_once( 'projects-hooks.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  global $projects;
 
29
  $projects = new Projects( __FILE__ );
4
  * Plugin URI: http://woothemes.com/
5
  * Description: Hi, I'm your project showcase plugin for WordPress. Show off your recent work using our shortcode, widget or template tag.
6
  * Author: WooThemes
7
+ * Version: 1.2.2
8
  * Author URI: http://woothemes.com/
9
  *
10
  * @package WordPress
13
  * @since 1.0.0
14
  */
15
 
16
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
 
 
 
 
 
 
17
 
18
+ /**
19
+ * WooThemes Projects Class
20
+ *
21
+ * All functionality pertaining to the projects.
22
+ *
23
+ * @package WordPress
24
+ * @subpackage Projects
25
+ * @category Plugin
26
+ * @author Matty
27
+ * @since 1.0.0
28
+ */
29
+ final class Projects {
30
+ private $dir;
31
+ private $assets_dir;
32
+ private $assets_url;
33
+ private $token;
34
+ private $post_type;
35
+ private $file;
36
+ public $singular_name;
37
+ public $plural_name;
38
+ public $taxonomy_category;
39
+
40
+ public $template_url;
41
+
42
+ public $admin;
43
+ public $frontend;
44
+
45
+ /**
46
+ * @var string
47
+ */
48
+ public $version = '1.2.2';
49
+
50
+ /**
51
+ * Constructor function.
52
+ *
53
+ * @access public
54
+ * @since 1.0.0
55
+ * @return void
56
+ */
57
+ public function __construct( $file ) {
58
+ $this->dir = dirname( $file );
59
+ $this->file = $file;
60
+ $this->assets_dir = trailingslashit( $this->dir ) . 'assets';
61
+ $this->assets_url = esc_url( trailingslashit( plugins_url( '/assets/', $file ) ) );
62
+ $this->token = 'projects';
63
+ $this->post_type = 'project';
64
+
65
+ // Variables
66
+ $this->template_url = apply_filters( 'projects_template_url', 'projects/' );
67
+
68
+ $this->load_plugin_textdomain();
69
+ add_action( 'init', array( $this, 'load_localisation' ), 0 );
70
+
71
+ // Define constants
72
+ $this->define_constants();
73
+
74
+ // Include required files
75
+ $this->includes();
76
+
77
+ // Run this on activation.
78
+ register_activation_hook( $this->file, array( $this, 'activation' ) );
79
+
80
+ // Run this on deactivation.
81
+ register_deactivation_hook( $this->file, array( $this, 'deactivation' ) );
82
+
83
+ add_action( 'init', array( $this, 'post_type_names' ) );
84
+ add_action( 'init', array( $this, 'register_rewrite_tags' ) );
85
+ add_action( 'init', array( $this, 'register_post_type' ) );
86
+ add_action( 'init', array( $this, 'register_taxonomy' ) );
87
+
88
+ add_action( 'widgets_init', array( $this, 'include_widgets' ) );
89
+
90
+ add_action( 'after_setup_theme', array( $this, 'ensure_post_thumbnails_support' ) );
91
+ add_action( 'after_setup_theme', array( $this, 'register_image_sizes' ) );
92
+
93
+ if ( is_admin() ) {
94
+ require_once( 'classes/class-projects-admin.php' );
95
+ $this->admin = new Projects_Admin( $file );
96
+ } else {
97
+ require_once( 'classes/class-projects-frontend.php' );
98
+ $this->frontend = new Projects_Frontend( $file );
99
+ }
100
+
101
+ } // End __construct()
102
+
103
+ /**
104
+ * Register custom rewrite tags.
105
+ * @access public
106
+ * @since 1.0.0
107
+ * @return void
108
+ */
109
+ public function register_rewrite_tags () {
110
+ add_rewrite_tag( '%project_category%','([^&]+)' );
111
+ } // End register_rewrite_tags()
112
+
113
+ /**
114
+ * Define Projects Constants
115
+ */
116
+ private function define_constants() {
117
+ define( 'PROJECTS_PLUGIN_FILE', __FILE__ );
118
+ define( 'PROJECTS_VERSION', $this->version );
119
+ }
120
+
121
+ /**
122
+ * Change the UI names in the admin
123
+ *
124
+ * @access public
125
+ * @since 1.1.0
126
+ * @return void
127
+ */
128
+ public function post_type_names () {
129
+ $this->singular_name = apply_filters( 'projects_post_type_singular_name', _x( 'Project', 'post type singular name', 'projects-by-woothemes' ) );
130
+ $this->plural_name = apply_filters( 'projects_post_type_plural_name', _x( 'Projects', 'post type general name', 'projects-by-woothemes' ) );
131
+ }
132
+
133
+ /**
134
+ * Register the post type.
135
+ *
136
+ * @access public
137
+ * @return void
138
+ */
139
+ public function register_post_type () {
140
+ $labels = array(
141
+ 'name' => $this->plural_name,
142
+ 'singular_name' => $this->singular_name,
143
+ 'add_new' => _x( 'Add New', $this->post_type, 'projects-by-woothemes' ),
144
+ 'add_new_item' => sprintf( __( 'Add New %s', 'projects-by-woothemes' ), $this->singular_name ),
145
+ 'edit_item' => sprintf( __( 'Edit %s', 'projects-by-woothemes' ), $this->singular_name ),
146
+ 'new_item' => sprintf( __( 'New %s', 'projects-by-woothemes' ), $this->singular_name ),
147
+ 'all_items' => sprintf( _x( 'All %s', $this->post_type, 'projects-by-woothemes' ), $this->plural_name ),
148
+ 'view_item' => sprintf( __( 'View %s', 'projects-by-woothemes' ), $this->singular_name ),
149
+ 'search_items' => sprintf( __( 'Search %a', 'projects-by-woothemes' ), $this->plural_name ),
150
+ 'not_found' => sprintf( __( 'No %s Found', 'projects-by-woothemes' ), $this->plural_name ),
151
+ 'not_found_in_trash' => sprintf( __( 'No %s Found In Trash', 'projects-by-woothemes' ), $this->plural_name ),
152
+ 'parent_item_colon' => '',
153
+ 'menu_name' => $this->plural_name
154
+
155
+ );
156
+ $args = array(
157
+ 'labels' => $labels,
158
+ 'public' => true,
159
+ 'publicly_queryable' => true,
160
+ 'show_ui' => true,
161
+ 'show_in_menu' => true,
162
+ 'query_var' => true,
163
+ 'rewrite' => array(
164
+ 'slug' => trailingslashit ( strtolower( $this->singular_name ) ) . '%project_category%',
165
+ 'with_front' => false
166
+ ),
167
+ 'capability_type' => 'post',
168
+ 'has_archive' => ( $projects_page_id = projects_get_page_id( 'projects' ) ) && get_page( $projects_page_id ) ? get_page_uri( $projects_page_id ) : 'projects',
169
+ 'hierarchical' => false,
170
+ 'supports' => array(
171
+ 'title',
172
+ 'editor',
173
+ 'thumbnail',
174
+ 'excerpt'
175
+ ),
176
+ 'menu_position' => 5,
177
+ 'menu_icon' => 'dashicons-portfolio'
178
+ );
179
+
180
+ $args = apply_filters( 'projects_register_post_type', $args );
181
+
182
+ register_post_type( $this->post_type, (array) $args );
183
+ } // End register_post_type()
184
+
185
+ /**
186
+ * Register the "project-category" taxonomy.
187
+ * @access public
188
+ * @since 1.3.0
189
+ * @return void
190
+ */
191
+ public function register_taxonomy () {
192
+ $this->taxonomy_category = new Projects_Taxonomy(); // Leave arguments empty, to use the default arguments.
193
+ $this->taxonomy_category->register();
194
+ } // End register_taxonomy()
195
+
196
+ /**
197
+ * Register image sizes.
198
+ * @since 1.0.0
199
+ * @return void
200
+ */
201
+ public function register_image_sizes () {
202
+ if ( function_exists( 'add_image_size' ) ) {
203
+
204
+ $options = get_option( 'projects' );
205
+
206
+ $defaults = apply_filters( 'projects_default_image_size', array(
207
+ 'project-archive' => array(
208
+ 'width' => 300,
209
+ 'height' => 300,
210
+ 'crop' => 'no'
211
+ ),
212
+ 'project-single' => array(
213
+ 'width' => 1024,
214
+ 'height' => 1024,
215
+ 'crop' => 'no'
216
+ ),
217
+ 'project-thumbnail' => array(
218
+ 'width' => 100,
219
+ 'height' => 100,
220
+ 'crop' => 'yes'
221
+ )
222
+ ) );
223
+
224
+ // Parse incomming $options into an array and merge it with $defaults
225
+ $options = wp_parse_args( $options, $defaults );
226
+
227
+ // Register each image size
228
+ foreach ( $options as $image_size => $size ) {
229
+ $crop = isset( $size['crop'] ) && 'yes' == $size['crop'] ? true : false;
230
+ add_image_size( $image_size, $size['width'], $size['height'], $crop );
231
+ }
232
+
233
+ }
234
+ } // End register_image_sizes()
235
+
236
+ /**
237
+ * Get projects.
238
+ * @param string/array $args Arguments to be passed to the query.
239
+ * @since 1.0.0
240
+ * @return array/boolean Array if true, boolean if false.
241
+ */
242
+ public function get_projects ( $args = '' ) {
243
+ $defaults = array(
244
+ 'limit' => 5,
245
+ 'orderby' => 'menu_order',
246
+ 'order' => 'DESC',
247
+ 'id' => 0
248
+ );
249
+
250
+ $args = wp_parse_args( $args, $defaults );
251
+
252
+ // Allow child themes/plugins to filter here.
253
+ $args = apply_filters( 'projects_get_projects_args', $args );
254
+
255
+ // The Query Arguments.
256
+ $query_args = array();
257
+ $query_args['post_type'] = 'project';
258
+ $query_args['numberposts'] = $args['limit'];
259
+ $query_args['orderby'] = $args['orderby'];
260
+ $query_args['order'] = $args['order'];
261
+
262
+ if ( is_numeric( $args['id'] ) && ( intval( $args['id'] ) > 0 ) ) {
263
+ $query_args['p'] = intval( $args['id'] );
264
+ }
265
+
266
+ // Whitelist checks.
267
+ if ( ! in_array( $query_args['orderby'], array( 'none', 'ID', 'author', 'title', 'date', 'modified', 'parent', 'rand', 'comment_count', 'menu_order', 'meta_value', 'meta_value_num' ) ) ) {
268
+ $query_args['orderby'] = 'date';
269
+ }
270
+
271
+ if ( ! in_array( $query_args['order'], array( 'ASC', 'DESC' ) ) ) {
272
+ $query_args['order'] = 'DESC';
273
+ }
274
+
275
+ if ( ! in_array( $query_args['post_type'], get_post_types() ) ) {
276
+ $query_args['post_type'] = 'project';
277
+ }
278
+
279
+ // The Query.
280
+ $query = get_posts( $query_args );
281
+
282
+ // The Display.
283
+ if ( ! is_wp_error( $query ) && is_array( $query ) && count( $query ) > 0 ) {
284
+ foreach ( $query as $k => $v ) {
285
+ $meta = get_post_custom( $v->ID );
286
+
287
+ // Get the image.
288
+ $query[$k]->image = projects_get_image( $v->ID, $args['size'] );
289
+
290
+ // Get the URL.
291
+ if ( isset( $meta['_url'][0] ) && '' != $meta['_url'][0] ) {
292
+ $query[$k]->url = esc_url( $meta['_url'][0] );
293
+ } else {
294
+ $query[$k]->url = get_permalink( $v->ID );
295
+ }
296
+ }
297
+ } else {
298
+ $query = false;
299
+ }
300
+
301
+ return $query;
302
+ } // End get_projects()
303
+
304
+ /**
305
+ * Load the plugin's localisation file.
306
+ * @access public
307
+ * @since 1.0.0
308
+ * @return void
309
+ */
310
+ public function load_localisation () {
311
+ load_plugin_textdomain( 'projects-by-woothemes', false, dirname( plugin_basename( $this->file ) ) . '/lang/' );
312
+ } // End load_localisation()
313
+
314
+ /**
315
+ * Load the plugin textdomain from the main WordPress "languages" folder.
316
+ * @since 1.0.0
317
+ * @return void
318
+ */
319
+ public function load_plugin_textdomain () {
320
+ $domain = 'projects-by-woothemes';
321
+ // The "plugin_locale" filter is also used in load_plugin_textdomain()
322
+ $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
323
+
324
+ load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' );
325
+ load_plugin_textdomain( $domain, FALSE, dirname( plugin_basename( $this->file ) ) . '/lang/' );
326
+ } // End load_plugin_textdomain()
327
+
328
+ /**
329
+ * Run on activation.
330
+ * @access public
331
+ * @since 1.0.0
332
+ * @return void
333
+ */
334
+ public function activation () {
335
+ $this->register_plugin_version();
336
+
337
+ // Flush rewrite rules
338
+ flush_rewrite_rules();
339
+ } // End activation()
340
+
341
+ /**
342
+ * Run on deactivation.
343
+ * @access public
344
+ * @since 1.0.0
345
+ * @return void
346
+ */
347
+ public function deactivation () {
348
+ // Flush rewrite rules
349
+ flush_rewrite_rules();
350
+ } // End deactivation()
351
+
352
+ /**
353
+ * Register the plugin's version.
354
+ * @access public
355
+ * @since 1.0.0
356
+ * @return void
357
+ */
358
+ private function register_plugin_version () {
359
+ if ( $this->version != '' ) {
360
+ update_option( 'projects' . '-version', $this->version );
361
+ }
362
+ } // End register_plugin_version()
363
+
364
+ /**
365
+ * Ensure that "post-thumbnails" support is available for those themes that don't register it.
366
+ * @since 1.0.0
367
+ * @return void
368
+ */
369
+ public function ensure_post_thumbnails_support () {
370
+ if ( ! current_theme_supports( 'post-thumbnails' ) ) { add_theme_support( 'post-thumbnails' ); }
371
+ } // End ensure_post_thumbnails_support()
372
+
373
+ /**
374
+ * Get the plugin url.
375
+ * @access public
376
+ * @since 1.0.0
377
+ * @return string
378
+ */
379
+ public function plugin_url () {
380
+ return untrailingslashit( plugins_url( '/', $this->file ) );
381
+ } // End plugin_url()
382
+
383
+
384
+ /**
385
+ * Get the plugin path.
386
+ * @access public
387
+ * @since 1.0.0
388
+ * @return string
389
+ */
390
+ public function plugin_path () {
391
+ return untrailingslashit( plugin_dir_path( $this->file ) );
392
+ } // End plugin_path()
393
+
394
+
395
+ /**
396
+ * Get an image size.
397
+ *
398
+ * Variable is filtered by projects_get_image_size_{image_size}
399
+ *
400
+ * @access public
401
+ * @since 1.0.0
402
+ * @param mixed $image_size
403
+ * @return string
404
+ */
405
+ public function get_image_size ( $image_size ) {
406
+ // Only return sizes we define in settings
407
+ if ( ! in_array( $image_size, array( 'project-thumbnail', 'project-archive', 'project-single' ) ) )
408
+ return apply_filters( 'projects_get_image_size_' . $image_size, '' );
409
+
410
+ // Get image size from options
411
+ $options = get_option( 'projects', array() );
412
+ $size = $options[ $image_size ];
413
+
414
+ $size['width'] = isset( $size['width'] ) ? $size['width'] : '300';
415
+ $size['height'] = isset( $size['height'] ) ? $size['height'] : '300';
416
+ $size['crop'] = isset( $size['crop'] ) ? $size['crop'] : 1;
417
+
418
+ return apply_filters( 'projects_get_image_size_' . $image_size, $size );
419
+ } // End get_image_size()
420
+
421
+ /**
422
+ * Include Projects widgets.
423
+ *
424
+ * @access public
425
+ * @since 1.2.2
426
+ */
427
+ public function include_widgets() {
428
+ include_once( 'classes/class-widget-projects.php' );
429
+ include_once( 'classes/class-widget-project-categories.php' );
430
+ }
431
+
432
+ /**
433
+ * Include required files.
434
+ * @since 1.2.2
435
+ */
436
+ private function includes() {
437
+ require_once( 'classes/class-projects-taxonomy.php' );
438
+ require_once( 'classes/class-projects-shortcodes.php' );
439
+ require_once( 'classes/class-projects-settings.php' );
440
+ require_once( 'classes/class-projects-integrations.php' );
441
+
442
+ require_once( 'projects-template.php' );
443
+ require_once( 'projects-core-functions.php' );
444
+ require_once( 'projects-hooks.php' );
445
+ }
446
+
447
+ } // End Class
448
 
449
  global $projects;
450
+
451
  $projects = new Projects( __FILE__ );
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Projects by WooThemes ===
2
  Contributors: woothemes, mattyza, jameskoster, tiagonoronha
3
  Donate link: http://woothemes.com/
4
- Tags: portfolio, projects, project, showcase, artwork, work, creative, photography, art, images
5
  Requires at least: 3.8
6
- Tested up to: 3.8.1
7
- Stable tag: 1.2.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -44,6 +44,9 @@ Projects includes a responsive layout to integrate with any theme.
44
 
45
  Get your hands dirty! Customise & extend Projects via a vast array of hooks, filters & templates.
46
 
 
 
 
47
  = Testimonials =
48
 
49
  Integrated with our [testimonials plugin](http://wordpress.org/plugins/testimonials-by-woothemes/) allowing you to assign a client testimonial to a project and display it on the single project page.
@@ -109,6 +112,13 @@ You sure can! Read about how in the [documentation](http://docs.woothemes.com/do
109
 
110
  == Changelog ==
111
 
 
 
 
 
 
 
 
112
  = 1.2.1 =
113
  * 2014-04-24
114
  * Fix - Javascript error in admin
1
  === Projects by WooThemes ===
2
  Contributors: woothemes, mattyza, jameskoster, tiagonoronha
3
  Donate link: http://woothemes.com/
4
+ Tags: portfolio, projects, project, showcase, artwork, work, creative, photography, art, images, woocommerce
5
  Requires at least: 3.8
6
+ Tested up to: 3.9.1
7
+ Stable tag: 1.2.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
44
 
45
  Get your hands dirty! Customise & extend Projects via a vast array of hooks, filters & templates.
46
 
47
+ = WooCommerce =
48
+ Assign projects to products and give visitors an easy way to add products to their cart using [WooCommerce](http://wordpress.org/plugins/woocommerce/) functionality.
49
+
50
  = Testimonials =
51
 
52
  Integrated with our [testimonials plugin](http://wordpress.org/plugins/testimonials-by-woothemes/) allowing you to assign a client testimonial to a project and display it on the single project page.
112
 
113
  == Changelog ==
114
 
115
+ = 1.2.2 =
116
+ * 2014-06-06
117
+ * Tweak - Product linking label now includes sku / id.
118
+ * Tweak - Widgets now called via a single function and other minor refactoring.
119
+ * Tweak - Project Category taxonomy names filterable. (Props @abouolia)
120
+ * Fix - Reset post data in projects widget.
121
+
122
  = 1.2.1 =
123
  * 2014-04-24
124
  * Fix - Javascript error in admin
templates/single-project/project-gallery.php CHANGED
@@ -40,7 +40,7 @@ global $post, $projects, $project;
40
  if ( ! $image_link )
41
  continue;
42
 
43
- $image = wp_get_attachment_image( $attachment_id, apply_filters( 'single_project_small_thumbnail_size', 'project-single' ) );
44
  $image_class = esc_attr( implode( ' ', $classes ) );
45
  $image_title = esc_attr( get_the_title( $attachment_id ) );
46
 
40
  if ( ! $image_link )
41
  continue;
42
 
43
+ $image = wp_get_attachment_image( $attachment_id, apply_filters( 'single_project_single_thumbnail_size', 'project-single' ) );
44
  $image_class = esc_attr( implode( ' ', $classes ) );
45
  $image_title = esc_attr( get_the_title( $attachment_id ) );
46