Changeset 2862820
- Timestamp:
- 02/09/2023 04:19:34 PM (3 years ago)
- Location:
- constellation-client-portal/trunk
- Files:
-
- 5 edited
-
README.txt (modified) (5 diffs)
-
admin/class-ars-constellation-client-portal-admin.php (modified) (11 diffs)
-
ars-constellation-client-portal.php (modified) (2 diffs)
-
public/class-ars-constellation-client-portal-public.php (modified) (22 diffs)
-
uninstall.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
constellation-client-portal/trunk/README.txt
r2845715 r2862820 89 89 * **list_id** this can be useful for development when you have multiple lists on the same page (ex. this could be helpful when creatig paginated lists on the same page). Accepted Values: any whole positive number that is unique on the page. Default: null 90 90 * **categories** Accepted Values: this can be entered as an Invoice Category Slug or ID, or a combination of those. Separate multiple values with a comma (ex. “21, category-a”). Default: null. 91 * **link_title** Accepted Values: “no_link”. Adding this parameter and setting the value to "no_link" will remove the href from post titles in the list and make them unclickable. Default: null. 92 * **id** Accepted Values: any valid HTML ID attribute name. Default: null. 93 * **class** Accepted Values: any valid HTML class attribute name or names (separate multiple class names with a space). Default: null. 94 91 95 92 96 = Pro Invoice Shortcode Parameters = … … 115 119 * **align_thumbnail** this allows the thumbnail image alignment to be set if the “show_thumbnail” attribute is set to “true”. Accepted Values: “center”, “left”, “right”, “float-left”, or “float-right”. Default: null. 116 120 * **show_post_date** this allows for the WordPress post date to be displayed with each item in a list. Accepted Values: “true” or “false”. Default: “false”. 117 * **list_id** this can be useful for development when you have multiple lists on the same page (ex. this could be helpful when creatig paginated lists on the same page). Accepted Values: any whole positive number that is unique on the page. Default: null 121 * **list_id** this can be useful for development when you have multiple lists on the same page (ex. this could be helpful when creatig paginated lists on the same page). Accepted Values: any whole positive number that is unique on the page. Default: null. 122 * **link_title** Accepted Values: “no_link”. Adding this parameter and setting the value to "no_link" will remove the href from post titles in the list and make them unclickable. Default: null. 123 * **id** Accepted Values: any valid HTML ID attribute name. Default: null. 124 * **class** Accepted Values: any valid HTML class attribute name or names (separate multiple class names with a space). Default: null. 118 125 119 126 = Pro File Shortcode Parameters = … … 196 203 197 204 == Changelog == 205 = 1.5.4 (Pro) - 2023-2-9 = 206 * Update: Corrected typo in the pro email settings section. 207 * Improvement: Updated the CSV import functionality to verify that the assigned company ID is associated with a valid company and return a warning if not. 208 * Improvement: Updated the CSV import functionality to assign a default post status of draft if none was provided and post a warning to the import log. 209 210 = 1.5.4 (Core) - 2023-2-9 = 211 * Improvement: Added new id param to the file and invoice shortcodes to allow an ID attribute to be added to the list container div. 212 * Improvement: Added new class param to the file and invoice shortcodes to allow additional classes to be added to the list container div. 213 * Update: Updated the parameter order in the accp_update_dir_name_in_file_attachments function to clear optional parameter warnings in PHP 8. 214 * Update: Updated the parameter order in the accp_load_requested_file function to clear optional parameter warnings in PHP 8. 215 * Update: Updated the file shortcode to accept the file_status param and adjust the output accordingly. 216 198 217 = 1.5.3 (Pro) - 2023-1-9 = 199 218 * Update: Updated the deactivate function to clear the accp_automated_email_cron cron job if it is scheduled on plugin deactivation. … … 206 225 * Improvement: Added functionality to display a product_total column within invoice CSV exports. 207 226 * Update: Relocated accp_save_invoice_cart_item_meta_as_order_item_meta, accp_change_invoice_status_on_woocommerce_payment_complete, accp_change_invoice_status_on_woocommerce_order_status_complete, and accp_change_invoice_status_to_completed functions and hooks from public to admin files. 208 * Improvement -Added functionality to add the Woocommerce order number as attribution within invoice notes when they are automatically marked as paid by Woocommerce.227 * Improvement: Added functionality to add the Woocommerce order number as attribution within invoice notes when they are automatically marked as paid by Woocommerce. 209 228 210 229 = 1.5.3 (Core) - 2023-1-9 = … … 212 231 * Improvement: Added new link_title file and invoice shortcode attribute that removes the link from post titles in the loop if the attribute is set to nolink. 213 232 * Improvement: Added a role select field to the new primary user create form in the Company UI and updated the AJAX function to assign the role on user creation. 214 * Improvement: Added a "Company ID" column t he the Company WP list table for easy access to the Company/post ID.s233 * Improvement: Added a "Company ID" column to the Company WP list table for easy access to the Company/post ID. 215 234 * Improvement: Extended login and WP capability checks for admin settings pages. 216 235 -
constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-admin.php
r2798490 r2862820 108 108 global $wp, $wp_rewrite; 109 109 110 // Don't specify the plugin directory name to account for different 111 // dir names based on the plugin tier - Basic, Pro, Premium 112 113 // Account for WP being installed in a sub directory, and the wp-content 114 // and/or /uploads directories being renamed. 110 /** 111 * Don't specify the plugin directory name to account for different 112 * dir names based on the plugin tier - Basic, Pro, etc. 113 * 114 * Account for WP being installed in a sub directory, and the wp-content 115 * and/or /uploads directories being renamed. 116 */ 115 117 $page_with_query_string = 'index.php/?accp_direct_access=1'; 116 118 $wp_content_dir_name = $this->accp_utility_functions->accp_get_wp_content_dir_name(); 117 119 $accp_clientfiles_full_dir_path = $this->accp_utility_functions->accp_get_clientfiles_path(); 118 120 119 // Constrain path to start with 'wp-content/...' as an example, but this is dynamic based on the environment. 121 122 /** 123 * Constrain path to start with 'wp-content/...' as an example, but this is dynamic based on the environment. 124 */ 120 125 $accp_clientfiles_partial_dir_path = strstr($accp_clientfiles_full_dir_path, $wp_content_dir_name); 121 126 $accp_clientfiles_partial_dir_path_slashed = str_replace('/', '\/', $accp_clientfiles_partial_dir_path); 122 127 123 // Prep the regex (Example: value should look like - '^wp-content\/uploads\/accp-clientfiles\/.*?\/.*?\..*?$'). 124 $regex_path = '^'.$accp_clientfiles_partial_dir_path_slashed.'\/.*?\/.*?\..*?$'; 125 128 129 /** 130 * Prep the regex (Example: value should look like - '^wp-content\/uploads\/accp-clientfiles\/.*?\/.*?\..*?$'). 131 */ 132 $regex_path = '^'.$accp_clientfiles_partial_dir_path_slashed.'\/.*?\/.*?\..*?$'; 133 134 135 /** 136 * Add the rewrite rule for direct file access. 137 */ 126 138 add_rewrite_rule( $regex_path, $page_with_query_string, 'top' ); 127 139 128 } 140 } 141 129 142 130 143 /** … … 134 147 135 148 $query_vars[] = 'accp_direct_access'; 149 136 150 return $query_vars; 137 151 138 152 } 153 139 154 140 155 /** … … 149 164 $base_checks = $this->accp_direct_file_access_base_checks($request_uri); 150 165 151 // If this is the Basic tier, serve the file here if the base checks passed. 166 /** 167 * If this is the Basic tier, serve the file here if the base checks passed. 168 */ 152 169 if( $this->plugin_name != 'ars-constellation-client-portal-premium' && $this->plugin_name != 'ars-constellation-client-portal-pro'){ 153 170 … … 156 173 $checks_passed = true; 157 174 158 // Serve the requested file. 159 $this->accp_load_requested_file($checks_passed, $request_uri); 175 /** 176 * Serve the requested file. 177 */ 178 $this->accp_load_requested_file($request_uri, $checks_passed); 160 179 exit; 161 180 162 181 }else{ 163 182 164 // Redirect to the home page. 183 /** 184 * Redirect to the home page. 185 */ 165 186 wp_redirect('/'); 166 187 exit; … … 189 210 $checks_passed = true; 190 211 191 // Serve the requested file. 192 $this->accp_load_requested_file($checks_passed, $request_uri); 212 /** 213 * Serve the requested file. 214 */ 215 $this->accp_load_requested_file($request_uri, $checks_passed); 193 216 exit(); 194 217 195 218 }else{ 196 219 197 // Redirect to the home page. 220 /** 221 * Redirect to the home page. 222 */ 198 223 wp_redirect('/'); 199 224 exit; … … 217 242 218 243 global $current_user; 244 219 245 $current_user = wp_get_current_user(); 220 246 $current_user_id = $current_user->ID; 221 247 $plugin_name = $this->plugin_name; 222 248 223 // Return false if the user is not logged in. 224 if ( !is_user_logged_in() || $current_user_id === 0) return false; 249 /** 250 * Return false if the user is not logged in. 251 */ 252 if ( !is_user_logged_in() || $current_user_id === 0) 253 return false; 225 254 226 255 // Get the company that the current user is assigned to … … 233 262 234 263 }else{ 264 235 265 $company_directory = NULL; 266 236 267 } 237 268 … … 301 332 * Serves the requested file after checks have passed. 302 333 */ 303 private function accp_load_requested_file($ checks_passed = false, $request_uri){334 private function accp_load_requested_file($request_uri, $checks_passed = false){ 304 335 305 336 if($checks_passed == false) return; … … 1343 1374 if($update_links == 'update'){ 1344 1375 1345 $process_link_updates = $this->accp_update_dir_name_in_file_attachments($company_id, array('accp_clientinvoice', 'accp_clientfile'), $new_dir_name);1376 $process_link_updates = $this->accp_update_dir_name_in_file_attachments($company_id, $new_dir_name, array('accp_clientinvoice', 'accp_clientfile')); 1346 1377 1347 1378 /** … … 1461 1492 * or false if no post ID's were returned in the query. 1462 1493 */ 1463 function accp_update_dir_name_in_file_attachments($company_id, $ post_types = array('accp_clientinvoice', 'accp_clientfile'), $new_dir_name){1494 function accp_update_dir_name_in_file_attachments($company_id, $new_dir_name, $post_types = array('accp_clientinvoice', 'accp_clientfile')){ 1464 1495 1465 1496 if(!is_admin() || !current_user_can('manage_options')) … … 1651 1682 if($update_links == 'update'){ 1652 1683 1653 $process_link_updates = $this->accp_update_dir_name_in_file_attachments($company_id, array('accp_clientinvoice', 'accp_clientfile'), $new_dir_name);1684 $process_link_updates = $this->accp_update_dir_name_in_file_attachments($company_id, $new_dir_name, array('accp_clientinvoice', 'accp_clientfile')); 1654 1685 1655 1686 /** -
constellation-client-portal/trunk/ars-constellation-client-portal.php
r2845715 r2862820 5 5 * Plugin URI: https://adrianrodriguezstudios.com/constellation-client-portal/ 6 6 * Description: Create private pages for each of your clients, post private files, and protect your client files from unauthorized users and search engines. <strong>Important:</strong> All Site-level File Protection features will cease to function if the plugin is disabled or uninstalled. 7 * Version: 1.5. 37 * Version: 1.5.4 8 8 * Author: ARS 9 9 * Author URI: https://adrianrodriguezstudios.com … … 41 41 */ 42 42 define('ACCP_PLUGIN_NAME', 'ARS_CONSTELLATION_CLIENT_PORTAL'); 43 define('ACCP_PLUGIN_VERSION', '1.5. 3'); // Change the version in the header as well.43 define('ACCP_PLUGIN_VERSION', '1.5.4'); // Change the version in the header as well. 44 44 define( ACCP_PLUGIN_NAME, ACCP_PLUGIN_VERSION ); 45 45 -
constellation-client-portal/trunk/public/class-ars-constellation-client-portal-public.php
r2845715 r2862820 89 89 $roles = array_map('strtolower', $roles_array); 90 90 $list_instance = filter_var( $this->accp_generate_list_instance_id(), FILTER_SANITIZE_NUMBER_INT); 91 $paged_param = 'paged' . $list_instance; 92 $paged = isset( $_GET[$paged_param] ) ? (int)$_GET[$paged_param] : 1; 93 94 // Get the Company ID associated with the current user 95 $curr_user_company_id = get_user_meta( $user_id, 'client_company', true ); 96 97 // Get the Company id of the current page 98 $page_company = get_post_meta($post_id, 'accp_user', true); 99 100 // Get additonal assigned companies 101 $additional_assigned_companies = get_user_meta($user_id, 'client_additional_company', true); 102 103 if ( $additional_assigned_companies != null && in_array($page_company, $additional_assigned_companies) ){ 104 105 $additional_company_id = $page_company; 106 107 }else{ 108 109 $additional_company_id = null; 110 $additional_assigned_companies = array(); 111 } 112 113 if ( $additional_company_id != null){ 114 115 $authorized_company_id = $additional_company_id; 116 117 }else{ 118 119 $authorized_company_id = $curr_user_company_id; 120 } 121 122 // Admins have access to all companies 123 if( current_user_can('manage_options') ){ 124 125 $authorized_company_id = $page_company; 126 $additional_assigned_companies = array(); 127 128 } 129 130 $current_date = date('Y-m-d'); 91 131 92 132 … … 107 147 * Output the shortcode attributes. 108 148 */ 109 $atts = shortcode_atts($atts_list_array, $atts); 110 111 ob_start(); 112 113 $cur_date = date('m/d/Y'); 149 $atts = shortcode_atts($atts_list_array, $atts); 150 114 151 115 152 /** … … 117 154 */ 118 155 156 // File Status 157 if( $atts['file_status'] != null){ 158 159 $file_status = strtolower($atts['file_status']); 160 161 }else{ 162 163 $file_status = ''; 164 165 } 166 119 167 // List ID 120 168 $list_id = $this->accp_list_id_var($atts); … … 141 189 // Thumbnail alignment 142 190 $align_thumbnail = $this->accp_align_thumbnail_var($atts); 143 144 // Get the Company ID associated with the current user145 $curr_user_company_id = get_user_meta( $user_id, 'client_company', true );146 191 147 192 // Link title … … 154 199 155 200 $link_title = 'nolink'; 201 202 } 203 204 // Container ID 205 $container_id = ''; 206 207 if( isset($atts['id']) && !empty($atts['id']) ){ 208 209 $container_id = trim($atts['id']); 210 $container_id = str_replace(' ', '', $container_id); 211 212 } 213 214 // Container Classes 215 $container_classes = ''; 216 217 if( isset($atts['class']) && !empty($atts['class']) ){ 218 219 $container_classes = trim($atts['class']); 156 220 157 221 } … … 177 241 } 178 242 179 ?> 180 181 182 183 <?php // File List ?> 184 185 <div class="accp_documents_filelist" <?php echo ( $list_id != null ? ' data-accp-rel-list="' . esc_attr($list_id) . '"' : '' ); ?> data-list-id="<?php echo esc_attr($list_instance); ?>"> 186 <?php 187 188 $paged_param = 'paged' . $list_instance; 189 $paged = isset( $_GET[$paged_param] ) ? (int)$_GET[$paged_param] : 1; 190 191 // Get the Company id of the current page 192 $page_company = get_post_meta($post_id, 'accp_user', true); 193 194 // Get additonal assigned companies 195 $additional_assigned_companies = get_user_meta($user_id, 'client_additional_company', true); 196 197 if ( $additional_assigned_companies != null && in_array($page_company, $additional_assigned_companies) ){ 198 199 $additional_company_id = $page_company; 200 201 }else{ 202 203 $additional_company_id = null; 204 $additional_assigned_companies = array(); 205 } 206 207 if ( $additional_company_id != null){ 208 209 $authorized_company_id = $additional_company_id; 210 211 }else{ 212 213 $authorized_company_id = $curr_user_company_id; 214 } 215 216 // Admins have access to all companies 217 if( current_user_can('manage_options') ){ 218 219 $authorized_company_id = $page_company; 220 $additional_assigned_companies = array(); 221 222 } 223 224 // Add a tax_query if the 'categories' att is not empty. 225 $tax_query = array(); 226 227 if(!empty($categories)){ 228 229 $tax_query[] = array( 230 'taxonomy' => 'accp_file_categories', 231 'field' => 'slug', 232 'terms' => $categories, 233 ); 234 235 } 236 237 $args = array( 238 'post_type' => 'accp_clientfile', 239 'posts_per_page' => $number_of_posts, 240 'paged' => $paged, 241 'orderby' => $order_by, 242 'order' => $order, 243 'meta_query' => array( 244 'relation' => 'AND', 245 array( 246 'key' => 'accp_user', 247 'value' => $authorized_company_id 248 ) 249 ), 250 'tax_query' => $tax_query, 251 ); 243 ob_start(); 244 245 ?> 246 247 <?php // File List ?> 248 249 <div <?php echo !empty($container_id) ? 'id="'. esc_attr($container_id).'"' : ''; ?> class="accp_documents_filelist <?php echo !empty($container_classes) ? esc_attr($container_classes) : ''; ?>" <?php echo ( $list_id != null ? ' data-accp-rel-list="' . esc_attr($list_id) . '"' : '' ); ?> data-list-id="<?php echo esc_attr($list_instance); ?>"> 250 <?php 251 252 /** 253 * Generate file query args. 254 */ 255 $args = $this->accp_generate_file_query_args($categories, $number_of_posts, $paged, $order_by, $order, $authorized_company_id, $file_status); 252 256 253 257 $query = new WP_Query( $args ); 254 258 255 $html = ''; 256 $current_year = ''; 257 $current_date = date('m/d/Y'); 259 $html = ''; 258 260 259 261 if ($query->have_posts()): … … 261 263 while ( $query->have_posts() ): 262 264 263 $query->the_post(); 264 265 $year = get_the_date('Y'); 266 267 if ($year != $current_year){ 268 269 $current_year = $year; 270 271 } 265 $query->the_post(); 272 266 273 267 $accp_file = get_post_meta($post->ID, 'accp_file', true); … … 435 429 </div> 436 430 431 437 432 <?php 438 433 /** … … 531 526 } 532 527 528 529 /** 530 * Generate file query args. 531 * 532 * @return array $args - array of file query args. 533 */ 534 function accp_generate_file_query_args($categories, $number_of_posts, $paged, $order_by, $order, $authorized_company_id, $file_status){ 535 536 /** 537 * Add a tax_query if the 'categories' att is not empty. 538 */ 539 $tax_query = array(); 540 541 if(!empty($categories)){ 542 543 $tax_query[] = array( 544 'taxonomy' => 'accp_file_categories', 545 'field' => 'slug', 546 'terms' => $categories, 547 ); 548 549 } 550 551 $meta_query = array(); 552 553 /** 554 * Add the file status to the meta_query 555 * if it's not empty. 556 */ 557 if(!empty($file_status)){ 558 559 $meta_query['relation'] = 'AND'; 560 561 $meta_query[] = array( 562 'key' => 'file_status', 563 'value' => $file_status 564 ); 565 566 } 567 568 $meta_query[] = array( 569 'key' => 'accp_user', 570 'value' => $authorized_company_id 571 ); 572 573 $args = array( 574 'post_type' => 'accp_clientfile', 575 'posts_per_page' => $number_of_posts, 576 'paged' => $paged, 577 'orderby' => $order_by, 578 'order' => $order, 579 'meta_query' => $meta_query, 580 'tax_query' => $tax_query, 581 ); 582 583 return $args; 584 585 } 586 533 587 /** 534 588 * Set up the core atts for the clientfile shortcode. … … 537 591 538 592 $atts_list_array = array( 593 'id' => '', // Optional ID for the accp_documents_filelist list div. Defaults to null. 594 'class' => '', // Optional additional class(es) for the accp_documents_filelist list div. Defaults to null. 539 595 'categories' => '', // Category atts can be entered as the Slug or ID in the shortcode 596 'file_status' => '', // File status to show - file status slug or null. Defaults to null. 540 597 'display_number' => '', // This is the number of posts per page 541 598 'order_by' => '', // This allows ordering by post title - default is post date - options "title" or "date" … … 572 629 $roles_array = ( array ) $user->roles; 573 630 $roles = array_map('strtolower', $roles_array); 574 $list_instance = filter_var( $this->accp_generate_list_instance_id(), FILTER_SANITIZE_NUMBER_INT); 631 $list_instance = filter_var( $this->accp_generate_list_instance_id(), FILTER_SANITIZE_NUMBER_INT); 632 $paged_param = 'paged' . $list_instance; 633 $paged = isset( $_GET[$paged_param] ) ? (int)$_GET[$paged_param] : 1; 634 635 // Get the Company ID associated with the current user 636 $curr_user_company_id = get_user_meta( $user_id, 'client_company', true ); 637 638 // Get the Company id of the current page 639 $page_company = get_post_meta($post_id, 'accp_user', true); 640 641 // Get additonal assigned companies 642 $additional_assigned_companies = get_user_meta($user_id, 'client_additional_company', true); 643 644 if ( $additional_assigned_companies != null && in_array($page_company, $additional_assigned_companies) ){ 645 646 $additional_company_id = $page_company; 647 648 }else{ 649 650 $additional_company_id = null; 651 $additional_assigned_companies = array(); 652 } 653 654 if ( $additional_company_id != null){ 655 656 $authorized_company_id = $additional_company_id; 657 658 }else{ 659 660 $authorized_company_id = $curr_user_company_id; 661 } 662 663 // Admins have access to all companies 664 if( current_user_can('manage_options') ){ 665 666 $authorized_company_id = $page_company; 667 $additional_assigned_companies = array(); 668 669 } 670 671 $current_date = date('Y-m-d'); 575 672 576 673 … … 592 689 * Output the shortcode attributes 593 690 */ 594 $atts = shortcode_atts($atts_list_array, $atts); 595 596 ob_start(); 597 598 $cur_date = date('m/d/Y'); 691 $atts = shortcode_atts($atts_list_array, $atts); 692 599 693 600 694 /** … … 610 704 611 705 $invoice_status = 'unpaid'; 706 612 707 } 613 708 … … 635 730 636 731 // Thumbnail alignment 637 $align_thumbnail = $this->accp_align_thumbnail_var($atts); 638 639 // Get the Company ID associated with the current user 640 $curr_user_company_id = get_user_meta( $user_id, 'client_company', true ); 732 $align_thumbnail = $this->accp_align_thumbnail_var($atts); 641 733 642 734 // Link title … … 649 741 650 742 $link_title = 'nolink'; 743 744 } 745 746 // Container ID 747 $container_id = ''; 748 749 if( isset($atts['id']) && !empty($atts['id']) ){ 750 751 $container_id = trim($atts['id']); 752 $container_id = str_replace(' ', '', $container_id); 753 754 } 755 756 // Container Classes 757 $container_classes = ''; 758 759 if( isset($atts['class']) && !empty($atts['class']) ){ 760 761 $container_classes = trim($atts['class']); 651 762 652 763 } … … 671 782 echo wp_kses_post($before_loop_content); 672 783 } 784 785 ob_start(); 673 786 ?> 674 787 675 788 <?php // Invoice List ?> 676 789 677 <div class="accp_documents_filelist" <?php echo ( $list_id != null ? ' data-accp-rel-list="' . esc_attr($list_id) . '"' : '' ); ?> data-list-id="<?php echo esc_attr($list_instance); ?>"> 678 <?php 679 680 $paged_param = 'paged' . $list_instance; 681 $paged = isset( $_GET[$paged_param] ) ? (int)$_GET[$paged_param] : 1; 682 683 // Get the Company id of the current page 684 $page_company = get_post_meta($post_id, 'accp_user', true); 685 686 // Get additonal assigned companies 687 $additional_assigned_companies = get_user_meta($user_id, 'client_additional_company', true); 688 689 if ( $additional_assigned_companies != null && in_array($page_company, $additional_assigned_companies) ){ 690 691 $additional_company_id = $page_company; 692 693 }else{ 694 695 $additional_company_id = null; 696 $additional_assigned_companies = array(); 697 } 698 699 if ( $additional_company_id != null){ 700 701 $authorized_company_id = $additional_company_id; 702 703 }else{ 704 705 $authorized_company_id = $curr_user_company_id; 706 } 707 708 // Admins have access to all companies 709 if( current_user_can('manage_options') ){ 710 711 $authorized_company_id = $page_company; 712 $additional_assigned_companies = array(); 713 714 } 715 716 // Add a tax_query if the 'categories' att is not empty. 717 $tax_query = array(); 718 719 if(!empty($categories)){ 720 721 $tax_query[] = array( 722 'taxonomy' => 'accp_invoice_categories', 723 'field' => 'slug', 724 'terms' => $categories, 725 ); 726 727 } 728 729 $args = array( 730 'post_type' => 'accp_clientinvoice', 731 'posts_per_page' => $number_of_posts, 732 'paged' => $paged, 733 'orderby' => $order_by, 734 'order' => $order, 735 'meta_query' => array( 736 'relation' => 'AND', 737 array( 738 'key' => 'accp_user', 739 'value' => $authorized_company_id 740 ), 741 array( 742 'key' => 'invoice_status', 743 'value' => $invoice_status 744 ) 745 ), 746 'tax_query' => $tax_query 747 ); 748 790 <div <?php echo !empty($container_id) ? 'id="'. esc_attr($container_id).'"' : ''; ?> class="accp_documents_filelist <?php echo !empty($container_classes) ? esc_attr($container_classes) : ''; ?>" <?php echo ( $list_id != null ? ' data-accp-rel-list="' . esc_attr($list_id) . '"' : '' ); ?> data-list-id="<?php echo esc_attr($list_instance); ?>"> 791 <?php 792 793 /** 794 * Generate invoice query args. 795 */ 796 $args = $this->accp_generate_invoice_query_args($categories, $number_of_posts, $paged, $order_by, $order, $authorized_company_id, $invoice_status); 749 797 $query = new WP_Query( $args ); 750 798 751 $html = ''; 752 $current_year = ''; 753 $current_date = date('m/d/Y'); 799 $html = ''; 754 800 755 801 // The Loop … … 760 806 while ( $query->have_posts()): 761 807 762 $query->the_post(); 763 764 $year = get_the_date('Y'); 765 766 if ($year != $current_year) { 767 $current_year = $year; 768 } 808 $query->the_post(); 769 809 770 810 $accp_file = get_post_meta($post->ID, 'accp_file', true); … … 1076 1116 1077 1117 /** 1118 * Generate invoice query args. 1119 * 1120 * @return array - array of args for the invoice query. 1121 */ 1122 function accp_generate_invoice_query_args($categories, $number_of_posts, $paged, $order_by, $order, $authorized_company_id, $invoice_status){ 1123 1124 /** 1125 * Add a tax_query if the 'categories' att is not empty. 1126 */ 1127 $tax_query = array(); 1128 1129 if(!empty($categories)){ 1130 1131 $tax_query[] = array( 1132 'taxonomy' => 'accp_invoice_categories', 1133 'field' => 'slug', 1134 'terms' => $categories, 1135 ); 1136 1137 } 1138 1139 $args = array( 1140 'post_type' => 'accp_clientinvoice', 1141 'posts_per_page' => $number_of_posts, 1142 'paged' => $paged, 1143 'orderby' => $order_by, 1144 'order' => $order, 1145 'meta_query' => array( 1146 'relation' => 'AND', 1147 array( 1148 'key' => 'accp_user', 1149 'value' => $authorized_company_id 1150 ), 1151 array( 1152 'key' => 'invoice_status', 1153 'value' => $invoice_status 1154 ) 1155 ), 1156 'tax_query' => $tax_query 1157 ); 1158 1159 return $args; 1160 1161 } 1162 1163 1164 /** 1078 1165 * Set up the core atts for the clientinvoice shortcode. 1079 1166 */ … … 1081 1168 1082 1169 $atts_list_array = array( 1170 'id' => '', // Optional ID for the accp_documents_filelist list div. Defaults to null. 1171 'class' => '', // Optional additional class(es) for the accp_documents_filelist list div. Defaults to null. 1083 1172 'categories' => '', // Category atts can be entered as the Slug or ID in the shortcode 1084 1173 'invoice_status' => '', // Invoice status to show - 'paid' or 'unpaid'. Defaults to 'unpaid.' … … 1473 1562 1474 1563 1564 /** 1565 * Generate a list instance ID by posting 1566 * and incrementing a number that can be assigned 1567 * to lists that are added to the page via file and 1568 * invoice shortcodes. 1569 * 1570 * This allows for accurate pagination functionality 1571 * when multiple lists are added to the same page, and 1572 * can allow for better css and/or script targetting. 1573 * 1574 * @return int $list_instance_id - a unique number to be used 1575 * for a file or invoice list. 1576 */ 1475 1577 function accp_generate_list_instance_id(){ 1476 1578 1579 /** 1580 * If $_POST['accp_list_count'] is not set, 1581 * this should be the first (or only) list on the page, 1582 * so let's set $_POST['accp_list_count'] to "1". 1583 */ 1477 1584 if( !isset($_POST['accp_list_count'])){ 1478 1585 … … 1481 1588 }else{ 1482 1589 1590 /** 1591 * If we've gotten this far and $_POST['accp_list_count'] 1592 * is already set, There's more than one list on the page. 1593 * So, let's increment $_POST['accp_list_count'] by 1 and 1594 * use that for the current list's ID (and repeat until 1595 * all lists on the page have a unique list ID). * 1596 */ 1483 1597 $_POST['accp_list_count'] = (int)$_POST['accp_list_count'] + 1; 1484 1598 … … 1487 1601 $list_instance_id = filter_var($_POST['accp_list_count'], FILTER_SANITIZE_NUMBER_INT); 1488 1602 1489 return $list_instance_id; 1603 return $list_instance_id; 1490 1604 1491 1605 } -
constellation-client-portal/trunk/uninstall.php
r2663884 r2862820 3 3 /** 4 4 * Fired when the plugin is uninstalled. 5 * For more information, see the following discussion:6 * https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-285419137 5 * 8 6 * @link https://adrianrodriguezstudios.com … … 12 10 */ 13 11 14 // If uninstall not called from WordPress, then exit.12 // Exit if not called from WordPress. 15 13 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { 16 14 exit;
Note: See TracChangeset
for help on using the changeset viewer.