Changeset 2933483
- Timestamp:
- 07/03/2023 03:20:59 PM (3 years ago)
- Location:
- constellation-client-portal
- Files:
-
- 107 added
- 11 edited
-
tags/1.5.9 (added)
-
tags/1.5.9/LICENSE.txt (added)
-
tags/1.5.9/README.txt (added)
-
tags/1.5.9/admin (added)
-
tags/1.5.9/admin/class-ars-constellation-client-portal-admin.php (added)
-
tags/1.5.9/admin/class-ars-constellation-client-portal-client-pages.php (added)
-
tags/1.5.9/admin/class-ars-constellation-client-portal-company.php (added)
-
tags/1.5.9/admin/class-ars-constellation-client-portal-core-authorization.php (added)
-
tags/1.5.9/admin/class-ars-constellation-client-portal-core-file-checks.php (added)
-
tags/1.5.9/admin/class-ars-constellation-client-portal-file.php (added)
-
tags/1.5.9/admin/class-ars-constellation-client-portal-invoice.php (added)
-
tags/1.5.9/admin/class-ars-constellation-client-portal-users.php (added)
-
tags/1.5.9/admin/css (added)
-
tags/1.5.9/admin/css/ars-constellation-client-portal-admin.css (added)
-
tags/1.5.9/admin/css/jquery-ui (added)
-
tags/1.5.9/admin/css/jquery-ui/1.11.1 (added)
-
tags/1.5.9/admin/css/jquery-ui/1.11.1/themes (added)
-
tags/1.5.9/admin/css/jquery-ui/1.11.1/themes/cupertino (added)
-
tags/1.5.9/admin/css/jquery-ui/1.11.1/themes/cupertino/jquery-ui.css (added)
-
tags/1.5.9/admin/css/select2.min.css (added)
-
tags/1.5.9/admin/includes (added)
-
tags/1.5.9/admin/includes/accp-settings-page.php (added)
-
tags/1.5.9/admin/index.php (added)
-
tags/1.5.9/admin/js (added)
-
tags/1.5.9/admin/js/ars-constellation-client-portal-admin.js (added)
-
tags/1.5.9/admin/js/i18n (added)
-
tags/1.5.9/admin/js/i18n/af.js (added)
-
tags/1.5.9/admin/js/i18n/ar.js (added)
-
tags/1.5.9/admin/js/i18n/az.js (added)
-
tags/1.5.9/admin/js/i18n/bg.js (added)
-
tags/1.5.9/admin/js/i18n/bs.js (added)
-
tags/1.5.9/admin/js/i18n/ca.js (added)
-
tags/1.5.9/admin/js/i18n/cs.js (added)
-
tags/1.5.9/admin/js/i18n/da.js (added)
-
tags/1.5.9/admin/js/i18n/de.js (added)
-
tags/1.5.9/admin/js/i18n/dsb.js (added)
-
tags/1.5.9/admin/js/i18n/el.js (added)
-
tags/1.5.9/admin/js/i18n/en.js (added)
-
tags/1.5.9/admin/js/i18n/es.js (added)
-
tags/1.5.9/admin/js/i18n/et.js (added)
-
tags/1.5.9/admin/js/i18n/eu.js (added)
-
tags/1.5.9/admin/js/i18n/fa.js (added)
-
tags/1.5.9/admin/js/i18n/fi.js (added)
-
tags/1.5.9/admin/js/i18n/fr.js (added)
-
tags/1.5.9/admin/js/i18n/gl.js (added)
-
tags/1.5.9/admin/js/i18n/he.js (added)
-
tags/1.5.9/admin/js/i18n/hi.js (added)
-
tags/1.5.9/admin/js/i18n/hr.js (added)
-
tags/1.5.9/admin/js/i18n/hsb.js (added)
-
tags/1.5.9/admin/js/i18n/hu.js (added)
-
tags/1.5.9/admin/js/i18n/hy.js (added)
-
tags/1.5.9/admin/js/i18n/id.js (added)
-
tags/1.5.9/admin/js/i18n/is.js (added)
-
tags/1.5.9/admin/js/i18n/it.js (added)
-
tags/1.5.9/admin/js/i18n/ja.js (added)
-
tags/1.5.9/admin/js/i18n/km.js (added)
-
tags/1.5.9/admin/js/i18n/ko.js (added)
-
tags/1.5.9/admin/js/i18n/lt.js (added)
-
tags/1.5.9/admin/js/i18n/lv.js (added)
-
tags/1.5.9/admin/js/i18n/mk.js (added)
-
tags/1.5.9/admin/js/i18n/ms.js (added)
-
tags/1.5.9/admin/js/i18n/nb.js (added)
-
tags/1.5.9/admin/js/i18n/nl.js (added)
-
tags/1.5.9/admin/js/i18n/pl.js (added)
-
tags/1.5.9/admin/js/i18n/ps.js (added)
-
tags/1.5.9/admin/js/i18n/pt-BR.js (added)
-
tags/1.5.9/admin/js/i18n/pt.js (added)
-
tags/1.5.9/admin/js/i18n/ro.js (added)
-
tags/1.5.9/admin/js/i18n/ru.js (added)
-
tags/1.5.9/admin/js/i18n/sk.js (added)
-
tags/1.5.9/admin/js/i18n/sl.js (added)
-
tags/1.5.9/admin/js/i18n/sr-Cyrl.js (added)
-
tags/1.5.9/admin/js/i18n/sr.js (added)
-
tags/1.5.9/admin/js/i18n/sv.js (added)
-
tags/1.5.9/admin/js/i18n/th.js (added)
-
tags/1.5.9/admin/js/i18n/tr.js (added)
-
tags/1.5.9/admin/js/i18n/uk.js (added)
-
tags/1.5.9/admin/js/i18n/vi.js (added)
-
tags/1.5.9/admin/js/i18n/zh-CN.js (added)
-
tags/1.5.9/admin/js/i18n/zh-TW.js (added)
-
tags/1.5.9/admin/js/select2.min.js (added)
-
tags/1.5.9/ars-constellation-client-portal.php (added)
-
tags/1.5.9/assets (added)
-
tags/1.5.9/assets/img (added)
-
tags/1.5.9/assets/img/accp-full-logo.png (added)
-
tags/1.5.9/includes (added)
-
tags/1.5.9/includes/ars-constellation-client-portal-install-uninstall.php (added)
-
tags/1.5.9/includes/class-ars-constellation-client-portal-activator.php (added)
-
tags/1.5.9/includes/class-ars-constellation-client-portal-deactivator.php (added)
-
tags/1.5.9/includes/class-ars-constellation-client-portal-i18n.php (added)
-
tags/1.5.9/includes/class-ars-constellation-client-portal-loader.php (added)
-
tags/1.5.9/includes/class-ars-constellation-client-portal-utility-functions.php (added)
-
tags/1.5.9/includes/class-ars-constellation-client-portal.php (added)
-
tags/1.5.9/includes/index.php (added)
-
tags/1.5.9/index.php (added)
-
tags/1.5.9/languages (added)
-
tags/1.5.9/languages/ars-constellation-client-portal.pot (added)
-
tags/1.5.9/public (added)
-
tags/1.5.9/public/assets (added)
-
tags/1.5.9/public/assets/index.php (added)
-
tags/1.5.9/public/class-ars-constellation-client-portal-public.php (added)
-
tags/1.5.9/public/css (added)
-
tags/1.5.9/public/css/ars-constellation-client-portal-public.css (added)
-
tags/1.5.9/public/index.php (added)
-
tags/1.5.9/public/js (added)
-
tags/1.5.9/public/js/ars-constellation-client-portal-public.js (added)
-
tags/1.5.9/uninstall.php (added)
-
trunk/README.txt (modified) (4 diffs)
-
trunk/admin/class-ars-constellation-client-portal-admin.php (modified) (2 diffs)
-
trunk/admin/class-ars-constellation-client-portal-client-pages.php (modified) (6 diffs)
-
trunk/admin/class-ars-constellation-client-portal-company.php (modified) (12 diffs)
-
trunk/admin/css/ars-constellation-client-portal-admin.css (modified) (1 diff)
-
trunk/admin/includes/accp-settings-page.php (modified) (4 diffs)
-
trunk/admin/js/ars-constellation-client-portal-admin.js (modified) (1 diff)
-
trunk/ars-constellation-client-portal.php (modified) (2 diffs)
-
trunk/includes/class-ars-constellation-client-portal-utility-functions.php (modified) (2 diffs)
-
trunk/includes/class-ars-constellation-client-portal.php (modified) (1 diff)
-
trunk/public/class-ars-constellation-client-portal-public.php (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
constellation-client-portal/trunk/README.txt
r2920206 r2933483 5 5 Requires at least: 5.0.0 6 6 Tested up to: 6.2 7 Stable tag: 1.5. 87 Stable tag: 1.5.9 8 8 Requires PHP: 7.4 9 9 License: GPLv3 or later … … 29 29 * Automatically redirect clients to their private client page at login (optional login redirect setting). 30 30 * Integrate your invoices with WooCommerce and add a pay button to your unpaid invoices, and accept payments from your customers and clients (requires WooCommerce). 31 * Change the Client Page URL base name from "accp-client-page" to a name of your choosing. 31 32 * Automatically send email notifications to clients when a new File or Invoice post is created. 32 33 * Automatically send reminder email notifications on a schedule. … … 36 37 * Add internal notes to File and Invoice posts. 37 38 * Export file and invoice lists to CSV. 39 * Create [global client pages](https://adrianrodriguezstudios.com/2023/05/16/how-to-utilize-global-pages/ "Client Portal Global Pages"). 38 40 39 41 = Use Cases = … … 203 205 204 206 == Changelog == 207 208 = 1.5.9 (Pro) - 2023-7-3 = 209 * Fix: Updated the quick edit functionality related to the Reminder Email column in file and invoice WP list tables to prevent loss of the column after a quick edit (AJAX) update. 210 * Feature: Added new filter to allow core users to change the default client page URL base name. 211 * Feature: Added new settings and functionality to allows users to change the default client page URL base name. 212 213 = 1.5.9 (Core) - 2023-7-3 = 214 * Fix: Fixed issue preventing the new user generation section within WP admin company pages from generating new users. 215 * Improvement: Created better method for displaying admin notices. 216 * Update: Made minor updates to the file and invoice shortcodes. 217 218 205 219 = 1.5.8 (Pro) - 2023-6-1 = 206 220 * Fix: Updated the pro public facing functions to check for WooCommerce to prevent errors if WooCommerce is not installed/active. 207 221 * Feature: Added global page functionality that allows client pages to be accessed by multiple companies. 208 * Update: Updated add functionality to allow global pages to be created in the client page quick-create section withcompany edit pages.222 * Update: Updated add client page functionality to allow global pages to be created in the client page quick-create section within company edit pages. 209 223 * Update: Updated the client page post meta save functionality to exit early on new, unsaved posts to clear notices related to the post object not yet existing. 210 224 -
constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-admin.php
r2920206 r2933483 788 788 789 789 endwhile; 790 790 791 wp_reset_postdata(); 792 791 793 endif; 792 794 … … 3192 3194 3193 3195 3196 /** 3197 * Generate admin settings message and 3198 * error markup. 3199 * 3200 * @param string $message - The message to be displayed, 3201 * which can also contain markup. 3202 * @param string $type - The type of message type from the 3203 * list of available WP admin notice type classes (notice-error, 3204 * notice-warning, notice-succes, notice-info). 3205 * 3206 * @return string $html - The html message to be displayed. 3207 */ 3208 function generate_admin_settings_message($message, $type = 'notice-info'){ 3209 3210 if( !is_admin() || !is_user_logged_in() || !current_user_can('manage_options') ) 3211 return; 3212 3213 if( !$message || empty($message) ) 3214 return; 3215 3216 $accepted_types = array('notice-error', 'notice-warning', 'notice-succes', 'notice-info'); 3217 3218 if( !in_array($type, $accepted_types) ){ 3219 3220 $type = 'notice-info'; 3221 3222 } 3223 3224 $html = ''; 3225 3226 $html .= '<div class="accp-settings-messages-and-errors-item notice '.esc_attr($type).'">'; 3227 3228 $html .= $message; 3229 3230 $html .= '</div>'; 3231 3232 return wp_kses_post($html); 3233 3234 } 3235 3236 3237 /** 3238 * Set rewrite flush needed option. 3239 */ 3240 function maybe_set_rewrite_flush_needed_option(){ 3241 3242 if( !is_admin() || !is_user_logged_in() || !current_user_can('manage_options') ) 3243 return; 3244 3245 /** 3246 * Set the rewrite flush needed options 3247 * if it's not already set. 3248 */ 3249 $saved_option = get_option('accp_rewrite_flush_needed_after_settings_change'); 3250 3251 if( !$saved_option || empty($saved_option) ){ 3252 3253 if( $saved_option !== 'rewrite-flush-needed' ){ 3254 3255 update_option('accp_rewrite_flush_needed_after_settings_change', 'rewrite-flush-needed'); 3256 3257 } 3258 3259 } 3260 3261 } 3262 3263 3264 /** 3265 * Flush rewrite fules if the 'accp_rewrite_flush_needed_after_settings_change' 3266 * option is present and set to 'rewrite-flush-needed.' 3267 * 3268 * @hooked to init. 3269 */ 3270 function accp_maybe_flush_rewrite_rules(){ 3271 3272 $saved_option = get_option('accp_rewrite_flush_needed_after_settings_change'); 3273 3274 if( !$saved_option || empty($saved_option) ) 3275 return; 3276 3277 if( $saved_option !== 'rewrite-flush-needed' ) 3278 return; 3279 3280 if( $saved_option === 'rewrite-flush-needed' ){ 3281 3282 /** 3283 * Flush the rewrite rules. 3284 */ 3285 flush_rewrite_rules(); 3286 3287 3288 /** 3289 * Clear the rewrite flush needed option. 3290 */ 3291 delete_option('accp_rewrite_flush_needed_after_settings_change'); 3292 3293 } 3294 3295 } 3296 3194 3297 } //End ARS_Constellation_Client_Portal_Admin Class -
constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-client-pages.php
r2920206 r2933483 45 45 46 46 $this->plugin_name = $plugin_name; 47 $this->version = $version; 47 $this->version = $version; 48 $this->utilities = new ACCP_Utility_Functions($this->plugin_name, $this->version); 49 50 if( class_exists('ARS_Constellation_Client_Portal_Pro_Admin') ){ 51 52 $this->pro_admin = new ARS_Constellation_Client_Portal_Pro_Admin($this->plugin_name, $this->version); 53 54 } 48 55 49 56 } … … 54 61 * 55 62 * @since 1.0.0 56 */ 57 public function accp_register_client_pages_post_type() { 63 */ 64 public function accp_register_client_pages_post_type() { 58 65 59 66 $labels = array( … … 78 85 */ 79 86 $show_in_rest = current_user_can( 'manage_options' ) ? true : false; 87 88 89 /** 90 * Allow custom rewrite slug. 91 */ 92 if( true === $this->utilities->is_pro_plugin($this->plugin_name) ){ 93 94 $rewrite_slug = $this->pro_admin->get_client_page_rewrite_slug(); 95 96 }else{ 97 98 $rewrite_slug = 'accp-client-page'; 99 100 } 80 101 81 102 $args = array( … … 94 115 'query_var' => true, 95 116 'can_export' => true, 96 'rewrite' => array('slug' => 'accp-client-page'),117 'rewrite' => array('slug' => $rewrite_slug), 97 118 'capabilities' => array( 98 119 'edit_post' => 'update_core', … … 110 131 111 132 } 112 133 113 134 114 135 /** … … 205 226 206 227 register_taxonomy( 'accp_client_page_tags', array('accp_client_pages'), $args ); 228 207 229 } 208 230 -
constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-company.php
r2920206 r2933483 365 365 public function display_home_page_meta_options() { 366 366 367 global $post; 368 369 $accp_home_page = get_post_meta($post->ID, 'accp_home_page', true); 367 if( !is_admin() || !is_user_logged_in() || !current_user_can('manage_options') ) 368 return; 369 370 $company_id = get_the_ID(); 371 $accp_home_page = get_post_meta($company_id, 'accp_home_page', true); 370 372 371 373 ?> … … 373 375 <?php 374 376 375 $wp_post_statuses = get_post_statuses() ? array_keys( (array)get_post_statuses() ) : array(); 376 377 378 /** 379 * Define get_pages args. 380 */ 377 381 $args = array( 378 382 'post_type' => 'accp_client_pages', 379 383 ); 380 384 385 381 386 /** 382 387 * Include all defined WP post statuses, 383 * not just "publish." 384 */ 385 if(!empty($wp_post_statuses)){ 388 * not just "publish" in the get_pages args. 389 */ 390 $wp_post_statuses = get_post_statuses() ? array_keys( (array)get_post_statuses() ) : array(); 391 392 if( !empty($wp_post_statuses) ){ 386 393 387 394 $args['post_status'] = $wp_post_statuses; … … 389 396 } 390 397 391 $client_page_list = get_pages($args); 392 ?> 393 <select name="accp_home_page" id="accp_home_page"> 394 395 <option value="">Select a page...</option> 398 399 /** 400 * Get client pages. 401 */ 402 $client_page_list = get_pages($args); 403 404 405 /** 406 * Client page select field. 407 */ 408 if($client_page_list): 409 410 ?> 411 <select name="accp_home_page" id="accp_home_page"> 412 413 <option value="">Select a page...</option> 414 <?php 415 416 foreach( $client_page_list as $key => $post ){ 417 418 $post_id = $post->ID; 419 $post_name = $post->post_title; 420 $selected = $accp_home_page && (int)$accp_home_page === (int)$post_id ? "selected" : ""; 421 $post_status_class = ''; 422 423 if( $post->post_status != 'publish' ){ 424 425 $post_name = $post_name . ' (' . $post->post_status . ')'; 426 $post_status_class = "accp-non-published-post-option"; 427 428 } 429 430 ?> 431 <option class="level-0 <?php echo esc_attr($post_status_class); ?>" value="<?php echo esc_attr($post_id); ?>" <?php echo esc_attr($selected); ?> ><?php echo esc_html($post_name); ?></option> 432 <?php 433 434 } 435 436 ?> 437 </select> 396 438 <?php 397 439 398 foreach( $client_page_list as $key => $post ){ 399 400 $post_id = $post->ID; 401 $post_name = $post->post_title; 402 $selected = $accp_home_page && (int)$accp_home_page === (int)$post_id ? "selected" : ""; 403 $post_status_class = ''; 404 405 if( $post->post_status != 'publish' ){ 406 407 $post_name = $post_name . ' (' . $post->post_status . ')'; 408 $post_status_class = "accp-non-published-post-option"; 409 410 } 411 412 ?> 413 <option class="level-0 <?php echo esc_attr($post_status_class); ?>" value="<?php echo esc_attr($post_id); ?>" <?php echo esc_attr($selected); ?> ><?php echo esc_html($post_name); ?></option> 414 <?php 415 416 } 417 418 ?> 419 </select> 420 <?php 421 440 endif; 441 442 443 /** 444 * Create new page form. 445 */ 422 446 $create_page_nonce = wp_create_nonce('create_home_page'); 423 447 … … 432 456 433 457 <p class="accp-create-new-page-instructions"> 434 This process will create a new blank Client Page and assign it as the home page for the current Company.458 This process will create a new blank Client Page and assign it as the home page for the current Company. 435 459 </p> 436 460 … … 448 472 ?> 449 473 450 <span class="button button-primary accp-generate-new-page" data-nonce="<?php echo $create_page_nonce; ?>" data-post-id="<?php echo $ post->ID; ?>">Generate Page</span>474 <span class="button button-primary accp-generate-new-page" data-nonce="<?php echo $create_page_nonce; ?>" data-post-id="<?php echo $company_id; ?>">Generate Page</span> 451 475 452 476 <span class="accp-generate-page-message"></span> … … 620 644 <?php 621 645 622 $company_id = get_the_ID(); 646 $company_id = get_the_ID(); 623 647 624 648 $args = array( … … 1204 1228 } 1205 1229 1230 1206 1231 if( !$role || empty($role) ){ 1207 1232 … … 1211 1236 1212 1237 } 1238 1213 1239 1214 1240 if( !$company_id || empty($company_id) ){ … … 1220 1246 } 1221 1247 1248 1222 1249 if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { 1223 1250 … … 1226 1253 wp_die(); 1227 1254 1228 } 1255 } 1229 1256 1230 1257 $post = get_post($company_id); … … 1232 1259 if($post->post_type != 'accp_clientcompany') 1233 1260 die(); 1261 1234 1262 1235 1263 /** … … 1307 1335 $this->accp_send_new_account_notification_to_user($new_user_id); 1308 1336 1309 } 1337 } 1310 1338 1311 1339 -
constellation-client-portal/trunk/admin/css/ars-constellation-client-portal-admin.css
r2920206 r2933483 110 110 .tax-custom-select .select2 { 111 111 width: 95% !important; 112 } 113 114 .accp-settings-messages-and-errors-item.notice { 115 padding-top: 20px; 116 padding-bottom: 20px; 112 117 } 113 118 -
constellation-client-portal/trunk/admin/includes/accp-settings-page.php
r2893071 r2933483 12 12 13 13 $accp_utility_functions = new ACCP_Utility_Functions(); 14 $accp_admin = new ARS_Constellation_Client_Portal_Admin(ACCP_PLUGIN_NAME, ACCP_PLUGIN_VERSION); 14 15 ?> 15 16 … … 21 22 22 23 <?php 23 if( is_admin() && current_user_can('manage_options') ){24 if( is_admin() && current_user_can('manage_options') ){ 24 25 25 26 $logo_url = plugins_url( '/assets/img/accp-full-logo.png', dirname(dirname(__FILE__)) ); … … 30 31 </div> 31 32 <?php 32 33 33 } 34 ?> 35 34 ?> 35 36 37 <?php 38 /** 39 * Settings Tabs 40 */ 41 ?> 36 42 <ul class="accp-settings-tabs"> 37 43 … … 93 99 94 100 <?php // Note: form does not (should not) post to options.php due to the needs of the status repeater. ?> 95 <form action="" method="post" enctype="multipart/form-data"> 96 97 <?php 101 <form action="" method="post" enctype="multipart/form-data"> 102 103 <?php 98 104 // Include additional Pro and Premium settings 99 105 if ($this->plugin_name == 'ars-constellation-client-portal-premium' || $this->plugin_name == 'ars-constellation-client-portal-pro'){ -
constellation-client-portal/trunk/admin/js/ars-constellation-client-portal-admin.js
r2920206 r2933483 518 518 success: function(data){ 519 519 520 //dev 521 console.log(data); 522 520 523 try { 521 524 522 525 var response_obj = JSON.parse(data); 523 526 524 if (response_obj && typeof response_obj === 'object') { 527 if (response_obj && typeof response_obj === 'object') { 525 528 526 529 $('.accp-primary-user-section-message').html('Primary User: ' + response_obj.username); -
constellation-client-portal/trunk/ars-constellation-client-portal.php
r2920206 r2933483 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. 87 * Version: 1.5.9 8 8 * Author: ARS 9 9 * Author URI: https://adrianrodriguezstudios.com … … 55 55 */ 56 56 define('ACCP_PLUGIN_NAME', 'ARS_CONSTELLATION_CLIENT_PORTAL'); 57 define('ACCP_PLUGIN_VERSION', '1.5. 8'); // Change the version in the header as well.57 define('ACCP_PLUGIN_VERSION', '1.5.9'); // Change the version in the header as well. 58 58 define( ACCP_PLUGIN_NAME, ACCP_PLUGIN_VERSION ); 59 59 define('ACCP_PLUGIN_FILE_NAME', __FILE__); -
constellation-client-portal/trunk/includes/class-ars-constellation-client-portal-utility-functions.php
r2845715 r2933483 62 62 $this->plugin_name = 'ars-constellation-client-portal'; 63 63 64 } 64 } 65 65 66 66 } … … 171 171 172 172 173 /** 174 * Sanitize URL slug names. 175 * 176 * Only allow alphanumeric characters, 177 * hypens, and underscores. Also, remove 178 * spaces. 179 * 180 * @param string $slug - The slug to sanitize. 181 * 182 * @return string $slug - The sanitized slug. 183 */ 184 function sanitize_url_slug_name($slug){ 185 186 if(!$slug) 187 return; 188 189 /** 190 * Remove all spaces. 191 */ 192 $slug = trim( str_replace(' ', '', $slug) ); 193 194 195 /** 196 * Make lowercase. 197 */ 198 $slug = strtolower($slug); 199 200 201 /** 202 * Remove unpermitted characters. 203 */ 204 $slug = preg_replace('/[^\w-]/', '', $slug); 205 206 return $slug; 207 208 } 209 210 211 /** 212 * Check slug for uniqueness, and 213 * verify that it is not already in use 214 * by another post type. 215 * 216 * @param string $slug - The slug to check. 217 * 218 * @return bool $is_unique - True if the slug is unique or false if not. 219 */ 220 function check_if_post_type_slug_is_unique($slug){ 221 222 $is_unique = true; 223 224 if(!$slug) 225 return $is_unique; 226 227 /** 228 * Get all post types. 229 */ 230 $post_types = get_post_types( array(), 'objects'); 231 232 foreach($post_types as $post_type){ 233 234 /** 235 * Check the post type name. 236 */ 237 $name = $post_type->name; 238 239 /** 240 * Return false if the post type name 241 * matches the slug being checked. 242 */ 243 if( $name === $slug ){ 244 245 $is_unique = false; 246 247 return $is_unique; 248 249 } 250 251 252 /** 253 * Check the post type slug if it exists. 254 */ 255 if( is_array($post_type->rewrite) ){ 256 257 $post_type_slug = array_key_exists('slug', $post_type->rewrite) ? 'slug: ' . $post_type->rewrite['slug'] : false; 258 259 if( $post_type_slug && false !== $post_type_slug ){ 260 261 $post_type_slug = str_replace('/', '', $post_type_slug); 262 263 /** 264 * Return false if the post type slug 265 * matches the slug being checked. 266 */ 267 if( $post_type_slug === $slug ){ 268 269 $is_unique = false; 270 271 return $is_unique; 272 273 } 274 275 } 276 277 } 278 279 } 280 281 return $is_unique; 282 283 } 284 285 286 /** 287 * Check if this is the pro plugin. 288 * 289 * @param string $plugin_name - The name of the current plugin. 290 * 291 * @return bool $is_pro - True if this is the pro plugin, false if not. 292 */ 293 function is_pro_plugin($plugin_name){ 294 295 $is_pro = false; 296 297 if(!$plugin_name) 298 return $is_pro; 299 300 if( strpos( strtolower($plugin_name), 'pro' ) !== false ){ 301 302 $is_pro = true; 303 304 } 305 306 return $is_pro; 307 308 } 309 310 173 311 } // END ACCP_Utility_Functions -
constellation-client-portal/trunk/includes/class-ars-constellation-client-portal.php
r2920206 r2933483 236 236 237 237 // Run plugin initialization functions. 238 $this->loader->add_action( 'admin_init', $plugin_admin, 'accp_plugin_initialize'); 238 $this->loader->add_action( 'admin_init', $plugin_admin, 'accp_plugin_initialize'); 239 240 // Maybe flush rewrite rules. 241 $this->loader->add_action( 'init', $plugin_admin, 'accp_maybe_flush_rewrite_rules'); 239 242 240 243 -
constellation-client-portal/trunk/public/class-ars-constellation-client-portal-public.php
r2920206 r2933483 223 223 } 224 224 225 ob_start(); 226 225 /** 226 * File List 227 */ 228 ob_start(); 227 229 ?> 228 229 <?php // File List ?>230 230 231 231 <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); ?>"> … … 233 233 234 234 /** 235 * Generate file query args.235 * Generate the file query. 236 236 */ 237 $args = $this->accp_generate_file_query_args($categories, $number_of_posts, $paged, $order_by, $order, $authorized_company_id, $file_status); 238 237 $args = $this->accp_generate_file_query_args($categories, $number_of_posts, $paged, $order_by, $order, $authorized_company_id, $file_status); 239 238 $query = new WP_Query( $args ); 240 239 … … 250 249 $file_post_id = get_the_ID(); 251 250 252 // Get the Company ID associated with the file 251 /** 252 * Get the Company ID associated with the file. 253 */ 253 254 $file_post_company_id = get_post_meta($file_post_id, 'accp_user', true ); 255 254 256 255 257 /** … … 278 280 * the file list item. 279 281 * 280 * @param $item_id - ID of the file post in the loop.282 * @param $item_id - The ID of the file post in the loop. 281 283 */ 282 284 $item_id = $file_post_id; … … 285 287 if($before_item_content){ 286 288 echo wp_kses_post($before_item_content); 287 } 288 289 } 289 290 ?> 291 290 292 <div class="accp-item-container clearfix"> 291 293 … … 390 392 <div class="accp-view-dl-link-container"> 391 393 392 <?php 393 $file_id = get_the_ID(); 394 <?php 394 395 $file_dl_nonce = wp_create_nonce('file_download'); 395 $url_params = '/?accp-dl-id=' . $file_ id;396 $url_params = '/?accp-dl-id=' . $file_post_id; 396 397 ?> 397 398 398 <?php if( $accp_file && $accp_file['url']): ?>399 400 <a href="<?php echo esc_url($accp_file['url']);?>" class="view-print " target="_blank">View and Print</a> <span class="accp-view-download-separator">|</span>399 <?php if( $accp_file && $accp_file['url'] ): ?> 400 401 <a href="<?php echo esc_url($accp_file['url']);?>" class="view-print accp-file-view-print" target="_blank">View and Print</a> <span class="accp-view-download-separator">|</span> 401 402 402 <a href="<?php echo esc_url($url_params);?>" class="download accp-file-download" data-file-id="<?php echo esc_attr($file_ id); ?>" data-nonce="<?php echo esc_attr($file_dl_nonce); ?>" target="_blank" download>Download</a>403 <a href="<?php echo esc_url($url_params);?>" class="download accp-file-download" data-file-id="<?php echo esc_attr($file_post_id); ?>" data-nonce="<?php echo esc_attr($file_dl_nonce); ?>" target="_blank" download>Download</a> 403 404 404 405 <?php endif; ?> … … 751 752 } 752 753 754 /** 755 * Invoice List 756 */ 753 757 ob_start(); 754 ?> 755 756 <?php // Invoice List ?> 758 ?> 757 759 758 760 <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); ?>"> … … 760 762 761 763 /** 762 * Generate invoice query args.764 * Generate invoice query. 763 765 */ 764 $args = $this->accp_generate_invoice_query_args($categories, $number_of_posts, $paged, $order_by, $order, $authorized_company_id, $invoice_status); 765 $query = new WP_Query( $args ); 766 767 $html = ''; 768 769 // The Loop 766 $args = $this->accp_generate_invoice_query_args($categories, $number_of_posts, $paged, $order_by, $order, $authorized_company_id, $invoice_status); 767 $query = new WP_Query( $args ); 768 $html = ''; 769 770 770 if ($query->have_posts()): 771 771 … … 780 780 $invoice_woo_product_id = get_post_meta($file_post_id, 'accp_woo_inv_id', true); 781 781 782 // Only add the invoice post id to the list of payable invoices 783 // if the post has a WooCommerce product ID saved to it. 782 /** 783 * Only add the invoice post id to the list of payable invoices 784 * if the post has a WooCommerce product ID saved to it. 785 */ 784 786 if($invoice_woo_product_id){ 785 787 $invoice_id_list[] = $file_post_id; 786 } 788 } 789 787 790 788 // Get the Company ID associated with the file 789 $file_post_company_id = get_post_meta($file_post_id, 'accp_user', true ); 791 /** 792 * Get the Company ID associated with the file. 793 */ 794 $file_post_company_id = get_post_meta($file_post_id, 'accp_user', true ); 795 790 796 791 797 /** … … 906 912 echo wp_kses_post($excerpt_html); 907 913 908 // Display 'Invoice - Paid' if the invoice status is paid 914 /** 915 * Display 'Invoice - Paid' if the invoice status is paid. 916 */ 909 917 $saved_invoice_status = get_post_meta($post->ID, 'invoice_status', true); 910 918 … … 947 955 <div class="accp-view-dl-link-container"> 948 956 949 <?php 950 $file_id = (int)get_the_ID(); 957 <?php 951 958 $invoice_dl_nonce = wp_create_nonce('invoice_download'); 952 $url_params = '/?accp-dl-id=' . $file_ id;959 $url_params = '/?accp-dl-id=' . $file_post_id; 953 960 ?> 954 961 … … 957 964 <a href="<?php echo esc_url($accp_file['url']);?>" class="view-print" target="_blank">View and Print</a> <span class="accp-view-download-separator">|</span> 958 965 959 <a href="<?php echo esc_url($url_params);?>" class="download accp-file-download" data-file-id="<?php echo esc_attr($file_ id); ?>" data-nonce="<?php echo esc_attr($invoice_dl_nonce); ?>" target="_blank" download>Download</a>966 <a href="<?php echo esc_url($url_params);?>" class="download accp-file-download" data-file-id="<?php echo esc_attr($file_post_id); ?>" data-nonce="<?php echo esc_attr($invoice_dl_nonce); ?>" target="_blank" download>Download</a> 960 967 961 968 <?php endif; ?> … … 1034 1041 /** 1035 1042 * Page Nav 1036 */ 1037 1043 */ 1038 1044 $page_args1 = array( 1039 1045 'format' => '?'.$paged_param.'=%#%', … … 1075 1081 1076 1082 return $html; 1083 1077 1084 } 1078 1085
Note: See TracChangeset
for help on using the changeset viewer.