Changeset 760885
- Timestamp:
- 08/22/2013 07:49:24 PM (13 years ago)
- Location:
- community-jar/trunk
- Files:
-
- 3 deleted
- 11 edited
-
README.txt (modified) (2 diffs)
-
js/admin.min.js (modified) (1 diff)
-
js/community-jar-project.min.js (modified) (1 diff)
-
js/css (deleted)
-
js/dev/admin.js (modified) (1 diff)
-
js/dev/community-jar-project.js (modified) (2 diffs)
-
lib/Community_Jar_Admin.php (modified) (15 diffs)
-
lib/Community_Jar_Archive_Loop.php (modified) (3 diffs)
-
lib/Community_Jar_Functions.php (modified) (2 diffs)
-
lib/Community_Jar_Tokenizer.class.php (modified) (1 diff)
-
plugin.php (modified) (45 diffs)
-
templates/archive-project.php (deleted)
-
templates/single-project.php (deleted)
-
views/templates/community-jar-project-submission.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
community-jar/trunk/README.txt
r760260 r760885 5 5 Requires at least: 3.4 6 6 Tested up to: 3.6 7 Stable tag: 1.0.3 7 Stable tag: 1.1 8 License: GPLv2 or later 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html 8 10 9 11 Have a need or Help a need? The Community Jar makes it easy for anyone to submit a service project or volunteer to help meet a need. … … 69 71 * FIXED: Once the Project Submission Template has been copied to the active plugin directory do not remove it. 70 72 * UPDATED: Templates now reflect icon font changes 73 74 = 1.1 = 75 * FIXED: Changed CPT's from 'project' & 'email' to 'cj_project' & 'cj_email' to remove any possible conflicts with other plugins or themes 76 * ADDED: Admin notification that lets you convert old 'project' CPT's to the new 'cj_project' 77 * FIXED: When visiting the 'Project Update Page' you can now mark your project as complete, which removes it from public listings. 78 * UPDATED: page templates now reflect new custom post type name convention. 79 * FIXED: Misc. spelling errors and cleaned up code. 80 81 == Upgrade Notice == 82 83 = 1.1 = 84 This version fixes Custom Post Type conflicts. Upgrade immediately. -
community-jar/trunk/js/admin.min.js
r758663 r760885 1 (function(e){"use strict";e(function(){var t,n,r,i,s,o,u,a;t=e("#phone-number");s=e("#datepicker");o=e("#project_is_completed");u=e("#email_subject");a=e(".add-new-h2");if(0<t.length){t.attr("placeholder","404-123-1234");i=e("#your-profile");e("#submit, #createusersub").click(function(s){if(0<t.val().length&&!/^(\d|,|-)+$/.test(t.val())){s.preventDefault();n=e("<p />").attr("id","notice").append("You've entered an invalid phone number.");r=e("<div />").attr("id","message").attr("class","error below-h2").append(n);if("message"!==i.prev()){i=0<e("#createuser").length?e("#createuser"):e("#your-profile");r.insertBefore(i)}window.scrollTo(0,0)}})}o.click(function(){var t=e(this).parent().next();e(this).is(":checked")?t.show():t.hide()});0<s.length&&s.datepicker({minDate:1}).keydown(function(e){e.preventDefault()});if(0<u.length){u.insertAfter(e("#titlewrap")).css("margin-top","20px");e("#title").css("background","rgb(250, 250, 250)").attr("disabled","disabled");e("input#email_subject").focus()}0<a.length&&("post-new.php?post_type= project"===a.attr("href")||"post-new.php?post_type=email"===a.attr("href"))&&a.hide()})})(jQuery);1 (function(e){"use strict";e(function(){var t,n,r,i,s,o,u,a;t=e("#phone-number");s=e("#datepicker");o=e("#project_is_completed");u=e("#email_subject");a=e(".add-new-h2");if(0<t.length){t.attr("placeholder","404-123-1234");i=e("#your-profile");e("#submit, #createusersub").click(function(s){if(0<t.val().length&&!/^(\d|,|-)+$/.test(t.val())){s.preventDefault();n=e("<p />").attr("id","notice").append("You've entered an invalid phone number.");r=e("<div />").attr("id","message").attr("class","error below-h2").append(n);if("message"!==i.prev()){i=0<e("#createuser").length?e("#createuser"):e("#your-profile");r.insertBefore(i)}window.scrollTo(0,0)}})}o.click(function(){var t=e(this).parent().next();e(this).is(":checked")?t.show():t.hide()});0<s.length&&s.datepicker({minDate:1}).keydown(function(e){e.preventDefault()});if(0<u.length){u.insertAfter(e("#titlewrap")).css("margin-top","20px");e("#title").css("background","rgb(250, 250, 250)").attr("disabled","disabled");e("input#email_subject").focus()}0<a.length&&("post-new.php?post_type=cj_project"===a.attr("href")||"post-new.php?post_type=cj_email"===a.attr("href"))&&a.hide()})})(jQuery); -
community-jar/trunk/js/community-jar-project.min.js
r758663 r760885 1 1 /*------------------------------------------------------------* 2 2 * Individual Validation Functions 3 *------------------------------------------------------------*/function verifyTitle(e,t){"use strict";var n=!1;n=0<e.trim(t.val()).length;!n&&e("#title-error").is(":not(:visible)")?e("#title-error").toggle():n&&e("#title-error").is(":visible")&&e("#title-error").toggle();return n}function verifyDescription(e,t){"use strict";var n=!1;n=0<t.val().length;!n&&e("#desc-error").is(":not(:visible)")?e("#desc-error").toggle():n&&e("#desc-error").is(":visible")&&e("#desc-error").toggle();return n}function verifyName(e,t){"use strict";var n=!1;n=0<e.trim(t.val()).length;!n&&e("#name-error").is(":not(:visible)")?e("#name-error").toggle():n&&e("#name-error").is(":visible")&&e("#name-error").toggle();return n}function verifyEmailAddress(e,t){"use strict";var n,r;n=!1;r=new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);n=r.test(t.val());!n&&e("#email-error").is(":not(:visible)")?e("#email-error").toggle():n&&e("#email-error").is(":visible")&&e("#email-error").toggle();return n}function verifyPhoneNumber(e,t){"use strict";var n,r;n=!1;r=new RegExp(/(\d{1})?(-|(\.)|\s)*(-|(\.)|\s)*(\()?\d{3}(\))?(-|(\.)|\s)*\d{3}(-|(\.)|\s)*\d{4}/);n=r.test(t.val());!n&&e("#number-error").is(":not(:visible)")?e("#number-error").toggle():n&&e("#number-error").is(":visible")&&e("#number-error").toggle();return n}function verifyDate(e,t){"use strict";var n=!1;n=0<e.trim(t.val()).length;!n&&e("#date-error").is(":not(:visible)")?e("#date-error").toggle():n&&e("#date-error").is(":visible")&&e("#date-error").toggle();return n}function verifyProject(e){"use strict";return verifyTitle(e,e("#project-title"))&&verifyDescription(e,e("#project-description"))&&verifyName(e,e("#project-owner-name"))&&verifyEmailAddress(e,e("#project-owner"))&&verifyPhoneNumber(e,e("#project-owner-phone"))&&verifyDate(e,e("#project-date"))}(function(e){"use strict";e(function(){e("#project-description").redactor({buttons:["bold","italic","underline","|","unorderedlist","orderedlist","|","link"]});e("#project-date").datepicker({minDate:1});e("#submit-project").click(function(t){t.preventDefault();if(verifyProject(e)){e(".alert").each(function(){e(this).is(":visible")&&e(this).hide()});e("#community-jar-submit-form").submit()}else e(window).scrollTop(0,0)});e("#cancel-project").click(function(t){e(" form")[0].reset()})})})(jQuery);3 *------------------------------------------------------------*/function verifyTitle(e,t){"use strict";var n=!1;n=0<e.trim(t.val()).length;!n&&e("#title-error").is(":not(:visible)")?e("#title-error").toggle():n&&e("#title-error").is(":visible")&&e("#title-error").toggle();return n}function verifyDescription(e,t){"use strict";var n=!1;n=0<t.val().length;!n&&e("#desc-error").is(":not(:visible)")?e("#desc-error").toggle():n&&e("#desc-error").is(":visible")&&e("#desc-error").toggle();return n}function verifyName(e,t){"use strict";var n=!1;n=0<e.trim(t.val()).length;!n&&e("#name-error").is(":not(:visible)")?e("#name-error").toggle():n&&e("#name-error").is(":visible")&&e("#name-error").toggle();return n}function verifyEmailAddress(e,t){"use strict";var n,r;n=!1;r=new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);n=r.test(t.val());!n&&e("#email-error").is(":not(:visible)")?e("#email-error").toggle():n&&e("#email-error").is(":visible")&&e("#email-error").toggle();return n}function verifyPhoneNumber(e,t){"use strict";var n,r;n=!1;r=new RegExp(/(\d{1})?(-|(\.)|\s)*(-|(\.)|\s)*(\()?\d{3}(\))?(-|(\.)|\s)*\d{3}(-|(\.)|\s)*\d{4}/);n=r.test(t.val());!n&&e("#number-error").is(":not(:visible)")?e("#number-error").toggle():n&&e("#number-error").is(":visible")&&e("#number-error").toggle();return n}function verifyDate(e,t){"use strict";var n=!1;n=0<e.trim(t.val()).length;!n&&e("#date-error").is(":not(:visible)")?e("#date-error").toggle():n&&e("#date-error").is(":visible")&&e("#date-error").toggle();return n}function verifyProject(e){"use strict";return verifyTitle(e,e("#project-title"))&&verifyDescription(e,e("#project-description"))&&verifyName(e,e("#project-owner-name"))&&verifyEmailAddress(e,e("#project-owner"))&&verifyPhoneNumber(e,e("#project-owner-phone"))&&verifyDate(e,e("#project-date"))}(function(e){"use strict";e(function(){e("#project-description").redactor({buttons:["bold","italic","underline","|","unorderedlist","orderedlist","|","link"]});e("#project-date").datepicker({minDate:1});e("#submit-project").click(function(t){t.preventDefault();if(verifyProject(e)){e(".alert").each(function(){e(this).is(":visible")&&e(this).hide()});e("#community-jar-submit-form").submit()}else e(window).scrollTop(0,0)});e("#cancel-project").click(function(t){e("#community-jar-submit-form").reset()})})})(jQuery); -
community-jar/trunk/js/dev/admin.js
r758663 r760885 106 106 107 107 // Let's hide the 'Add New' anchor at the top of the page 108 if( 'post-new.php?post_type= project' === $addNew.attr('href') || 'post-new.php?post_type=email' === $addNew.attr('href') ) {108 if( 'post-new.php?post_type=cj_project' === $addNew.attr('href') || 'post-new.php?post_type=cj_email' === $addNew.attr('href') ) { 109 109 $addNew.hide(); 110 110 } // end if -
community-jar/trunk/js/dev/community-jar-project.js
r758663 r760885 170 170 171 171 // ...submit the project 172 $( 'form')[0].submit();172 $("#community-jar-submit-form").submit(); 173 173 174 174 } else { … … 183 183 // Clear the form if the user opts to reset it 184 184 $('#cancel-project').click(function(evt) { 185 $( 'form')[0].reset();185 $("#community-jar-submit-form").reset(); 186 186 }); 187 187 -
community-jar/trunk/lib/Community_Jar_Admin.php
r760147 r760885 3 3 * Registers and enqueues admin-specific styles. 4 4 * 5 * @version 1. 05 * @version 1.1 6 6 * @since 1.0 7 7 */ 8 8 function register_admin_styles() { 9 if( ' project' == get_current_screen()->id ) {9 if( 'cj_project' == get_current_screen()->id ) { 10 10 wp_enqueue_style( 'jquery-ui-datepicker', COMMUNITYJAR_DIR .'css/cj-admin-fresh.css'); 11 11 } … … 19 19 * Registers and enqueues admin-specific JavaScript. 20 20 * 21 * @version 1. 021 * @version 1.1 22 22 * @since 1.0 23 23 */ 24 24 function register_admin_scripts() { 25 26 wp_enqueue_script( 'jquery-ui-datepicker' ); 27 wp_enqueue_script( 'community-jar', COMMUNITYJAR_DIR .'js/admin.min.js' ); 25 wp_register_script( 'community-jar-notice', COMMUNITYJAR_DIR .'js/notices.min.js' ); 26 wp_enqueue_script( 'community-jar-notice' ); 28 27 29 28 // If we're on the post edit page, then let's add the 'Volunteer' script 30 if( 'project' == get_current_screen()->id ) { 29 if( 'cj_project' == get_current_screen()->id ) { 30 wp_enqueue_script( 'community-jar', COMMUNITYJAR_DIR .'js/admin.min.js' ); 31 wp_enqueue_script( 'jquery-ui-datepicker' ); 31 32 wp_enqueue_script( 'community-jar-volunteers', COMMUNITYJAR_DIR .'js/admin.volunteers.min.js'); 32 33 } // end if … … 36 37 37 38 /** 38 * Removes unwanted buttons from the TinyMCE editor for email temp alte editing.39 * Removes unwanted buttons from the TinyMCE editor for email template editing. 39 40 * 40 * @version 1. 041 * @version 1.1 41 42 * @since 1.0 42 43 */ 43 44 function myformatTinyMCE($in) { 44 if( ' email' == get_current_screen()->id) {45 if( 'cj_email' == get_current_screen()->id) { 45 46 $in['plugins']='inlinepopups,tabfocus,paste,fullscreen,wordpress,wplink,wpdialogs,wpfullscreen'; 46 47 $in['apply_source_formatting']=false; … … 61 62 */ 62 63 function email_remove_media_controls() { 63 if( ' email' == get_current_screen()->id && is_admin()) {64 if( 'cj_email' == get_current_screen()->id && is_admin()) { 64 65 remove_action( 'media_buttons', 'media_buttons' ); 65 66 } … … 70 71 * Changes the Editor screen icon to the Jar Icon. 71 72 * 72 * @version 1. 073 * @version 1.1 73 74 * @since 1.0 74 75 */ … … 76 77 global $post_type; 77 78 78 if ((isset($_GET['post_type']) && $_GET['post_type'] == ' project') || ($post_type == 'project')) : ?>79 if ((isset($_GET['post_type']) && $_GET['post_type'] == 'cj_project') || ($post_type == 'cj_project')) : ?> 79 80 <style> 80 81 #icon-edit { background:transparent url('<?php echo COMMUNITYJAR_DIR .'images/jar32.png' ?>') no-repeat; } … … 85 86 86 87 /** 87 * Adds new custom columns for ' project' Custom Post Type admin.88 * Adds new custom columns for 'cj_project' Custom Post Type admin. 88 89 * 89 * @version 1. 090 * @version 1.1 90 91 * @since 1.0 91 92 */ … … 104 105 return $columns; 105 106 } 106 add_filter( 'manage_edit- project_columns', 'set_custom_edit_project_columns');107 108 /** 109 * Sets what data should be used form custom columns in ' project' Custom Post Type Admin.110 * 111 * @version 1. 0107 add_filter( 'manage_edit-cj_project_columns', 'set_custom_edit_project_columns'); 108 109 /** 110 * Sets what data should be used form custom columns in 'cj_project' Custom Post Type Admin. 111 * 112 * @version 1.1 112 113 * @since 1.0 113 114 */ … … 144 145 } 145 146 } 146 add_action( 'manage_ project_posts_custom_column', 'custom_project_column', 10, 2 );147 148 /** 149 * Sets which columns are sortable in ' project' Custom Post Type Admin.150 * 151 * @version 1. 0147 add_action( 'manage_cj_project_posts_custom_column', 'custom_project_column', 10, 2 ); 148 149 /** 150 * Sets which columns are sortable in 'cj_project' Custom Post Type Admin. 151 * 152 * @version 1.1 152 153 * @since 1.0 153 154 */ … … 158 159 return $columns; 159 160 } 160 add_filter( 'manage_edit- project_sortable_columns', 'sortable_project_columns');161 162 /** 163 * Enables column sorting for project date in ' project' Custom Post Type Admin.164 * 165 * @version 1. 0161 add_filter( 'manage_edit-cj_project_sortable_columns', 'sortable_project_columns'); 162 163 /** 164 * Enables column sorting for project date in 'cj_project' Custom Post Type Admin. 165 * 166 * @version 1.1 166 167 * @since 1.0 167 168 */ … … 180 181 181 182 /** 182 * Enables column sorting for project date in ' project' Custom Post Type Admin.183 * 184 * @version 1. 0183 * Enables column sorting for project date in 'cj_project' Custom Post Type Admin. 184 * 185 * @version 1.1 185 186 * @since 1.0 186 187 */ … … 192 193 193 194 /** 194 * Change Column View for ' email' Custom Post Type Removes CB and Date.195 * 196 * @version 1. 0195 * Change Column View for 'cj_email' Custom Post Type Removes CB and Date. 196 * 197 * @version 1.1 197 198 * @since 1.0 198 199 */ … … 203 204 return $columns; 204 205 } 205 add_filter( 'manage_edit- email_columns', 'set_custom_edit_email_columns'); //removes cb and date from view206 207 /** 208 * Change Row View for ' email' Custom Post Type Removes trash, quick edit and preview on hover.206 add_filter( 'manage_edit-cj_email_columns', 'set_custom_edit_email_columns'); //removes cb and date from view 207 208 /** 209 * Change Row View for 'cj_email' Custom Post Type Removes trash, quick edit and preview on hover. 209 210 * 210 211 * @version 1.0 … … 213 214 function remove_email_row_actions( $actions ) 214 215 { 215 if(' email' == get_post_type() ){216 if('cj_email' == get_post_type() ){ 216 217 unset( $actions['view'] ); 217 218 unset( $actions['trash'] ); … … 223 224 224 225 /** 225 * Removes column sorting for ' email' Custom Post Type.226 * 227 * @version 1. 0228 * @since 1.0 229 */ 230 add_filter( 'manage_edit- email_sortable_columns', '__return_empty_array' );231 232 /** 233 * Removes bulk action dropdown for ' email' Custom Post Type.234 * 235 * @version 1. 0236 * @since 1.0 237 */ 238 add_filter( 'bulk_actions-' . 'edit- email', '__return_empty_array' );239 240 /** 241 * Removes 'all' and 'published' links for ' email' Custom Post Type Removes trash, quick edit and preview on hover.242 * 243 * @version 1. 0244 * @since 1.0 245 */ 246 add_filter( 'views_edit- email', '__return_empty_array' );226 * Removes column sorting for 'cj_email' Custom Post Type. 227 * 228 * @version 1.1 229 * @since 1.0 230 */ 231 add_filter( 'manage_edit-cj_email_sortable_columns', '__return_empty_array' ); 232 233 /** 234 * Removes bulk action dropdown for 'cj_email' Custom Post Type. 235 * 236 * @version 1.1 237 * @since 1.0 238 */ 239 add_filter( 'bulk_actions-' . 'edit-cj_email', '__return_empty_array' ); 240 241 /** 242 * Removes 'all' and 'published' links for 'cj_email' Custom Post Type Removes trash, quick edit and preview on hover. 243 * 244 * @version 1.1 245 * @since 1.0 246 */ 247 add_filter( 'views_edit-cj_email', '__return_empty_array' ); 247 248 248 249 /** 249 250 * Removes the Slug, Revisions, and Author div elements from the Project editor. 250 251 * 251 * @version 1. 0252 * @version 1.1 252 253 * @since 1.0 253 254 */ 254 255 function remove_project_meta_boxes() { 255 256 256 remove_meta_box( 'slugdiv', ' project', 'normal' );257 remove_meta_box( 'revisionsdiv', ' project', 'normal' );258 remove_meta_box( 'authordiv', ' project', 'normal' );259 remove_meta_box( 'submitdiv', ' email', 'side' );257 remove_meta_box( 'slugdiv', 'cj_project', 'normal' ); 258 remove_meta_box( 'revisionsdiv', 'cj_project', 'normal' ); 259 remove_meta_box( 'authordiv', 'cj_project', 'normal' ); 260 remove_meta_box( 'submitdiv', 'cj_email', 'side' ); 260 261 261 262 } // end remove_project_meta_boxes -
community-jar/trunk/lib/Community_Jar_Archive_Loop.php
r760147 r760885 9 9 * Hooked onto pre_get_posts 10 10 * @since 1.0.0 11 * @version 1.1.0 11 12 * @access private 12 13 * @ignore; … … 18 19 19 20 //If not on project, stop here. 20 if(' project'!= $query->get('post_type') ){21 if('cj_project'!= $query->get('post_type') ){ 21 22 return $query; 22 23 } 23 24 //If project archive filter results. 24 if ( ' project'== $query->get('post_type') && !is_admin()) {25 if ( 'cj_project'== $query->get('post_type') && !is_admin()) { 25 26 //$query->set( 'posts_per_page', 1 ); 26 27 $meta_query = $query->get('meta_query'); … … 37 38 ) 38 39 ); 39 $query->set('meta_query',$meta_query) ; 40 //$query->set( 'meta_query', array( array('key' => 'project_is_complete', 'compare' => 'NOT EXISTS')) ); 40 $query->set('meta_query', $meta_query ) ; 41 41 $query->set( 'orderby', 'meta_value' ); 42 42 $query->set( 'meta_key', 'project_date' ); -
community-jar/trunk/lib/Community_Jar_Functions.php
r760147 r760885 111 111 * @param string $num number of recent project you want to return. 112 112 * 113 * @version 1. 0.1113 * @version 1.1 114 114 * @since 1.0 115 115 */ … … 122 122 $args = array( 123 123 'numberposts' => $recentNum, 124 'post_type' => ' project',124 'post_type' => 'cj_project', 125 125 'suppress_filters' => false 126 126 ); -
community-jar/trunk/lib/Community_Jar_Tokenizer.class.php
r758663 r760885 2 2 /** 3 3 * Community Jar Tokenizer is responsible for looking for certain tokens or key values 4 * (like in shortc des) and replacing it from information from the database.4 * (like in shortcodes) and replacing it from information from the database. 5 5 * 6 6 * Specifically, this class is responsible for taken specific tokens and replace them -
community-jar/trunk/plugin.php
r760253 r760885 4 4 Plugin URI: http://ChurchMediaDesign.tv/community-jar 5 5 Description: Have a need or Help a need? The Community Jar makes it easy for anyone to submit a service project or volunteer to help meet a need. 6 Version: 1. 0.36 Version: 1.1 7 7 Author: Brad Zimmerman 8 8 Author URI: http://ChurchMediaDesign.tv/ … … 28 28 29 29 if( ! defined( 'COMMUNITY_JAR_VERSION' ) ) { 30 define( 'COMMUNITY_JAR_VERSION', '1. 0' );30 define( 'COMMUNITY_JAR_VERSION', '1.1' ); 31 31 } // end if 32 32 /** … … 40 40 require_once( COMMUNITYJAR_PATH . 'lib/Community_Jar_Volunteer_Manager.class.php' ); 41 41 require_once( COMMUNITYJAR_PATH . 'lib/Community_Jar_Tokenizer.class.php' ); 42 include_once( COMMUNITYJAR_PATH . 'lib/Community_Jar_Notifications.class.php' ); 42 43 require_once( COMMUNITYJAR_PATH . 'lib/Community_Jar_Functions.php' ); 43 44 require_once( COMMUNITYJAR_PATH . 'lib/Community_Jar_Admin_Page.php' ); … … 54 55 private $volunteers; 55 56 56 private $ linker;57 private $notices; 57 58 58 59 private $tokenizer; … … 86 87 * @since 1.0 87 88 */ 88 function __construct( $volunteers, $tokenizer ) {89 function __construct( $volunteers, $tokenizer, $notices ) { 89 90 90 91 // Set the dependencies coming in via the constructor 91 92 $this->volunteers = $volunteers; 92 93 $this->tokenizer = $tokenizer; 94 $this->notices = $notices; 93 95 $this->cj_options = get_option('cj_settings'); 94 96 $this->cj_options_from_email = sanitize_text_field($this->cj_options['from_email']); … … 99 101 $this->cj_email_headers = 'From: '.$this->cj_options['from_name'].' <'.$this->cj_options_from_email .'>' . "\r\n"; 100 102 103 101 104 // Load plugin text domain 102 105 add_action( 'init', array( $this, 'plugin_textdomain' ) ); 103 106 107 // Set Up Notifications 108 register_activation_hook( __FILE__, array( $this->notices, 'activate' ) ); 109 register_deactivation_hook( __FILE__, array( $this->notices, 'deactivate' ) ); 110 if( false == get_option( 'cj_notification' ) ) { 111 add_action( 'admin_notices', array( $this->notices, 'display_admin_notice' ) ); 112 } // end if 113 add_action( 'wp_ajax_hide_admin_notification', array( $this->notices, 'hide_admin_notification' ) ); 114 104 115 // Setup the project detection 105 116 //add_action( 'init', array( $this, 'detect_project' ) ); … … 108 119 add_action( 'init', array( $this, 'register_post_types' ) ); 109 120 110 // Flush Rewrite rules so all pretty permalinks work on plugin ac ivation121 // Flush Rewrite rules so all pretty permalinks work on plugin activation 111 122 register_activation_hook( __FILE__, array( $this, 'communityjar_plugin_activation' ) ); 112 123 register_deactivation_hook( __FILE__, array( $this, 'communityjar_plugin_deactivation' ) ); … … 137 148 add_action( 'save_post', array( $this, 'notify_project_owner_of_publish' ) ); 138 149 139 // Register the plugin template files on plugin ac ivation150 // Register the plugin template files on plugin activation 140 151 register_activation_hook( __FILE__, array( $this, 'register_project_template' ) ); 141 152 … … 147 158 register_activation_hook( __FILE__, array( $this, 'create_email_templates' ) ); 148 159 149 // Delete the Project Submission Page 150 register_deactivation_hook( __FILE__, array( $this, 'delete_project_submission_page' ) );160 // Delete the Project Submission Page: don't think this a good idea or right hook, disabled till I find the Correct way. 161 //register_deactivation_hook( __FILE__, array( $this, 'delete_project_submission_page' ) ); 151 162 152 163 //If WordPress couldn't find proper 'event' templates use plug-in instead: 153 164 add_filter('template_include', array( $this,'communityjar_set_template')); 154 165 155 // Remove sec ert has keys as soon as a post is trashed166 // Remove secret has keys as soon as a post is trashed 156 167 add_action( 'transition_post_status', array( $this,'project_trashed'), 10, 3 ); 157 168 add_action( 'get_header', array( $this, 'single_project_header_hook' )); … … 184 195 $project_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_value = %s AND meta_key = 'project_hash'", $project_key ) ); 185 196 if (isset($project_id) && !empty($project_id)){ 186 if(' project' === get_post_type($project_id) && 'publish' == get_post_status ( $project_id )){197 if('cj_project' === get_post_type($project_id) && 'publish' == get_post_status ( $project_id )){ 187 198 return $project_id; 188 199 }else{ … … 197 208 198 209 } // end detect_project 199 200 201 210 202 211 /** … … 218 227 219 228 // If we're on the 'Read Only' page for projects, then we need to enqueue the styles 220 if( ' project' == get_post_type() || is_post_type_archive( 'project' ) ) {229 if( 'cj_project' == get_post_type() || is_post_type_archive( 'cj_project' ) ) { 221 230 wp_enqueue_style( 'community-jar-project', COMMUNITYJAR_DIR . 'css/community-jar.css'); 222 231 } // end if … … 245 254 246 255 // If we're on the 'Read Only' page for projects, then we need to enqueue the JavaScript 247 if( ' project' == get_post_type() ) {256 if( 'cj_project' == get_post_type() ) { 248 257 wp_enqueue_script( 'community-jar-project', COMMUNITYJAR_DIR .'js/single-project.min.js', array( 'jquery' ), COMMUNITY_JAR_VERSION ); 249 258 } // end if … … 295 304 296 305 // Now, get the 'Project Submitted' email 297 $page = get_page_by_title( '[Admin] Project Submitted', OBJECT, ' email' );306 $page = get_page_by_title( '[Admin] Project Submitted', OBJECT, 'cj_email' ); 298 307 $subject = get_post_meta( $page->ID, 'email_subject', true ); 299 308 $searchArray = array('’', '"'); … … 340 349 341 350 // If the project is valid... 342 if ( $this->validate_project( $_POST ) && ' project' === get_post_type( $project_id ) ) {351 if ( $this->validate_project( $_POST ) && 'cj_project' === get_post_type( $project_id ) ) { 343 352 344 353 // ...read the post values … … 386 395 387 396 // Now, get the 'Project Updated' email 388 $page = get_page_by_title( '[Project Owner] Project Updated', OBJECT, ' email' );397 $page = get_page_by_title( '[Project Owner] Project Updated', OBJECT, 'cj_email' ); 389 398 $subject = get_post_meta( $page->ID, 'email_subject', true ); 390 399 $searchArray = array('’', '"'); … … 474 483 475 484 // Email the admin that a new volunteer has been submitted for the project 476 $page = get_page_by_title( '[Admin] Volunteer Submitted', OBJECT, ' email' );485 $page = get_page_by_title( '[Admin] Volunteer Submitted', OBJECT, 'cj_email' ); 477 486 $subject = get_post_meta( $page->ID, 'email_subject', true ); 478 487 $searchArray = array('’', '"'); … … 584 593 'rewrite' => array( 'slug' => 'projects', 'with_front' => false ) 585 594 ); 586 register_post_type( ' project', $args );595 register_post_type( 'cj_project', $args ); 587 596 588 597 $args = array( … … 601 610 ), 602 611 'supports' => array( 'title', 'editor', 'revisions' ), 603 'show_in_menu' => 'edit.php?post_type= project',612 'show_in_menu' => 'edit.php?post_type=cj_project', 604 613 'menu_position' => 6, 605 614 'public' => false, 606 615 'show_ui' => true 607 616 ); 608 register_post_type( ' email', $args );617 register_post_type( 'cj_email', $args ); 609 618 610 619 } // end register_post_types … … 630 639 __( 'Email Subject', 'community-jar' ), 631 640 array( $this, 'email_subject_display' ), 632 ' email',641 'cj_email', 633 642 'normal', 634 643 'low' … … 694 703 __( 'Project Owner', 'community-jar' ), 695 704 array( $this, 'project_owner_display' ), 696 ' project',705 'cj_project', 697 706 'side', 698 707 'low' … … 780 789 __( 'Project Information', 'community-jar' ), 781 790 array( $this, 'project_info_display' ), 782 ' project',791 'cj_project', 783 792 'side', 784 793 'low' … … 869 878 870 879 /** 871 * Creates a new Publish Meta Box for email temp alte pages.880 * Creates a new Publish Meta Box for email template pages. 872 881 * 873 882 * @version 1.0 … … 880 889 __( 'Publish', 'community-jar' ), 881 890 array( $this, 'email_submit_display' ), 882 ' email',891 'cj_email', 883 892 'side', 884 893 'high' … … 900 909 901 910 /** 902 * Creates a new Publish Meta Box for email temp alte pages.911 * Creates a new Publish Meta Box for email template pages. 903 912 * 904 913 * @version 1.0 … … 911 920 __( 'Available Shortcodes', 'community-jar' ), 912 921 array( $this, 'email_shortcodes_display' ), 913 ' email',922 'cj_email', 914 923 'side', 915 924 'low' … … 964 973 965 974 /** 966 * Emails the project owner and the administrator that hte project has just been published.975 * Emails the project owner and the administrator that the project has just been published. 967 976 * 968 977 * @param int $post_id The ID of the post that's just been published. … … 995 1004 __( 'Project Volunteers', 'community-jar' ), 996 1005 array( $this, 'project_volunteer_display' ), 997 ' project',1006 'cj_project', 998 1007 'normal', 999 1008 'low' … … 1100 1109 1101 1110 // Get the email page 1102 $page = get_page_by_title( '[Volunteer] Volunteer Approved', OBJECT, ' email' );1111 $page = get_page_by_title( '[Volunteer] Volunteer Approved', OBJECT, 'cj_email' ); 1103 1112 1104 1113 // Get the email's subject … … 1130 1139 1131 1140 // Get the email page 1132 $page = get_page_by_title( '[Project Owner] Volunteer Approved', OBJECT, ' email' );1141 $page = get_page_by_title( '[Project Owner] Volunteer Approved', OBJECT, 'cj_email' ); 1133 1142 1134 1143 // Get the email's subject … … 1155 1164 } // end if/else 1156 1165 1157 // If 'All Volunteers' are set, loop through them and delete meta data if it ex sts1166 // If 'All Volunteers' are set, loop through them and delete meta data if it exists 1158 1167 if( isset( $all_volunteers ) && 0 < count( $all_volunteers ) ) { 1159 1168 … … 1246 1255 1247 1256 public function communityjar_set_template( $template ){ 1248 if( is_post_type_archive(' project') )1249 if ( $theme_file = locate_template( array ( 'archive- project.php' ) ) ) {1257 if( is_post_type_archive('cj_project') ) 1258 if ( $theme_file = locate_template( array ( 'archive-cj_project.php' ) ) ) { 1250 1259 $template = $theme_file; 1251 1260 } else { 1252 $template = plugin_dir_path( __FILE__ ) . 'templates/archive- project.php';1261 $template = plugin_dir_path( __FILE__ ) . 'templates/archive-cj_project.php'; 1253 1262 } 1254 if( is_singular(' project') )1255 if ( $theme_file = locate_template( array ( 'single- project.php' ) ) ) {1263 if( is_singular('cj_project') ) 1264 if ( $theme_file = locate_template( array ( 'single-cj_project.php' ) ) ) { 1256 1265 $template = $theme_file; 1257 1266 } else { 1258 $template = plugin_dir_path( __FILE__ ) . 'templates/single- project.php';1267 $template = plugin_dir_path( __FILE__ ) . 'templates/single-cj_project.php'; 1259 1268 } 1260 1269 return $template; … … 1271 1280 1272 1281 // Volunteer. Volunteer Approved. 1273 if( null == get_page_by_title( '[Volunteer] Volunteer Approved', OBJECT, ' email' ) ) {1274 self::create_page( 'volunteer-volunteer-approved', '[Volunteer] Volunteer Approved', 'publish', ' email', COMMUNITYJAR_DIR . 'views/email/volunteer.volunteer-approved.html' );1282 if( null == get_page_by_title( '[Volunteer] Volunteer Approved', OBJECT, 'cj_email' ) ) { 1283 self::create_page( 'volunteer-volunteer-approved', '[Volunteer] Volunteer Approved', 'publish', 'cj_email', COMMUNITYJAR_DIR . 'views/email/volunteer.volunteer-approved.html' ); 1275 1284 } // end if 1276 1285 1277 1286 // Project Owner. Volunteer Approved. 1278 if( null == get_page_by_title( '[Project Owner] Volunteer Approved', OBJECT, ' email' ) ) {1279 self::create_page( 'project-owner-volunteer-approved', '[Project Owner] Volunteer Approved', 'publish', ' email', COMMUNITYJAR_DIR . 'views/email/project-owner.volunteer-approved.html' );1287 if( null == get_page_by_title( '[Project Owner] Volunteer Approved', OBJECT, 'cj_email' ) ) { 1288 self::create_page( 'project-owner-volunteer-approved', '[Project Owner] Volunteer Approved', 'publish', 'cj_email', COMMUNITYJAR_DIR . 'views/email/project-owner.volunteer-approved.html' ); 1280 1289 } // end if 1281 1290 1282 1291 // Project Owner. Project Approved. 1283 if( null == get_page_by_title( '[Project Owner] Project Approved', OBJECT, ' email' ) ) {1284 self::create_page( 'project-owner-project-approved', '[Project Owner] Project Approved', 'publish', ' email', COMMUNITYJAR_DIR . 'views/email/project-owner.project-approved.html' );1292 if( null == get_page_by_title( '[Project Owner] Project Approved', OBJECT, 'cj_email' ) ) { 1293 self::create_page( 'project-owner-project-approved', '[Project Owner] Project Approved', 'publish', 'cj_email', COMMUNITYJAR_DIR . 'views/email/project-owner.project-approved.html' ); 1285 1294 } // end if 1286 1295 1287 1296 // Project Owner. Project Updated. 1288 if( null == get_page_by_title( '[Project Owner] Project Updated', OBJECT, ' email' ) ) {1289 self::create_page( 'project-owner-project-updated', '[Project Owner] Project Updated', 'publish', ' email', COMMUNITYJAR_DIR . 'views/email/project-owner.project-updated.html' );1297 if( null == get_page_by_title( '[Project Owner] Project Updated', OBJECT, 'cj_email' ) ) { 1298 self::create_page( 'project-owner-project-updated', '[Project Owner] Project Updated', 'publish', 'cj_email', COMMUNITYJAR_DIR . 'views/email/project-owner.project-updated.html' ); 1290 1299 } // end if 1291 1300 1292 1301 // Project Owner. Project Completed. 1293 if( null == get_page_by_title( '[Project Owner] Project Completed', OBJECT, ' email' ) ) {1294 self::create_page( 'project-owner-project-completed', '[Project Owner] Project Completed', 'publish', ' email', COMMUNITYJAR_DIR . 'views/email/project-owner.project-completed.html' );1302 if( null == get_page_by_title( '[Project Owner] Project Completed', OBJECT, 'cj_email' ) ) { 1303 self::create_page( 'project-owner-project-completed', '[Project Owner] Project Completed', 'publish', 'cj_email', COMMUNITYJAR_DIR . 'views/email/project-owner.project-completed.html' ); 1295 1304 } // end if 1296 1305 1297 1306 // Admin. Project Submission. 1298 if( null == get_page_by_title( '[Admin] Project Submitted', OBJECT, ' email' ) ) {1299 self::create_page( 'admin-project-submitted', '[Admin] Project Submitted', 'publish', ' email', COMMUNITYJAR_DIR . 'views/email/admin.project-submitted.html' );1307 if( null == get_page_by_title( '[Admin] Project Submitted', OBJECT, 'cj_email' ) ) { 1308 self::create_page( 'admin-project-submitted', '[Admin] Project Submitted', 'publish', 'cj_email', COMMUNITYJAR_DIR . 'views/email/admin.project-submitted.html' ); 1300 1309 } // end if 1301 1310 1302 1311 // Admin. Volunteer Submission. 1303 if( null == get_page_by_title( '[Admin] Volunteer Submitted', OBJECT, ' email' ) ) {1304 self::create_page( 'admin-volunteer-submitted', '[Admin] Volunteer Submitted', 'publish', ' email', COMMUNITYJAR_DIR . 'views/email/admin.volunteer-submitted.html');1312 if( null == get_page_by_title( '[Admin] Volunteer Submitted', OBJECT, 'cj_email' ) ) { 1313 self::create_page( 'admin-volunteer-submitted', '[Admin] Volunteer Submitted', 'publish', 'cj_email', COMMUNITYJAR_DIR . 'views/email/admin.volunteer-submitted.html'); 1305 1314 } // end if 1306 1315 if(False == get_option('cj_settings')){ … … 1331 1340 1332 1341 $page = get_page_by_title( 'Project Submission', OBJECT, 'page' ); 1333 wp_delete_post( $page->ID, true );1334 1335 $page = get_page_by_title( 'All Projects', OBJECT, 'page' );1336 1342 wp_delete_post( $page->ID, true ); 1337 1343 … … 1436 1442 * @param int $post_id The ID of the post being updated. 1437 1443 * @return bool Whether or not the specified post is being published. 1438 * @version 1. 01444 * @version 1.1 1439 1445 * @since 1.0 1440 1446 */ … … 1442 1448 1443 1449 return 1444 ' project' == get_post_type() &&1450 'cj_project' == get_post_type() && 1445 1451 'publish' == get_post_status( $post_id ) && 1446 1452 'true' != get_post_meta( $post_id, 'project_owner_emailed', true ); … … 1453 1459 * @param int $post_id The ID of the post being updated. 1454 1460 * @return bool Whether or not the specified post is being updated or not. 1455 * @version 1. 01461 * @version 1.1 1456 1462 * @since 1.0 1457 1463 */ … … 1459 1465 1460 1466 return 1461 ' project' == get_post_type() &&1467 'cj_project' == get_post_type() && 1462 1468 'true' != get_post_meta( $post_id, 'project_owner_emailed', true ) && 1463 1469 'inherit' == get_post_status( $post_id ) && … … 1477 1483 1478 1484 // Get the email page 1479 $page = get_page_by_title( '[Project Owner] Project Approved', OBJECT, ' email' );1485 $page = get_page_by_title( '[Project Owner] Project Approved', OBJECT, 'cj_email' ); 1480 1486 1481 1487 // Get the email's subject … … 1515 1521 1516 1522 // Get the email page 1517 $page = get_page_by_title( '[Project Owner] Project Completed', OBJECT, ' email' );1523 $page = get_page_by_title( '[Project Owner] Project Completed', OBJECT, 'cj_email' ); 1518 1524 1519 1525 // Get the email's subject … … 1820 1826 'post_name' => $title, 1821 1827 'post_status' => 'pending', 1822 'post_type' => ' project'1828 'post_type' => 'cj_project' 1823 1829 ); 1824 1830 … … 1925 1931 1926 1932 $project_hash = get_post_meta( $project_id, 'project_hash', true); 1927 return add_query_arg( array(' cj_project' => $project_hash ), $this->get_template_page_url('community-jar-project-submission.php'));1933 return add_query_arg( array('my_project' => $project_hash ), $this->get_template_page_url('community-jar-project-submission.php')); 1928 1934 1929 1935 } … … 1958 1964 */ 1959 1965 public function project_trashed( $new_status, $old_status, $post ) { 1960 if ($new_status == 'trash' && ' project' == get_post_type($post->ID)) {1966 if ($new_status == 'trash' && 'cj_project' == get_post_type($post->ID)) { 1961 1967 delete_post_meta($post->ID, 'project_hash'); 1962 1968 } 1963 if ($old_status == 'trash' && ' project' == get_post_type($post->ID)) {1969 if ($old_status == 'trash' && 'cj_project' == get_post_type($post->ID)) { 1964 1970 update_post_meta($post->ID, 'project_hash', sha1(wp_salt('auth').$post->ID)); 1965 1971 } … … 1974 1980 */ 1975 1981 public function submission_form_validation(){ 1976 if( isset( $_GET[' cj_project'] ) && !empty($_GET['cj_project'])) {1977 $project_id = $this->detect_project( $_GET[' cj_project']);1982 if( isset( $_GET['my_project'] ) && !empty($_GET['my_project'])) { 1983 $project_id = $this->detect_project( $_GET['my_project']); 1978 1984 if(NULL != $project_id){ 1979 1985 $this->update_existing_project( $project_id ); … … 1996 2002 */ 1997 2003 public function single_project_header_hook( $name ) { 1998 if( ' project' == get_post_type() && is_single()) {2004 if( 'cj_project' == get_post_type() && is_single()) { 1999 2005 $this->register_new_volunteer(); 2000 2006 } 2001 2007 } 2002 2003 2008 /** 2009 * Fixes post type names, and changes all old 'project' types to the new 'cj_project' type. 2010 * 2011 * 2012 * @version 1.1 2013 * @since 1.1 2014 */ 2015 public function convert_projects(){ 2016 2017 $args = array( 'post_type' => 'project','meta_key'=> 'owner_visibility','posts_per_page' => -1, 'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash')); 2018 2019 $myposts = get_posts( $args ); 2020 foreach ( $myposts as $post ) { 2021 $my_post = array( 2022 'post_type' => 'cj_project', 2023 'ID' => $post->ID 2024 ); 2025 // Insert the post into the database 2026 wp_update_post( $my_post ); 2027 } 2028 2029 wp_reset_postdata(); 2030 2031 } 2004 2032 } // end class 2005 2033 2006 $GLOBALS['community-jar'] = new CommunityJar( new Community_Jar_Volunteer_Manager(), new Community_Jar_Tokenizer() );2034 $GLOBALS['community-jar'] = new CommunityJar( new Community_Jar_Volunteer_Manager(), new Community_Jar_Tokenizer(), new Community_Jar_Notification() ); 2007 2035 ?> -
community-jar/trunk/views/templates/community-jar-project-submission.php
r758663 r760885 3 3 * Template Name: Project Submission 4 4 * 5 * Used to submit a 'Project' from the front end of the site. Also allows for editing.5 * Used to submit a 'Project' from the front-end of the site. Also allows for editing. 6 6 * 7 7 * @package Community Jar … … 113 113 </label> 114 114 115 <?php if( 'publish' == get_post_status() && isset( $_GET['owner'] ) && 'true' == $_GET['owner']) { ?>115 <?php if( 'publish' == get_post_status() && isset($project->post_author) ) { ?> 116 116 <p> 117 117 <label for="project_is_complete"> … … 128 128 <input type="button" class="btn-primary" id="submit-project" name="submit-project" value="<?php _e( 'Update Project', 'community-jar' ); ?>" /> 129 129 <?php } // end if/else ?> 130 <input type="button" class="btn" id="cancel-project" name="cancel-project" value="<?php _e( 'Cancel', 'community-jar' ); ?>" />131 130 </p> 132 131
Note: See TracChangeset
for help on using the changeset viewer.