diff --git a/wordpress/wp-content/plugins/ignitiondeck-crowdfunding/ign_metabox/init.php b/wordpress/wp-content/plugins/ignitiondeck-crowdfunding/ign_metabox/init.php index d70fe5f7645686de0ec562bb026ff619cfa7c328..9d4d37a2961e1fbcd8c9f1ca13680ab2fdc7303f 100644 --- a/wordpress/wp-content/plugins/ignitiondeck-crowdfunding/ign_metabox/init.php +++ b/wordpress/wp-content/plugins/ignitiondeck-crowdfunding/ign_metabox/init.php @@ -129,20 +129,28 @@ class ign_cmb_Meta_Box { if ( !isset($field['show_help']) ) $field['show_help'] = false; $meta = get_post_meta( $post->ID, $field['id'], 'multicheck' != $field['type'] /* If multicheck this can be multiple values */ ); + if ( $field['type'] == "wrapper_start" ) { + echo '
'; + continue; + } + if ( $field['type'] == "wrapper_end" ) { + echo '
'; + continue; + } if ( $field['type'] == "level1wraptop" ) { - echo '

'.$GLOBALS["tr_Level"].' 1

'; + echo '
'; } if ( $field['type'] == "level1wrapbottom" ) { echo '
'; } if ( $field['type'] == "level2wraptop" ) { - echo '

What we’re installing 1

'; + echo '
'; } if ( $field['type'] == "level2wrapbottom" ) { echo '
'; } if ( $field['type'] == "level3wraptop" ) { - echo '

Project Timeline 1

'; + echo '
'; } if ( $field['type'] == "level3wrapbottom" ) { echo '
'; @@ -150,23 +158,23 @@ class ign_cmb_Meta_Box { echo '
  • '; if ( $field['type'] == "title" ) { - echo '
    ', $field['desc'], ''; + } else if ( $field['type'] == "subtitle" ) { + echo '
    ', $field['name'], '', $field['desc'], '
    '; + } else if ($field['type'] == 'checkbox') { echo '
    ', $field['desc'], '
    '; echo ''; echo ' '; echo ' [?]'; - } - else { + } else { if( $field['show_help'] == true ) { - echo ' [?] -
    ', $field['desc'], '
    - '; + echo '[?] +
    ', $field['desc'], '
    '; } - else { - echo ''; + else if($field['name']){ + echo ''; } echo '
    '; } @@ -239,10 +247,6 @@ class ign_cmb_Meta_Box { echo ''; echo ' '; break; - case 'title': - echo '
    ', $field['name'], '
    '; - echo ' '; - break; case 'wysiwyg': echo '
    '; echo '
    '; @@ -286,9 +290,8 @@ class ign_cmb_Meta_Box { $check_image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $meta ); if ( $check_image ) { echo '
    '; - echo '
    '; + echo ''; echo 'Remove Image
    '; - echo '
    '; } else { $parts = explode( "/", $meta ); for( $i = 0; $i < sizeof( $parts ); ++$i ) { @@ -318,13 +321,12 @@ class ign_cmb_Meta_Box { $meta_short_desc = stripslashes(get_post_meta( $post->ID, $name="ign_product_level_".($i)."_short_desc", true )); $meta_desc = stripslashes(get_post_meta( $post->ID, $name="ign_product_level_".($i)."_desc", true )); $levels_html .= ''. - '

    '.__('Level', 'ignitiondeck').' '.($i).'

    '. - '
    '. - '
    '. - '
    '. - '
    ' . - '
    '. - '
    '. + '
    '. + '
    '. + '
    '. + '
    ' . + '
    '. + '
    '. '
    '; $levels_html .= '
    '; } @@ -345,7 +347,7 @@ class ign_cmb_Meta_Box { echo apply_filters('id_product_levels_html_admin', $levels_html, $meta_no_levels, $post->ID); break; case 'add_levels': - echo ' '; + echo ''; break; ////Project What we’re installing line html form start here case 'product_levels_2': @@ -363,8 +365,7 @@ class ign_cmb_Meta_Box { $meta_order = 0; } $levels_html_2 .= ''. - '

    '.__('What we’re installing ', 'ignitiondeck').' '.($i).'

    '. - '
    '. + '

    '.__('Item ', 'ignitiondeck').' '.($i).'

    '. '
    '. '
    '; $levels_html_2 .= '
    '; @@ -378,7 +379,7 @@ class ign_cmb_Meta_Box { echo apply_filters('id_product_levels_2_html_admin', $levels_html_2, $meta_no_levels_2, $post->ID); break; case 'add_levels_2': - echo ' '; + echo ''; break; ////Project What we’re installing line html form end here ////Project Timeline multiple line html form start here @@ -397,10 +398,11 @@ class ign_cmb_Meta_Box { $meta_order = 0; } $levels_html_3 .= ''. - '

    '.__('Project Timeline ', 'ignitiondeck').' '.($i).'

    '. - '
    '. - '
    '. - '
    '; + '
    '.__('Event ', 'ignitiondeck').' '.($i).'
    '. + '
    '. + ''. + ''. + '
    '; $levels_html_3 .= '
    '; } @@ -412,23 +414,20 @@ class ign_cmb_Meta_Box { echo apply_filters('id_product_levels_3_html_admin', $levels_html_3, $meta_no_levels_3, $post->ID); break; case 'add_levels_3': - echo ' '; + echo ''; break; ////Project Timeline multiple line html form End here case 'short_code': - echo '
    + echo '
    '; - break; + break; case 'headline1': echo '

    '.$GLOBALS["tr_Headline1"].'

    '; - break; - case 'headline2': - echo '

    '.$GLOBALS["tr_Headline2"].'

    '; - break; + break; case 'headline2': echo '

    '.$GLOBALS["tr_Headline2"].'

    '; - break; + break; } echo '','
  • '; } @@ -766,7 +765,7 @@ function ign_cmb_editor_footer_scripts() { jQuery('div[levels]').attr('levels', element_number); jQuery('#levels').val(element_number); jQuery('div[levels]').append('
    ' + - '

    '+(element_number)+'

    '+ + '
    '+ '
    ' + '
    ' + '
    ' + @@ -791,10 +790,9 @@ function ign_cmb_editor_footer_scripts() { var pre_element_number = element_number - 1; jQuery('div[levels_2]').attr('levels_2', element_number); jQuery('#levels_2').val(element_number); - jQuery('div[levels_2]').append('
    ' + - '

    '+(element_number)+'

    '+ - '
    ' + - '
    '); + jQuery('div[levels_2]').append('
    ' + + '' + + '
    '); }); // Add What we’re installing js code end here // Add Project Timeline js code start here @@ -805,9 +803,11 @@ function ign_cmb_editor_footer_scripts() { jQuery('div[levels_3]').attr('levels_3', element_number); jQuery('#levels_3').val(element_number); jQuery('div[levels_3]').append('
    ' + - '

    '+(element_number)+'

    '+ - '
    ' + - '
    '); + '
    '+(element_number)+'
    ' + + '
    ' + + ''+ + '' + + '
    '); }); // Add Project Timeline js code end here }); diff --git a/wordpress/wp-content/plugins/ignitiondeck-crowdfunding/ignitiondeck-admin.css b/wordpress/wp-content/plugins/ignitiondeck-crowdfunding/ignitiondeck-admin.css index a9c691e3052d851c785fbfd7919b559b6f3481c6..8337b1e5d80b564ec75ddcdbcdb14e0b575b42da 100644 --- a/wordpress/wp-content/plugins/ignitiondeck-crowdfunding/ignitiondeck-admin.css +++ b/wordpress/wp-content/plugins/ignitiondeck-crowdfunding/ignitiondeck-admin.css @@ -48,6 +48,12 @@ width: 100%; clear: both; } +.wrap ul li.ign_projectmeta_full.new_levels{ + padding: 0 0 10px; +} +.wrap ul li.ign_projectmeta_full input[type=text]{ + width: 97%; +} .wrap ul li.ign_projectmeta_full .customEditor { padding: 1px; border: 1px solid #c9c9c9; @@ -62,8 +68,8 @@ width: 450px; margin: 10px 0; } -.wrap .ign_file_upload .upload_button { - margin-top: 10px; +.wrap .img_status{ + margin: 10px; } .wrap .ign_file_upload_image { padding: 0; @@ -99,24 +105,19 @@ } .wrap .ign_projectmeta_reward_price { padding: 0; - margin: 0; + margin: 0 0 10px; float: left; width: 20%; clear: both; } .wrap .ign_projectmeta_reward_limit { padding: 0; - margin: 0; + margin: 0 0 10px; float: left; width: 20%; clear: left; } -.wrap .ign_projectmeta_reward_left .ign_projectmeta_reward_limit { - margin-top: 65px; -} -.wrap .ign_projectmeta_reward_left .ign_projectmeta_reward_limit:last-child { - margin-top: 0; -} + .wrap .ign_projectmeta_reward_desc { padding: 0; margin: 0 2% 0 0; @@ -138,9 +139,11 @@ display: block; } .wrap .projectmeta-levelbox { - background-color: #f2f3f5; - margin-bottom: 10px; - padding: 8px; + margin: 0 0 10px; + padding: 0 0 30px; +} +.wrap .projectmeta-levelbox .ign_projectmeta_full{ + padding: 0; } .wrap .projectmeta_none { display: none ; @@ -159,6 +162,7 @@ } .wrap .projectmeta-levelbox label { font-weight: bold; + margin: 10px 0; } .new_levels h4 { diff --git a/wordpress/wp-content/themes/backer/css/admin-style.css b/wordpress/wp-content/themes/backer/css/admin-style.css index 57e55499585fc1dec7509cf48e155de24ed9c9fd..99775dfba14cf3a240caa1aed939f40e37352abe 100644 --- a/wordpress/wp-content/themes/backer/css/admin-style.css +++ b/wordpress/wp-content/themes/backer/css/admin-style.css @@ -1,3 +1,68 @@ +#poststuff #postbox-container-2 h3{ + font-size: 1.25rem; +} +#poststuff #post-body.columns-2{ + margin-right: 30%; +} +#post-body.columns-2 #postbox-container-1 { + float: right; + margin-right: -43%; + width: 40%; +} +#poststuff #post-body.columns-2 #side-sortables{ + width: auto; +} +.metabox-holder label { + font-weight: bold; + margin-bottom: 10px; + display: inline-block; +} +.metabox-holder label span{ + display: block; + font-weight: normal; +} +.metabox-holder h4{ + margin: 1rem 0; + font-size: 1.2rem; + line-height: 1.5rem; +} +.metabox-holder h4 span{ + display: block; + font-weight: normal; + font-size: .85rem; +} +.metabox-holder h5{ + margin: 1rem 0 0; + font-size: 1rem; + line-height: 1rem; + font-weight: bold; +} +.metabox-holder h5 span{ + display: block; + font-weight: normal; + font-size: .85rem; +} +.metabox-holder .new_levels_2{ + padding: 0; +} +.metabox-holder .new_item{ + padding: 10px 0; +} +.metabox-holder .meta_wrapper{ + margin: 10px 0; + border-top: 1px solid #ccc; +} +.metabox-holder .ign_projectmeta_left{ + float: none; +} +.metabox-holder .ign_projectmeta_left label{ + margin-bottom: 10px; + display: inline-block; +} +.metabox-holder .ign_projectmeta_full{ + padding: 10px 0; + width: 100%; +} #wp-admin-bar-vc-inline-admin-bar-link, td.column-title .edit_vc, .composer-switch .wpb_switch-to-front-composer, .composer-switch span.vc-spacer:nth-of-type(3), #wpb-edit-inline, #message.rs-update-notice-wrap, #wpb-custom-post-css, .vc_row_edit_clone_delete .vc_row_image, .vc_admin_label.admin_label_css_animation.hidden-label, .vc-license-activation-notice, #accordion-section-idc_menu_items { display: none !important; } diff --git a/wordpress/wp-content/themes/backer/functions.php b/wordpress/wp-content/themes/backer/functions.php index f25843916430297c02e264baa65b9bc6f8a58285..7baf8e2cbfb59486a2d9d620fdf1763e478c28d0 100644 --- a/wordpress/wp-content/themes/backer/functions.php +++ b/wordpress/wp-content/themes/backer/functions.php @@ -1,64 +1,4 @@ _x( 'Closed', 'post' ), - 'public' => true, - 'show_in_admin_all_list' => true, - 'show_in_admin_status_list' => true, - 'label_count' => _n_noop( 'Closed (%s)', 'Closed (%s)' ) - ) ); - register_post_status( 'completed', array( - 'label' => _x( 'Completed', 'post' ), - 'public' => true, - 'show_in_admin_all_list' => true, - 'show_in_admin_status_list' => true, - 'label_count' => _n_noop( 'Completed (%s)', 'Completed (%s)' ) - ) ); - register_post_status( 'needsediting', array( - 'label' => _x( 'Needs Editing', 'post' ), - 'public' => true, - 'show_in_admin_all_list' => true, - 'show_in_admin_status_list' => true, - 'label_count' => _n_noop( 'Needs Editing (%s)', 'Needs Editing (%s)' ) - ) ); -} - -function append_project_status_list(){ - global $post; - $label = ''; - if($post->post_type == 'ignition_product'){ - $post_value = ""; - $original_status = ""; - if($post->post_status == 'closed'){ - $label = ' Closed'; - $post_value = '$("#original_publish, #publish").val("Update");'; - } else if($post->post_status == 'completed'){ - $label = ' Completed'; - $post_value = '$("#original_publish, #publish").val("Update");'; - } else if($post->post_status == 'needsediting'){ - $label = ' Needs Editing'; - $post_value = '$("#original_publish, #publish").val("Update");'; - } - echo ' - - '; - } -} - /*--------------------------------- Setup OptionTree ------------------------------------*/ @@ -85,6 +25,8 @@ add_filter( 'ot_header_version_text', 'filter_ot_header_version_text'); Include other files ------------------------------------*/ +include( 'includes/overrides/project-status.php' ); +include( 'includes/overrides/project-edit.php' ); include( 'includes/theme-options.php' ); include( 'includes/customizer-options.php' ); include( 'includes/custom-styles.php' ); diff --git a/wordpress/wp-content/themes/backer/includes/ignitiondeck-functions.php b/wordpress/wp-content/themes/backer/includes/ignitiondeck-functions.php index a84c1a95f5721ea3a7256d54d0c674bd1cb67521..8d828bdceca5ce02a5c2ce7759b4f3c1d3de2d92 100644 --- a/wordpress/wp-content/themes/backer/includes/ignitiondeck-functions.php +++ b/wordpress/wp-content/themes/backer/includes/ignitiondeck-functions.php @@ -3,174 +3,6 @@ * This file contains some IgnitionDeck related functions */ -/*--------------------------------- - overrides for project admin ------------------------------------*/ -function override_ign_change_columns( $cols ) { - require ID_PATH.'languages/text_variables.php'; - $cols = array( - 'cb' => '', - 'title' => $tr_Product, - 'author' => __('Author', 'ignitiondeck'), - 'type' => __('Type', 'ignitiondeck'), - 'status' => $tr_Status, - 'goal' => $tr_Funding_Goal, - 'raised' => $tr_Pledged, - 'enddate' => $tr_End_Date, - 'daysleft' => $tr_Days_Remaining , - ); - return apply_filters('id_project_columns', $cols); -} -add_filter( "manage_ignition_product_posts_columns", "override_ign_change_columns" ); - -function override_ign_sortable_columns() { - $sortable_columns = array( - 'title' => 'title', - 'author' => 'author', - 'type' => 'type', - 'status' => 'status', - 'goal' => 'goal', - 'raised' => 'raised', - 'enddate' => 'enddate', - 'daysleft' => 'daysleft', - ); - return apply_filters('id_sortable_project_columns', $sortable_columns); -} -add_filter( "manage_edit-ignition_product_sortable_columns", "override_ign_sortable_columns" ); - - -remove_action( 'manage_posts_custom_column', 'manage_ign_product_columns', 10); -add_action( 'manage_posts_custom_column', 'override_manage_ign_product_columns', 10, 2 ); - -function override_manage_ign_product_columns($column_name, $id) { - global $post; - require ID_PATH.'languages/text_variables.php'; - $post_id = $post->ID; - $project_id = get_post_meta($id, 'ign_project_id', true); - $project = new ID_Project($project_id); - $cCode = $project->currency_code(); - switch ($column_name) { - // display goal amount with currency formatting - case 'author': - echo (!empty($post->post_author) ? $post->post_author : __('None', 'ignitiondeck')); - break; - - case 'type': - $type = get_post_meta($post_id, 'ign_project_type', true); - if (isset($type)) { - if ($type == 'pwyw') { - $type = __('Pledge What You Want', 'Ignitiondeck'); - } - else if ($type == 'level-based') { - $type = __('Level-Based', 'ignitiondeck'); - } - } - $type = apply_filters('id_project_type', $type); - echo (isset($type) ? $type : ''); - break; - - case 'status': - $status = get_post_status_object($post->post_status); - echo $status->label; - break; - - case 'goal': - if (get_post_meta( $post->ID, 'ign_fund_goal', true)) { - $goal_amt = number_format(get_post_meta( $post->ID, 'ign_fund_goal', true), 2, '.', ','); - - setlocale(LC_MONETARY, 'en_US'); - echo //money_format('%(#10n', $goal_amt); - $cCode.$goal_amt; - } else { - echo ''.$tr_No_Goal_set.''; - } - break; - - case 'raised': - if (isset($project_id)) { - $project = new ID_Project($project_id); - $post_id = $project->get_project_postid(); - $raised = apply_filters('id_funds_raised', $project->get_project_raised(), $post_id); - echo $raised; - } - break; - // display end date - case 'enddate': - if (get_post_meta( $post->ID, 'ign_fund_end', true)) { - echo get_post_meta( $post->ID, 'ign_fund_end', true); - } else { - echo ''.$tr_No_Date_set.''; - } - break; - - // calculate days remaining - case 'daysleft': - if (get_post_meta( $post->ID, 'ign_fund_end', true)) { - $days_left = $project->days_left(); - //$ending = get_post_meta( $post->ID, 'ign_fund_end', true); - //$daysleft = ID_Project::days_left($ending); - echo $days_left; - } else { - echo ''.$tr_No_Date_set.''; - } - break; - - // return standard post columns - default: - break; - } // end switch -} - -function filter_by_project_status(){ - $type = 'post'; - if (isset($_GET['post_type'])) { - $type = $_GET['post_type']; - } - //only add filter to post type you want - if ('ignition_product' == $type){ - //change this to the list of values you want to show - //in 'label' => 'value' format - $values = array( - 'All Status' => 'any', - 'Closed' => 'closed', - 'Completed' => 'completed', - 'Needs Editing' => 'needsediting', - 'Published' => 'publish', - 'Pending Review' => 'pending', - 'Draft ' => 'draft', - ); - ?> - - query_vars['post_status'] = $_GET['project_status']; - } -} -add_filter( 'parse_query', 'status_project_filter' ); - /*--------------------------------- Raised Funds Filter ------------------------------------*/ diff --git a/wordpress/wp-content/themes/backer/includes/overrides/project-edit.php b/wordpress/wp-content/themes/backer/includes/overrides/project-edit.php new file mode 100644 index 0000000000000000000000000000000000000000..399075994619adaeb382a4647602c42f62a8d13b --- /dev/null +++ b/wordpress/wp-content/themes/backer/includes/overrides/project-edit.php @@ -0,0 +1,471 @@ + array( + 'name' => $tr_Projects, + 'singular_name' => $tr_Project, + 'add_new' => $tr_Add_New_Project, + 'add_new_item' => $tr_Add_New_Project, + 'edit' => $tr_Edit, + 'edit_item' => $tr_Edit_Project, + 'new_item' => $tr_New_Project, + 'view' => $tr_View_Project, + 'view_item' => $tr_View_Project, + 'search_items' =>$tr_Search_Project, + 'not_found' => $tr_No_Products_found , + 'not_found_in_trash' => $tr_No_Product_in_Trash, + ), + 'public' => true, + 'show_in_nav_menus' => true, + 'show_ui' => true, + 'publicly_queryable' => true, + 'exclude_from_search' => false, + 'hierarchical' => apply_filters('idcf_hierarchical', false), + 'menu_position' => 5, + 'capability_type' => 'post', + 'menu_icon' => plugins_url('/ignitiondeck-crowdfunding/images/ignitiondeck-menu.png'), + 'query_var' => true, + 'rewrite' => array( 'slug' => $slug, 'with_front' => true ), + 'has_archive' => $slug, + 'supports' => array('title', 'author'), + 'taxonomies' => array('category', 'post_tag', 'project_category'), + ) + ); +} +remove_action( 'init', 'ign_create_post_type' ); +add_action( 'init', 'override_ign_create_post_type' ); + +function override_ign_meta_boxes(array $meta_boxes) { + require ID_PATH.'languages/text_variables.php'; + $prefix = 'ign_'; + $meta_boxes[] = array( + 'id' => 'project_detail', + 'title' => 'Project Details', + 'pages' => array('ignition_product'), + 'context' => 'normal', + 'priority' => 'high', + 'class' => $prefix . 'projectmeta', + 'fields' => array( + array( + 'name' => 'Project Location', + 'desc' => 'This should be exact address of project', + 'id' => $prefix . 'product_location', + 'class' => $prefix . 'projectmeta_full', + 'show_help' => false, + 'type' => 'text' + ), + array( + 'name' => 'Project Short Description', + 'desc' => 'Max 140 chars', + 'id' => $prefix . 'project_description', + 'class' => $prefix . 'projectmeta_full tinymce', + 'show_help' => false, + 'type' => 'textarea_medium' + ), + array( + 'name' => 'Project Long Description', + 'desc' => 'History and back story behind the building and the people. No character limit.', + 'id' => $prefix . 'project_long_description', + 'class' => $prefix . 'projectmeta_full tinymce', + 'show_help' => false, + 'type' => 'textarea_medium' + ), + array( + 'name' => 'About this Project', + 'desc' => 'Specifics about the retrofit itself. No character limit.', + 'id' => $prefix . 'about_project', + 'class' => $prefix . 'projectmeta_full tinymce', + 'show_help' => false, + 'type' => 'textarea_medium' + ), + ) + ); + $meta_boxes[] = array( + 'id' => 'project_what', + 'title' => 'What we’re installing', + 'pages' => array('ignition_product'), + 'context' => 'normal', + 'priority' => 'high', + 'class' => $prefix . 'projectmeta', + 'fields' => array( + array( + 'name' => 'The exact details of the retrofit. Ex. New XR5 Boiler', + 'type' => 'description', + ), + array( + 'name' => 'Item 1', + 'id' => $prefix . 'product_title_2', + 'class' => $prefix . 'projectmeta_full', + 'type' => 'text' + ), + array( + 'id' => $prefix . 'install_levels', + 'class' => $prefix . 'projectmeta_full install_level', + 'show_help' => false, + 'type' => 'install_level' + ), + array( + 'id' => $prefix . 'add_install_level', + 'class' => $prefix . 'projectmeta_full install_level', + 'type' => 'add_install_level', + ), + ), + ); + $meta_boxes[] = array( + 'id' => 'project_who', + 'title' => 'Who is installing?', + 'pages' => array('ignition_product'), + 'context' => 'normal', + 'priority' => 'high', + 'class' => $prefix . 'projectmeta', + 'fields' => array( + array( + 'name' => 'Contractor Information', + 'desc' => 'This can be the name, address and website of the contractor', + 'id' => $prefix . 'who_is_installing', + 'class' => $prefix . 'projectmeta_full tinymce', + 'show_help' => false, + 'type' => 'textarea_medium' + ), + ), + ); + $meta_boxes[] = array( + 'id' => 'project_funding', + 'title' => 'Funding Details', + 'pages' => array('ignition_product'), + 'context' => 'normal', + 'priority' => 'high', + 'class' => $prefix . 'projectmeta', + 'fields' => array( + array( + 'name' => 'Funding Goal', + 'desc' => 'Amount you are seeking to raise (required)', + 'id' => $prefix . 'fund_goal', + 'show_help' => false, + 'type' => 'text_money' + ), + array( + 'name' => 'Fundraising End Date', + 'desc' => 'Date funding will end (recommended)', + 'id' => $prefix . 'fund_end', + 'show_help' => false, + 'type' => 'text_date' + ), + array( + 'name' => 'Funding Levels', + 'desc' => 'This part should be completed by an Admin that knows what they are doing. Otherwise leave blank.', + 'type' => 'subtitle', + ), + array( + 'type' => 'level1wraptop', + 'class' => 'projectmeta_none' + ), + array( + 'name' => 'Funding Level 1', + 'id' => $prefix . 'product_title', + 'class' => $prefix . 'projectmeta_full', + 'show_help' => false, + 'type' => 'text' + ), + array( + 'name' => 'Level Price', + 'id' => $prefix . 'product_price', + 'class' => $prefix . 'projectmeta_reward_price', + 'type' => 'text_money' + ), + array( + 'name' => 'Level Short Description', + 'desc' => 'Used in widgets sidebars, and in some cases, on the purchase form', + 'id' => $prefix . 'product_short_description', + 'class' => $prefix . 'projectmeta_reward_desc', + 'show_help' => true, + 'type' => 'textarea_small' + ), + array( + 'name' => 'Level Long Description', + 'desc' => 'For use on the project page and in level shortcodes/widgets', + 'id' => $prefix . 'product_details', + 'class' => $prefix . 'projectmeta_reward_desc tinymce', + 'show_help' => true, + 'type' => 'textarea_medium' + ), + array( + 'name' => 'Level Limit', + 'desc' => 'Restrict the number of buyers that can back this level', + 'id' => $prefix . 'product_limit', + 'class' => $prefix . 'projectmeta_reward_limit', + 'show_help' => true, + 'type' => 'text_small' + ), + array( + 'name' => 'Level Order', + 'desc' => 'Enter a number of 0 (first) or higher if you wish to customize the placement of this level', + 'id' => $prefix.'projectmeta_level_order', + 'class' => $prefix . 'projectmeta_reward_limit', + 'show_help' => true, + 'type' => 'text_small' + ), + array( + 'type' => 'level1wrapbottom', + 'class' => 'projectmeta_none' + ), + array( + 'id' => $prefix . 'level', + 'class' => $prefix . 'projectmeta_full new_levels', + 'show_help' => false, + 'type' => 'product_levels' + ), + array( + 'id' => $prefix . 'addlevels', + 'class' => $prefix . 'projectmeta_full new_level', + 'type' => 'add_levels', + ), + ), + ); + $meta_boxes[] = array( + 'id' => 'project_timeline', + 'title' => 'Project Timeline', + 'pages' => array('ignition_product'), + 'context' => 'normal', + 'priority' => 'high', + 'class' => $prefix . 'projectmeta', + 'fields' => array( + array( + 'name' => 'A rough timeline of the overall project. Ex. March 2016 - Contractor chosen', + 'type' => 'description', + ), + array( + 'name' => 'Event 1', + 'type' => 'subtitle', + ), + array( + 'name' => 'What', + 'id' => $prefix . 'product_image_3', + 'class' => $prefix . 'projectmeta_full', + 'show_help' => false, + 'type' => 'text' + ), + array( + 'name' => 'When', + 'id' => $prefix . 'product_title_3', + 'class' => $prefix . 'projectmeta_full', + 'type' => 'text' + ), + array( + 'id' => $prefix . 'project_timelines', + 'class' => $prefix . 'projectmeta_full new_levels_3', + 'show_help' => false, + 'type' => 'project_timeline' + ), + array( + 'id' => $prefix . 'add_project_timeline', + 'class' => $prefix . 'projectmeta_full new_level_3', + 'type' => 'add_timeline', + ), + ), + ); + $meta_boxes[] = array( + 'id' => 'project_invest', + 'title' => 'Why Invest', + 'pages' => array('ignition_product'), + 'context' => 'normal', + 'priority' => 'high', + 'class' => $prefix . 'projectmeta', + 'fields' => array( + array( + 'name' => 'A quantifiable reasoning behind investing in projects', + 'type' => 'description', + ), + array( + 'name' => 'Why Invest Description', + 'desc' => 'General description about the pronmary reason for investing in this project 200-300 characters', + 'id' => $prefix . 'why_invest', + 'class' => $prefix . 'projectmeta_full tinymce', + 'show_help' => false, + 'type' => 'textarea_medium' + ), + array( + 'name' => 'Health Impact', + 'type' => 'title', + ), + array( + 'name' => 'Health Rating', + 'id' => $prefix . 'test_select', + 'show_option_none' => true, + 'type' => 'select', + 'options' => array( + '1' => __( '1', 'cmb2' ), + '2' => __( '2', 'cmb2' ), + '3' => __( '3', 'cmb2' ), + '4' => __( '4', 'cmb2' ), + '5' => __( '5', 'cmb2' ), + '6' => __( '6', 'cmb2' ), + '7' => __( '7', 'cmb2' ), + '8' => __( '8', 'cmb2' ), + '9' => __( '9', 'cmb2' ), + '10' => __( '10', 'cmb2' ), + ), + ), + array( + 'name' => 'Health', + 'desc' => 'Describe why this project gets the health rating it has been given. Max 140 characters', + 'id' => $prefix . 'health', + 'class' => $prefix . 'projectmeta_full tinymce', + 'show_help' => false, + 'type' => 'textarea_medium' + ), + array( + 'name' => 'Financial Impact', + 'type' => 'title', + ), + array( + 'name' => 'Financial Rating', + 'id' => $prefix . 'test_select2', + 'show_option_none' => true, + 'type' => 'select', + 'options' => array( + '1' => __( '1', 'cmb2' ), + '2' => __( '2', 'cmb2' ), + '3' => __( '3', 'cmb2' ), + '4' => __( '4', 'cmb2' ), + '5' => __( '5', 'cmb2' ), + '6' => __( '6', 'cmb2' ), + '7' => __( '7', 'cmb2' ), + '8' => __( '8', 'cmb2' ), + '9' => __( '9', 'cmb2' ), + '10' => __( '10', 'cmb2' ), + ), + ), + array( + 'name' => 'Financial', + 'desc' => 'Describe why this project gets the financial rating it has been given. Max 140 characters', + 'id' => $prefix . 'Financial', + 'class' => $prefix . 'projectmeta_full tinymce', + 'show_help' => false, + 'type' => 'textarea_medium' + ), + array( + 'name' => 'Environmental Impact', + 'type' => 'title', + ), + array( + 'name' => 'Environmental Rating', + 'id' => $prefix . 'test_select1', + 'show_option_none' => true, + 'type' => 'select', + 'options' => array( + '1' => __( '1', 'cmb2' ), + '2' => __( '2', 'cmb2' ), + '3' => __( '3', 'cmb2' ), + '4' => __( '4', 'cmb2' ), + '5' => __( '5', 'cmb2' ), + '6' => __( '6', 'cmb2' ), + '7' => __( '7', 'cmb2' ), + '8' => __( '8', 'cmb2' ), + '9' => __( '9', 'cmb2' ), + '10' => __( '10', 'cmb2' ), + ), + ), + array( + 'name' => 'Environmental', + 'desc' => 'Describe why this project gets the environmental rating it has been given. Max 140 characters', + 'id' => $prefix . 'Environmental', + 'class' => $prefix . 'projectmeta_full tinymce', + 'show_help' => false, + 'type' => 'textarea_medium' + ), + array( + 'name' => 'Social Impact', + 'type' => 'title', + ), + array( + 'name' => 'Social Rating', + 'id' => $prefix . 'test_select3', + 'show_option_none' => true, + 'type' => 'select', + 'options' => array( + '1' => __( '1', 'cmb2' ), + '2' => __( '2', 'cmb2' ), + '3' => __( '3', 'cmb2' ), + '4' => __( '4', 'cmb2' ), + '5' => __( '5', 'cmb2' ), + '6' => __( '6', 'cmb2' ), + '7' => __( '7', 'cmb2' ), + '8' => __( '8', 'cmb2' ), + '9' => __( '9', 'cmb2' ), + '10' => __( '10', 'cmb2' ), + ), + ), + array( + 'name' => 'Social', + 'desc' => 'Describe why this project gets the social rating it has been given. Max 140 characters', + 'id' => $prefix . 'Social', + 'class' => $prefix . 'projectmeta_full tinymce', + 'show_help' => false, + 'type' => 'textarea_medium' + ), + ), + ); + $meta_boxes[] = array( + 'id' => 'project_media', + 'title' => 'Media', + 'pages' => array('ignition_product'), + 'context' => 'normal', + 'priority' => 'high', + 'class' => $prefix . 'projectmeta', + 'fields' => array( + array( + 'name' => 'Featured Image 1024px x 340px', + 'desc' => 'First photo and thumbnail seen all over the site and posted to socail media', + 'id' => $prefix . 'product_image1', + 'class' => $prefix . 'projectmeta_full', + 'show_help' => false, + 'type' => 'file' + ), + array( + 'name' => 'Image 2 1024px x 340px', + 'desc' => 'Additonal photos to show on produc pages', + 'id' => $prefix . 'product_image2', + 'class' => $prefix . 'projectmeta_full', + 'show_help' => false, + 'type' => 'file' + ), + array( + 'name' => 'Image 3 1024px x 340px', + 'desc' => 'Additonal photos to show on produc pages', + 'id' => $prefix . 'product_image3', + 'class' => $prefix . 'projectmeta_full', + 'show_help' => false, + 'type' => 'file' + ), + array( + 'name' => 'Image 4 1024px x 340px', + 'desc' => 'Additonal photos to show on produc pages', + 'id' => $prefix . 'product_image4', + 'class' => $prefix . 'projectmeta_full', + 'show_help' => false, + 'type' => 'file' + ), + ), + ); + return apply_filters('id_postmeta_boxes', $meta_boxes); +} + +function override_install_ign_metaboxes() { + global $pagenow; + if ($pagenow == 'post.php' || 'post-new.php') { + add_filter('overrides_ign_cmb_meta_boxes', 'override_ign_meta_boxes'); + require_once(ID_PATH.'ign_metabox/init.php'); + require_once('project-meta-boxes.php'); + } +} +remove_action('init', 'install_ign_metaboxes'); +add_action('init', 'override_install_ign_metaboxes'); + +?> \ No newline at end of file diff --git a/wordpress/wp-content/themes/backer/includes/overrides/project-meta-boxes.php b/wordpress/wp-content/themes/backer/includes/overrides/project-meta-boxes.php new file mode 100644 index 0000000000000000000000000000000000000000..f74be8cdeb709f294c42dd8e81e0754b10193f9d --- /dev/null +++ b/wordpress/wp-content/themes/backer/includes/overrides/project-meta-boxes.php @@ -0,0 +1,703 @@ +_meta_box = $meta_box; + + $upload = false; + foreach ( $meta_box['fields'] as $field ) { + if ( $field['type'] == 'file' || $field['type'] == 'file_list' || $field['type'] == 'wysiwyg') { + $upload = true; + break; + } + } + + $current_page = substr(strrchr($_SERVER['PHP_SELF'], '/'), 1, -4); + + if ( $upload && ( $current_page == 'page' || $current_page == 'page-new' || $current_page == 'post' || $current_page == 'post-new' ) ) { + add_action('admin_head', array(&$this, 'add_post_enctype')); + } + + add_action( 'admin_menu', array(&$this, 'add') ); + add_action( 'save_post', array(&$this, 'save'), 3, 2 ); + } + + function add_post_enctype() { + echo ' + '; + } + + /// Add metaboxes + function add() { + $this->_meta_box['context'] = empty($this->_meta_box['context']) ? 'normal' : $this->_meta_box['context']; + $this->_meta_box['priority'] = empty($this->_meta_box['priority']) ? 'high' : $this->_meta_box['priority']; + foreach ($this->_meta_box['pages'] as $page) { + add_meta_box($this->_meta_box['id'], $this->_meta_box['title'], array(&$this, 'show'), $page, $this->_meta_box['context'], $this->_meta_box['priority']); + } + } + + // Show fields + function show() { + global $post; + + // Use nonce for verification + echo ''; + echo '
      '; + + foreach ( $this->_meta_box['fields'] as $field ) { + // Set up blank values for empty ones + if ( !isset($field['desc']) ) $field['desc'] = ''; + if ( !isset($field['std']) ) $field['std'] = ''; + if ( !isset($field['id']) ) $field['id'] = ''; + if ( !isset($field['name']) ) $field['name'] = ''; + if ( !isset($field['show_help']) ) $field['show_help'] = false; + $meta = get_post_meta( $post->ID, $field['id'], 'multicheck' != $field['type'] /* If multicheck this can be multiple values */ ); + + if ( $field['type'] == "wrapper_start" ) { + echo '
      '; + continue; + } + if ( $field['type'] == "wrapper_end" ) { + echo '
      '; + continue; + } + if ( $field['type'] == "level1wraptop" ) { + echo '
      '; + } + if ( $field['type'] == "level1wrapbottom" ) { + echo '
      '; + } + if ( $field['type'] == "level2wraptop" ) { + echo '
      '; + } + if ( $field['type'] == "level2wrapbottom" ) { + echo '
      '; + } + if ( $field['type'] == "level3wraptop" ) { + echo '
      '; + } + if ( $field['type'] == "level3wrapbottom" ) { + echo '
      '; + } + echo '
    • '; + + if ( $field['type'] == "title" ) { + echo '

      ', $field['name'], '', $field['desc'], '

      '; + } else if ( $field['type'] == "subtitle" ) { + echo '
      ', $field['name'], '', $field['desc'], '
      '; + } else if ( $field['type'] == "description") { + echo '

      ', $field['name'], '

      '; + } else if ($field['type'] == 'checkbox') { + echo '
      ', $field['desc'], '
      '; + echo ''; + echo ' '; + echo ' [?]'; + } else { + if( $field['show_help'] == true ) { + echo '[?] +
      ', $field['desc'], '
      '; + } + + else if($field['name']){ + echo ''; + } + echo '
      '; + } + switch ( $field['type'] ) { + case 'text': + echo ''; + break; + case 'text_small': + echo ' '; + break; + case 'text_medium': + echo ''; + break; + case 'text_date': + echo ' '; + break; + case 'text_money': + echo ' '; + break; + case 'textarea': + echo '', + ''; + break; + case 'textarea_code': + echo '', + ' '; + break; + case 'textarea_small': + echo '', + ' '; + break; + case 'textarea_medium': + echo ''; + break; + case 'select': + echo ''; + break; + case 'radio_inline': + echo '
      '; + foreach ($field['options'] as $option) { + echo '
      ', $option['name'], '
      '; + } + echo '
      '; + break; + case 'radio': + foreach ($field['options'] as $option) { + echo '

      ', $option['name'].'

      '; + } + break; + case 'multicheck': + echo '
        '; + foreach ( $field['options'] as $value => $name ) { + // Append `[]` to the name to get multiple values + // Use in_array() to check whether the current option should be checked + echo '
      • '; + } + echo '
      '; + break; + case 'wysiwyg': + echo '
      '; + echo '
      '; + echo '
      '; + break; + case 'file_list': + echo ''; + echo ''; + $args = array( + 'post_type' => 'attachment', + 'numberposts' => null, + 'post_status' => null, + 'post_parent' => $post->ID + ); + $attachments = get_posts($args); + if ($attachments) { + echo '
        '; + foreach ($attachments as $attachment) { + echo '
      • '.wp_get_attachment_link($attachment->ID, 'thumbnail', 0, 0, 'Download'); + echo ''; + echo apply_filters('the_title', ' '.$attachment->post_title); + echo '
      • '; + } + echo '
      '; + } + break; + case 'file': + echo '
      '; + echo ''; + echo '
      '; + echo '
      '; + if ( $meta != '' ) { + $check_image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $meta ); + if ( $check_image ) { + echo '
      '; + echo ''; + echo 'Remove Image
      '; + } else { + $parts = explode( "/", $meta ); + for( $i = 0; $i < sizeof( $parts ); ++$i ) { + $title = $parts[$i]; + } + echo 'File: ', $title, '    (Download / )'; + } + } + echo '
      '; + break; + case 'product_levels': + $meta_no_levels = get_post_meta( $post->ID, $name="ign_product_level_count", true ); + $levels_html = ''; + + if ($meta_no_levels > 0 || $meta_no_levels != "") { + $levels_html .= '
      '; + + for ($i=2 ; $i <= $meta_no_levels ; $i++) { + $meta_title = stripslashes(get_post_meta( $post->ID, $name="ign_product_level_".($i)."_title", true )); + $meta_limit = get_post_meta( $post->ID, $name="ign_product_level_".($i)."_limit", true ); + $meta_order = get_post_meta( $post->ID, $name="ign_product_level_".($i)."_order", true ); + if (empty($meta_order)) { + $meta_order = 0; + } + $meta_price = get_post_meta( $post->ID, $name="ign_product_level_".($i)."_price", true ); + $meta_short_desc = stripslashes(get_post_meta( $post->ID, $name="ign_product_level_".($i)."_short_desc", true )); + $meta_desc = stripslashes(get_post_meta( $post->ID, $name="ign_product_level_".($i)."_desc", true )); + $levels_html .= ''. + '
      '. + '
      '. + '
      '. + '
      ' . + '
      '. + '
      '. + '
      '; + $levels_html .= '
      '; + } + + } else { + $levels_html .= '
      '; + } + echo apply_filters('id_product_levels_html_admin', $levels_html, $meta_no_levels, $post->ID); + break; + case 'add_levels': + echo ''; + break; + ////Project What we’re installing line html form start here + case 'install_level': + $meta_no_levels_2 = get_post_meta( $post->ID, $name="ign_product_level_count_2", true ); + $levels_html_2 = ''; + //echo $meta_no_levels; + + if ($meta_no_levels_2 > 0 || $meta_no_levels_2 != "") { + $levels_html_2 .= '
      '; + + for ($i=2 ; $i <= $meta_no_levels_2 ; $i++) { + $filename = stripslashes(get_post_meta( $post->ID, $name="ign_product_level_2_".($i)."_filename", true )); + $meta_title = stripslashes(get_post_meta( $post->ID, $name="ign_product_level_2_".($i)."_title", true )); + if (empty($meta_order)) { + $meta_order = 0; + } + $levels_html_2 .= ''. + ''. + ''. + '
      '; + } + $levels_html_2 .= '
      '; + + } else { + $levels_html_2 .= '
      '; + } + echo apply_filters('id_product_levels_2_html_admin', $levels_html_2, $meta_no_levels_2, $post->ID); + break; + case 'add_install_level': + echo ''; + break; + ////Project What we’re installing line html form end here + ////Project Timeline multiple line html form start here + case 'project_timeline': + $meta_no_levels_3 = get_post_meta( $post->ID, $name="ign_product_level_count_3", true ); + $levels_html_3 = ''; + + if ($meta_no_levels_3 > 0 || $meta_no_levels_3 != "") { + $levels_html_3 .= '
      '; + + for ($i=2 ; $i <= $meta_no_levels_3 ; $i++) { + $what = stripslashes(get_post_meta( $post->ID, $name="ign_product_level_3_".($i)."_what", true )); + $when = stripslashes(get_post_meta( $post->ID, $name="ign_product_level_3_".($i)."_when", true )); + if (empty($meta_order)) { + $meta_order = 0; + } + $levels_html_3 .= ''. + '
      Event '.($i).'
      '. + '
      '. + '
      '. + '
      '. + '
      '; + + } + $levels_html_3 .= '
    '; + } else { + $levels_html_3 .= '
    '; + } + echo apply_filters('id_product_levels_3_html_admin', $levels_html_3, $meta_no_levels_3, $post->ID); + break; + case 'add_timeline': + echo ''; + break; + ////Project Timeline multiple line html form End here + case 'short_code': + echo '
    '; + break; + case 'headline1': + echo '

    '.$GLOBALS["tr_Headline1"].'

    '; + break; + case 'headline2': + echo '

    '.$GLOBALS["tr_Headline2"].'

    '; + break; + } + echo '',''; + } + echo '
    '; + } + + // Save data from metabox + function save($post_id, $post) { + global $post; + + // verify nonce + if ( ! isset( $_POST['wp_meta_box_nonce'] ) || !wp_verify_nonce($_POST['wp_meta_box_nonce'], basename(__FILE__))) { + return $post_id; + } + + // check autosave + if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { + return $post_id; + } + + if (isset($_POST['wp-preview']) && $_POST['wp-preview'] == 'dopreview') { + return $post_id; + } + + // check permissions + if ( 'page' == $_POST['post_type'] ) { + if ( !current_user_can( 'edit_page', $post_id ) ) { + return $post_id; + } + } + + else if ( !current_user_can( 'edit_post', $post_id ) ) { + return $post_id; + } + + //=================================================================== + // Saving the post meta field in the product table as well + //=================================================================== + //echo "referrer: ".$_SERVER['HTTP_REFERER']."
    "; exit; + global $wpdb; + if (!empty($_POST['ign_product_price'])) { + //$product_price = 0.00; + $product_price = round(str_replace(",", "", esc_attr($_POST['ign_product_price'])), 2); //replacing commas with empty + } + else { + $product_price = ''; + } + + if ($post->post_type == 'ignition_product') { + if ( stristr($_SERVER['HTTP_REFERER'], "action=edit") !== false) { + + $project_id = get_post_meta($post_id, 'ign_project_id', true); + //$post_data = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."posts WHERE ID = '".$post_id."'"); + + + $product_goal = round(str_replace(",", "", esc_attr($_POST['ign_fund_goal'])), 2); //replacing commas with empty + update_post_meta($post_id, 'ign_project_id', $project_id); + $sql_update = $wpdb->prepare("UPDATE ".$wpdb->prefix."ign_products SET product_name = %s, + ign_product_title = %s, + ign_product_limit = %s, + product_details = %s, + product_price = %s, + product_url = %s, + goal = %s WHERE id = %d", esc_attr($_POST['post_title']), esc_attr($_POST['ign_product_title']), esc_attr($_POST['ign_product_limit']), esc_attr($_POST['ign_product_details']), $product_price, esc_attr($_POST['id_project_URL']).'/', $product_goal, $project_id); + $wpdb->query( $sql_update ); + do_action('id_update_project', $post_id, $project_id); + update_option('id_preview_data', serialize($_POST)); + update_option('id_products_notice', 'off'); + } else { + + $product_goal = round(str_replace(",", "", $_POST['ign_fund_goal']), 2); //replacing commas with empty + $sql_product = $wpdb->prepare("INSERT INTO ".$wpdb->prefix ."ign_products ( + product_image, + product_name, + product_url, + ign_product_title, + ign_product_limit, + product_details, + product_price, + goal, + created_at) VALUES ( + 'product image', + %s, + %s, + %s, + %s, + %s, + %s, + %s, + '".date('Y-m-d H:i:s')."' + )", esc_attr($_POST['post_title']), + esc_attr($_POST['id_project_URL']).'/' , + esc_attr($_POST['ign_product_title']) , + esc_attr($_POST['ign_product_limit']), + esc_attr($_POST['ign_product_details']), + $product_price, + $product_goal); + + $res = $wpdb->query( $sql_product ); + $product_id = $wpdb->insert_id; + update_post_meta($post_id, 'ign_project_id', $product_id); + do_action('id_create_project', $post_id, $product_id); + update_option('id_products_notice', 'off'); + } + } + + //=================================================================== + + foreach ( $this->_meta_box['fields'] as $field ) { + if ( !isset($field['desc']) ) $field['desc'] = ''; + if ( !isset($field['std']) ) $field['std'] = ''; + if ( !isset($field['id']) ) $field['id'] = ''; + if ( !isset($field['name']) ) $field['name'] = ''; + if ( !isset($field['show_help']) ) $field['show_help'] = false; + + $name = $field['id']; + $old = get_post_meta( $post_id, $name, 'multicheck' != $field['type'] /* If multicheck this can be multiple values */ ); + $new = isset( $_POST[$field['id']] ) ? $_POST[$field['id']] : null; + + if ( $field['type'] == 'wysiwyg' || $field['type'] == 'textarea_medium') { + $new = wpautop($new); + } + + if ( ($field['type'] == 'textarea') || ($field['type'] == 'textarea_small') ) { + $new = htmlspecialchars($new); + } + + if ( ($field['id'] == "ign_product_price") || ($field['id'] == "ign_fund_goal") ) { + $new = str_replace(",", "", $new); + } + + if ($field['id'] == "ign_product_name") { + $new = htmlspecialchars($new); + } + + // validate meta value + if ( isset($field['validate_func']) ) { + $ok = call_user_func(array('ign_cmb_Meta_Box_Validate', $field['validate_func']), $new); + if ( $ok === false ) { // pass away when meta value is invalid + continue; + } + } elseif ( 'multicheck' == $field['type'] ) { + // Do the saving in two steps: first get everything we don't have yet + // Then get everything we should not have anymore + if ( empty( $new ) ) { + $new = array(); + } + $aNewToAdd = array_diff( $new, $old ); + $aOldToDelete = array_diff( $old, $new ); + foreach ( $aNewToAdd as $newToAdd ) { + add_post_meta( $post_id, $name, $newToAdd, false ); + } + foreach ( $aOldToDelete as $oldToDelete ) { + delete_post_meta( $post_id, $name, $oldToDelete ); + } + } elseif ($new && $new != $old) { + update_post_meta($post_id, $name, $new); + } elseif ('' == $new && $old && $field['type'] != 'file') { + delete_post_meta($post_id, $name, $old); + } + } + + //=================================================================== + // Saving the product levels + //=================================================================== + if (isset($_POST['level-count'])) { + update_post_meta($post_id, "ign_product_level_count", $_POST['level-count']); + } + $j = 2; + //find a better way to declare this without using +1 + if (isset($_POST['levels'])) { + $custom_order = false; + $level_order = absint($_POST['ign_projectmeta_level_order']); + if ($level_order > 0) { + $custom_order = true; + } + if ($_POST['levels'] > 1 ) { + foreach ( $_POST['levels'] as $level ) { + update_post_meta($post_id, $meta_key="ign_product_level_".$j."_title", esc_attr($meta_value=$level['title'])); + update_post_meta($post_id, $meta_key="ign_product_level_".$j."_limit", $meta_value=$level['limit']); + update_post_meta($post_id, $meta_key="ign_product_level_".$j."_order", $meta_value=$level['order']); + update_post_meta($post_id, $meta_key="ign_product_level_".$j."_price", $meta_value=str_replace(",", "", $level['price'])); + update_post_meta($post_id, $meta_key="ign_product_level_".$j."_short_desc", esc_html($meta_value=$level['short_description'])); + update_post_meta($post_id, $meta_key="ign_product_level_".$j."_desc", esc_html($meta_value=$level['description'])); + if ($level['order'] > 0) { + $custom_order = true; + } + $j++; + } + } + update_post_meta($post_id, 'custom_level_order', $custom_order); + } + + //=================================================================== + // Saving the Who is installing + //=================================================================== + if (isset($_POST['level-count-2'])) { + update_post_meta($post_id, "ign_product_level_count_2", $_POST['level-count-2']); + } + $j = 2; + //find a better way to declare this without using +1 + + if (isset($_POST['levels_2'])) { + $custom_order = false; + $level_order = absint($_POST['ign_projectmeta_level_order_2']); + if ($level_order > 0) { + $custom_order = true; + } + if ($_POST['levels_2'] > 1 ) { + foreach ( $_POST['levels_2'] as $level_2 ) { + update_post_meta($post_id, $meta_key="ign_product_level_2_".$j."_filename", esc_attr($meta_value=$level_2['filename'])); + update_post_meta($post_id, $meta_key="ign_product_level_2_".$j."_title", $meta_value=$level_2['title_2']); + + if ($level_2['order'] > 0) { + $custom_order = true; + } + $j++; + } + } + update_post_meta($post_id, 'custom_level_order_2', $custom_order); + } + + //=================================================================== + // Saving the Project Timeline + //=================================================================== + if (isset($_POST['level-count-3'])) { + update_post_meta($post_id, "ign_product_level_count_3", $_POST['level-count-3']); + } + $j = 2; + //find a better way to declare this without using +1 + + if (isset($_POST['levels_3'])) { + $custom_order = false; + $level_order = absint($_POST['ign_projectmeta_level_order_3']); + if ($level_order > 0) { + $custom_order = true; + } + if ($_POST['levels_3'] > 1 ) { + foreach ( $_POST['levels_3'] as $level_3 ) { + update_post_meta($post_id, $meta_key="ign_product_level_3_".$j."_what", esc_attr($meta_value=$level_3['what'])); + update_post_meta($post_id, $meta_key="ign_product_level_3_".$j."_when", $meta_value=$level_3['when']); + + if ($level_3['order'] > 0) { + $custom_order = true; + } + $j++; + } + } + update_post_meta($post_id, 'custom_level_order_3', $custom_order); + } + + //=================================================================== + } +} + +function override_ign_cmb_editor_footer_scripts() { + global $post; + if (isset($post->post_type) && $post->post_type == 'ignition_product') { + ?> + + \ No newline at end of file diff --git a/wordpress/wp-content/themes/backer/includes/overrides/project-status.php b/wordpress/wp-content/themes/backer/includes/overrides/project-status.php new file mode 100644 index 0000000000000000000000000000000000000000..8ac9f47e291e911ce7af83f41beab50daec09374 --- /dev/null +++ b/wordpress/wp-content/themes/backer/includes/overrides/project-status.php @@ -0,0 +1,229 @@ + _x( 'Closed', 'post' ), + 'public' => true, + 'show_in_admin_all_list' => true, + 'show_in_admin_status_list' => true, + 'label_count' => _n_noop( 'Closed (%s)', 'Closed (%s)' ) + ) ); + register_post_status( 'completed', array( + 'label' => _x( 'Completed', 'post' ), + 'public' => true, + 'show_in_admin_all_list' => true, + 'show_in_admin_status_list' => true, + 'label_count' => _n_noop( 'Completed (%s)', 'Completed (%s)' ) + ) ); + register_post_status( 'needsediting', array( + 'label' => _x( 'Needs Editing', 'post' ), + 'public' => true, + 'show_in_admin_all_list' => true, + 'show_in_admin_status_list' => true, + 'label_count' => _n_noop( 'Needs Editing (%s)', 'Needs Editing (%s)' ) + ) ); +} + +function append_project_status_list(){ + global $post; + $label = ''; + if($post->post_type == 'ignition_product'){ + $post_value = ""; + $original_status = ""; + if($post->post_status == 'closed'){ + $label = ' Closed'; + $post_value = '$("#original_publish, #publish").val("Update");'; + } else if($post->post_status == 'completed'){ + $label = ' Completed'; + $post_value = '$("#original_publish, #publish").val("Update");'; + } else if($post->post_status == 'needsediting'){ + $label = ' Needs Editing'; + $post_value = '$("#original_publish, #publish").val("Update");'; + } + echo ' + + '; + } +} +/*--------------------------------- + overrides for project admin +-----------------------------------*/ +function override_ign_change_columns( $cols ) { + require ID_PATH.'languages/text_variables.php'; + $cols = array( + 'cb' => '', + 'title' => $tr_Product, + 'author' => __('Author', 'ignitiondeck'), + 'type' => __('Type', 'ignitiondeck'), + 'status' => $tr_Status, + 'goal' => $tr_Funding_Goal, + 'raised' => $tr_Pledged, + 'enddate' => $tr_End_Date, + 'daysleft' => $tr_Days_Remaining , + ); + return apply_filters('id_project_columns', $cols); +} +remove_filter('manage_ignition_product_posts_columns', 'ign_change_columns'); +add_filter( "manage_ignition_product_posts_columns", "override_ign_change_columns" ); + +function override_ign_sortable_columns() { + $sortable_columns = array( + 'title' => 'title', + 'author' => 'author', + 'type' => 'type', + 'status' => 'status', + 'goal' => 'goal', + 'raised' => 'raised', + 'enddate' => 'enddate', + 'daysleft' => 'daysleft', + ); + return apply_filters('id_sortable_project_columns', $sortable_columns); +} +remove_filter('manage_edit-ignition_product_sortable_columns', 'ign_sortable_columns'); +add_filter( "manage_edit-ignition_product_sortable_columns", "override_ign_sortable_columns" ); + +function override_manage_ign_product_columns($column_name, $id) { + global $post; + require ID_PATH.'languages/text_variables.php'; + $post_id = $post->ID; + $project_id = get_post_meta($id, 'ign_project_id', true); + $project = new ID_Project($project_id); + $cCode = $project->currency_code(); + switch ($column_name) { + // display goal amount with currency formatting + case 'author': + echo (!empty($post->post_author) ? $post->post_author : __('None', 'ignitiondeck')); + break; + + case 'type': + $type = get_post_meta($post_id, 'ign_project_type', true); + if (isset($type)) { + if ($type == 'pwyw') { + $type = __('Pledge What You Want', 'Ignitiondeck'); + } + else if ($type == 'level-based') { + $type = __('Level-Based', 'ignitiondeck'); + } + } + $type = apply_filters('id_project_type', $type); + echo (isset($type) ? $type : ''); + break; + + case 'status': + $status = get_post_status_object($post->post_status); + echo $status->label; + break; + + case 'goal': + if (get_post_meta( $post->ID, 'ign_fund_goal', true)) { + $goal_amt = number_format(get_post_meta( $post->ID, 'ign_fund_goal', true), 2, '.', ','); + + setlocale(LC_MONETARY, 'en_US'); + echo //money_format('%(#10n', $goal_amt); + $cCode.$goal_amt; + } else { + echo ''.$tr_No_Goal_set.''; + } + break; + + case 'raised': + if (isset($project_id)) { + $project = new ID_Project($project_id); + $post_id = $project->get_project_postid(); + $raised = apply_filters('id_funds_raised', $project->get_project_raised(), $post_id); + echo $raised; + } + break; + // display end date + case 'enddate': + if (get_post_meta( $post->ID, 'ign_fund_end', true)) { + echo get_post_meta( $post->ID, 'ign_fund_end', true); + } else { + echo ''.$tr_No_Date_set.''; + } + break; + + // calculate days remaining + case 'daysleft': + if (get_post_meta( $post->ID, 'ign_fund_end', true)) { + $days_left = $project->days_left(); + //$ending = get_post_meta( $post->ID, 'ign_fund_end', true); + //$daysleft = ID_Project::days_left($ending); + echo $days_left; + } else { + echo ''.$tr_No_Date_set.''; + } + break; + + // return standard post columns + default: + break; + } // end switch +} +remove_action( 'manage_posts_custom_column', 'manage_ign_product_columns', 10); +add_action( 'manage_posts_custom_column', 'override_manage_ign_product_columns', 10, 2 ); + +function filter_by_project_status(){ + $type = 'post'; + if (isset($_GET['post_type'])) { + $type = $_GET['post_type']; + } + //only add filter to post type you want + if ('ignition_product' == $type){ + //change this to the list of values you want to show + //in 'label' => 'value' format + $values = array( + 'All Status' => 'any', + 'Closed' => 'closed', + 'Completed' => 'completed', + 'Needs Editing' => 'needsediting', + 'Published' => 'publish', + 'Pending Review' => 'pending', + 'Draft ' => 'draft', + ); + ?> + + query_vars['post_status'] = $_GET['project_status']; + } +} +add_filter( 'parse_query', 'status_project_filter' ); + +?> \ No newline at end of file diff --git a/wordpress/wp-content/themes/backer/single-ignition_product.php b/wordpress/wp-content/themes/backer/single-ignition_product.php index da7e0bd8ec3f589ef7ddf680dbdc62849f4a5664..c41a8ab9d6bcb4d95fdca60dc81f8664835f18dc 100644 --- a/wordpress/wp-content/themes/backer/single-ignition_product.php +++ b/wordpress/wp-content/themes/backer/single-ignition_product.php @@ -17,10 +17,12 @@ $product_location = get_post_meta( $post->ID, 'ign_product_location', true ); $project_description = get_post_meta( $post->ID, 'ign_project_description', true ); $project_long_description = get_post_meta( $post->ID, 'ign_project_long_description', true ); + $ign_product_level_count_2 = get_post_meta( $post->ID, 'ign_product_level_count_2', true ); $ign_fund_goal = get_post_meta( $post->ID, 'ign_fund_goal', true ); $ign_fund_raised = get_post_meta( $post->ID, 'ign_fund_raised', true ); $ign_days_left = get_post_meta( $post->ID, 'ign_days_left', true ); + $ign_test_select = get_post_meta( $post->ID, 'ign_test_select', true ); $ign_test_select1 = get_post_meta( $post->ID, 'ign_test_select1', true ); $ign_test_select2 = get_post_meta( $post->ID, 'ign_test_select2', true ); @@ -200,15 +202,6 @@
    - - - - -