Plugin Directory

Changeset 760885


Ignore:
Timestamp:
08/22/2013 07:49:24 PM (13 years ago)
Author:
cmdtv
Message:

Commit 1.1

Location:
community-jar/trunk
Files:
3 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • community-jar/trunk/README.txt

    r760260 r760885  
    55Requires at least: 3.4
    66Tested up to: 3.6
    7 Stable tag: 1.0.3
     7Stable tag: 1.1
     8License: GPLv2 or later
     9License URI: http://www.gnu.org/licenses/gpl-2.0.html
    810
    911Have 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.
     
    6971* FIXED: Once the Project Submission Template has been copied to the active plugin directory do not remove it.
    7072* 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 =
     84This 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  
    11/*------------------------------------------------------------*
    22 * 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  
    106106       
    107107            // 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') ) {
    109109                $addNew.hide();
    110110            } // end if
  • community-jar/trunk/js/dev/community-jar-project.js

    r758663 r760885  
    170170               
    171171                // ...submit the project
    172                 $('form')[0].submit();
     172                $("#community-jar-submit-form").submit();
    173173               
    174174            } else {
     
    183183        // Clear the form if the user opts to reset it
    184184        $('#cancel-project').click(function(evt) {
    185             $('form')[0].reset();
     185            $("#community-jar-submit-form").reset();
    186186        });
    187187       
  • community-jar/trunk/lib/Community_Jar_Admin.php

    r760147 r760885  
    33 * Registers and enqueues admin-specific styles.
    44 *
    5  * @version     1.0
     5 * @version     1.1
    66 * @since       1.0
    77 */
    88function register_admin_styles() {
    9     if( 'project' == get_current_screen()->id ) {
     9    if( 'cj_project' == get_current_screen()->id ) {
    1010        wp_enqueue_style( 'jquery-ui-datepicker', COMMUNITYJAR_DIR .'css/cj-admin-fresh.css');
    1111    }
     
    1919 * Registers and enqueues admin-specific JavaScript.
    2020 *
    21  * @version     1.0
     21 * @version     1.1
    2222 * @since       1.0
    2323 */
    2424function 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' );
    2827   
    2928    // 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' );
    3132        wp_enqueue_script( 'community-jar-volunteers', COMMUNITYJAR_DIR .'js/admin.volunteers.min.js');
    3233    } // end if
     
    3637
    3738/**
    38 * Removes unwanted buttons from the TinyMCE editor for email tempalte editing.
     39* Removes unwanted buttons from the TinyMCE editor for email template editing.
    3940*
    40 * @version      1.0
     41* @version      1.1
    4142* @since        1.0
    4243*/
    4344function myformatTinyMCE($in) {
    44     if( 'email' == get_current_screen()->id) {
     45    if( 'cj_email' == get_current_screen()->id) {
    4546        $in['plugins']='inlinepopups,tabfocus,paste,fullscreen,wordpress,wplink,wpdialogs,wpfullscreen';
    4647        $in['apply_source_formatting']=false;
     
    6162 */
    6263function email_remove_media_controls() {
    63     if( 'email' == get_current_screen()->id  && is_admin()) {
     64    if( 'cj_email' == get_current_screen()->id  && is_admin()) {
    6465        remove_action( 'media_buttons', 'media_buttons' );
    6566    }
     
    7071 * Changes the Editor screen icon to the Jar Icon.
    7172 *
    72  * @version     1.0
     73 * @version     1.1
    7374 * @since       1.0
    7475 */
     
    7677    global $post_type;
    7778
    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')) : ?>
    7980        <style>
    8081            #icon-edit { background:transparent url('<?php echo  COMMUNITYJAR_DIR .'images/jar32.png' ?>') no-repeat; }     
     
    8586
    8687/**
    87   * Adds new custom columns for 'project' Custom Post Type admin.
     88  * Adds new custom columns for 'cj_project' Custom Post Type admin.
    8889  *
    89   * @version 1.0
     90  * @version 1.1
    9091  * @since  1.0
    9192  */
     
    104105    return $columns;
    105106}
    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.0
     107add_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
    112113 * @since  1.0
    113114*/
     
    144145    }
    145146}
    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.0
     147add_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
    152153 * @since  1.0
    153154*/
     
    158159    return $columns;
    159160}
    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.0
     161add_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
    166167 * @since  1.0
    167168*/
     
    180181
    181182/**
    182  * Enables column sorting for project date in 'project' Custom Post Type Admin.
    183  *
    184  * @version 1.0
     183 * Enables column sorting for project date in 'cj_project' Custom Post Type Admin.
     184 *
     185 * @version 1.1
    185186 * @since  1.0
    186187*/
     
    192193
    193194/**
    194  * Change Column View for 'email' Custom Post Type Removes CB and Date.
    195  *
    196  * @version 1.0
     195 * Change Column View for 'cj_email' Custom Post Type Removes CB and Date.
     196 *
     197 * @version 1.1
    197198 * @since  1.0
    198199*/
     
    203204    return $columns;
    204205}
    205 add_filter( 'manage_edit-email_columns', 'set_custom_edit_email_columns'); //removes cb and date from view
    206 
    207 /**
    208  * Change Row View for 'email' Custom Post Type Removes trash, quick edit and preview on hover.
     206add_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.
    209210 *
    210211 * @version 1.0
     
    213214function remove_email_row_actions( $actions )
    214215{
    215     if('email' == get_post_type()  ){
     216    if('cj_email' == get_post_type()  ){
    216217        unset( $actions['view'] );
    217218        unset( $actions['trash'] );
     
    223224
    224225/**
    225  * Removes column sorting for 'email' Custom Post Type.
    226  *
    227  * @version 1.0
    228  * @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.0
    236  * @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.0
    244  * @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*/
     231add_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*/
     239add_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*/
     247add_filter( 'views_edit-cj_email', '__return_empty_array' );
    247248
    248249/**
    249250 * Removes the Slug, Revisions, and Author div elements from the Project editor.
    250251 *
    251  * @version     1.0
     252 * @version     1.1
    252253 * @since       1.0
    253254 */
    254255function remove_project_meta_boxes() {
    255256   
    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' );
    260261   
    261262} // end remove_project_meta_boxes
  • community-jar/trunk/lib/Community_Jar_Archive_Loop.php

    r760147 r760885  
    99 * Hooked onto pre_get_posts
    1010 * @since 1.0.0
     11 * @version 1.1.0
    1112 * @access private
    1213 * @ignore;
     
    1819
    1920    //If not on project, stop here.
    20     if('project'!= $query->get('post_type') ){
     21    if('cj_project'!= $query->get('post_type') ){
    2122        return $query;
    2223    }
    2324    //If project archive filter results.
    24     if ( 'project'== $query->get('post_type') && !is_admin()) {
     25    if ( 'cj_project'== $query->get('post_type') && !is_admin()) {
    2526        //$query->set( 'posts_per_page', 1 );
    2627        $meta_query = $query->get('meta_query');
     
    3738            )
    3839        );
    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 ) ;
    4141        $query->set( 'orderby', 'meta_value' );
    4242        $query->set( 'meta_key', 'project_date' );
  • community-jar/trunk/lib/Community_Jar_Functions.php

    r760147 r760885  
    111111 * @param string $num number of recent project you want to return.
    112112 *
    113  * @version     1.0.1
     113 * @version     1.1
    114114 * @since       1.0
    115115 */
     
    122122    $args = array(
    123123        'numberposts'       => $recentNum,
    124         'post_type'         => 'project',
     124        'post_type'         => 'cj_project',
    125125        'suppress_filters' => false
    126126    );     
  • community-jar/trunk/lib/Community_Jar_Tokenizer.class.php

    r758663 r760885  
    22/**
    33 * Community Jar Tokenizer is responsible for looking for certain tokens or key values
    4  * (like in shortcdes) and replacing it from information from the database.
     4 * (like in shortcodes) and replacing it from information from the database.
    55 *
    66 * Specifically, this class is responsible for taken specific tokens and replace them
  • community-jar/trunk/plugin.php

    r760253 r760885  
    44Plugin URI: http://ChurchMediaDesign.tv/community-jar
    55Description: 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.3
     6Version: 1.1
    77Author: Brad Zimmerman
    88Author URI: http://ChurchMediaDesign.tv/
     
    2828
    2929if( ! defined( 'COMMUNITY_JAR_VERSION' ) ) {
    30     define( 'COMMUNITY_JAR_VERSION', '1.0' );
     30    define( 'COMMUNITY_JAR_VERSION', '1.1' );
    3131} // end if
    3232/**
     
    4040require_once( COMMUNITYJAR_PATH . 'lib/Community_Jar_Volunteer_Manager.class.php' );
    4141require_once( COMMUNITYJAR_PATH . 'lib/Community_Jar_Tokenizer.class.php' );
     42include_once( COMMUNITYJAR_PATH . 'lib/Community_Jar_Notifications.class.php' );
    4243require_once( COMMUNITYJAR_PATH . 'lib/Community_Jar_Functions.php' );
    4344require_once( COMMUNITYJAR_PATH . 'lib/Community_Jar_Admin_Page.php' );
     
    5455    private $volunteers;
    5556   
    56     private $linker;
     57    private $notices;
    5758   
    5859    private $tokenizer;
     
    8687     * @since       1.0
    8788     */
    88     function __construct( $volunteers, $tokenizer ) {
     89    function __construct( $volunteers, $tokenizer, $notices ) {
    8990       
    9091        // Set the dependencies coming in via the constructor
    9192        $this->volunteers = $volunteers;
    9293        $this->tokenizer = $tokenizer;
     94        $this->notices = $notices;
    9395        $this->cj_options = get_option('cj_settings');
    9496        $this->cj_options_from_email = sanitize_text_field($this->cj_options['from_email']);
     
    99101        $this->cj_email_headers = 'From: '.$this->cj_options['from_name'].' <'.$this->cj_options_from_email .'>' . "\r\n";
    100102       
     103       
    101104        // Load plugin text domain
    102105        add_action( 'init', array( $this, 'plugin_textdomain' ) );
    103106       
     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       
    104115        // Setup the project detection
    105116        //add_action( 'init', array( $this, 'detect_project' ) );
     
    108119        add_action( 'init', array( $this, 'register_post_types' ) );
    109120       
    110         // Flush Rewrite rules so all pretty permalinks work on plugin acivation
     121        // Flush Rewrite rules so all pretty permalinks work on plugin activation
    111122        register_activation_hook( __FILE__, array( $this, 'communityjar_plugin_activation' ) );
    112123        register_deactivation_hook( __FILE__, array( $this, 'communityjar_plugin_deactivation' ) );
     
    137148        add_action( 'save_post', array( $this, 'notify_project_owner_of_publish' ) );
    138149
    139         // Register the plugin template files on plugin acivation
     150        // Register the plugin template files on plugin activation
    140151        register_activation_hook( __FILE__, array( $this, 'register_project_template' ) );
    141152       
     
    147158        register_activation_hook( __FILE__, array( $this, 'create_email_templates' ) );
    148159       
    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' ) );
    151162       
    152163        //If WordPress couldn't find proper 'event' templates use plug-in instead:
    153164        add_filter('template_include', array( $this,'communityjar_set_template'));
    154165
    155         // Remove secert has keys as soon as a post is trashed
     166        // Remove secret has keys as soon as a post is trashed
    156167        add_action( 'transition_post_status', array( $this,'project_trashed'), 10, 3 );
    157168        add_action( 'get_header',  array( $this, 'single_project_header_hook' ));
     
    184195            $project_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_value = %s AND meta_key = 'project_hash'", $project_key ) );
    185196            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 )){
    187198                    return $project_id;
    188199                }else{
     
    197208       
    198209    } // end detect_project
    199 
    200    
    201210   
    202211    /**
     
    218227       
    219228        // 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' ) ) {
    221230            wp_enqueue_style( 'community-jar-project', COMMUNITYJAR_DIR . 'css/community-jar.css'); 
    222231        } // end if
     
    245254       
    246255        // 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() ) {
    248257            wp_enqueue_script( 'community-jar-project',  COMMUNITYJAR_DIR .'js/single-project.min.js', array( 'jquery' ), COMMUNITY_JAR_VERSION );   
    249258        } // end if
     
    295304
    296305                    // 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' );
    298307                    $subject = get_post_meta( $page->ID, 'email_subject', true );
    299308                    $searchArray = array('&#8217;', '&quot;');
     
    340349
    341350            // 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 ) ) {
    343352
    344353                // ...read the post values             
     
    386395       
    387396                            // 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' );
    389398                            $subject = get_post_meta( $page->ID, 'email_subject', true );
    390399                            $searchArray = array('&#8217;', '&quot;');
     
    474483               
    475484                // 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' );
    477486                $subject = get_post_meta( $page->ID, 'email_subject', true );
    478487                $searchArray = array('&#8217;', '&quot;');
     
    584593            'rewrite'       => array( 'slug' => 'projects', 'with_front' => false )
    585594        );
    586         register_post_type( 'project', $args );
     595        register_post_type( 'cj_project', $args );
    587596       
    588597        $args = array(
     
    601610                            ),
    602611            'supports'      =>  array( 'title', 'editor', 'revisions' ),
    603             'show_in_menu'  =>  'edit.php?post_type=project',
     612            'show_in_menu'  =>  'edit.php?post_type=cj_project',
    604613            'menu_position' =>  6,
    605614            'public'        =>  false,
    606615            'show_ui' => true
    607616        );
    608         register_post_type( 'email', $args );
     617        register_post_type( 'cj_email', $args );
    609618       
    610619     } // end register_post_types
     
    630639            __( 'Email Subject', 'community-jar' ),
    631640            array( $this, 'email_subject_display' ),
    632             'email',
     641            'cj_email',
    633642            'normal',
    634643            'low'
     
    694703            __( 'Project Owner', 'community-jar' ),
    695704            array( $this, 'project_owner_display' ),
    696             'project',
     705            'cj_project',
    697706            'side',
    698707            'low'
     
    780789            __( 'Project Information', 'community-jar' ),
    781790            array( $this, 'project_info_display' ),
    782             'project',
     791            'cj_project',
    783792            'side',
    784793            'low'
     
    869878     
    870879     /**
    871       * Creates a new Publish Meta Box for email tempalte pages.
     880      * Creates a new Publish Meta Box for email template pages.
    872881      *
    873882      * @version    1.0
     
    880889            __( 'Publish', 'community-jar' ),
    881890            array( $this, 'email_submit_display' ),
    882             'email',
     891            'cj_email',
    883892            'side',
    884893            'high'
     
    900909     
    901910      /**
    902       * Creates a new Publish Meta Box for email tempalte pages.
     911      * Creates a new Publish Meta Box for email template pages.
    903912      *
    904913      * @version    1.0
     
    911920            __( 'Available Shortcodes', 'community-jar' ),
    912921            array( $this, 'email_shortcodes_display' ),
    913             'email',
     922            'cj_email',
    914923            'side',
    915924            'low'
     
    964973     
    965974    /**
    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.
    967976     *
    968977     * @param   int $post_id    The ID of the post that's just been published.
     
    9951004            __( 'Project Volunteers', 'community-jar' ),
    9961005            array( $this, 'project_volunteer_display' ),
    997             'project',
     1006            'cj_project',
    9981007            'normal',
    9991008            'low'
     
    11001109                   
    11011110                    // 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' );
    11031112                   
    11041113                    // Get the email's subject
     
    11301139                   
    11311140                    // 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' );
    11331142                   
    11341143                    // Get the email's subject
     
    11551164             } // end if/else
    11561165             
    1157              // If 'All Volunteers' are set, loop through them and delete meta data if it exsts
     1166             // If 'All Volunteers' are set, loop through them and delete meta data if it exists
    11581167             if( isset( $all_volunteers ) && 0 < count( $all_volunteers ) ) {
    11591168                                 
     
    12461255     
    12471256    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' ) ) ) {
    12501259                $template = $theme_file;
    12511260            } else {
    1252                 $template = plugin_dir_path( __FILE__ ) . 'templates/archive-project.php';
     1261                $template = plugin_dir_path( __FILE__ ) . 'templates/archive-cj_project.php';
    12531262            }
    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' ) ) ) {
    12561265                $template = $theme_file;
    12571266            } else {
    1258                 $template = plugin_dir_path( __FILE__ ) . 'templates/single-project.php';
     1267                $template = plugin_dir_path( __FILE__ ) . 'templates/single-cj_project.php';
    12591268            }
    12601269        return $template;
     
    12711280       
    12721281        // 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' );
    12751284        } // end if
    12761285       
    12771286        // 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' );
    12801289        } // end if
    12811290       
    12821291        // 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'  );
    12851294        } // end if
    12861295       
    12871296        // 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' );
    12901299        } // end if
    12911300       
    12921301        // 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' );
    12951304        } // end if
    12961305       
    12971306        // 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' );
    13001309        } // end if
    13011310       
    13021311        // 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');
    13051314        } // end if
    13061315        if(False == get_option('cj_settings')){
     
    13311340       
    13321341        $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' );
    13361342        wp_delete_post( $page->ID, true );
    13371343       
     
    14361442      * @param      int     $post_id    The ID of the post being updated.
    14371443      * @return     bool                Whether or not the specified post is being published.
    1438       * @version    1.0
     1444      * @version    1.1
    14391445      * @since      1.0
    14401446      */
     
    14421448       
    14431449        return
    1444             'project' == get_post_type() &&
     1450            'cj_project' == get_post_type() &&
    14451451            'publish' == get_post_status( $post_id ) &&
    14461452            'true' != get_post_meta( $post_id, 'project_owner_emailed', true );
     
    14531459      * @param      int     $post_id    The ID of the post being updated.
    14541460      * @return     bool                Whether or not the specified post is being updated or not.
    1455       * @version    1.0
     1461      * @version    1.1
    14561462      * @since      1.0
    14571463      */
     
    14591465         
    14601466         return
    1461             'project' == get_post_type() &&
     1467            'cj_project' == get_post_type() &&
    14621468            'true' != get_post_meta( $post_id, 'project_owner_emailed', true ) &&
    14631469            'inherit' == get_post_status( $post_id ) &&
     
    14771483       
    14781484        // 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' );
    14801486       
    14811487        // Get the email's subject
     
    15151521       
    15161522        // 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' );
    15181524       
    15191525        // Get the email's subject
     
    18201826            'post_name'         =>  $title,
    18211827            'post_status'       =>  'pending',
    1822             'post_type'         =>  'project'
     1828            'post_type'         =>  'cj_project'
    18231829        );
    18241830
     
    19251931       
    19261932        $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'));
    19281934       
    19291935    }
     
    19581964      */
    19591965    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)) {
    19611967            delete_post_meta($post->ID, 'project_hash');
    19621968        }
    1963         if ($old_status == 'trash' && 'project' == get_post_type($post->ID)) {
     1969        if ($old_status == 'trash' && 'cj_project' == get_post_type($post->ID)) {
    19641970            update_post_meta($post->ID, 'project_hash', sha1(wp_salt('auth').$post->ID));
    19651971        }
     
    19741980      */
    19751981    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']);
    19781984                if(NULL != $project_id){
    19791985                    $this->update_existing_project( $project_id  );
     
    19962002      */
    19972003    public function single_project_header_hook( $name ) {
    1998         if( 'project' == get_post_type() && is_single()) {
     2004        if( 'cj_project' == get_post_type() && is_single()) {
    19992005            $this->register_new_volunteer();
    20002006        }
    20012007    }
    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    }
    20042032} // end class
    20052033
    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() );
    20072035?>
  • community-jar/trunk/views/templates/community-jar-project-submission.php

    r758663 r760885  
    33 * Template Name: Project Submission
    44 *
    5  * Used to submit a 'Project' from the frontend of the site. Also allows for editing.
     5 * Used to submit a 'Project' from the front-end of the site. Also allows for editing.
    66 *
    77 * @package Community Jar
     
    113113                                </label>
    114114                           
    115                                 <?php if( 'publish' == get_post_status() && isset( $_GET['owner'] ) && 'true' == $_GET['owner'] ) { ?>
     115                                <?php if( 'publish' == get_post_status() && isset($project->post_author) ) { ?>
    116116                                    <p>
    117117                                        <label for="project_is_complete">
     
    128128                                        <input type="button" class="btn-primary" id="submit-project" name="submit-project" value="<?php _e( 'Update Project', 'community-jar' ); ?>" />
    129129                                    <?php } // end if/else ?>
    130                                     <input type="button" class="btn" id="cancel-project" name="cancel-project" value="<?php _e( 'Cancel', 'community-jar' ); ?>" />
    131130                                </p>
    132131                               
Note: See TracChangeset for help on using the changeset viewer.