Version Description
- The project category urls have been improved to use the base page title as the slug opposed to the
project-category
default. So, previously your project cateogry urls will have looked like: yoursite.com/project-category/illustration. Now,project-category
is replaced with the slug of your projects base page. So if you're using a page called 'Portfolio' that url will now look like: yoursite.com/portfolio/illustration. You will have to create custom redirects if you want the old urls work. - This version adds admin tabs to the settings screens, and will run an update to your existing settings data. If your data is not retained, simply resave your settings.
Download this release
Release Info
Developer | jameskoster |
Plugin | Projects by WooThemes |
Version | 1.3.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.2 to 1.3.0
- classes/class-projects-admin.php +21 -8
- classes/class-projects-settings.php +85 -22
- classes/class-projects-taxonomy.php +2 -1
- config.codekit +51 -12
- projects-core-functions.php +1 -1
- projects.php +41 -8
- readme.txt +11 -3
classes/class-projects-admin.php
CHANGED
@@ -98,7 +98,7 @@ class Projects_Admin {
|
|
98 |
) );
|
99 |
}
|
100 |
}
|
101 |
-
}
|
102 |
|
103 |
/**
|
104 |
* Adjust the query string to use taxonomy slug instead of ID.
|
@@ -128,7 +128,7 @@ class Projects_Admin {
|
|
128 |
}
|
129 |
|
130 |
return $query;
|
131 |
-
}
|
132 |
|
133 |
/**
|
134 |
* Add custom columns for the "manage" screen of this post type.
|
@@ -265,7 +265,7 @@ class Projects_Admin {
|
|
265 |
);
|
266 |
|
267 |
wp_editor( htmlspecialchars_decode( $post->post_excerpt ), 'excerpt', apply_filters( 'projects_product_short_description_editor_settings', $settings ) );
|
268 |
-
}
|
269 |
|
270 |
/**
|
271 |
* The contents of our meta box.
|
@@ -312,6 +312,15 @@ class Projects_Admin {
|
|
312 |
if( isset( $v['description'] ) ) $html .= '<p class="description">' . $v['description'] . '</p>' . "\n";
|
313 |
$html .= '</td><tr/>' . "\n";
|
314 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
case 'upload':
|
316 |
$data_atts = '';
|
317 |
if ( isset( $v['media-frame']['title'] ) ){
|
@@ -470,6 +479,7 @@ class Projects_Admin {
|
|
470 |
${$f} = isset( $_POST[$f] ) ? esc_url( $_POST[$f] ) : '';
|
471 |
break;
|
472 |
case 'textarea':
|
|
|
473 |
${$f} = isset( $_POST[$f] ) ? wp_kses_post( trim( $_POST[$f] ) ) : '';
|
474 |
break;
|
475 |
case 'checkbox':
|
@@ -500,6 +510,9 @@ class Projects_Admin {
|
|
500 |
// Save the project gallery image IDs.
|
501 |
$attachment_ids = array_filter( explode( ',', sanitize_text_field( $_POST['project_image_gallery'] ) ) );
|
502 |
update_post_meta( $post_id, '_project_image_gallery', implode( ',', $attachment_ids ) );
|
|
|
|
|
|
|
503 |
} // End meta_box_save()
|
504 |
|
505 |
/**
|
@@ -602,7 +615,7 @@ class Projects_Admin {
|
|
602 |
global $projects;
|
603 |
remove_meta_box( 'postimagediv', 'project', 'side' );
|
604 |
add_meta_box( 'postimagediv', sprintf( __( '%s Cover Image', 'projects-by-woothemes' ), $projects->singular_name ), 'post_thumbnail_meta_box', 'project', 'side' );
|
605 |
-
}
|
606 |
|
607 |
/**
|
608 |
* Tweak the 'Set featured image' string to say 'Set cover image'.
|
@@ -618,7 +631,7 @@ class Projects_Admin {
|
|
618 |
}
|
619 |
|
620 |
return $content;
|
621 |
-
}
|
622 |
|
623 |
/**
|
624 |
* Tweak the 'Remove featured image' string to say 'Remove cover image'.
|
@@ -634,7 +647,7 @@ class Projects_Admin {
|
|
634 |
}
|
635 |
|
636 |
return $content;
|
637 |
-
}
|
638 |
|
639 |
/**
|
640 |
* Tweak the featured image strings in the media popup
|
@@ -649,7 +662,7 @@ class Projects_Admin {
|
|
649 |
$strings['setFeaturedImage'] = __( 'Set cover image', 'projects-by-woothemes' );
|
650 |
}
|
651 |
return $strings;
|
652 |
-
}
|
653 |
|
654 |
/**
|
655 |
* Determine what post type the current admin page is related to
|
@@ -673,6 +686,6 @@ class Projects_Admin {
|
|
673 |
return sanitize_key( $_REQUEST['post_type'] );
|
674 |
|
675 |
return null;
|
676 |
-
}
|
677 |
|
678 |
} // End Class
|
98 |
) );
|
99 |
}
|
100 |
}
|
101 |
+
} // projects_restrict_manage_posts()
|
102 |
|
103 |
/**
|
104 |
* Adjust the query string to use taxonomy slug instead of ID.
|
128 |
}
|
129 |
|
130 |
return $query;
|
131 |
+
} // End projects_post_type_request()
|
132 |
|
133 |
/**
|
134 |
* Add custom columns for the "manage" screen of this post type.
|
265 |
);
|
266 |
|
267 |
wp_editor( htmlspecialchars_decode( $post->post_excerpt ), 'excerpt', apply_filters( 'projects_product_short_description_editor_settings', $settings ) );
|
268 |
+
} // End meta_box_short_description()
|
269 |
|
270 |
/**
|
271 |
* The contents of our meta box.
|
312 |
if( isset( $v['description'] ) ) $html .= '<p class="description">' . $v['description'] . '</p>' . "\n";
|
313 |
$html .= '</td><tr/>' . "\n";
|
314 |
break;
|
315 |
+
case 'editor':
|
316 |
+
ob_start();
|
317 |
+
wp_editor( $data, $k, array( 'media_buttons' => false, 'textarea_rows' => 10 ) );
|
318 |
+
$field = ob_get_contents();
|
319 |
+
ob_end_clean();
|
320 |
+
$html .= '<tr valign="top"><th scope="row"><label for="' . esc_attr( $k ) . '">' . $v['name'] . '</label></th><td>' . $field . "\n";
|
321 |
+
if( isset( $v['description'] ) ) $html .= '<p class="description">' . $v['description'] . '</p>' . "\n";
|
322 |
+
$html .= '</td><tr/>' . "\n";
|
323 |
+
break;
|
324 |
case 'upload':
|
325 |
$data_atts = '';
|
326 |
if ( isset( $v['media-frame']['title'] ) ){
|
479 |
${$f} = isset( $_POST[$f] ) ? esc_url( $_POST[$f] ) : '';
|
480 |
break;
|
481 |
case 'textarea':
|
482 |
+
case 'editor':
|
483 |
${$f} = isset( $_POST[$f] ) ? wp_kses_post( trim( $_POST[$f] ) ) : '';
|
484 |
break;
|
485 |
case 'checkbox':
|
510 |
// Save the project gallery image IDs.
|
511 |
$attachment_ids = array_filter( explode( ',', sanitize_text_field( $_POST['project_image_gallery'] ) ) );
|
512 |
update_post_meta( $post_id, '_project_image_gallery', implode( ',', $attachment_ids ) );
|
513 |
+
|
514 |
+
do_action( 'projects_process_meta', $post_id, $field_data, $fields );
|
515 |
+
|
516 |
} // End meta_box_save()
|
517 |
|
518 |
/**
|
615 |
global $projects;
|
616 |
remove_meta_box( 'postimagediv', 'project', 'side' );
|
617 |
add_meta_box( 'postimagediv', sprintf( __( '%s Cover Image', 'projects-by-woothemes' ), $projects->singular_name ), 'post_thumbnail_meta_box', 'project', 'side' );
|
618 |
+
} // End featured_image_label()
|
619 |
|
620 |
/**
|
621 |
* Tweak the 'Set featured image' string to say 'Set cover image'.
|
631 |
}
|
632 |
|
633 |
return $content;
|
634 |
+
} // End featured_image_set_link()
|
635 |
|
636 |
/**
|
637 |
* Tweak the 'Remove featured image' string to say 'Remove cover image'.
|
647 |
}
|
648 |
|
649 |
return $content;
|
650 |
+
} // End featured_image_remove_link()
|
651 |
|
652 |
/**
|
653 |
* Tweak the featured image strings in the media popup
|
662 |
$strings['setFeaturedImage'] = __( 'Set cover image', 'projects-by-woothemes' );
|
663 |
}
|
664 |
return $strings;
|
665 |
+
} // End featured_image_popup_set_link()
|
666 |
|
667 |
/**
|
668 |
* Determine what post type the current admin page is related to
|
686 |
return sanitize_key( $_REQUEST['post_type'] );
|
687 |
|
688 |
return null;
|
689 |
+
} // End get_current_post_type()
|
690 |
|
691 |
} // End Class
|
classes/class-projects-settings.php
CHANGED
@@ -29,19 +29,54 @@ class Projects_Settings {
|
|
29 |
|
30 |
public function projects_add_settings_page() {
|
31 |
add_submenu_page( 'edit.php?post_type=project', __( 'Settings', 'projects-by-woothemes' ), __( 'Settings', 'projects-by-woothemes' ), 'publish_posts', 'projects-settings-page', array( $this, 'projects_settings_page' ) );
|
32 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
public function projects_settings_page() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
?>
|
36 |
<div class="wrap">
|
37 |
|
38 |
<h2><?php _e( 'Projects Settings', 'projects-by-woothemes' ); ?></h2>
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
<form action="options.php" method="post">
|
41 |
|
42 |
-
<?php
|
43 |
-
|
44 |
-
|
|
|
45 |
|
46 |
<p class="submit">
|
47 |
<input type="submit" class="button-primary" value="<?php _e( 'Save Changes' ) ?>" />
|
@@ -51,21 +86,33 @@ class Projects_Settings {
|
|
51 |
|
52 |
</div>
|
53 |
<?php
|
54 |
-
}
|
55 |
|
56 |
public function projects_options_init(){
|
57 |
-
register_setting( 'projects_main_settings', 'projects', array( $this, 'projects_main_settings_validate' ) );
|
58 |
-
add_settings_section( 'projects_page_settings_description', __( 'Pages', 'projects-by-woothemes' ), array( $this, 'projects_page_settings' ), 'projects' );
|
59 |
-
add_settings_section( 'projects_image_settings_description', __( 'Images', 'projects-by-woothemes' ), array( $this, 'projects_images_settings' ), 'projects' );
|
60 |
-
}
|
61 |
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
?>
|
64 |
<p><?php _e( 'Configure projects pages.', 'projects-by-woothemes' ); ?></p>
|
65 |
<?php
|
66 |
-
$options = get_option( 'projects' );
|
67 |
$args = array(
|
68 |
-
'name' => 'projects[projects_page_id]',
|
69 |
'selected' => absint( $options['projects_page_id'] ),
|
70 |
'sort_column' => 'menu_order',
|
71 |
'sort_order' => 'ASC',
|
@@ -84,14 +131,14 @@ class Projects_Settings {
|
|
84 |
</tr>
|
85 |
</table>
|
86 |
<?php
|
87 |
-
}
|
88 |
|
89 |
public function projects_images_settings() {
|
90 |
?>
|
91 |
<p><?php _e ( 'These settings control the dimensions of thumbnails in your projects. After updating these settings you may need to' , 'projects-by-woothemes' ); ?> <a href="http://wordpress.org/extend/plugins/regenerate-thumbnails/"><?php _e( 'regenerate your thumbnails', 'projects-by-woothemes' ); ?></a>.</p>
|
92 |
<?php
|
93 |
|
94 |
-
$options = get_option( 'projects' );
|
95 |
|
96 |
$defaults = apply_filters( 'projects_default_image_size', array(
|
97 |
'project-archive' => array(
|
@@ -122,7 +169,7 @@ class Projects_Settings {
|
|
122 |
</th>
|
123 |
<td>
|
124 |
<?php $crop = isset( $options['project-archive']['crop'] ) ? $options['project-archive']['crop'] : 'no'; ?>
|
125 |
-
<?php _e( 'Width:', 'projects-by-woothemes' ); ?> <input type="text" size="3" name="projects[project-archive][width]" value="<?php echo $options['project-archive']['width']; ?>" /> <?php _e( 'Height:', 'projects-by-woothemes' ); ?> <input type="text" size="3" name="projects[project-archive][height]" value="<?php echo $options['project-archive']['height']; ?>" /> <?php _e( 'Crop:', 'projects-by-woothemes' ); ?> <input type="checkbox" name="projects[project-archive][crop]" value="1" <?php checked( $crop, 'yes' );?> />
|
126 |
</td>
|
127 |
</tr>
|
128 |
<tr valign="top">
|
@@ -131,7 +178,7 @@ class Projects_Settings {
|
|
131 |
</th>
|
132 |
<td>
|
133 |
<?php $crop = isset( $options['project-single']['crop'] ) ? $options['project-single']['crop'] : 'no'; ?>
|
134 |
-
<?php _e( 'Width:', 'projects-by-woothemes' ); ?> <input type="text" size="3" name="projects[project-single][width]" value="<?php echo $options['project-single']['width']; ?>" /> <?php _e( 'Height:', 'projects-by-woothemes' ); ?> <input type="text" size="3" name="projects[project-single][height]" value="<?php echo $options['project-single']['height']; ?>" /> <?php _e( 'Crop:', 'projects-by-woothemes' ); ?> <input type="checkbox" name="projects[project-single][crop]" value="1" <?php checked( $crop, 'yes' );?> />
|
135 |
</td>
|
136 |
</tr>
|
137 |
<tr valign="top">
|
@@ -140,17 +187,34 @@ class Projects_Settings {
|
|
140 |
</th>
|
141 |
<td>
|
142 |
<?php $crop = isset( $options['project-thumbnail']['crop'] ) ? $options['project-thumbnail']['crop'] : 'no'; ?>
|
143 |
-
<?php _e( 'Width:', 'projects-by-woothemes' ); ?> <input type="text" size="3" name="projects[project-thumbnail][width]" value="<?php echo $options['project-thumbnail']['width']; ?>" /> <?php _e( 'Height:', 'projects-by-woothemes' ); ?> <input type="text" size="3" name="projects[project-thumbnail][height]" value="<?php echo $options['project-thumbnail']['height']; ?>" /> <?php _e( 'Crop:', 'projects-by-woothemes' ); ?> <input type="checkbox" name="projects[project-thumbnail][crop]" value="1" <?php checked( $crop, 'yes' );?> />
|
144 |
</td>
|
145 |
</tr>
|
146 |
</table>
|
147 |
<?php
|
148 |
-
}
|
149 |
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
|
152 |
$input['projects_page_id'] = absint( $input['projects_page_id'] );
|
153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
$input['project-archive']['width'] = absint( $input['project-archive']['width'] );
|
155 |
$input['project-archive']['height'] = absint( $input['project-archive']['height'] );
|
156 |
$input['project-archive']['crop'] = isset( $input['project-archive']['crop'] ) ? 'yes': 'no';
|
@@ -164,8 +228,7 @@ class Projects_Settings {
|
|
164 |
$input['project-thumbnail']['crop'] = isset( $input['project-thumbnail']['crop'] ) ? 'yes': 'no';
|
165 |
|
166 |
return $input;
|
167 |
-
}
|
168 |
-
|
169 |
|
170 |
} // End Class
|
171 |
|
29 |
|
30 |
public function projects_add_settings_page() {
|
31 |
add_submenu_page( 'edit.php?post_type=project', __( 'Settings', 'projects-by-woothemes' ), __( 'Settings', 'projects-by-woothemes' ), 'publish_posts', 'projects-settings-page', array( $this, 'projects_settings_page' ) );
|
32 |
+
} // End projects_add_settings_page()
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Retrieve the settings fields details
|
36 |
+
* @access public
|
37 |
+
* @since 1.2.3
|
38 |
+
* @return array Settings fields.
|
39 |
+
*/
|
40 |
+
public function get_settings_sections () {
|
41 |
+
$settings_sections = array();
|
42 |
+
|
43 |
+
$settings_sections['pages-fields'] = __( 'Pages', 'projects-by-woothemes' );
|
44 |
+
$settings_sections['images-fields'] = __( 'Images', 'projects-by-woothemes' );
|
45 |
+
|
46 |
+
return (array)apply_filters( 'projects_settings_sections', $settings_sections );
|
47 |
+
} // End get_settings_sections()
|
48 |
|
49 |
public function projects_settings_page() {
|
50 |
+
$sections = $this->get_settings_sections();
|
51 |
+
if ( isset ( $_GET['tab'] ) ) {
|
52 |
+
$tab = $_GET['tab'];
|
53 |
+
} else {
|
54 |
+
list( $first_section ) = array_keys( $sections );
|
55 |
+
$tab = $first_section;
|
56 |
+
} // End If Statement
|
57 |
?>
|
58 |
<div class="wrap">
|
59 |
|
60 |
<h2><?php _e( 'Projects Settings', 'projects-by-woothemes' ); ?></h2>
|
61 |
+
<h2 class="nav-tab-wrapper">
|
62 |
+
<?php
|
63 |
+
foreach ( $sections as $key => $value ) {
|
64 |
+
$class = '';
|
65 |
+
|
66 |
+
if ( $tab == $key ) {
|
67 |
+
$class = ' nav-tab-active';
|
68 |
+
} // End If Statement
|
69 |
+
|
70 |
+
echo '<a href="' . admin_url( 'edit.php?post_type=project&page=projects-settings-page&tab=' . $key ) . '" class="nav-tab' . $class . '">' . $value . '</a>';
|
71 |
+
} // End For Loop
|
72 |
+
?>
|
73 |
+
</h2>
|
74 |
<form action="options.php" method="post">
|
75 |
|
76 |
+
<?php
|
77 |
+
settings_fields( 'projects-settings-' . $tab );
|
78 |
+
do_settings_sections( 'projects-' . $tab );
|
79 |
+
?>
|
80 |
|
81 |
<p class="submit">
|
82 |
<input type="submit" class="button-primary" value="<?php _e( 'Save Changes' ) ?>" />
|
86 |
|
87 |
</div>
|
88 |
<?php
|
89 |
+
} // End projects_settings_page()
|
90 |
|
91 |
public function projects_options_init(){
|
|
|
|
|
|
|
|
|
92 |
|
93 |
+
$sections = $this->get_settings_sections();
|
94 |
+
if ( 0 < count( $sections ) ) {
|
95 |
+
foreach ( $sections as $k => $v ) {
|
96 |
+
$callback_array = explode( '-', $k );
|
97 |
+
if ( method_exists( $this, 'projects_' . $callback_array[0] . '_settings_validate' ) ) {
|
98 |
+
register_setting( 'projects-settings-' . $k, 'projects-' . $k, array( $this, 'projects_' . $callback_array[0] . '_settings_validate' ) );
|
99 |
+
add_settings_section( $k, $v, array( $this, 'projects_' . $callback_array[0] . '_settings' ), 'projects-' . $k );
|
100 |
+
} elseif( function_exists( 'projects_' . $callback_array[0] . '_settings_validate' ) ) {
|
101 |
+
register_setting( 'projects-settings-' . $k, 'projects-' . $k, 'projects_' . $callback_array[0] . '_settings_validate' );
|
102 |
+
add_settings_section( $k, $v, 'projects_' . $callback_array[0] . '_settings', 'projects-' . $k );
|
103 |
+
} // End If Statement
|
104 |
+
} // End For Loop
|
105 |
+
} // End If Statement
|
106 |
+
|
107 |
+
} // End projects_options_init()
|
108 |
+
|
109 |
+
public function projects_pages_settings() {
|
110 |
?>
|
111 |
<p><?php _e( 'Configure projects pages.', 'projects-by-woothemes' ); ?></p>
|
112 |
<?php
|
113 |
+
$options = get_option( 'projects-pages-fields' );
|
114 |
$args = array(
|
115 |
+
'name' => 'projects-pages-fields[projects_page_id]',
|
116 |
'selected' => absint( $options['projects_page_id'] ),
|
117 |
'sort_column' => 'menu_order',
|
118 |
'sort_order' => 'ASC',
|
131 |
</tr>
|
132 |
</table>
|
133 |
<?php
|
134 |
+
} // End projects_pages_settings()
|
135 |
|
136 |
public function projects_images_settings() {
|
137 |
?>
|
138 |
<p><?php _e ( 'These settings control the dimensions of thumbnails in your projects. After updating these settings you may need to' , 'projects-by-woothemes' ); ?> <a href="http://wordpress.org/extend/plugins/regenerate-thumbnails/"><?php _e( 'regenerate your thumbnails', 'projects-by-woothemes' ); ?></a>.</p>
|
139 |
<?php
|
140 |
|
141 |
+
$options = get_option( 'projects-images-fields' );
|
142 |
|
143 |
$defaults = apply_filters( 'projects_default_image_size', array(
|
144 |
'project-archive' => array(
|
169 |
</th>
|
170 |
<td>
|
171 |
<?php $crop = isset( $options['project-archive']['crop'] ) ? $options['project-archive']['crop'] : 'no'; ?>
|
172 |
+
<?php _e( 'Width:', 'projects-by-woothemes' ); ?> <input type="text" size="3" name="projects-images-fields[project-archive][width]" value="<?php echo $options['project-archive']['width']; ?>" /> <?php _e( 'Height:', 'projects-by-woothemes' ); ?> <input type="text" size="3" name="projects-images-fields[project-archive][height]" value="<?php echo $options['project-archive']['height']; ?>" /> <?php _e( 'Crop:', 'projects-by-woothemes' ); ?> <input type="checkbox" name="projects-images-fields[project-archive][crop]" value="1" <?php checked( $crop, 'yes' );?> />
|
173 |
</td>
|
174 |
</tr>
|
175 |
<tr valign="top">
|
178 |
</th>
|
179 |
<td>
|
180 |
<?php $crop = isset( $options['project-single']['crop'] ) ? $options['project-single']['crop'] : 'no'; ?>
|
181 |
+
<?php _e( 'Width:', 'projects-by-woothemes' ); ?> <input type="text" size="3" name="projects-images-fields[project-single][width]" value="<?php echo $options['project-single']['width']; ?>" /> <?php _e( 'Height:', 'projects-by-woothemes' ); ?> <input type="text" size="3" name="projects-images-fields[project-single][height]" value="<?php echo $options['project-single']['height']; ?>" /> <?php _e( 'Crop:', 'projects-by-woothemes' ); ?> <input type="checkbox" name="projects-images-fields[project-single][crop]" value="1" <?php checked( $crop, 'yes' );?> />
|
182 |
</td>
|
183 |
</tr>
|
184 |
<tr valign="top">
|
187 |
</th>
|
188 |
<td>
|
189 |
<?php $crop = isset( $options['project-thumbnail']['crop'] ) ? $options['project-thumbnail']['crop'] : 'no'; ?>
|
190 |
+
<?php _e( 'Width:', 'projects-by-woothemes' ); ?> <input type="text" size="3" name="projects-images-fields[project-thumbnail][width]" value="<?php echo $options['project-thumbnail']['width']; ?>" /> <?php _e( 'Height:', 'projects-by-woothemes' ); ?> <input type="text" size="3" name="projects-images-fields[project-thumbnail][height]" value="<?php echo $options['project-thumbnail']['height']; ?>" /> <?php _e( 'Crop:', 'projects-by-woothemes' ); ?> <input type="checkbox" name="projects-images-fields[project-thumbnail][crop]" value="1" <?php checked( $crop, 'yes' );?> />
|
191 |
</td>
|
192 |
</tr>
|
193 |
</table>
|
194 |
<?php
|
195 |
+
} // End projects_images_settings()
|
196 |
|
197 |
+
/**
|
198 |
+
* projects_pages_settings_validate validates pages settings form data
|
199 |
+
* @param array $input array of form data
|
200 |
+
* @since 1.2.3
|
201 |
+
* @return array $input array of sanitized form data
|
202 |
+
*/
|
203 |
+
public function projects_pages_settings_validate( $input ) {
|
204 |
|
205 |
$input['projects_page_id'] = absint( $input['projects_page_id'] );
|
206 |
|
207 |
+
return $input;
|
208 |
+
} // End projects_pages_settings_validate()
|
209 |
+
|
210 |
+
/**
|
211 |
+
* projects_images_settings_validate validates images settings form data
|
212 |
+
* @param array $input array of form data
|
213 |
+
* @since 1.2.3
|
214 |
+
* @return array $input array of sanitized form data
|
215 |
+
*/
|
216 |
+
public function projects_images_settings_validate( $input ) {
|
217 |
+
|
218 |
$input['project-archive']['width'] = absint( $input['project-archive']['width'] );
|
219 |
$input['project-archive']['height'] = absint( $input['project-archive']['height'] );
|
220 |
$input['project-archive']['crop'] = isset( $input['project-archive']['crop'] ) ? 'yes': 'no';
|
228 |
$input['project-thumbnail']['crop'] = isset( $input['project-thumbnail']['crop'] ) ? 'yes': 'no';
|
229 |
|
230 |
return $input;
|
231 |
+
} // End projects_images_settings_validate()
|
|
|
232 |
|
233 |
} // End Class
|
234 |
|
classes/class-projects-taxonomy.php
CHANGED
@@ -89,7 +89,8 @@ class Projects_Taxonomy {
|
|
89 |
'show_admin_column' => true,
|
90 |
'query_var' => true,
|
91 |
'show_in_nav_menus' => true,
|
92 |
-
'show_tagcloud' => false
|
|
|
93 |
);
|
94 |
} // End _get_default_args()
|
95 |
|
89 |
'show_admin_column' => true,
|
90 |
'query_var' => true,
|
91 |
'show_in_nav_menus' => true,
|
92 |
+
'show_tagcloud' => false,
|
93 |
+
'rewrite' => array( 'slug' => ( $projects_page_id = projects_get_page_id( 'projects' ) ) && get_page( $projects_page_id ) ? get_page_uri( $projects_page_id ) : 'projects', 'with_front' => false )
|
94 |
);
|
95 |
} // End _get_default_args()
|
96 |
|
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": "
|
4 |
"files": {
|
5 |
"\/assets\/css\/_mixins.scss": {
|
6 |
"createSourceMap": 0,
|
@@ -137,38 +137,38 @@
|
|
137 |
"outputStyle": 1,
|
138 |
"syntaxCheckerStyle": 1
|
139 |
},
|
140 |
-
"\/classes\/class-projects-
|
141 |
"fileType": 8192,
|
142 |
"ignore": 0,
|
143 |
"ignoreWasSetByUser": 0,
|
144 |
-
"inputAbbreviatedPath": "\/classes\/class-projects-
|
145 |
"outputAbbreviatedPath": "No Output Path",
|
146 |
"outputPathIsOutsideProject": 0,
|
147 |
"outputPathIsSetByUser": 0
|
148 |
},
|
149 |
-
"\/classes\/class-projects-
|
150 |
"fileType": 8192,
|
151 |
"ignore": 0,
|
152 |
"ignoreWasSetByUser": 0,
|
153 |
-
"inputAbbreviatedPath": "\/classes\/class-projects-
|
154 |
"outputAbbreviatedPath": "No Output Path",
|
155 |
"outputPathIsOutsideProject": 0,
|
156 |
"outputPathIsSetByUser": 0
|
157 |
},
|
158 |
-
"\/classes\/class-projects-
|
159 |
"fileType": 8192,
|
160 |
"ignore": 0,
|
161 |
"ignoreWasSetByUser": 0,
|
162 |
-
"inputAbbreviatedPath": "\/classes\/class-projects-
|
163 |
"outputAbbreviatedPath": "No Output Path",
|
164 |
"outputPathIsOutsideProject": 0,
|
165 |
"outputPathIsSetByUser": 0
|
166 |
},
|
167 |
-
"\/classes\/class-projects-
|
168 |
"fileType": 8192,
|
169 |
"ignore": 0,
|
170 |
"ignoreWasSetByUser": 0,
|
171 |
-
"inputAbbreviatedPath": "\/classes\/class-projects-
|
172 |
"outputAbbreviatedPath": "No Output Path",
|
173 |
"outputPathIsOutsideProject": 0,
|
174 |
"outputPathIsSetByUser": 0
|
@@ -182,11 +182,20 @@
|
|
182 |
"outputPathIsOutsideProject": 0,
|
183 |
"outputPathIsSetByUser": 0
|
184 |
},
|
185 |
-
"\/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
"fileType": 8192,
|
187 |
"ignore": 0,
|
188 |
"ignoreWasSetByUser": 0,
|
189 |
-
"inputAbbreviatedPath": "\/
|
190 |
"outputAbbreviatedPath": "No Output Path",
|
191 |
"outputPathIsOutsideProject": 0,
|
192 |
"outputPathIsSetByUser": 0
|
@@ -371,6 +380,15 @@
|
|
371 |
"outputPathIsOutsideProject": 0,
|
372 |
"outputPathIsSetByUser": 0
|
373 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
"\/templates\/single-project\/short-description.php": {
|
375 |
"fileType": 8192,
|
376 |
"ignore": 0,
|
@@ -417,6 +435,8 @@
|
|
417 |
"autoprefixerBrowserString": "> 1%, last 2 versions, ff 17, opera 12.1",
|
418 |
"autoSyncProjectSettingsFile": 1,
|
419 |
"browserRefreshDelay": 0,
|
|
|
|
|
420 |
"coffeeAutoOutputPathRelativePath": "",
|
421 |
"coffeeAutoOutputPathReplace1": "",
|
422 |
"coffeeAutoOutputPathReplace2": "",
|
@@ -542,6 +562,8 @@
|
|
542 |
"externalServerAddress": "http:\/\/localhost:8888",
|
543 |
"externalServerPreviewPathAddition": "",
|
544 |
"genericWebpageFileExtensionsString": "html, htm, shtml, shtm, xhtml, php, jsp, asp, aspx, erb, ctp",
|
|
|
|
|
545 |
"hamlAutoOutputPathRelativePath": "",
|
546 |
"hamlAutoOutputPathReplace1": "",
|
547 |
"hamlAutoOutputPathReplace2": "",
|
@@ -553,19 +575,22 @@
|
|
553 |
"hamlUseCDATA": 0,
|
554 |
"hamlUseDoubleQuotes": 0,
|
555 |
"hamlUseUnixNewlines": 0,
|
|
|
|
|
556 |
"jadeAutoOutputPathRelativePath": "",
|
557 |
"jadeAutoOutputPathReplace1": "",
|
558 |
"jadeAutoOutputPathReplace2": "",
|
559 |
"jadeAutoOutputPathStyle": 0,
|
560 |
"jadeCompileDebug": 1,
|
561 |
"jadeOutputStyle": 0,
|
|
|
|
|
562 |
"javascriptAutoOutputPathRelativePath": "\/min",
|
563 |
"javascriptAutoOutputPathReplace1": "",
|
564 |
"javascriptAutoOutputPathReplace2": "",
|
565 |
"javascriptAutoOutputPathStyle": 2,
|
566 |
"javascriptCreateSourceMap": 1,
|
567 |
"javascriptOutputStyle": 1,
|
568 |
-
"javascriptOutputSuffix": "-ck",
|
569 |
"javascriptSyntaxCheckerStyle": 1,
|
570 |
"jsCheckerReservedNamesString": "",
|
571 |
"jsHintFlags2": {
|
@@ -940,11 +965,15 @@
|
|
940 |
"flagValue": -1
|
941 |
}
|
942 |
},
|
|
|
|
|
943 |
"kitAutoOutputPathRelativePath": "",
|
944 |
"kitAutoOutputPathReplace1": "",
|
945 |
"kitAutoOutputPathReplace2": "",
|
946 |
"kitAutoOutputPathStyle": 0,
|
947 |
"lessAllowInsecureImports": 0,
|
|
|
|
|
948 |
"lessAutoOutputPathRelativePath": "..\/css",
|
949 |
"lessAutoOutputPathReplace1": "less",
|
950 |
"lessAutoOutputPathReplace2": "css",
|
@@ -957,6 +986,8 @@
|
|
957 |
"lessStrictImports": 0,
|
958 |
"lessStrictMath": 0,
|
959 |
"lessStrictUnits": 0,
|
|
|
|
|
960 |
"markdownAutoOutputPathRelativePath": "",
|
961 |
"markdownAutoOutputPathReplace1": "",
|
962 |
"markdownAutoOutputPathReplace2": "",
|
@@ -965,6 +996,8 @@
|
|
965 |
"markdownEnableSmartyPants": 1,
|
966 |
"markdownExpandTabs": 1,
|
967 |
"reloadFileURLs": 0,
|
|
|
|
|
968 |
"sassAutoOutputPathRelativePath": "..\/css",
|
969 |
"sassAutoOutputPathReplace1": "sass",
|
970 |
"sassAutoOutputPathReplace2": "css",
|
@@ -977,6 +1010,8 @@
|
|
977 |
"shouldRunAutoprefixer": 0,
|
978 |
"shouldRunBless": 0,
|
979 |
"skippedItemsString": ".svn, .git, .hg, log, _logs, _cache, cache, logs",
|
|
|
|
|
980 |
"slimAutoOutputPathRelativePath": "",
|
981 |
"slimAutoOutputPathReplace1": "",
|
982 |
"slimAutoOutputPathReplace2": "",
|
@@ -985,6 +1020,8 @@
|
|
985 |
"slimLogicless": 0,
|
986 |
"slimOutputStyle": 1,
|
987 |
"slimRailsCompatible": 0,
|
|
|
|
|
988 |
"stylusAutoOutputPathRelativePath": "..\/css",
|
989 |
"stylusAutoOutputPathReplace1": "stylus",
|
990 |
"stylusAutoOutputPathReplace2": "css",
|
@@ -993,6 +1030,8 @@
|
|
993 |
"stylusImportCSS": 0,
|
994 |
"stylusOutputStyle": 0,
|
995 |
"stylusResolveRelativeURLS": 0,
|
|
|
|
|
996 |
"typescriptAutoOutputPathRelativePath": "\/js",
|
997 |
"typescriptAutoOutputPathReplace1": "",
|
998 |
"typescriptAutoOutputPathReplace2": "",
|
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": "17670",
|
4 |
"files": {
|
5 |
"\/assets\/css\/_mixins.scss": {
|
6 |
"createSourceMap": 0,
|
137 |
"outputStyle": 1,
|
138 |
"syntaxCheckerStyle": 1
|
139 |
},
|
140 |
+
"\/classes\/class-projects-frontend.php": {
|
141 |
"fileType": 8192,
|
142 |
"ignore": 0,
|
143 |
"ignoreWasSetByUser": 0,
|
144 |
+
"inputAbbreviatedPath": "\/classes\/class-projects-frontend.php",
|
145 |
"outputAbbreviatedPath": "No Output Path",
|
146 |
"outputPathIsOutsideProject": 0,
|
147 |
"outputPathIsSetByUser": 0
|
148 |
},
|
149 |
+
"\/classes\/class-projects-integrations.php": {
|
150 |
"fileType": 8192,
|
151 |
"ignore": 0,
|
152 |
"ignoreWasSetByUser": 0,
|
153 |
+
"inputAbbreviatedPath": "\/classes\/class-projects-integrations.php",
|
154 |
"outputAbbreviatedPath": "No Output Path",
|
155 |
"outputPathIsOutsideProject": 0,
|
156 |
"outputPathIsSetByUser": 0
|
157 |
},
|
158 |
+
"\/classes\/class-projects-shortcodes.php": {
|
159 |
"fileType": 8192,
|
160 |
"ignore": 0,
|
161 |
"ignoreWasSetByUser": 0,
|
162 |
+
"inputAbbreviatedPath": "\/classes\/class-projects-shortcodes.php",
|
163 |
"outputAbbreviatedPath": "No Output Path",
|
164 |
"outputPathIsOutsideProject": 0,
|
165 |
"outputPathIsSetByUser": 0
|
166 |
},
|
167 |
+
"\/classes\/class-projects-taxonomy.php": {
|
168 |
"fileType": 8192,
|
169 |
"ignore": 0,
|
170 |
"ignoreWasSetByUser": 0,
|
171 |
+
"inputAbbreviatedPath": "\/classes\/class-projects-taxonomy.php",
|
172 |
"outputAbbreviatedPath": "No Output Path",
|
173 |
"outputPathIsOutsideProject": 0,
|
174 |
"outputPathIsSetByUser": 0
|
182 |
"outputPathIsOutsideProject": 0,
|
183 |
"outputPathIsSetByUser": 0
|
184 |
},
|
185 |
+
"\/classes\/class-widget-project-categories.php": {
|
186 |
+
"fileType": 8192,
|
187 |
+
"ignore": 0,
|
188 |
+
"ignoreWasSetByUser": 0,
|
189 |
+
"inputAbbreviatedPath": "\/classes\/class-widget-project-categories.php",
|
190 |
+
"outputAbbreviatedPath": "No Output Path",
|
191 |
+
"outputPathIsOutsideProject": 0,
|
192 |
+
"outputPathIsSetByUser": 0
|
193 |
+
},
|
194 |
+
"\/classes\/class-widget-projects.php": {
|
195 |
"fileType": 8192,
|
196 |
"ignore": 0,
|
197 |
"ignoreWasSetByUser": 0,
|
198 |
+
"inputAbbreviatedPath": "\/classes\/class-widget-projects.php",
|
199 |
"outputAbbreviatedPath": "No Output Path",
|
200 |
"outputPathIsOutsideProject": 0,
|
201 |
"outputPathIsSetByUser": 0
|
380 |
"outputPathIsOutsideProject": 0,
|
381 |
"outputPathIsSetByUser": 0
|
382 |
},
|
383 |
+
"\/templates\/single-project\/project-gallery.php": {
|
384 |
+
"fileType": 8192,
|
385 |
+
"ignore": 0,
|
386 |
+
"ignoreWasSetByUser": 0,
|
387 |
+
"inputAbbreviatedPath": "\/templates\/single-project\/project-gallery.php",
|
388 |
+
"outputAbbreviatedPath": "No Output Path",
|
389 |
+
"outputPathIsOutsideProject": 0,
|
390 |
+
"outputPathIsSetByUser": 0
|
391 |
+
},
|
392 |
"\/templates\/single-project\/short-description.php": {
|
393 |
"fileType": 8192,
|
394 |
"ignore": 0,
|
435 |
"autoprefixerBrowserString": "> 1%, last 2 versions, ff 17, opera 12.1",
|
436 |
"autoSyncProjectSettingsFile": 1,
|
437 |
"browserRefreshDelay": 0,
|
438 |
+
"coffeeAutoOutputPathEnabled": 1,
|
439 |
+
"coffeeAutoOutputPathFilenamePattern": "*.js",
|
440 |
"coffeeAutoOutputPathRelativePath": "",
|
441 |
"coffeeAutoOutputPathReplace1": "",
|
442 |
"coffeeAutoOutputPathReplace2": "",
|
562 |
"externalServerAddress": "http:\/\/localhost:8888",
|
563 |
"externalServerPreviewPathAddition": "",
|
564 |
"genericWebpageFileExtensionsString": "html, htm, shtml, shtm, xhtml, php, jsp, asp, aspx, erb, ctp",
|
565 |
+
"hamlAutoOutputPathEnabled": 1,
|
566 |
+
"hamlAutoOutputPathFilenamePattern": "*.html",
|
567 |
"hamlAutoOutputPathRelativePath": "",
|
568 |
"hamlAutoOutputPathReplace1": "",
|
569 |
"hamlAutoOutputPathReplace2": "",
|
575 |
"hamlUseCDATA": 0,
|
576 |
"hamlUseDoubleQuotes": 0,
|
577 |
"hamlUseUnixNewlines": 0,
|
578 |
+
"jadeAutoOutputPathEnabled": 1,
|
579 |
+
"jadeAutoOutputPathFilenamePattern": "*.html",
|
580 |
"jadeAutoOutputPathRelativePath": "",
|
581 |
"jadeAutoOutputPathReplace1": "",
|
582 |
"jadeAutoOutputPathReplace2": "",
|
583 |
"jadeAutoOutputPathStyle": 0,
|
584 |
"jadeCompileDebug": 1,
|
585 |
"jadeOutputStyle": 0,
|
586 |
+
"javascriptAutoOutputPathEnabled": 1,
|
587 |
+
"javascriptAutoOutputPathFilenamePattern": "*-min.js",
|
588 |
"javascriptAutoOutputPathRelativePath": "\/min",
|
589 |
"javascriptAutoOutputPathReplace1": "",
|
590 |
"javascriptAutoOutputPathReplace2": "",
|
591 |
"javascriptAutoOutputPathStyle": 2,
|
592 |
"javascriptCreateSourceMap": 1,
|
593 |
"javascriptOutputStyle": 1,
|
|
|
594 |
"javascriptSyntaxCheckerStyle": 1,
|
595 |
"jsCheckerReservedNamesString": "",
|
596 |
"jsHintFlags2": {
|
965 |
"flagValue": -1
|
966 |
}
|
967 |
},
|
968 |
+
"kitAutoOutputPathEnabled": 1,
|
969 |
+
"kitAutoOutputPathFilenamePattern": "*.html",
|
970 |
"kitAutoOutputPathRelativePath": "",
|
971 |
"kitAutoOutputPathReplace1": "",
|
972 |
"kitAutoOutputPathReplace2": "",
|
973 |
"kitAutoOutputPathStyle": 0,
|
974 |
"lessAllowInsecureImports": 0,
|
975 |
+
"lessAutoOutputPathEnabled": 1,
|
976 |
+
"lessAutoOutputPathFilenamePattern": "*.css",
|
977 |
"lessAutoOutputPathRelativePath": "..\/css",
|
978 |
"lessAutoOutputPathReplace1": "less",
|
979 |
"lessAutoOutputPathReplace2": "css",
|
986 |
"lessStrictImports": 0,
|
987 |
"lessStrictMath": 0,
|
988 |
"lessStrictUnits": 0,
|
989 |
+
"markdownAutoOutputPathEnabled": 1,
|
990 |
+
"markdownAutoOutputPathFilenamePattern": "*.html",
|
991 |
"markdownAutoOutputPathRelativePath": "",
|
992 |
"markdownAutoOutputPathReplace1": "",
|
993 |
"markdownAutoOutputPathReplace2": "",
|
996 |
"markdownEnableSmartyPants": 1,
|
997 |
"markdownExpandTabs": 1,
|
998 |
"reloadFileURLs": 0,
|
999 |
+
"sassAutoOutputPathEnabled": 1,
|
1000 |
+
"sassAutoOutputPathFilenamePattern": "*.css",
|
1001 |
"sassAutoOutputPathRelativePath": "..\/css",
|
1002 |
"sassAutoOutputPathReplace1": "sass",
|
1003 |
"sassAutoOutputPathReplace2": "css",
|
1010 |
"shouldRunAutoprefixer": 0,
|
1011 |
"shouldRunBless": 0,
|
1012 |
"skippedItemsString": ".svn, .git, .hg, log, _logs, _cache, cache, logs",
|
1013 |
+
"slimAutoOutputPathEnabled": 1,
|
1014 |
+
"slimAutoOutputPathFilenamePattern": "*.html",
|
1015 |
"slimAutoOutputPathRelativePath": "",
|
1016 |
"slimAutoOutputPathReplace1": "",
|
1017 |
"slimAutoOutputPathReplace2": "",
|
1020 |
"slimLogicless": 0,
|
1021 |
"slimOutputStyle": 1,
|
1022 |
"slimRailsCompatible": 0,
|
1023 |
+
"stylusAutoOutputPathEnabled": 1,
|
1024 |
+
"stylusAutoOutputPathFilenamePattern": "*.css",
|
1025 |
"stylusAutoOutputPathRelativePath": "..\/css",
|
1026 |
"stylusAutoOutputPathReplace1": "stylus",
|
1027 |
"stylusAutoOutputPathReplace2": "css",
|
1030 |
"stylusImportCSS": 0,
|
1031 |
"stylusOutputStyle": 0,
|
1032 |
"stylusResolveRelativeURLS": 0,
|
1033 |
+
"typescriptAutoOutputPathEnabled": 1,
|
1034 |
+
"typescriptAutoOutputPathFilenamePattern": "*.js",
|
1035 |
"typescriptAutoOutputPathRelativePath": "\/js",
|
1036 |
"typescriptAutoOutputPathReplace1": "",
|
1037 |
"typescriptAutoOutputPathReplace2": "",
|
projects-core-functions.php
CHANGED
@@ -24,7 +24,7 @@ if ( ! function_exists( 'projects_get_page_id' ) ) {
|
|
24 |
* @return int
|
25 |
*/
|
26 |
function projects_get_page_id ( $page ) {
|
27 |
-
$options = get_option( 'projects' );
|
28 |
$page = apply_filters( 'projects_get_' . $page . '_page_id', $options[ $page . '_page_id' ] );
|
29 |
|
30 |
return $page ? $page : -1;
|
24 |
* @return int
|
25 |
*/
|
26 |
function projects_get_page_id ( $page ) {
|
27 |
+
$options = get_option( 'projects-pages-fields' );
|
28 |
$page = apply_filters( 'projects_get_' . $page . '_page_id', $options[ $page . '_page_id' ] );
|
29 |
|
30 |
return $page ? $page : -1;
|
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.
|
8 |
* Author URI: http://woothemes.com/
|
9 |
*
|
10 |
* @package WordPress
|
@@ -45,7 +45,7 @@ final class Projects {
|
|
45 |
/**
|
46 |
* @var string
|
47 |
*/
|
48 |
-
public $version = '1.
|
49 |
|
50 |
/**
|
51 |
* Constructor function.
|
@@ -62,6 +62,9 @@ final class Projects {
|
|
62 |
$this->token = 'projects';
|
63 |
$this->post_type = 'project';
|
64 |
|
|
|
|
|
|
|
65 |
// Variables
|
66 |
$this->template_url = apply_filters( 'projects_template_url', 'projects/' );
|
67 |
|
@@ -116,7 +119,7 @@ final class Projects {
|
|
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
|
@@ -128,7 +131,7 @@ final class Projects {
|
|
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.
|
@@ -201,7 +204,7 @@ final class Projects {
|
|
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(
|
@@ -408,7 +411,7 @@ final class Projects {
|
|
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';
|
@@ -427,7 +430,7 @@ final class Projects {
|
|
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.
|
@@ -442,7 +445,37 @@ final class Projects {
|
|
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 |
|
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.3.0
|
8 |
* Author URI: http://woothemes.com/
|
9 |
*
|
10 |
* @package WordPress
|
45 |
/**
|
46 |
* @var string
|
47 |
*/
|
48 |
+
public $version = '1.3.0';
|
49 |
|
50 |
/**
|
51 |
* Constructor function.
|
62 |
$this->token = 'projects';
|
63 |
$this->post_type = 'project';
|
64 |
|
65 |
+
// Upgrade data
|
66 |
+
$this->upgrade_data( true );
|
67 |
+
|
68 |
// Variables
|
69 |
$this->template_url = apply_filters( 'projects_template_url', 'projects/' );
|
70 |
|
119 |
private function define_constants() {
|
120 |
define( 'PROJECTS_PLUGIN_FILE', __FILE__ );
|
121 |
define( 'PROJECTS_VERSION', $this->version );
|
122 |
+
} // End define_constants()
|
123 |
|
124 |
/**
|
125 |
* Change the UI names in the admin
|
131 |
public function post_type_names () {
|
132 |
$this->singular_name = apply_filters( 'projects_post_type_singular_name', _x( 'Project', 'post type singular name', 'projects-by-woothemes' ) );
|
133 |
$this->plural_name = apply_filters( 'projects_post_type_plural_name', _x( 'Projects', 'post type general name', 'projects-by-woothemes' ) );
|
134 |
+
} // End post_type_names()
|
135 |
|
136 |
/**
|
137 |
* Register the post type.
|
204 |
public function register_image_sizes () {
|
205 |
if ( function_exists( 'add_image_size' ) ) {
|
206 |
|
207 |
+
$options = get_option( 'projects-images-fields' );
|
208 |
|
209 |
$defaults = apply_filters( 'projects_default_image_size', array(
|
210 |
'project-archive' => array(
|
411 |
return apply_filters( 'projects_get_image_size_' . $image_size, '' );
|
412 |
|
413 |
// Get image size from options
|
414 |
+
$options = get_option( 'projects-images-fields', array() );
|
415 |
$size = $options[ $image_size ];
|
416 |
|
417 |
$size['width'] = isset( $size['width'] ) ? $size['width'] : '300';
|
430 |
public function include_widgets() {
|
431 |
include_once( 'classes/class-widget-projects.php' );
|
432 |
include_once( 'classes/class-widget-project-categories.php' );
|
433 |
+
} // End include_widgets()
|
434 |
|
435 |
/**
|
436 |
* Include required files.
|
445 |
require_once( 'projects-template.php' );
|
446 |
require_once( 'projects-core-functions.php' );
|
447 |
require_once( 'projects-hooks.php' );
|
448 |
+
} // End includes()
|
449 |
+
|
450 |
+
/**
|
451 |
+
* upgrade_data upgrades old data structure to the new data structure
|
452 |
+
* @param boolean $upgrade_data override setting to run the function
|
453 |
+
* @since 1.2.3
|
454 |
+
* @return void
|
455 |
+
*/
|
456 |
+
private function upgrade_data( $upgrade_data = false ) {
|
457 |
+
if ( $upgrade_data ) {
|
458 |
+
// Get old data
|
459 |
+
$old_options = get_option( 'projects' );
|
460 |
+
if ( isset( $old_options['projects_page_id'] ) && is_array( $old_options ) && !empty( $old_options ) ) {
|
461 |
+
// Check if new pages data exists
|
462 |
+
$new_pages_options = get_option( 'projects-pages-fields' );
|
463 |
+
if ( !isset( $new_pages_options['projects_page_id'] ) ) {
|
464 |
+
update_option( 'projects-pages-fields', array( 'projects_page_id' => $old_options['projects_page_id'] ) );
|
465 |
+
} // End If Statement
|
466 |
+
// Check if new images data exists
|
467 |
+
$new_images_options = get_option( 'projects-images-fields' );
|
468 |
+
if ( !isset( $new_images_options['project-archive'] ) && !isset( $new_images_options['project-single'] ) && !isset( $new_images_options['project-thumbnail'] ) ) {
|
469 |
+
update_option( 'projects-images-fields', array( 'project-archive' => $old_options['project-archive'],
|
470 |
+
'project-single' => $old_options['project-single'],
|
471 |
+
'project-thumbnail' => $old_options['project-thumbnail']
|
472 |
+
) );
|
473 |
+
} // End If Statement
|
474 |
+
// Remove old data
|
475 |
+
delete_option( 'projects' );
|
476 |
+
} // End If Statement
|
477 |
+
} // End If Statement
|
478 |
+
} // End upgrade_data()
|
479 |
|
480 |
} // End Class
|
481 |
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ 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:
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -103,8 +103,11 @@ You sure can! Read about how in the [documentation](http://docs.woothemes.com/do
|
|
103 |
|
104 |
== Upgrade Notice ==
|
105 |
|
106 |
-
= 1.
|
|
|
|
|
107 |
|
|
|
108 |
* The project archive slug now mirrors your projects base page slug isntead of being fixed as 'projects'. If you're using a base page with a slug other than 'projects' you may want to check any static links to your projects page. For example if your base page is 'portfolio' your projects post type archive will now exist at http://yoursite.com/portfolio rather than http://yoursite.com/projects.
|
109 |
|
110 |
= 1.0.0 =
|
@@ -112,6 +115,11 @@ You sure can! Read about how in the [documentation](http://docs.woothemes.com/do
|
|
112 |
|
113 |
== Changelog ==
|
114 |
|
|
|
|
|
|
|
|
|
|
|
115 |
= 1.2.2 =
|
116 |
* 2014-06-06
|
117 |
* Tweak - Product linking label now includes sku / id.
|
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: 4.0
|
7 |
+
Stable tag: 1.3.0
|
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.3.0 =
|
107 |
+
* The project category urls have been improved to use the base page title as the slug opposed to the `project-category` default. So, previously your project cateogry urls will have looked like: yoursite.com/project-category/illustration. Now, `project-category` is replaced with the slug of your projects base page. So if you're using a page called 'Portfolio' that url will now look like: yoursite.com/portfolio/illustration. You will have to create custom redirects if you want the old urls work.
|
108 |
+
* This version adds admin tabs to the settings screens, and will run an update to your existing settings data. If your data is not retained, simply resave your settings.
|
109 |
|
110 |
+
= 1.2.0 =
|
111 |
* The project archive slug now mirrors your projects base page slug isntead of being fixed as 'projects'. If you're using a base page with a slug other than 'projects' you may want to check any static links to your projects page. For example if your base page is 'portfolio' your projects post type archive will now exist at http://yoursite.com/portfolio rather than http://yoursite.com/projects.
|
112 |
|
113 |
= 1.0.0 =
|
115 |
|
116 |
== Changelog ==
|
117 |
|
118 |
+
= 1.3.0 =
|
119 |
+
* 2014-08-26
|
120 |
+
* New - Adds admin tabs to the settings screens for better UX.
|
121 |
+
* New - Category permalinks use base page for structure.
|
122 |
+
|
123 |
= 1.2.2 =
|
124 |
* 2014-06-06
|
125 |
* Tweak - Product linking label now includes sku / id.
|