Projects by WooThemes - Version 1.4.2

Version Description

  • Removes deprecated constructor call for WP_Widget
Download this release

Release Info

Developer mattyza
Plugin Icon wp plugin Projects by WooThemes
Version 1.4.2
Comparing to
See all releases

Code changes from version 1.4.1 to 1.4.2

assets/css/_mixins.scss CHANGED
@@ -1,55 +1,55 @@
1
- @import "bourbon";
2
-
3
- // Vars
4
- $error: #f63121;
5
-
6
- // Mixins
7
- @mixin iconbefore( $glyph: "\f179" )
8
- {
9
- font-family: 'dashicons';
10
- vertical-align: top;
11
- margin-right: .618em;
12
- content: $glyph;
13
- }
14
-
15
- @mixin iconafter( $glyph: "\f179" )
16
- {
17
- font-family: 'dashicons';
18
- vertical-align: top;
19
- margin-left: .618em;
20
- content: $glyph;
21
- }
22
-
23
- @mixin icon( $glyph: "\f179" )
24
- {
25
- font-family: 'dashicons';
26
- speak: none;
27
- font-weight: normal;
28
- font-variant: normal;
29
- text-transform: none;
30
- line-height: 1;
31
- -webkit-font-smoothing: antialiased;
32
- margin:0;
33
- text-indent: 0;
34
- position: absolute;
35
- top:0;
36
- left:0;
37
- width:100%;
38
- height: 100%;
39
- text-align: center;
40
- content: $glyph;
41
- }
42
-
43
- // Mixins
44
- @mixin border_radius_reset()
45
- {
46
- -webkit-border-radius: none;
47
- -moz-border-radius: none;
48
- border-radius: none;
49
- }
50
-
51
- @mixin opacity($opacity:0.75)
52
- {
53
- opacity: $opacity;
54
- filter: alpha(opacity=$opacity * 100);
55
  }
1
+ @import "bourbon";
2
+
3
+ // Vars
4
+ $error: #f63121;
5
+
6
+ // Mixins
7
+ @mixin iconbefore( $glyph: "\f179" )
8
+ {
9
+ font-family: 'dashicons';
10
+ vertical-align: top;
11
+ margin-right: .618em;
12
+ content: $glyph;
13
+ }
14
+
15
+ @mixin iconafter( $glyph: "\f179" )
16
+ {
17
+ font-family: 'dashicons';
18
+ vertical-align: top;
19
+ margin-left: .618em;
20
+ content: $glyph;
21
+ }
22
+
23
+ @mixin icon( $glyph: "\f179" )
24
+ {
25
+ font-family: 'dashicons';
26
+ speak: none;
27
+ font-weight: normal;
28
+ font-variant: normal;
29
+ text-transform: none;
30
+ line-height: 1;
31
+ -webkit-font-smoothing: antialiased;
32
+ margin:0;
33
+ text-indent: 0;
34
+ position: absolute;
35
+ top:0;
36
+ left:0;
37
+ width:100%;
38
+ height: 100%;
39
+ text-align: center;
40
+ content: $glyph;
41
+ }
42
+
43
+ // Mixins
44
+ @mixin border_radius_reset()
45
+ {
46
+ -webkit-border-radius: none;
47
+ -moz-border-radius: none;
48
+ border-radius: none;
49
+ }
50
+
51
+ @mixin opacity($opacity:0.75)
52
+ {
53
+ opacity: $opacity;
54
+ filter: alpha(opacity=$opacity * 100);
55
  }
assets/css/admin.scss CHANGED
@@ -1,168 +1,168 @@
1
- // Imports
2
- @import 'mixins';
3
-
4
- // Projects screen
5
- .post-type-project.edit-php {
6
- table.wp-list-table {
7
- .column-image {
8
- width: 120px;
9
- text-align: center;;
10
-
11
- img {
12
- width: 60px;
13
- height: auto;
14
- }
15
- }
16
- }
17
- }
18
-
19
- // Project Gallery
20
- #project-images {
21
- .inside {
22
- margin: 0;
23
- padding: 0;
24
- .add_project_images {
25
- padding: 0 12px 12px;
26
- }
27
- #project_images_container {
28
- padding: 0 0 0 9px;
29
- ul {
30
- margin: 0;
31
- padding: 0;
32
- @include clearfix;
33
-
34
- li.image,
35
- li.add,
36
- li.projects-metabox-sortable-placeholder {
37
- width: 80px;
38
- float: left;
39
- cursor: move;
40
- margin: 9px 9px 0 0;
41
- background: #f7f7f7;
42
- position: relative;
43
- background: #000;
44
- -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
45
- -moz-box-sizing: border-box; /* Firefox, other Gecko */
46
- box-sizing: border-box; /* Opera/IE 8+ */
47
- img {
48
- width: 100%;
49
- height: auto;
50
- display: block;
51
- @include animation(all ease .2s);
52
- }
53
- &:hover {
54
- img {
55
- @include opacity(0.75);
56
- }
57
- }
58
- }
59
- li.projects-metabox-sortable-placeholder {
60
- background: #f1f1f1;
61
- }
62
- ul.actions {
63
- position: absolute;
64
- top:0;
65
- right: 0;
66
- @include animation(all ease .2s);
67
- @include opacity(0);
68
- li {
69
- float: right;
70
- //margin: 0 0 0 1px;
71
- a {
72
- width: 20px;
73
- margin: 0;
74
- height: 20px;
75
- font-size: 16px;
76
- display: block;
77
- overflow: hidden;
78
- color: #fff;
79
- background:#000;
80
- font-weight: 300;
81
- line-height: 20px;
82
- text-align: center;
83
- text-decoration: none;
84
- @include animation(all ease .2s);
85
- &.edit,
86
- &.delete {
87
- text-indent: -999px;
88
- position: relative;
89
- background: #000;
90
-
91
- &:before {
92
- content: "\f464";
93
- display: block;
94
- position: absolute;
95
- top: 0;
96
- right: 0;
97
- bottom: 0;
98
- left: 0;
99
- font-family: 'Dashicons';
100
- color: #fff;
101
- text-indent: 0;
102
- font-weight: normal;
103
- }
104
-
105
- &:hover {
106
- background: #444;
107
- }
108
- }
109
-
110
- &.delete {
111
- background-color: $error;
112
- &:before {
113
- content: "\f335";
114
- }
115
- &:hover {
116
- background: $error - #222;
117
- }
118
- }
119
- }
120
- }
121
- }
122
- li:hover ul.actions {
123
- @include opacity(1);
124
- }
125
- }
126
- }
127
- }
128
- }
129
-
130
- // Autocomplete
131
- .post-type-project {
132
- .ui-autocomplete {
133
- font-family: inherit;
134
- font-size: 1em;
135
- background: #fafafa;
136
- -webkit-box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1);
137
- box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1);
138
- -webkit-border-radius: 0 0 4px 4px;
139
- border-radius: 0 0 4px 4px;
140
- -webkit-transform: translateY(-1px);
141
- transform: translateY(-1px);
142
- li {
143
- a {
144
- -webkit-border-radius: 0;
145
- border-radius: 0;
146
- border: 0;
147
- background: none;
148
- &:hover {
149
- border: 0;
150
- background: #f6f6f6;
151
- }
152
- }
153
- &:last-child {
154
- a {
155
- -webkit-border-radius: 0 0 4px 4px;
156
- border-radius: 0 0 4px 4px;
157
- }
158
- }
159
- }
160
- }
161
-
162
- .projects-radio {
163
- label {
164
- display: block;
165
- line-height: 1.5;
166
- }
167
- }
168
  }
1
+ // Imports
2
+ @import 'mixins';
3
+
4
+ // Projects screen
5
+ .post-type-project.edit-php {
6
+ table.wp-list-table {
7
+ .column-image {
8
+ width: 120px;
9
+ text-align: center;;
10
+
11
+ img {
12
+ width: 60px;
13
+ height: auto;
14
+ }
15
+ }
16
+ }
17
+ }
18
+
19
+ // Project Gallery
20
+ #project-images {
21
+ .inside {
22
+ margin: 0;
23
+ padding: 0;
24
+ .add_project_images {
25
+ padding: 0 12px 12px;
26
+ }
27
+ #project_images_container {
28
+ padding: 0 0 0 9px;
29
+ ul {
30
+ margin: 0;
31
+ padding: 0;
32
+ @include clearfix;
33
+
34
+ li.image,
35
+ li.add,
36
+ li.projects-metabox-sortable-placeholder {
37
+ width: 80px;
38
+ float: left;
39
+ cursor: move;
40
+ margin: 9px 9px 0 0;
41
+ background: #f7f7f7;
42
+ position: relative;
43
+ background: #000;
44
+ -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
45
+ -moz-box-sizing: border-box; /* Firefox, other Gecko */
46
+ box-sizing: border-box; /* Opera/IE 8+ */
47
+ img {
48
+ width: 100%;
49
+ height: auto;
50
+ display: block;
51
+ @include animation(all ease .2s);
52
+ }
53
+ &:hover {
54
+ img {
55
+ @include opacity(0.75);
56
+ }
57
+ }
58
+ }
59
+ li.projects-metabox-sortable-placeholder {
60
+ background: #f1f1f1;
61
+ }
62
+ ul.actions {
63
+ position: absolute;
64
+ top:0;
65
+ right: 0;
66
+ @include animation(all ease .2s);
67
+ @include opacity(0);
68
+ li {
69
+ float: right;
70
+ //margin: 0 0 0 1px;
71
+ a {
72
+ width: 20px;
73
+ margin: 0;
74
+ height: 20px;
75
+ font-size: 16px;
76
+ display: block;
77
+ overflow: hidden;
78
+ color: #fff;
79
+ background:#000;
80
+ font-weight: 300;
81
+ line-height: 20px;
82
+ text-align: center;
83
+ text-decoration: none;
84
+ @include animation(all ease .2s);
85
+ &.edit,
86
+ &.delete {
87
+ text-indent: -999px;
88
+ position: relative;
89
+ background: #000;
90
+
91
+ &:before {
92
+ content: "\f464";
93
+ display: block;
94
+ position: absolute;
95
+ top: 0;
96
+ right: 0;
97
+ bottom: 0;
98
+ left: 0;
99
+ font-family: 'Dashicons';
100
+ color: #fff;
101
+ text-indent: 0;
102
+ font-weight: normal;
103
+ }
104
+
105
+ &:hover {
106
+ background: #444;
107
+ }
108
+ }
109
+
110
+ &.delete {
111
+ background-color: $error;
112
+ &:before {
113
+ content: "\f335";
114
+ }
115
+ &:hover {
116
+ background: $error - #222;
117
+ }
118
+ }
119
+ }
120
+ }
121
+ }
122
+ li:hover ul.actions {
123
+ @include opacity(1);
124
+ }
125
+ }
126
+ }
127
+ }
128
+ }
129
+
130
+ // Autocomplete
131
+ .post-type-project {
132
+ .ui-autocomplete {
133
+ font-family: inherit;
134
+ font-size: 1em;
135
+ background: #fafafa;
136
+ -webkit-box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1);
137
+ box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1);
138
+ -webkit-border-radius: 0 0 4px 4px;
139
+ border-radius: 0 0 4px 4px;
140
+ -webkit-transform: translateY(-1px);
141
+ transform: translateY(-1px);
142
+ li {
143
+ a {
144
+ -webkit-border-radius: 0;
145
+ border-radius: 0;
146
+ border: 0;
147
+ background: none;
148
+ &:hover {
149
+ border: 0;
150
+ background: #f6f6f6;
151
+ }
152
+ }
153
+ &:last-child {
154
+ a {
155
+ -webkit-border-radius: 0 0 4px 4px;
156
+ border-radius: 0 0 4px 4px;
157
+ }
158
+ }
159
+ }
160
+ }
161
+
162
+ .projects-radio {
163
+ label {
164
+ display: block;
165
+ line-height: 1.5;
166
+ }
167
+ }
168
  }
classes/class-projects-shortcodes.php CHANGED
@@ -61,8 +61,14 @@ class Projects_Shortcodes {
61
  'orderby' => 'date',
62
  'order' => 'desc',
63
  'exclude_categories' => null,
 
64
  ), $atts ) );
65
 
 
 
 
 
 
66
  $args = array(
67
  'post_type' => 'project',
68
  'post_status' => 'publish',
@@ -75,6 +81,7 @@ class Projects_Shortcodes {
75
  'taxonomy' => 'project-category',
76
  'field' => 'id',
77
  'terms' => explode( ',', $exclude_categories ),
 
78
  'operator' => 'NOT IN'
79
  )
80
  )
@@ -109,4 +116,4 @@ class Projects_Shortcodes {
109
  }
110
 
111
 
112
- new Projects_Shortcodes();
61
  'orderby' => 'date',
62
  'order' => 'desc',
63
  'exclude_categories' => null,
64
+ 'include_children' => true
65
  ), $atts ) );
66
 
67
+ // Cater for fallback on false attribute
68
+ if ( $include_children === 'false' ) {
69
+ $include_children = false;
70
+ } // End If Statement
71
+
72
  $args = array(
73
  'post_type' => 'project',
74
  'post_status' => 'publish',
81
  'taxonomy' => 'project-category',
82
  'field' => 'id',
83
  'terms' => explode( ',', $exclude_categories ),
84
+ 'include_children' => $include_children,
85
  'operator' => 'NOT IN'
86
  )
87
  )
116
  }
117
 
118
 
119
+ new Projects_Shortcodes();
classes/class-projects.php ADDED
@@ -0,0 +1,402 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
@@ -55,7 +55,7 @@ class Woothemes_Widget_Project_Categories extends WP_Widget {
55
  );
56
 
57
  /* Create the widget. */
58
- $this->WP_Widget( $this->projects_widget_idbase, $this->projects_widget_title, $widget_ops, $control_ops );
59
  } // End __construct()
60
 
61
  /**
@@ -181,4 +181,4 @@ class Woothemes_Widget_Project_Categories extends WP_Widget {
181
  } // End Class
182
 
183
  /* Register the widget. */
184
- register_widget( 'Woothemes_Widget_Project_Categories' );
55
  );
56
 
57
  /* Create the widget. */
58
+ parent::__construct( $this->projects_widget_idbase, $this->projects_widget_title, $widget_ops, $control_ops );
59
  } // End __construct()
60
 
61
  /**
181
  } // End Class
182
 
183
  /* Register the widget. */
184
+ register_widget( 'Woothemes_Widget_Project_Categories' );
classes/class-widget-projects.php CHANGED
@@ -59,7 +59,7 @@ class Woothemes_Widget_Projects extends WP_Widget {
59
  );
60
 
61
  /* Create the widget. */
62
- $this->WP_Widget( $this->projects_widget_idbase, $this->projects_widget_title, $widget_ops, $control_ops );
63
  } // End __construct()
64
 
65
  /**
@@ -214,4 +214,4 @@ class Woothemes_Widget_Projects extends WP_Widget {
214
  } // End Class
215
 
216
  /* Register the widget. */
217
- register_widget( 'Woothemes_Widget_Projects' );
59
  );
60
 
61
  /* Create the widget. */
62
+ parent::__construct( $this->projects_widget_idbase, $this->projects_widget_title, $widget_ops, $control_ops );
63
  } // End __construct()
64
 
65
  /**
214
  } // End Class
215
 
216
  /* Register the widget. */
217
+ register_widget( 'Woothemes_Widget_Projects' );
projects.php CHANGED
@@ -4,8 +4,9 @@
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.4.1
8
  * Author URI: http://woothemes.com/
 
9
  *
10
  * @package WordPress
11
  * @subpackage Projects
@@ -45,7 +46,7 @@ final class Projects {
45
  /**
46
  * @var string
47
  */
48
- public $version = '1.4.1';
49
 
50
  /**
51
  * Constructor function.
@@ -479,4 +480,4 @@ final class Projects {
479
 
480
  global $projects;
481
 
482
- $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.4.2
8
  * Author URI: http://woothemes.com/
9
+ * Text Domain: projects-by-woothemes
10
  *
11
  * @package WordPress
12
  * @subpackage Projects
46
  /**
47
  * @var string
48
  */
49
+ public $version = '1.4.2';
50
 
51
  /**
52
  * Constructor function.
480
 
481
  global $projects;
482
 
483
+ $projects = new Projects( __FILE__ );
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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: 4.0
7
- Stable tag: 1.4.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -103,6 +103,9 @@ You sure can! Read about how in the [documentation](http://docs.woothemes.com/do
103
 
104
  == Upgrade Notice ==
105
 
 
 
 
106
  = 1.4.0 =
107
  * The default permalink structure has been tweaked to remove the project category. So http://localhost/network/project/landscapes/the-barrow-downs/ becomes http://localhost/network/project/the-barrow-downs/. Any old links will automatically redirect to their newer counterparts. You may have to re-save your permalink settings after performing this update. You can use the `projects_post_type_rewrite` filter to adjust this.
108
 
@@ -118,6 +121,11 @@ You sure can! Read about how in the [documentation](http://docs.woothemes.com/do
118
 
119
  == Changelog ==
120
 
 
 
 
 
 
121
  = 1.4.1 =
122
  * 2014.12.05
123
  * Fix - Redirect issue when setting projects page as homepage.
4
  Tags: portfolio, projects, project, showcase, artwork, work, creative, photography, art, images, woocommerce
5
  Requires at least: 3.8
6
  Tested up to: 4.0
7
+ Stable tag: 1.4.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
103
 
104
  == Upgrade Notice ==
105
 
106
+ = 1.4.2 =
107
+ * Removes deprecated constructor call for WP_Widget
108
+
109
  = 1.4.0 =
110
  * The default permalink structure has been tweaked to remove the project category. So http://localhost/network/project/landscapes/the-barrow-downs/ becomes http://localhost/network/project/the-barrow-downs/. Any old links will automatically redirect to their newer counterparts. You may have to re-save your permalink settings after performing this update. You can use the `projects_post_type_rewrite` filter to adjust this.
111
 
121
 
122
  == Changelog ==
123
 
124
+ = 1.4.2 =
125
+ * 2015.07.07
126
+ * Tweak - Allow attribute for include_children inside taxonomy query.
127
+ * Removes deprecated constructor call for WP_Widget
128
+
129
  = 1.4.1 =
130
  * 2014.12.05
131
  * Fix - Redirect issue when setting projects page as homepage.