Changeset 3062211
- Timestamp:
- 04/01/2024 05:33:31 PM (23 months ago)
- Location:
- constellation-client-portal
- Files:
-
- 131 added
- 1 deleted
- 21 edited
-
tags/1.7.6 (deleted)
-
tags/1.8.1 (added)
-
tags/1.8.1/LICENSE.txt (added)
-
tags/1.8.1/README.txt (added)
-
tags/1.8.1/admin (added)
-
tags/1.8.1/admin/class-ars-constellation-client-portal-admin.php (added)
-
tags/1.8.1/admin/class-ars-constellation-client-portal-client-pages.php (added)
-
tags/1.8.1/admin/class-ars-constellation-client-portal-company.php (added)
-
tags/1.8.1/admin/class-ars-constellation-client-portal-core-authorization.php (added)
-
tags/1.8.1/admin/class-ars-constellation-client-portal-core-file-checks.php (added)
-
tags/1.8.1/admin/class-ars-constellation-client-portal-file.php (added)
-
tags/1.8.1/admin/class-ars-constellation-client-portal-invoice.php (added)
-
tags/1.8.1/admin/class-ars-constellation-client-portal-settings.php (added)
-
tags/1.8.1/admin/class-ars-constellation-client-portal-users.php (added)
-
tags/1.8.1/admin/css (added)
-
tags/1.8.1/admin/css/ars-constellation-client-portal-admin.css (added)
-
tags/1.8.1/admin/css/jquery-ui (added)
-
tags/1.8.1/admin/css/jquery-ui/1.11.1 (added)
-
tags/1.8.1/admin/css/jquery-ui/1.11.1/themes (added)
-
tags/1.8.1/admin/css/jquery-ui/1.11.1/themes/cupertino (added)
-
tags/1.8.1/admin/css/jquery-ui/1.11.1/themes/cupertino/jquery-ui.css (added)
-
tags/1.8.1/admin/css/select2.min.css (added)
-
tags/1.8.1/admin/index.php (added)
-
tags/1.8.1/admin/js (added)
-
tags/1.8.1/admin/js/ars-constellation-client-portal-admin.js (added)
-
tags/1.8.1/admin/js/i18n (added)
-
tags/1.8.1/admin/js/i18n/af.js (added)
-
tags/1.8.1/admin/js/i18n/ar.js (added)
-
tags/1.8.1/admin/js/i18n/az.js (added)
-
tags/1.8.1/admin/js/i18n/bg.js (added)
-
tags/1.8.1/admin/js/i18n/bs.js (added)
-
tags/1.8.1/admin/js/i18n/ca.js (added)
-
tags/1.8.1/admin/js/i18n/cs.js (added)
-
tags/1.8.1/admin/js/i18n/da.js (added)
-
tags/1.8.1/admin/js/i18n/de.js (added)
-
tags/1.8.1/admin/js/i18n/dsb.js (added)
-
tags/1.8.1/admin/js/i18n/el.js (added)
-
tags/1.8.1/admin/js/i18n/en.js (added)
-
tags/1.8.1/admin/js/i18n/es.js (added)
-
tags/1.8.1/admin/js/i18n/et.js (added)
-
tags/1.8.1/admin/js/i18n/eu.js (added)
-
tags/1.8.1/admin/js/i18n/fa.js (added)
-
tags/1.8.1/admin/js/i18n/fi.js (added)
-
tags/1.8.1/admin/js/i18n/fr.js (added)
-
tags/1.8.1/admin/js/i18n/gl.js (added)
-
tags/1.8.1/admin/js/i18n/he.js (added)
-
tags/1.8.1/admin/js/i18n/hi.js (added)
-
tags/1.8.1/admin/js/i18n/hr.js (added)
-
tags/1.8.1/admin/js/i18n/hsb.js (added)
-
tags/1.8.1/admin/js/i18n/hu.js (added)
-
tags/1.8.1/admin/js/i18n/hy.js (added)
-
tags/1.8.1/admin/js/i18n/id.js (added)
-
tags/1.8.1/admin/js/i18n/is.js (added)
-
tags/1.8.1/admin/js/i18n/it.js (added)
-
tags/1.8.1/admin/js/i18n/ja.js (added)
-
tags/1.8.1/admin/js/i18n/km.js (added)
-
tags/1.8.1/admin/js/i18n/ko.js (added)
-
tags/1.8.1/admin/js/i18n/lt.js (added)
-
tags/1.8.1/admin/js/i18n/lv.js (added)
-
tags/1.8.1/admin/js/i18n/mk.js (added)
-
tags/1.8.1/admin/js/i18n/ms.js (added)
-
tags/1.8.1/admin/js/i18n/nb.js (added)
-
tags/1.8.1/admin/js/i18n/nl.js (added)
-
tags/1.8.1/admin/js/i18n/pl.js (added)
-
tags/1.8.1/admin/js/i18n/ps.js (added)
-
tags/1.8.1/admin/js/i18n/pt-BR.js (added)
-
tags/1.8.1/admin/js/i18n/pt.js (added)
-
tags/1.8.1/admin/js/i18n/ro.js (added)
-
tags/1.8.1/admin/js/i18n/ru.js (added)
-
tags/1.8.1/admin/js/i18n/sk.js (added)
-
tags/1.8.1/admin/js/i18n/sl.js (added)
-
tags/1.8.1/admin/js/i18n/sr-Cyrl.js (added)
-
tags/1.8.1/admin/js/i18n/sr.js (added)
-
tags/1.8.1/admin/js/i18n/sv.js (added)
-
tags/1.8.1/admin/js/i18n/th.js (added)
-
tags/1.8.1/admin/js/i18n/tr.js (added)
-
tags/1.8.1/admin/js/i18n/uk.js (added)
-
tags/1.8.1/admin/js/i18n/vi.js (added)
-
tags/1.8.1/admin/js/i18n/zh-CN.js (added)
-
tags/1.8.1/admin/js/i18n/zh-TW.js (added)
-
tags/1.8.1/admin/js/select2.full.min.js (added)
-
tags/1.8.1/admin/js/select2.min.js (added)
-
tags/1.8.1/ars-constellation-client-portal.php (added)
-
tags/1.8.1/assets (added)
-
tags/1.8.1/assets/css (added)
-
tags/1.8.1/assets/css/font-awesome (added)
-
tags/1.8.1/assets/css/font-awesome/css (added)
-
tags/1.8.1/assets/css/font-awesome/css/all.css (added)
-
tags/1.8.1/assets/css/font-awesome/css/all.min.css (added)
-
tags/1.8.1/assets/css/font-awesome/webfonts (added)
-
tags/1.8.1/assets/css/font-awesome/webfonts/fa-brands-400.eot (added)
-
tags/1.8.1/assets/css/font-awesome/webfonts/fa-brands-400.svg (added)
-
tags/1.8.1/assets/css/font-awesome/webfonts/fa-brands-400.ttf (added)
-
tags/1.8.1/assets/css/font-awesome/webfonts/fa-brands-400.woff (added)
-
tags/1.8.1/assets/css/font-awesome/webfonts/fa-brands-400.woff2 (added)
-
tags/1.8.1/assets/css/font-awesome/webfonts/fa-regular-400.eot (added)
-
tags/1.8.1/assets/css/font-awesome/webfonts/fa-regular-400.svg (added)
-
tags/1.8.1/assets/css/font-awesome/webfonts/fa-regular-400.ttf (added)
-
tags/1.8.1/assets/css/font-awesome/webfonts/fa-regular-400.woff (added)
-
tags/1.8.1/assets/css/font-awesome/webfonts/fa-regular-400.woff2 (added)
-
tags/1.8.1/assets/css/font-awesome/webfonts/fa-solid-900.eot (added)
-
tags/1.8.1/assets/css/font-awesome/webfonts/fa-solid-900.svg (added)
-
tags/1.8.1/assets/css/font-awesome/webfonts/fa-solid-900.ttf (added)
-
tags/1.8.1/assets/css/font-awesome/webfonts/fa-solid-900.woff (added)
-
tags/1.8.1/assets/css/font-awesome/webfonts/fa-solid-900.woff2 (added)
-
tags/1.8.1/assets/img (added)
-
tags/1.8.1/assets/img/accp-full-logo.png (added)
-
tags/1.8.1/includes (added)
-
tags/1.8.1/includes/ars-constellation-client-portal-install-uninstall.php (added)
-
tags/1.8.1/includes/class-ars-constellation-client-portal-activator.php (added)
-
tags/1.8.1/includes/class-ars-constellation-client-portal-deactivator.php (added)
-
tags/1.8.1/includes/class-ars-constellation-client-portal-i18n.php (added)
-
tags/1.8.1/includes/class-ars-constellation-client-portal-loader.php (added)
-
tags/1.8.1/includes/class-ars-constellation-client-portal-utility-functions.php (added)
-
tags/1.8.1/includes/class-ars-constellation-client-portal.php (added)
-
tags/1.8.1/includes/index.php (added)
-
tags/1.8.1/index.php (added)
-
tags/1.8.1/languages (added)
-
tags/1.8.1/languages/ars-constellation-client-portal.pot (added)
-
tags/1.8.1/public (added)
-
tags/1.8.1/public/assets (added)
-
tags/1.8.1/public/assets/index.php (added)
-
tags/1.8.1/public/class-ars-constellation-client-portal-public.php (added)
-
tags/1.8.1/public/css (added)
-
tags/1.8.1/public/css/ars-constellation-client-portal-list-shortcode-styles.css (added)
-
tags/1.8.1/public/css/ars-constellation-client-portal-public.css (added)
-
tags/1.8.1/public/index.php (added)
-
tags/1.8.1/public/js (added)
-
tags/1.8.1/public/js/ars-constellation-client-portal-public.js (added)
-
tags/1.8.1/public/shortcodes (added)
-
tags/1.8.1/public/shortcodes/class-ars-constellation-client-portal-list-shortcodes.php (added)
-
tags/1.8.1/uninstall.php (added)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/admin/class-ars-constellation-client-portal-admin.php (modified) (74 diffs)
-
trunk/admin/class-ars-constellation-client-portal-client-pages.php (modified) (4 diffs)
-
trunk/admin/class-ars-constellation-client-portal-company.php (modified) (4 diffs)
-
trunk/admin/class-ars-constellation-client-portal-core-authorization.php (modified) (4 diffs)
-
trunk/admin/class-ars-constellation-client-portal-core-file-checks.php (modified) (3 diffs)
-
trunk/admin/class-ars-constellation-client-portal-file.php (modified) (6 diffs)
-
trunk/admin/class-ars-constellation-client-portal-invoice.php (modified) (6 diffs)
-
trunk/admin/class-ars-constellation-client-portal-settings.php (modified) (3 diffs)
-
trunk/admin/class-ars-constellation-client-portal-users.php (modified) (4 diffs)
-
trunk/admin/css/ars-constellation-client-portal-admin.css (modified) (64 diffs)
-
trunk/admin/css/jquery-ui/1.11.1/themes/cupertino/jquery-ui.css (modified) (11 diffs)
-
trunk/admin/js/ars-constellation-client-portal-admin.js (modified) (16 diffs)
-
trunk/ars-constellation-client-portal.php (modified) (2 diffs)
-
trunk/includes/ars-constellation-client-portal-install-uninstall.php (modified) (4 diffs)
-
trunk/includes/class-ars-constellation-client-portal-utility-functions.php (modified) (1 diff)
-
trunk/includes/class-ars-constellation-client-portal.php (modified) (17 diffs)
-
trunk/public/class-ars-constellation-client-portal-public.php (modified) (1 diff)
-
trunk/public/css/ars-constellation-client-portal-list-shortcode-styles.css (modified) (6 diffs)
-
trunk/public/shortcodes/class-ars-constellation-client-portal-list-shortcodes.php (modified) (3 diffs)
-
trunk/uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
constellation-client-portal/trunk/README.txt
r3043713 r3062211 5 5 Requires at least: 5.0.0 6 6 Tested up to: 6.4 7 Stable tag: 1.8. 07 Stable tag: 1.8.1 8 8 Requires PHP: 7.4 9 9 License: GPLv3 or later … … 206 206 207 207 == Changelog == 208 = 1.8.1 (Pro) - 2024-4-1 = 209 * Update: Made the bulk create and export sections responsive. 210 * Feature: Created new post quick create feature that allows invoice, file, and global file posts to be batch created via a Quick Create UI. 211 * Improvement: Added better date format validation to the due date fields, along with user feedback for invalid date formats. 212 * Update: Added new parameters to the accp_company_menu shortcode to extend the functionality. 213 * Update: Corrected typo in client page company menu setting section. 214 * Update: Fixed broken link in the bulk create section description. 215 * Update: Reorganized the functionality that adds the Bulk Create section to WP list tables for better maintainability. 216 * Fix: Updated the csv export product total function to account for the new product quantity value to produce accurate product totals for quantities greater than one. 217 * Update: Created new csv export class and relocated related functions into the new class for better organization and maintainability. 218 * Update: Updated the functionality that adds pro WP list table columns for better organization and maintainability. 219 * Update: Fixed typo in reminder email button class, and in corresponding JS. 220 * Update: Deleted legacy, deprecated file access php file. 221 * Update: Added the accp_after_global_file_list_pagination action hook. 222 * Improvement: Improved sanitization and validation of the accp_update_allowed_post_types_for_global_files filter. 223 224 = 1.8.1 (Core) - 2024-4-1 = 225 * Update: Reworked the file upload functionality to work with new features. 226 * Update: Created new plugin dir path constant. 227 * Update: Updated the user profile field functionality for better organization and maintainability. 228 * Update: Updated the functionality that adds core WP list table columns for better organization and maintainability. 229 * Update: Code formatting updates. 230 * Update: Deprecated legacy settings function. 231 208 232 = 1.8.0 (Pro) - 2024-3-1 = 209 233 * Update: Updated the CSV import functionality to add warnings to import logs if company id or file attachment data is missing or malformed. -
constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-admin.php
r3043713 r3062211 11 11 */ 12 12 13 /** 14 * Exit if accessed directly. 15 */ 13 16 if ( ! defined( 'ABSPATH' ) ) { 14 15 exit; // Exit if accessed directly 16 17 exit; 17 18 } 18 19 … … 89 90 } 90 91 92 91 93 /** 92 94 * Register the JavaScript for the admin area. … … 108 110 * File Check Redirects 109 111 * 110 * Prevent direct access to clientfiles 112 * Prevent direct access to clientfiles. 111 113 */ 112 114 function accp_file_redirect_init() { … … 180 182 181 183 /** 182 * Add ACCP query_vars 184 * Add ACCP query_vars. 183 185 */ 184 186 function accp_query_vars( $query_vars ){ … … 234 236 */ 235 237 236 // Exit if the pro check class does not exist. 238 /** 239 * Exit if the pro check class does not exist. 240 */ 237 241 if( !class_exists('ARS_Constellation_Client_Portal_Pro_File_Checks') ){ 238 242 … … 300 304 301 305 } 302 303 306 304 307 } … … 339 342 } 340 343 344 341 345 /** 342 346 * Load requested file. … … 349 353 if($checks_passed == false) return; 350 354 351 // Set up the actual file path for readfile to work properly. 355 /** 356 * Set up the actual file path for readfile to work properly. 357 */ 352 358 $file_path = parse_url( esc_url_raw($request_uri), PHP_URL_PATH); 353 359 354 // Account for wp-content being renamed in installer's environment. 360 361 /** 362 * Account for wp-content being renamed in installer's environment. 363 */ 355 364 $home_path = $this->accp_get_wp_home_path(); 356 365 $wp_content_dir_name = $this->accp_utility_functions->accp_get_wp_content_dir_name(); 357 $file = $home_path . strstr($file_path, $wp_content_dir_name); 358 359 // Set up the mime info - important 366 $file = $home_path . strstr($file_path, $wp_content_dir_name); 367 368 369 /** 370 * Set up the mime info. 371 */ 360 372 $mime = wp_check_filetype($file); 361 373 … … 387 399 388 400 /** 389 * Actually serve the file.401 * Serve the file. 390 402 */ 391 403 readfile( $file ); … … 453 465 if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) { 454 466 455 foreach( $options['plugins'] as $plugin ) {456 457 if( $plugin == $accp_plugin_basename ) {458 459 flush_rewrite_rules();460 461 }462 463 }467 foreach( $options['plugins'] as $plugin ) { 468 469 if( $plugin == $accp_plugin_basename ) { 470 471 flush_rewrite_rules(); 472 473 } 474 475 } 464 476 465 477 } … … 470 482 /** 471 483 * Add items to the plugin row meta. 484 * 485 * @param array $links - Array of plugin links. 486 * @param string $file - Plugin file path. 487 * 488 * @return array $links - Array of plugin links. 489 * 490 * @hooked plugin_row_meta. 472 491 */ 473 492 function accp_add_plugin_row_meta( $links, $file ) { 474 493 475 494 if ( strpos( $file, plugin_basename( dirname(__DIR__) ) ) !== false ) { 495 476 496 $new_links = array( 477 497 '<a href="https://adrianrodriguezstudios.com/documentation-constellation-client-portal/" target="_blank">Documentation</a>' 478 );498 ); 479 499 480 500 $links = array_merge( $links, $new_links ); 501 481 502 } 482 503 … … 488 509 /** 489 510 * Add additional menu items to the plugin action menu. 511 * 512 * @param array $actions - Array of plugin action links. 513 * @param string $plugin_file - Plugin file path. 514 * @param array $plugin_data - Array of plugin data. 515 * @param string $context - The plugin context. 516 * 517 * @return array $actions - Array of plugin action links. 518 * 519 * @hooked plugin_action_links_{$plugin_file}. 490 520 */ 491 521 function accp_add_links_to_plugin_row_actions_menu( $actions, $plugin_file, $plugin_data, $context ){ … … 505 535 } 506 536 507 /** 508 * Add Upgrade menu item to the 509 * plugin action menu - base plugin only. 537 538 /** 539 * Add an Upgrade menu item to the plugin action menu - core plugin only. 540 * 541 * @param array $actions - Array of plugin action links. 542 * @param string $plugin_file - Plugin file path. 543 * @param array $plugin_data - Array of plugin data. 544 * @param string $context - The plugin context. 545 * 546 * @return array $actions - Array of plugin action links. 547 * 548 * @hooked plugin_action_links_{$plugin_file}. 510 549 */ 511 550 function accp_add_upgrade_link_to_plugin_row_actions_menu( $actions, $plugin_file, $plugin_data, $context ){ … … 526 565 * 527 566 * If there is no file associated with the post the default 528 * WP functionality will handle the post deletion 567 * WP functionality will handle the post deletion. 529 568 */ 530 569 function accp_delete_file_on_post_delete(){ … … 638 677 $note_id = get_the_ID(); 639 678 640 // Delete the note post. 679 /** 680 * Delete the note post. 681 */ 641 682 wp_delete_post($note_id, true); 642 683 … … 670 711 die (); 671 712 672 $file_ids = json_decode( stripslashes($_POST['del_file_post_id_json'])); // Sanitize in loop.713 $file_ids = json_decode( stripslashes($_POST['del_file_post_id_json']) ); // Sanitize in loop. 673 714 $included_post_types = array( 'accp_clientinvoice', 'accp_clientfile', 'accp_global_file' ); 674 715 … … 760 801 $nonce = filter_var($_POST['empty_trash_nonce'], FILTER_SANITIZE_STRING); 761 802 762 if ( ! wp_verify_nonce( $nonce, 'clientfile_admin_nonce' ) )803 if ( !wp_verify_nonce( $nonce, 'clientfile_admin_nonce' ) ) 763 804 die (); 764 805 … … 793 834 if($post_type !== 'accp_clientcompany'){ 794 835 795 // Check if the post has file. 836 /** 837 * Check if the post has a file. 838 */ 796 839 if (!empty($accp_file) ) { 797 840 … … 855 898 856 899 /** 857 * Restrict access to Client Pages, Client File and858 * Client Invoice, and Global File posts onfront-end.900 * Restrict access to Client Pages, Client File, Client Invoice, 901 * and Global File posts on the front-end. 859 902 */ 860 903 function accp_restrict_client_page_access(){ … … 967 1010 $current_user_id = $current_user->ID; 968 1011 969 // Get a list of users that are assigned to the 970 // current Company 1012 /** 1013 * Get a list of users that are assigned 1014 * to the current Company. 1015 */ 971 1016 $args = array( 972 1017 'meta_query' => array( … … 994 1039 foreach ($users as $user) { 995 1040 $user_id_array[] = $user->ID; 996 } 997 1041 } 998 1042 999 1043 if( $post_type == 'accp_clientcompany' ){ … … 1012 1056 1013 1057 } 1014 } 1058 1059 } 1060 1015 1061 } 1016 1062 … … 1018 1064 /** 1019 1065 * Get the Company upload directory name. 1066 * 1067 * @param int|string $company_id - The post ID of the company. 1068 * 1069 * @return string $dir - The directory name. 1020 1070 */ 1021 1071 function accp_get_company_dir($company_id) { 1022 1072 1023 if( !isset($company_id) ) return false; 1073 if( !isset($company_id) ) 1074 return false; 1024 1075 1025 1076 $dir = get_post_meta($company_id, 'accp_dir', true); … … 1038 1089 1039 1090 /** 1040 * Update the Client File Post Edit Form Tag 1091 * Update the the post edit form tag for 1092 * client file, client invoice, and global 1093 * file post types. 1041 1094 * 1042 1095 * Add 'enctype="multipart/form-data"' to allow 1043 1096 * for file upload support. 1097 * 1098 * @hooked post_edit_form_tag. 1044 1099 */ 1045 1100 function accp_update_post_edit_form_tag() { … … 1062 1117 } 1063 1118 1064 /** 1065 * Add Client File Metabox to Client File Post Type. 1119 1120 /** 1121 * Add meta fields to client file, client invoice, 1122 * and global file post types. 1123 * 1124 * @hooked admin_menu. 1066 1125 */ 1067 1126 public function accp_client_file_meta_box() { 1068 1127 1069 $screens = array( 'accp_clientfile', 'accp_clientinvoice' ); 1070 1128 $screens = array( 'accp_clientfile', 'accp_clientinvoice' ); 1071 1129 $is_pro = $this->accp_utility_functions->is_pro_plugin($this->plugin_name); 1072 1130 … … 1087 1145 1088 1146 /** 1089 * Client file meta boxes.1147 * Client file attachment meta box content. 1090 1148 * 1091 1149 * Adds the file upload and current file UI. … … 1125 1183 * Verify that the actual file (not post) still exists. 1126 1184 */ 1127 clearstatcache(); 1185 clearstatcache(); 1128 1186 1129 1187 if ( file_exists($accp_file_full_path) ): … … 1267 1325 1268 1326 /** 1269 * Reassign file to another company 1327 * Reassign file to another company - AJAX function. 1270 1328 */ 1271 1329 function accp_reassign_file_1(){ … … 1406 1464 1407 1465 /** 1408 * Generate a Company Directory - AJAX1466 * Generate a company directory - AJAX. 1409 1467 */ 1410 1468 function accp_generate_company_dir(){ … … 1436 1494 1437 1495 $new_company_dir = get_post_meta($company_id, 'accp_dir', true); 1438 1439 1496 $accp_clientfiles_full_dir_path = $this->accp_utility_functions->accp_get_clientfiles_path(); 1440 1497 … … 1454 1511 mkdir($new_company_path); 1455 1512 1513 1456 1514 /** 1457 1515 * Add the new directory name post meta. … … 1459 1517 add_post_meta( $company_id, 'accp_dir', $new_company_dir ); 1460 1518 1519 1461 1520 /** 1462 1521 * Add a note indicating that the new dir was created - Pro feature. … … 1487 1546 1488 1547 $new_dir_name = $new_company_dir; 1548 1489 1549 1490 1550 /** … … 1570 1630 /** 1571 1631 * Maybe insert note - Pro feature. 1632 * 1633 * @param int|string $company_id - The post ID of the company. 1634 * @param string $note_content - The note content. 1572 1635 */ 1573 1636 function accp_add_directory_update_note($company_id, $note_content){ … … 1576 1639 return; 1577 1640 1578 if( class_exists('ARS_Constellation_Client_Portal_Pro_Notes')){1641 if( class_exists('ARS_Constellation_Client_Portal_Pro_Notes') ){ 1579 1642 1580 1643 $accp_notes = new ARS_Constellation_Client_Portal_Pro_Notes($this->version, $this->plugin_name); … … 1591 1654 } 1592 1655 1593 /** 1594 * Move files from one company upload 1595 * directory to another company upload directory. 1656 1657 /** 1658 * Move files from one company upload directory 1659 * to another company upload directory. 1660 * 1661 * @param string $old_dir_name - The old directory name (moving away from). 1662 * @param string $new_dir_name - The new directory name (moving to). 1596 1663 */ 1597 1664 function accp_move_files_to_another_directory($old_dir_name, $new_dir_name){ 1598 1665 1599 if( !is_admin() || !current_user_can('manage_options'))1666 if( !is_admin() || !current_user_can('manage_options') ) 1600 1667 die(); 1601 1668 … … 1606 1673 $new_dir_name = filter_var(preg_replace("/[^-\w,]/", "", $new_dir_name), FILTER_SANITIZE_STRING); 1607 1674 1608 if( !$old_dir_name || !$new_dir_name)1675 if( !$old_dir_name || !$new_dir_name ) 1609 1676 return false; 1610 1677 1611 if( $old_dir_name == $new_dir_name)1678 if( $old_dir_name == $new_dir_name ) 1612 1679 return false; 1613 1680 … … 1739 1806 1740 1807 /** 1741 * Specify a Company Directory - AJAX1808 * Specify a company directory - AJAX. 1742 1809 */ 1743 1810 function accp_specify_company_dir(){ … … 1889 1956 1890 1957 1891 1892 /** 1893 * Function to delete actual files 1894 */ 1895 /*function accp_delete_file_or_dir(){ 1896 1897 // Verify the nonce 1898 $nonce = filter_var($_POST['file_del_nonce'], FILTER_SANITIZE_STRING); 1899 1900 if ( ! wp_verify_nonce( $nonce, 'file_del_nonce' ) ) 1901 die (); 1902 1903 $file_full_path = filter_var($_POST['accp_del_path'], FILTER_SANITIZE_URL); 1904 1905 1906 if( file_exists($file_full_path) ){ 1907 1908 unlink( $file_full_path ); 1909 echo 'The file was successfully deleted.'; 1910 1911 }else{ 1912 1913 echo 'That file does not exist.'; 1914 1915 } 1916 1917 1918 die(); 1919 1920 }*/ 1921 1922 /** 1923 * Function to delete directories 1924 * 1925 * Call the functions with "$this->accp_delete_dir();" 1926 */ 1927 /*function accp_delete_dir(){ 1928 1929 // Verify the nonce 1930 $nonce = filter_var($_POST['dir_del_nonce'], FILTER_SANITIZE_STRING); 1931 1932 if ( ! wp_verify_nonce( $nonce, 'dir_del_nonce' ) ) 1933 die (); 1934 1935 1936 $file_full_path = filter_var($_POST['accp_del_dir_path'], FILTER_SANITIZE_URL); 1937 1938 if( file_exists($file_full_path) ){ 1939 1940 rmdir( $file_full_path ); 1941 echo 'The directory was successfully deleted.'; 1942 1943 }else{ 1944 1945 echo 'That directory does not exist.'; 1946 1947 } 1948 1949 die(); 1950 1951 }*/ 1952 1953 1954 /** 1955 * Save File to Company Directory 1956 * 1957 * Client Files and Client Invoices. 1958 /** 1959 * Save file to company directory. 1960 * 1961 * @param int $post_id - The post ID. 1962 * @param object|null - The post object. 1963 * 1964 * @hooked save_post. 1958 1965 */ 1959 1966 function accp_save_post($post_id, $post = null){ 1960 1961 $post = get_post($post_id); 1962 $current_user = wp_get_current_user(); 1963 $post_type = $post->post_type; 1964 1965 if(isset($_POST['wp_accp_nonce'])){ 1966 1967 $nonce = filter_var($_POST['wp_accp_nonce'], FILTER_SANITIZE_STRING); 1968 1969 if(!wp_verify_nonce($nonce, 'accp_file_save_nonce')) 1970 return $post_id; 1971 1972 }else{ 1973 1974 return $post_id; 1975 1976 } 1977 1978 if( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) 1979 return $post_id; 1980 1981 if( $post_type !== 'accp_clientfile' && $post_type !== 'accp_clientinvoice' && $post_type !== 'accp_global_file') 1982 return $post_id; 1983 1984 if( !is_user_logged_in() ) 1967 1968 if( !is_user_logged_in() || !is_admin() ) 1985 1969 return wp_die('Invalid command.'); 1986 1970 … … 1988 1972 return $post_id; 1989 1973 1974 if( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) 1975 return $post_id; 1976 1977 if( isset($_POST['wp_accp_nonce']) ){ 1978 1979 $nonce = filter_var( $_POST['wp_accp_nonce'], FILTER_SANITIZE_STRING ); 1980 1981 if( !wp_verify_nonce($nonce, 'accp_file_save_nonce') ) 1982 return $post_id; 1983 1984 }else{ 1985 1986 return $post_id; 1987 1988 } 1989 1990 $post = get_post($post_id); 1991 $post_type = $post->post_type; 1992 1993 if( $post_type !== 'accp_clientfile' && $post_type !== 'accp_clientinvoice' && $post_type !== 'accp_global_file') 1994 return $post_id; 1990 1995 1991 1996 /** … … 2003 2008 update_post_meta($post_id, 'accp_user', $company_id); 2004 2009 2005 } 2006 2007 2010 } 2011 2012 /** 2013 * Upload the file attachment. 2014 */ 2015 $files = $_FILES['accp_file']; 2016 2017 $this->accp_upload_file($files, $post_id); 2018 2019 } 2020 2021 2022 /** 2023 * Upload client file attachment. 2024 * 2025 * @param array $files - The $_FILES['accp_file'] array. 2026 * @param int $post_id - The post ID that the file is associated with. 2027 */ 2028 function accp_upload_file($files, $post_id){ 2029 2030 if( !is_admin() || !is_user_logged_in() || !current_user_can('manage_options') ) 2031 return; 2032 2008 2033 /** 2009 2034 * Verify that the file field is not empty. … … 2012 2037 * are used to verify and handle the upload. 2013 2038 */ 2014 if( !empty($_FILES['accp_file']['name']) ) { 2015 2016 // Get list of enabled mime types 2039 if( !empty($files['name']) ) { 2040 2041 /** 2042 * Get list of enabled mime types. 2043 */ 2017 2044 $enabled_option_list = $this->accp_get_enabled_mime_type_option_values(); 2018 2019 // Set up the Supported Mime Type var 2045 2046 2047 /** 2048 * Set up the Supported Mime Type var. 2049 */ 2020 2050 if(!empty($enabled_option_list)){ 2021 2051 … … 2031 2061 2032 2062 } 2033 2063 2034 2064 2035 2065 /** 2036 * Verify mime type. 2066 * Get the file type of the upload. 2067 */ 2068 $file_type_array = wp_check_filetype(basename($files['name'])); 2069 $uploaded_file_type = $file_type_array['type']; 2070 2071 2072 /** 2073 * Verify that the mime type is supported. 2037 2074 */ 2038 2039 // Get the file type of the upload 2040 $file_type_array = wp_check_filetype(basename($_FILES['accp_file']['name'])); 2041 $uploaded_file_type = $file_type_array['type']; 2042 2043 // Verify that the mime type is supported 2044 if( in_array($uploaded_file_type, $supported_types) ) { 2045 2046 $accp_file = get_post_meta($post_id, 'accp_file', true); 2047 2048 if ($accp_file) { 2049 2050 $accp_file_path = $this->accp_utility_functions->accp_get_clientfiles_path() . '/' . $accp_file['file']; 2051 //NOTE: if the file already exists, a number will be appended to the new file name. 2052 2053 } 2075 if( in_array($uploaded_file_type, $supported_types) ) { 2054 2076 2055 2077 /** 2056 * Prep upload.2078 * Upload the file. 2057 2079 */ 2058 2080 if( !empty($file_type_array['type']) ){ 2059 $upload = wp_handle_upload( $_FILES['accp_file'], array( 'test_form' => false ) ); 2081 2082 $upload = wp_handle_upload( $files, array( 'test_form' => false ) ); 2083 2060 2084 } 2061 2085 2062 if( isset($upload['error']) && $upload['error'] != 0){2086 if( isset($upload['error']) && $upload['error'] != 0 ){ 2063 2087 2064 2088 wp_die( 'There was an error uploading your file. ' . $upload['error'] ); … … 2067 2091 2068 2092 /** 2069 * Update save uploaded file info to post meta.2093 * Save uploaded file info to post meta. 2070 2094 */ 2071 2095 update_post_meta($post_id, 'accp_file', $upload); … … 2076 2100 * company directory if it doesn't already exist. 2077 2101 */ 2078 $accp_clientfiles_full_dir_path = $this->accp_utility_functions->accp_get_clientfiles_path(); 2079 $company_dir_name = $this->accp_get_company_dir($company_id); 2080 $accp_file = get_post_meta($post_id, 'accp_file', true); //redefine $accp_file 2081 $source_file = plugin_dir_path( __DIR__ ) . 'public/assets/index.php'; 2082 $accp_file_path_dir = parse_url($accp_file['url'], PHP_URL_PATH); 2083 2084 // The upload dir is changed within this function, so 2085 // wp_get_upload_dir()['basedir'] returns 'fullpath/uploads/accp-clientfiles. 2086 $company_dir = wp_get_upload_dir()['basedir'] . '/' . $company_dir_name . '/' . 'index.php'; 2087 $main_file_dir = wp_get_upload_dir()['basedir'] . '/index.php'; 2102 $this->copy_index_file_to_company_dir($post_id); 2088 2103 2089 2104 … … 2096 2111 //do_action('accp_after_file_upload', $post_id, $company_id); 2097 2112 2098 if ( !file_exists( $company_dir )){2099 2100 copy($source_file, $company_dir);2101 2102 }2103 2113 2104 2114 /** 2105 * Add index.php (silence is golden) to the main 2106 * accp-clientfiles upload dir if it doesn't exist 2107 * NOTE: Consider adding this to plugin activation - 2108 * Need to create the /accp-clientfiles dir on activation if so. 2115 * Copy the detault index.php file to the main 2116 * client portal uploads dir if needed. 2109 2117 */ 2110 if ( !file_exists( $main_file_dir )){ 2111 2112 copy($source_file, $main_file_dir); 2113 2114 } 2118 $this->copy_index_file_to_uploads_dir($post_id); 2115 2119 2116 2120 } … … 2121 2125 2122 2126 } 2127 2128 } 2129 2130 } 2131 2132 2133 /** 2134 * Copy index.php file to client portal 2135 * uploads dir. 2136 * 2137 * @param int $post_id - The post ID of the post initiating the action. 2138 */ 2139 function copy_index_file_to_uploads_dir($post_id){ 2140 2141 if( !is_admin() || !is_user_logged_in() || !current_user_can('manage_options') ) 2142 return; 2143 2144 if(!$post_id) 2145 return; 2146 2147 $post_type = get_post_type($post_id); 2148 2149 if( 'accp_clientinvoice' !== $post_type && 2150 'accp_clientfile' !== $post_type && 2151 'accp_global_file' !== $post_type 2152 ){ 2153 2154 return; 2155 2156 } 2157 2158 $source_file = plugin_dir_path( __DIR__ ) . 'public/assets/index.php'; 2159 $main_file_dir = wp_get_upload_dir()['basedir'] . '/index.php'; 2160 2161 /** 2162 * Add index.php (silence is golden) to the main 2163 * accp-clientfiles upload dir if it doesn't exist 2164 * NOTE: Consider adding this to plugin activation - 2165 * Need to create the /accp-clientfiles dir on activation if so. 2166 */ 2167 if ( !file_exists( $main_file_dir )){ 2168 2169 copy($source_file, $main_file_dir); 2170 2171 } 2172 2173 2174 } 2175 2176 2177 /** 2178 * Copy index.php file to company and/or 2179 * global-files upload dir. 2180 * 2181 * @param int $post_id - The post ID of the post initiating the action. 2182 */ 2183 function copy_index_file_to_company_dir($post_id){ 2184 2185 if( !is_admin() || !is_user_logged_in() || !current_user_can('manage_options') ) 2186 return; 2187 2188 if(!$post_id) 2189 return; 2190 2191 $post_type = get_post_type($post_id); 2192 2193 if( 'accp_clientinvoice' !== $post_type && 2194 'accp_clientfile' !== $post_type && 2195 'accp_global_file' !== $post_type 2196 ){ 2197 2198 return; 2199 2200 } 2201 2202 $source_file = plugin_dir_path( __DIR__ ) . 'public/assets/index.php'; 2203 2204 $dir_name = ''; 2205 2206 if( 'accp_global_file' !== $post_type ){ 2207 2208 $company_id = get_post_meta($post_id, 'accp_user', true) ? (int)get_post_meta($post_id, 'accp_user', true) : ''; 2209 2210 if(!$company_id) 2211 return; 2212 2213 $company_dir_name = $this->accp_get_company_dir($company_id); 2214 $dir_name = $company_dir_name; 2215 2216 }else{ 2217 2218 $dir_name = 'global-files'; 2219 2220 } 2221 2222 if( !$dir_name || empty($dir_name) ) 2223 return; 2224 2225 /** 2226 * The upload dir is updated for client portal post types, so 2227 * wp_get_upload_dir()['basedir'] returns 'fullpath/uploads/accp-clientfiles. 2228 */ 2229 $directory = wp_get_upload_dir()['basedir'] . '/' . $dir_name . '/' . 'index.php'; 2230 2231 if ( !file_exists( $directory )){ 2232 2233 copy($source_file, $directory); 2123 2234 2124 2235 } … … 2151 2262 return $default_dir; 2152 2263 2153 $company_id = $this->accp_utility_functions->accp_sanitize_integers($_POST['accp_user']); 2264 $company_id = $this->accp_utility_functions->accp_sanitize_integers($_POST['accp_user']); 2265 $custom_dir = $this->get_custom_upload_dir($company_id); 2266 2267 if(!$custom_dir) 2268 return $default_dir; 2269 2270 return $custom_dir; 2271 2272 } 2273 2274 2275 /** 2276 * Get custom upload directory for 2277 * accp_clientfile and accp_clientinvoice 2278 * post types. 2279 * 2280 * @param int $company_id - The post ID of the company. 2281 * 2282 * @return array $custom_dir - The upload directory array. 2283 */ 2284 function get_custom_upload_dir($company_id){ 2285 2286 if(!$company_id) 2287 return; 2288 2154 2289 $base_dir = $this->wp_uploads_base_dir_const . '/accp-clientfiles'; 2155 2290 $base_url = $this->wp_uploads_base_url_const . '/accp-clientfiles'; … … 2174 2309 2175 2310 /** 2176 * File a nd Invoice Dowload Function2311 * File attachment front-end download functionality. 2177 2312 */ 2178 2313 public function accp_get_download(){ … … 2182 2317 if( !isset($_GET['accp-dl-id']) ) return; 2183 2318 2184 if( !is_user_logged_in() ) { 2319 if( !is_user_logged_in() ){ 2320 2185 2321 wp_redirect( wp_login_url($_SERVER['REQUEST_URI']) ); 2186 2322 exit; 2323 2187 2324 } 2188 2325 2189 2326 $file_id = $this->accp_utility_functions->accp_sanitize_integers($_GET['accp-dl-id']); 2190 2191 // Exit if the file was not assigned to the current user 2192 if( !get_post_meta($file_id, 'accp_user', true) ) return; 2193 if( !$current_user->ID || $current_user->ID == 0 ) return; 2327 2328 if( !get_post_meta($file_id, 'accp_user', true) ) 2329 return; 2330 2331 if( !$current_user->ID || $current_user->ID == 0 ) 2332 return; 2194 2333 2195 2334 $file_company_id = get_post_meta($file_id, 'accp_user', true); … … 2218 2357 2219 2358 $company_dir_name = get_post_meta($file_company_id, 'accp_dir', true); 2220 $accp_file = get_post_meta($file_id, 'accp_file', true); 2221 //$accp_dir_and_filename = substr($accp_file['file'], stripos($accp_file['file'], '/') +1); // DEPRECATED 2359 $accp_file = get_post_meta($file_id, 'accp_file', true); 2222 2360 $accp_dir_and_filename = $company_dir_name . '/' . basename($accp_file['file']); 2223 2361 $accp_file_path = $this->wp_uploads_base_dir_const . '/accp-clientfiles/' . $accp_dir_and_filename; … … 2233 2371 2234 2372 /** 2235 * Client File Output Function 2373 * File attachment output functionality. 2374 * 2375 * @param string $file - The file path. 2376 * @param string $mime_type - The mime type. 2377 * @param string $action - The action. Defaults to "download." 2236 2378 */ 2237 2379 private function accp_output_file($file, $name, $mime_type = '', $action = 'download') { … … 2244 2386 */ 2245 2387 $defined_mime_types = $this->accp_defined_file_mime_types(); 2246 $file_extension = strtolower( substr(strrchr($file,"."), 1));2388 $file_extension = strtolower( substr( strrchr($file,"."), 1 ) ); 2247 2389 2248 2390 /** … … 2250 2392 */ 2251 2393 if($file_extension == 'jpeg'){ 2394 2252 2395 $file_extension = 'jpg'; 2396 2253 2397 } 2254 2398 … … 2260 2404 2261 2405 if( strtolower($file_extension) == strtolower($value['file_extension']) ){ 2406 2262 2407 $mime_type = $value['file_extension']; 2263 2408 break; 2409 2264 2410 } 2265 2411 … … 2269 2415 2270 2416 if( $mime_type == '' || $mime_type == NULL || $mime_type == 'undefined'){ 2417 2271 2418 $mime_type = 'application/force-download'; 2419 2272 2420 } 2273 2421 … … 2317 2465 $bytes_send = 0; 2318 2466 2319 if ( $file = fopen($file, 'r')){2320 2321 if( isset($_SERVER['HTTP_RANGE']))2467 if ( $file = fopen($file, 'r') ){ 2468 2469 if( isset($_SERVER['HTTP_RANGE']) ) 2322 2470 fseek($file, $range); 2323 2471 2324 while( !feof($file) && (!connection_aborted()) && ($bytes_send < $updated_length)){2472 while( !feof($file) && (!connection_aborted()) && ($bytes_send < $updated_length) ){ 2325 2473 2326 2474 $buffer = fread($file, $chunk_size); … … 2347 2495 /** 2348 2496 * Set base file headers. 2497 * 2498 * @param string $file - The file path. 2499 * @param string $action - The action. Defaults to "download." 2500 * @param string $name - The file name for the file to output. 2349 2501 */ 2350 2502 private function set_base_file_headers($mime_type, $action, $name){ … … 2372 2524 2373 2525 if(ini_get('zlib.output_compression')){ 2526 2374 2527 ini_set('zlib.output_compression', 'Off'); 2528 2375 2529 } 2376 2530 … … 2386 2540 $screen = 'accp_client_pages'; 2387 2541 2388 add_meta_box( "client-meta-2", "Assign Company*", array($this, "display_meta_company_select_options"), $screen, "normal", "high");2542 add_meta_box('client-meta-2', 'Assign Company*', array($this, 'display_meta_company_select_options'), $screen, 'normal', 'high'); 2389 2543 2390 2544 } … … 2476 2630 $current_screen = get_current_screen(); 2477 2631 2478 if( $current_screen->id === "accp_client_pages") {2632 if( 'accp_client_pages' === $current_screen->id ) { 2479 2633 2480 2634 global $post; … … 2527 2681 } 2528 2682 2529 } 2530 2531 2532 /** 2533 * Add user profile fields. 2534 */ 2535 function extra_user_profile_fields($user){ 2536 2537 if( !$user || !is_object($user) ) 2538 return; 2539 2540 $user_id = $user->ID; 2541 2542 if(!$user_id) 2543 return; 2544 2545 $wp_post_statuses = get_post_statuses() ? array_keys( (array)get_post_statuses() ) : array(); 2546 2547 ?> 2548 <h2>Constellation Client Information</h2> 2549 2550 <table class="form-table"> 2551 2552 <?php 2553 /** 2554 * Primary Company section. 2555 */ 2556 ?> 2557 <tr> 2558 <th><label for="client_company">Company</label></th> 2559 2560 <td> 2561 <?php 2562 $saved_company = is_object($user) ? get_user_meta($user_id, 'client_company', true) : ''; 2563 2564 if ( current_user_can('manage_options') ){ 2565 2566 $args = array( 2567 'post_type' => 'accp_clientcompany', 2568 ); 2569 2570 /** 2571 * Include all defined WP post statuses, 2572 * not just "publish." 2573 */ 2574 if(!empty($wp_post_statuses)){ 2575 2576 $args['post_status'] = $wp_post_statuses; 2577 2578 } 2579 2580 2581 $company_list = get_pages($args); 2582 2583 ?> 2584 <select name="client_company" id="client_company"> 2585 2586 <option value="">Select a company...</option> 2587 <?php 2588 2589 foreach( $company_list as $key => $company ){ 2590 2591 $company_id = $company->ID; 2592 $company_name = $company->post_title; 2593 $selected = $saved_company && (int)$saved_company === (int)$company_id ? "selected" : ""; 2594 $post_status_class = ''; 2595 2596 if( $company->post_status != 'publish' ){ 2597 2598 $company_name = $company_name . ' (' . $company->post_status . ')'; 2599 $post_status_class = "accp-non-published-post-option"; 2600 2601 } 2602 2603 ?> 2604 <option class="level-0 <?php echo esc_attr($post_status_class); ?>" value="<?php echo esc_attr($company_id); ?>" <?php echo esc_attr($selected); ?> ><?php echo esc_html($company_name); ?></option> 2605 <?php 2606 2607 2608 } 2609 2610 ?> 2611 </select> 2612 <?php 2613 2614 }else{ 2615 2616 if( !empty($saved_company) ){ 2617 2618 echo esc_html(get_the_title($saved_company)); 2619 2620 } 2621 2622 } 2623 ?> 2624 <br /> 2625 2626 </td> 2627 </tr> 2628 2629 2630 <?php 2631 /** 2632 * Client Status section. 2633 */ 2634 ?> 2635 <tr> 2636 <th> 2637 <label for="client_status"> 2638 <?php _e("Client Status"); ?> 2639 2640 <?php if( is_user_logged_in() && current_user_can('manage_options') ): ?> 2641 2642 <span class="accp-admin-tooltip-icon">i</span> 2643 2644 <span class="accp-wp-admin-tooltip accp-wp-admin-tooltip-dark accp-wp-admin-has-tooltip-center accp-user-status-tooltip">A status of <strong>Inactive</strong> or <strong>Pending</strong> will prevent the user from accessing client pages, invoices, and files.</span> 2645 2646 <?php endif; ?> 2647 2648 </label> 2649 </th> 2650 2651 <td> 2652 <?php $saved_status = is_object($user) ? get_user_meta($user->ID, 'client_status', true) : ''; 2653 2654 if ( current_user_can('manage_options') ){ 2655 ?> 2656 2657 <select name="client_status" id="client-status" value="<?php echo esc_attr( get_the_author_meta( 'client_status', $user_id ) ); ?>"> 2658 <option value="active" <?php echo $saved_status == 'active' ? esc_attr("selected") : ""; ?>>Active</option> 2659 <option value="inactive" <?php echo $saved_status == 'inactive' ? esc_attr("selected") : ""; ?>>Inactive</option> 2660 <option value="pending" <?php echo $saved_status == 'pending' ? esc_attr("selected") : ""; ?>>Pending</option> 2661 </select> 2662 2663 <?php 2664 }else{ 2665 2666 if(!empty($saved_status)){ 2667 echo esc_html($saved_status); 2668 } 2669 2670 } 2671 2672 ?> 2673 2674 </td> 2675 </tr> 2676 2677 2678 <?php 2679 /** 2680 * Additional Assigned Companies section. 2681 */ 2682 ?> 2683 <tr> 2684 <th> 2685 <label for="client_company"><?php echo (current_user_can('manage_options') ? 'Assign Additional Companies' : 'Additional Companies' ); ?></label> 2686 </th> 2687 2688 <td> 2689 2690 <?php 2691 2692 $saved_companies = array(); 2693 2694 if(is_object($user)){ 2695 2696 if ( get_user_meta($user_id, 'client_additional_company', true) && !empty(get_user_meta($user_id, 'client_additional_company', true)) ){ 2697 2698 $saved_companies = (array)get_user_meta( $user_id, 'client_additional_company', true ); 2699 2700 } 2701 2702 } 2703 2704 if ( current_user_can('manage_options') ){ 2705 2706 ?> 2707 <select class="client-add-company-select" name="client_additional_company[]" value="" multiple="multiple" > 2708 <?php 2709 2710 foreach( $company_list as $company ){ 2711 2712 $company_id = $company->ID; 2713 $company_name = $company->post_title; 2714 $selected = in_array( $company_id , $saved_companies ) ? "selected" : ""; 2715 $post_status_class = ''; 2716 2717 if( $company->post_status != 'publish' ){ 2718 2719 $company_name = $company_name . ' (' . $company->post_status . ')'; 2720 $post_status_class = "accp-non-published-post-option"; 2721 2722 } 2723 2724 ?> 2725 <option class="level-0 <?php echo esc_attr($post_status_class); ?>" value="<?php echo esc_attr($company_id); ?>" <?php echo esc_attr($selected); ?> ><?php echo esc_html($company_name); ?></option> 2726 <?php 2727 2728 } 2729 2730 ?> 2731 </select> 2732 <?php 2733 2734 }else{ 2735 2736 if(!empty($saved_companies)){ 2737 2738 ?> 2739 <ul> 2740 <?php 2741 2742 foreach( $saved_companies as $saved_company ){ 2743 echo '<li>' . esc_html(get_the_title($saved_company)) . '</li>'; 2744 } 2745 2746 ?> 2747 </ul> 2748 <?php 2749 2750 } 2751 2752 } 2753 ?> 2754 2755 </td> 2756 2757 </tr> 2758 2759 <?php 2760 if( is_admin() && is_user_logged_in() && current_user_can('manage_options') ){ 2761 do_action('accp_after_user_profile_settings', $user_id); 2762 } 2763 ?> 2764 2765 </table> 2766 <?php 2767 } 2768 2769 2770 /** 2771 * Check user global page suitability. If a user 2772 * is assigned to only 1 company, they are suitable 2773 * for global pages, otherwise they are not. 2774 * 2775 * @param int $user_id - The ID of the user to check. 2776 * 2777 * @return bool $is_eligible - true|false. 2778 */ 2779 function check_if_user_is_eligible_for_global_pages($user_id){ 2780 2781 $primary_company_id = get_user_meta($user_id, 'client_company', true); 2782 $additional_company_ids = get_user_meta($user_id, 'client_additional_company', true); 2783 2784 /** 2785 * Return true if a primary company is assigned and no 2786 * additional companies are assigned. 2787 */ 2788 if( $primary_company_id && ( !$additional_company_ids || empty($additional_company_ids) ) ) 2789 return true; 2790 2791 2792 /** 2793 * Return true if a primary company is not assigned and only 2794 * one additional company is assigned. 2795 */ 2796 if( !$primary_company_id && $additional_company_ids && is_array($additional_company_ids) ){ 2797 2798 if( count($additional_company_ids) === 1) 2799 return true; 2800 2801 } 2802 2803 2804 /** 2805 * Return true if a primary company is not assigned and 2806 * no additional companies are assigned. 2807 */ 2808 if( !$primary_company_id && ( !$additional_company_ids || empty($additional_company_ids) ) ){ 2809 2810 return true; 2811 2812 } 2813 2814 return false; 2815 2816 } 2817 2818 2819 /** 2820 * Save user profile fields. 2821 */ 2822 function save_extra_user_profile_fields( $user_id ) { 2823 2824 if ( !current_user_can( 'edit_user', $user_id ) ) { 2825 return false; 2826 } 2827 2828 /** 2829 * Assigned Company 2830 */ 2831 if(isset($_POST['client_company'])){ 2832 2833 $company_id = $this->accp_utility_functions->accp_sanitize_integers($_POST['client_company']); 2834 update_user_meta( $user_id, 'client_company', $company_id ); 2835 2836 } 2837 2838 /** 2839 * User Client Status 2840 */ 2841 if(isset($_POST['client_status'])){ 2842 2843 $client_status = filter_var($_POST['client_status'], FILTER_SANITIZE_STRING); 2844 update_user_meta( $user_id, 'client_status', $client_status ); 2845 2846 } 2847 2848 /** 2849 * Additional Companies 2850 */ 2851 if (!empty($_POST['client_additional_company'])){ 2852 2853 $sanitized_company_array = array(); 2854 foreach( $_POST['client_additional_company'] as $additional_company_id ){ 2855 2856 $sanitized_company_array[] = $this->accp_utility_functions->accp_sanitize_integers($additional_company_id); 2857 2858 } 2859 2860 update_user_meta( $user_id, 'client_additional_company', $sanitized_company_array ); 2861 2862 }else{ 2863 2864 delete_user_meta( $user_id, 'client_additional_company'); 2865 2866 } 2867 2868 } 2869 2870 2871 /** 2872 * Add content above the clienfile list table. 2683 } 2684 2685 2686 /** 2687 * Add content above the clienfile list table. 2873 2688 */ 2874 2689 function accp_add_content_before_file_list_table(){ … … 2912 2727 * Define MIME Types. 2913 2728 * 2914 * @return array Returns listof defined mime types (enabled and disabled).2729 * @return array $mime_types - Array of defined mime types (enabled and disabled). 2915 2730 */ 2916 2731 function accp_defined_file_mime_types(){ … … 3032 2847 * Get Enabled ACCP Mime Type Options 3033 2848 * 3034 * @return array Returns list of enabled (only) mime type options. 2849 * @return array $enabled_mime_types - Array of enabled (only) mime type options. 2850 * 3035 2851 * Option value = $enabled_mime_types['value']. 3036 2852 */ … … 3044 2860 3045 2861 if( get_option($value['option_name']) ){ 2862 3046 2863 $enabled_mime_types[] = $value; 2864 3047 2865 } 3048 2866 … … 3056 2874 /** 3057 2875 * Get Enabled TCP Mime Type Option Values 3058 * @return array Returns listof enabled (only) mime type option values.2876 * @return array $enabled_mime_type_vals - Array of enabled (only) mime type option values. 3059 2877 */ 3060 2878 function accp_get_enabled_mime_type_option_values(){ … … 3065 2883 3066 2884 foreach ($enabled_mime_types as $key => $value) { 2885 3067 2886 $enabled_mime_type_vals[] = $value['value']; 2887 3068 2888 } 3069 2889 … … 3072 2892 } 3073 2893 3074 3075 /** 3076 * Add Settings Page Content 3077 */ 3078 public function accp_settings_page(){ 3079 3080 include_once( dirname( __FILE__ ) . '/includes/accp-settings-page.php'); 3081 3082 } 3083 3084 2894 3085 2895 /** 3086 2896 * Add Client Portal sub menu items … … 3091 2901 /** 3092 2902 * Company menu page. 3093 */ 3094 //add_submenu_page('admin.php?page=accp-settings.php', 'Companies', 'Companies', 'manage_options', 'edit.php?post_type=accp_clientcompany' ); 2903 */ 3095 2904 add_submenu_page('accp-settings', 'Companies', 'Companies', 'manage_options', 'edit.php?post_type=accp_clientcompany' ); 3096 2905 … … 3217 3026 /** 3218 3027 * Add columns to the WP user list table. 3028 * 3029 * @param array $columns - Array of column names. 3030 * 3031 * @return array $columns - Array of column names. 3032 * 3033 * @hooked manage_users_columns. 3219 3034 */ 3220 3035 function add_wp_user_list_columns($columns){ … … 3229 3044 /** 3230 3045 * Add WP user list table column content. 3046 * 3047 * @param string $output - The column content. 3048 * @param string $column_name - The column name. 3049 * @param string $user_id - The ID of the currently listed user. 3050 * 3051 * @return string $output - The column content. 3052 * 3053 * @hooked manage_users_custom_column. 3231 3054 */ 3232 3055 function add_wp_user_list_column_content($output, $column_name, $user_id){ … … 3362 3185 3363 3186 /** 3364 * Generate admin settings message and 3365 * error markup. 3366 * 3367 * @param string $message - The message to be displayed, 3368 * which can also contain markup. 3187 * Generate admin settings message and error markup. 3188 * 3189 * @param string $message - The message to be displayed, which can also contain markup. 3369 3190 * @param string $type - The type of message type from the 3370 3191 * list of available WP admin notice type classes (notice-error, … … 3430 3251 3431 3252 /** 3432 * Flush rewrite fules if the 'accp_rewrite_flush_needed_after_settings_change'3253 * Flush rewrite rules if the 'accp_rewrite_flush_needed_after_settings_change' 3433 3254 * option is present and set to 'rewrite-flush-needed.' 3434 3255 * 3435 * @hooked toinit.3256 * @hooked init. 3436 3257 */ 3437 3258 function accp_maybe_flush_rewrite_rules(){ … … 3589 3410 } 3590 3411 3412 3413 /** 3414 * Add core WP list table columns. 3415 * 3416 * @param array $columns - Array of column heading data. 3417 * 3418 * @hooked manage_edit-accp_clientfile_columns. 3419 * @hooked manage_edit-accp_clientinvoice_columns. 3420 * @hooked manage_edit-accp_global_file_columns. 3421 */ 3422 function add_core_wp_list_table_columns($columns){ 3423 3424 if( !is_admin() || !is_user_logged_in() || !current_user_can('manage_options') ) 3425 return; 3426 3427 global $current_screen; 3428 3429 $post_type = $current_screen->post_type; 3430 $position_column = 'title'; 3431 3432 $new_columns = array(); 3433 3434 foreach ( $columns as $column_slug => $column_name ) { 3435 3436 $new_columns[ $column_slug ] = $column_name; 3437 3438 if ( $position_column === $column_slug ) { 3439 3440 /** 3441 * Company 3442 */ 3443 if( $post_type !== 'accp_global_file' ){ 3444 3445 $new_columns['company'] = __( 'Company', 'constellation-client-portal' ); 3446 3447 } 3448 3449 /** 3450 * Category 3451 */ 3452 $new_columns['file_category'] = __( 'Category', 'constellation-client-portal' ); 3453 3454 3455 /** 3456 * Status 3457 */ 3458 $new_columns['status'] = __( 'Status', 'constellation-client-portal' ); 3459 3460 3461 /** 3462 * Document ID 3463 */ 3464 $new_columns['doc_id'] = __( 'Document ID', 'constellation-client-portal' ); 3465 3466 3467 /** 3468 * Due Date 3469 */ 3470 $new_columns['due_date'] = __( 'Due Date', 'constellation-client-portal' ); 3471 3472 } 3473 3474 } 3475 3476 return $new_columns; 3477 3478 } 3479 3591 3480 } //End ARS_Constellation_Client_Portal_Admin Class -
constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-client-pages.php
r3043713 r3062211 11 11 */ 12 12 13 /** 14 * Exit if accessed directly. 15 */ 13 16 if ( ! defined( 'ABSPATH' ) ) { 14 exit; // Exit if accessed directly17 exit; 15 18 } 16 19 … … 66 69 67 70 $labels = array( 68 'name' => _x( 'Client Pages', ' accp-client-page' ),69 'singular_name' => _x( 'Client Page', ' accp-client-page' ),70 'add_new' => _x( 'Add New', ' accp-client-page' ),71 'add_new_item' => _x( 'Add New Client Page', ' accp-client-page' ),72 'edit_item' => _x( 'Edit Client Page', ' accp-client-page' ),73 'new_item' => _x( 'New Client Page', ' accp-client-page' ),74 'view_item' => _x( 'View Client Page', ' accp-client-page' ),75 'search_items' => _x( 'Search Client Pages', ' accp-client-page' ),76 'not_found' => _x( 'No client pages found', ' accp-client-page' ),77 'not_found_in_trash' => _x( 'No client pages found in Trash', ' accp-client-page' ),78 'parent_item_colon' => _x( 'Parent Client Page:', ' accp-client-page' ),79 'menu_name' => _x( 'Client Pages', ' accp-client-page' ),71 'name' => _x( 'Client Pages', 'constellation-client-portal' ), 72 'singular_name' => _x( 'Client Page', 'constellation-client-portal' ), 73 'add_new' => _x( 'Add New', 'constellation-client-portal' ), 74 'add_new_item' => _x( 'Add New Client Page', 'constellation-client-portal' ), 75 'edit_item' => _x( 'Edit Client Page', 'constellation-client-portal' ), 76 'new_item' => _x( 'New Client Page', 'constellation-client-portal' ), 77 'view_item' => _x( 'View Client Page', 'constellation-client-portal' ), 78 'search_items' => _x( 'Search Client Pages', 'constellation-client-portal' ), 79 'not_found' => _x( 'No client pages found', 'constellation-client-portal' ), 80 'not_found_in_trash' => _x( 'No client pages found in Trash', 'constellation-client-portal' ), 81 'parent_item_colon' => _x( 'Parent Client Page:', 'constellation-client-portal' ), 82 'menu_name' => _x( 'Client Pages', 'constellation-client-portal' ), 80 83 ); 81 84 … … 142 145 143 146 $labels = array( 144 'name' => _x( 'Client Page Categories', ' accp_client_page_categories' ),145 'singular_name' => _x( 'Client Page Category', ' accp_client_page_categories' ),146 'search_items' => _x( 'Search Categories', ' accp_client_page_categories' ),147 'popular_items' => _x( 'Popular Categories', ' accp_client_page_categories' ),148 'all_items' => _x( 'All Categories', ' accp_client_page_categories' ),149 'parent_item' => _x( 'Parent Category', ' accp_client_page_categories' ),150 'parent_item_colon' => _x( 'Parent Category:', ' accp_client_page_categories' ),151 'edit_item' => _x( 'Edit Category', ' accp_client_page_categories' ),152 'update_item' => _x( 'Update Category', ' accp_client_page_categories' ),153 'add_new_item' => _x( 'Add New Category', ' accp_client_page_categories' ),154 'new_item_name' => _x( 'New Category', ' accp_client_page_categories' ),155 'separate_items_with_commas' => _x( 'Separate categories with commas', ' accp_client_page_categories' ),156 'add_or_remove_items' => _x( 'Add or remove categories', ' accp_client_page_categories' ),157 'choose_from_most_used' => _x( 'Choose from the most used categories', ' accp_client_page_categories' ),158 'menu_name' => _x( 'Client Page Categories', ' accp_client_page_categories' ),147 'name' => _x( 'Client Page Categories', 'constellation-client-portal' ), 148 'singular_name' => _x( 'Client Page Category', 'constellation-client-portal' ), 149 'search_items' => _x( 'Search Categories', 'constellation-client-portal' ), 150 'popular_items' => _x( 'Popular Categories', 'constellation-client-portal' ), 151 'all_items' => _x( 'All Categories', 'constellation-client-portal' ), 152 'parent_item' => _x( 'Parent Category', 'constellation-client-portal' ), 153 'parent_item_colon' => _x( 'Parent Category:', 'constellation-client-portal' ), 154 'edit_item' => _x( 'Edit Category', 'constellation-client-portal' ), 155 'update_item' => _x( 'Update Category', 'constellation-client-portal' ), 156 'add_new_item' => _x( 'Add New Category', 'constellation-client-portal' ), 157 'new_item_name' => _x( 'New Category', 'constellation-client-portal' ), 158 'separate_items_with_commas' => _x( 'Separate categories with commas', 'constellation-client-portal' ), 159 'add_or_remove_items' => _x( 'Add or remove categories', 'constellation-client-portal' ), 160 'choose_from_most_used' => _x( 'Choose from the most used categories', 'constellation-client-portal' ), 161 'menu_name' => _x( 'Client Page Categories', 'constellation-client-portal' ), 159 162 ); 160 163 … … 209 212 210 213 $labels = array( 211 'name' => _x( 'Client Page Tags', ' accp_client_page_tags' ),212 'singular_name' => _x( 'Client Page Tag', ' accp_client_page_tags' ),213 'search_items' => _x( 'Search Tags', ' accp_client_page_tags' ),214 'popular_items' => _x( 'Popular Tags', ' accp_client_page_tags' ),215 'all_items' => _x( 'All Tags', ' accp_client_page_tags' ),216 'parent_item' => _x( 'Parent Tag', ' accp_client_page_tags' ),217 'parent_item_colon' => _x( 'Parent Tag:', ' accp_client_page_tags' ),218 'edit_item' => _x( 'Edit Tag', ' accp_client_page_tags' ),219 'update_item' => _x( 'Update Tag', ' accp_client_page_tags' ),220 'add_new_item' => _x( 'Add New Tag', ' accp_client_page_tags' ),221 'new_item_name' => _x( 'New Tag', ' accp_client_page_tags' ),222 'separate_items_with_commas' => _x( 'Separate tags with commas', ' accp_client_page_tags' ),223 'add_or_remove_items' => _x( 'Add or remove tags', ' accp_client_page_tags' ),224 'choose_from_most_used' => _x( 'Choose from the most used tags', ' accp_client_page_tags' ),225 'menu_name' => _x( 'Client Page Tags', ' accp_client_page_tags' ),214 'name' => _x( 'Client Page Tags', 'constellation-client-portal' ), 215 'singular_name' => _x( 'Client Page Tag', 'constellation-client-portal' ), 216 'search_items' => _x( 'Search Tags', 'constellation-client-portal' ), 217 'popular_items' => _x( 'Popular Tags', 'constellation-client-portal' ), 218 'all_items' => _x( 'All Tags', 'constellation-client-portal' ), 219 'parent_item' => _x( 'Parent Tag', 'constellation-client-portal' ), 220 'parent_item_colon' => _x( 'Parent Tag:', 'constellation-client-portal' ), 221 'edit_item' => _x( 'Edit Tag', 'constellation-client-portal' ), 222 'update_item' => _x( 'Update Tag', 'constellation-client-portal' ), 223 'add_new_item' => _x( 'Add New Tag', 'constellation-client-portal' ), 224 'new_item_name' => _x( 'New Tag', 'constellation-client-portal' ), 225 'separate_items_with_commas' => _x( 'Separate tags with commas', 'constellation-client-portal' ), 226 'add_or_remove_items' => _x( 'Add or remove tags', 'constellation-client-portal' ), 227 'choose_from_most_used' => _x( 'Choose from the most used tags', 'constellation-client-portal' ), 228 'menu_name' => _x( 'Client Page Tags', 'constellation-client-portal' ), 226 229 ); 227 230 -
constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-company.php
r3043713 r3062211 11 11 */ 12 12 13 /** 14 * Exit if accessed directly. 15 */ 13 16 if ( ! defined( 'ABSPATH' ) ) { 14 exit; // Exit if accessed directly17 exit; 15 18 } 16 19 … … 36 39 37 40 /** 38 * Initialize the class and set its properties.39 *40 41 * @since 1.0.0 41 42 * @param string $plugin_name The name of this plugin. … … 59 60 60 61 $labels = array( 61 'name' => _x( 'Client Company', ' accp_clientcompany' ),62 'singular_name' => _x( 'Client Company', ' accp_clientcompany' ),63 'add_new' => _x( 'Add New', ' accp_clientcompany' ),64 'add_new_item' => _x( 'Add New Client Company', ' accp_clientcompany' ),65 'edit_item' => _x( 'Edit Client Company', ' accp_clientcompany' ),66 'new_item' => _x( 'New Client Company', ' accp_clientcompany' ),67 'view_item' => _x( 'View Client Company', ' accp_clientcompany' ),68 'search_items' => _x( 'Search Client Companies', ' accp_clientcompany' ),69 'not_found' => _x( 'No client Companies found', ' accp_clientcompany' ),70 'not_found_in_trash' => _x( 'No client companiess found in Trash', ' accp_clientcompany' ),71 'parent_item_colon' => _x( 'Parent Client Company:', ' accp_clientcompany' ),72 'menu_name' => _x( 'Client Companies', ' accp_clientcompany' ),62 'name' => _x( 'Client Company', 'constellation-client-portal' ), 63 'singular_name' => _x( 'Client Company', 'constellation-client-portal' ), 64 'add_new' => _x( 'Add New', 'constellation-client-portal' ), 65 'add_new_item' => _x( 'Add New Client Company', 'constellation-client-portal' ), 66 'edit_item' => _x( 'Edit Client Company', 'constellation-client-portal' ), 67 'new_item' => _x( 'New Client Company', 'constellation-client-portal' ), 68 'view_item' => _x( 'View Client Company', 'constellation-client-portal' ), 69 'search_items' => _x( 'Search Client Companies', 'constellation-client-portal' ), 70 'not_found' => _x( 'No client Companies found', 'constellation-client-portal' ), 71 'not_found_in_trash' => _x( 'No client companiess found in Trash', 'constellation-client-portal' ), 72 'parent_item_colon' => _x( 'Parent Client Company:', 'constellation-client-portal' ), 73 'menu_name' => _x( 'Client Companies', 'constellation-client-portal' ), 73 74 ); 74 75 … … 321 322 322 323 add_meta_box("company-home-page", "Company Home Page", array($this, "display_home_page_meta_options"), $screen, "side"); 324 323 325 add_meta_box("company-upload-dir", "Company Upload Directory", array($this, "display_company_upload_meta_options"), $screen, "normal", "high"); 326 324 327 add_meta_box("company-primary-user", "Company Primary User", array($this, "display_company_primary_user_meta_options"), $screen, "normal", "high"); 328 325 329 add_meta_box("company-users", "Company Users", array($this, "display_company_user_meta_options"), $screen, "normal", "high"); 326 330 -
constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-core-authorization.php
r3043713 r3062211 34 34 35 35 /** 36 * Initialize the class and set its properties.37 *38 36 * @since 1.0.0 39 37 * @param string $plugin_name The name of this plugin. … … 53 51 * 54 52 * @param int $post_id - the post ID of the page or post to verify. 53 * @param int $user_id - the user ID of the current user. 55 54 * @return bool $authorized true|false - true if authorized, and false if not authorized. 56 55 */ … … 177 176 * 178 177 * @param int $company_id - the post ID of the company to verify. 178 * @param int $user_id - the user ID of the current user. 179 179 * @return bool $authorized true|false - true if authorized, and false if not authorized. 180 180 */ … … 292 292 * Get the additional assigned companies for a user. 293 293 * 294 * @param int $user_id - the ID of the user to check.295 * @return array $additional_companies - array of comapny ID's that294 * @param int $user_id - The ID of the user to check. 295 * @return array $additional_companies - Array of comapny ID's that 296 296 * the user is assigned to, if any. 297 297 */ -
constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-core-file-checks.php
r2906601 r3062211 11 11 */ 12 12 13 /** 14 * Exit if accessed directly. 15 */ 13 16 if ( ! defined( 'ABSPATH' ) ) { 14 exit; // Exit if accessed directly17 exit; 15 18 } 16 19 … … 36 39 37 40 /** 38 * Initialize the class39 *40 41 * @since 1.0.0 41 42 * @param string $plugin_name The name of this plugin. … … 76 77 /** 77 78 * Direct file access base checks. 79 * 80 * @param string $request_uri - The file URL. 78 81 */ 79 82 function accp_direct_file_access_base_checks($request_uri){ -
constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-file.php
r3043713 r3062211 11 11 */ 12 12 13 /** 14 * Exit if accessed directly. 15 */ 13 16 if ( ! defined( 'ABSPATH' ) ) { 14 exit; // Exit if accessed directly17 exit; 15 18 } 16 19 … … 66 69 67 70 $labels = array( 68 'name' => _x( 'Client Files', ' accp_clientfile' ),69 'singular_name' => _x( 'Client File', ' accp_clientfile' ),70 'add_new' => _x( 'Add New', ' accp_clientfile' ),71 'add_new_item' => _x( 'Add New Client File', ' accp_clientfile' ),72 'edit_item' => _x( 'Edit Client File', ' accp_clientfile' ),73 'new_item' => _x( 'New Client File', ' accp_clientfile' ),74 'view_item' => _x( 'View Client File', ' accp_clientfile' ),75 'search_items' => _x( 'Search Client Files', ' accp_clientfile' ),76 'not_found' => _x( 'No client files found', ' accp_clientfile' ),77 'not_found_in_trash' => _x( 'No client files found in Trash', ' accp_clientfile' ),78 'parent_item_colon' => _x( 'Parent Client File:', ' accp_clientfile' ),79 'menu_name' => _x( 'Client Files', ' accp_clientfile' ),71 'name' => _x( 'Client Files', 'constellation-client-portal' ), 72 'singular_name' => _x( 'Client File', 'constellation-client-portal' ), 73 'add_new' => _x( 'Add New', 'constellation-client-portal' ), 74 'add_new_item' => _x( 'Add New Client File', 'constellation-client-portal' ), 75 'edit_item' => _x( 'Edit Client File', 'constellation-client-portal' ), 76 'new_item' => _x( 'New Client File', 'constellation-client-portal' ), 77 'view_item' => _x( 'View Client File', 'constellation-client-portal' ), 78 'search_items' => _x( 'Search Client Files', 'constellation-client-portal' ), 79 'not_found' => _x( 'No client files found', 'constellation-client-portal' ), 80 'not_found_in_trash' => _x( 'No client files found in Trash', 'constellation-client-portal' ), 81 'parent_item_colon' => _x( 'Parent Client File:', 'constellation-client-portal' ), 82 'menu_name' => _x( 'Client Files', 'constellation-client-portal' ), 80 83 ); 81 84 … … 133 136 134 137 $labels = array( 135 'name' => _x( 'Client File Categories', ' accp_file_categories' ),136 'singular_name' => _x( 'Client File Category', ' accp_file_categories' ),137 'search_items' => _x( 'Search Categories', ' accp_file_categories' ),138 'popular_items' => _x( 'Popular Categories', ' accp_file_categories' ),139 'all_items' => _x( 'All Categories', ' accp_file_categories' ),140 'parent_item' => _x( 'Parent Category', ' accp_file_categories' ),141 'parent_item_colon' => _x( 'Parent Category:', ' accp_file_categories' ),142 'edit_item' => _x( 'Edit Category', ' accp_file_categories' ),143 'update_item' => _x( 'Update Category', ' accp_file_categories' ),144 'add_new_item' => _x( 'Add New Category', ' accp_file_categories' ),145 'new_item_name' => _x( 'New Category', ' accp_file_categories' ),146 'separate_items_with_commas' => _x( 'Separate categories with commas', ' accp_file_categories' ),147 'add_or_remove_items' => _x( 'Add or remove categories', ' accp_file_categories' ),148 'choose_from_most_used' => _x( 'Choose from the most used categories', ' accp_file_categories' ),149 'menu_name' => _x( 'Client File Categories', ' accp_file_categories' ),138 'name' => _x( 'Client File Categories', 'constellation-client-portal' ), 139 'singular_name' => _x( 'Client File Category', 'constellation-client-portal' ), 140 'search_items' => _x( 'Search Categories', 'constellation-client-portal' ), 141 'popular_items' => _x( 'Popular Categories', 'constellation-client-portal' ), 142 'all_items' => _x( 'All Categories', 'constellation-client-portal' ), 143 'parent_item' => _x( 'Parent Category', 'constellation-client-portal' ), 144 'parent_item_colon' => _x( 'Parent Category:', 'constellation-client-portal' ), 145 'edit_item' => _x( 'Edit Category', 'constellation-client-portal' ), 146 'update_item' => _x( 'Update Category', 'constellation-client-portal' ), 147 'add_new_item' => _x( 'Add New Category', 'constellation-client-portal' ), 148 'new_item_name' => _x( 'New Category', 'constellation-client-portal' ), 149 'separate_items_with_commas' => _x( 'Separate categories with commas', 'constellation-client-portal' ), 150 'add_or_remove_items' => _x( 'Add or remove categories', 'constellation-client-portal' ), 151 'choose_from_most_used' => _x( 'Choose from the most used categories', 'constellation-client-portal' ), 152 'menu_name' => _x( 'Client File Categories', 'constellation-client-portal' ), 150 153 ); 151 154 … … 192 195 193 196 $labels = array( 194 'name' => _x( 'Client File Tags', ' accp_file_tags' ),195 'singular_name' => _x( 'Client File Tags', ' accp_file_tags' ),196 'search_items' => _x( 'Search Tags', ' accp_file_tags' ),197 'popular_items' => _x( 'Popular Tags', ' accp_file_tags' ),198 'all_items' => _x( 'All Categories', ' accp_file_tags' ),199 'parent_item' => _x( 'Parent Category', ' accp_file_tags' ),200 'parent_item_colon' => _x( 'Parent Tag:', ' accp_file_tags' ),201 'edit_item' => _x( 'Edit Tag', ' accp_file_tags' ),202 'update_item' => _x( 'Update Tag', ' accp_file_tags' ),203 'add_new_item' => _x( 'Add New Tag', ' accp_file_tags' ),204 'new_item_name' => _x( 'New Tag', ' accp_file_tags' ),205 'separate_items_with_commas' => _x( 'Separate tags with commas', ' accp_file_tags' ),206 'add_or_remove_items' => _x( 'Add or remove tags', ' accp_file_tags' ),207 'choose_from_most_used' => _x( 'Choose from the most used tags', ' accp_file_tags' ),208 'menu_name' => _x( 'Client File Tags', ' accp_file_tags' ),197 'name' => _x( 'Client File Tags', 'constellation-client-portal' ), 198 'singular_name' => _x( 'Client File Tags', 'constellation-client-portal' ), 199 'search_items' => _x( 'Search Tags', 'constellation-client-portal' ), 200 'popular_items' => _x( 'Popular Tags', 'constellation-client-portal' ), 201 'all_items' => _x( 'All Categories', 'constellation-client-portal' ), 202 'parent_item' => _x( 'Parent Category', 'constellation-client-portal' ), 203 'parent_item_colon' => _x( 'Parent Tag:', 'constellation-client-portal' ), 204 'edit_item' => _x( 'Edit Tag', 'constellation-client-portal' ), 205 'update_item' => _x( 'Update Tag', 'constellation-client-portal' ), 206 'add_new_item' => _x( 'Add New Tag', 'constellation-client-portal' ), 207 'new_item_name' => _x( 'New Tag', 'constellation-client-portal' ), 208 'separate_items_with_commas' => _x( 'Separate tags with commas', 'constellation-client-portal' ), 209 'add_or_remove_items' => _x( 'Add or remove tags', 'constellation-client-portal' ), 210 'choose_from_most_used' => _x( 'Choose from the most used tags', 'constellation-client-portal' ), 211 'menu_name' => _x( 'Client File Tags', 'constellation-client-portal' ), 209 212 ); 210 213 … … 240 243 241 244 register_taxonomy( 'accp_file_tags', array('accp_clientfile'), $args ); 242 } 243 244 /** 245 * Client File Post Type fields and list table. 246 * 247 * Register the columns - Company, Categories, and Doc ID. 248 */ 249 function clientfile_column_register( $columns ) { 250 251 $new_columns = array(); 252 253 foreach ( $columns as $column_name => $column_info ) { 254 255 $new_columns[ $column_name ] = $column_info; 256 257 if ( 'title' === $column_name ) { 258 259 $new_columns['company'] = __( 'Company', 'accp' ); 260 $new_columns['status'] = __( 'Status', 'accp' ); 261 $new_columns['doc_id'] = __( 'Document ID', 'accp' ); 262 $new_columns['file_category'] = __( 'Category', 'accp' ); 263 $new_columns['due_date'] = __( 'Due Date', 'accp' ); 264 265 } 266 } 267 268 return $new_columns; 269 } 245 } 270 246 271 247 … … 388 364 function accp_add_core_file_list_filter_fields($post_type, $which){ 389 365 390 if($post_type != 'accp_clientfile') return; 366 if( $post_type != 'accp_clientfile' ) 367 return; 391 368 392 369 /** -
constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-invoice.php
r3043713 r3062211 11 11 */ 12 12 13 /** 14 * Exit if accessed directly. 15 */ 13 16 if ( ! defined( 'ABSPATH' ) ) { 14 exit; // Exit if accessed directly17 exit; 15 18 } 16 19 … … 36 39 37 40 /** 38 * Initialize the class and set its properties.39 *40 41 * @since 1.0.0 41 42 * @param string $plugin_name The name of this plugin. … … 66 67 67 68 $labels = array( 68 'name' => _x( 'Client Invoices', 'c lientinvoice' ),69 'singular_name' => _x( 'Client Invoice', 'c lientinvoice' ),70 'add_new' => _x( 'Add New', 'c lientinvoice' ),71 'add_new_item' => _x( 'Add New Client Invoice', 'c lientinvoice' ),72 'edit_item' => _x( 'Edit Client Invoice', 'c lientinvoice' ),73 'new_item' => _x( 'New Client Invoice', 'c lientinvoice' ),74 'view_item' => _x( 'View Client Invoice', 'c lientinvoice' ),75 'search_items' => _x( 'Search Client Invoices', 'c lientinvoice' ),76 'not_found' => _x( 'No client invoices found', 'c lientinvoice' ),77 'not_found_in_trash' => _x( 'No client invoices found in Trash', 'c lientinvoice' ),78 'parent_item_colon' => _x( 'Parent Client Invoice:', 'c lientinvoice' ),79 'menu_name' => _x( 'Client Invoices', 'c lientinvoice' ),69 'name' => _x( 'Client Invoices', 'constellation-client-portal' ), 70 'singular_name' => _x( 'Client Invoice', 'constellation-client-portal' ), 71 'add_new' => _x( 'Add New', 'constellation-client-portal' ), 72 'add_new_item' => _x( 'Add New Client Invoice', 'constellation-client-portal' ), 73 'edit_item' => _x( 'Edit Client Invoice', 'constellation-client-portal' ), 74 'new_item' => _x( 'New Client Invoice', 'constellation-client-portal' ), 75 'view_item' => _x( 'View Client Invoice', 'constellation-client-portal' ), 76 'search_items' => _x( 'Search Client Invoices', 'constellation-client-portal' ), 77 'not_found' => _x( 'No client invoices found', 'constellation-client-portal' ), 78 'not_found_in_trash' => _x( 'No client invoices found in Trash', 'constellation-client-portal' ), 79 'parent_item_colon' => _x( 'Parent Client Invoice:', 'constellation-client-portal' ), 80 'menu_name' => _x( 'Client Invoices', 'constellation-client-portal' ), 80 81 ); 81 82 … … 134 135 135 136 $labels = array( 136 'name' => _x( 'Client Invoice Categories', ' invoice_categories' ),137 'singular_name' => _x( 'Client Invoice Category', ' invoice_categories' ),138 'search_items' => _x( 'Search Categories', ' invoice_categories' ),139 'popular_items' => _x( 'Popular Categories', ' invoice_categories' ),140 'all_items' => _x( 'All Categories', ' invoice_categories' ),141 'parent_item' => _x( 'Parent Category', ' invoice_categories' ),142 'parent_item_colon' => _x( 'Parent Category:', ' invoice_categories' ),143 'edit_item' => _x( 'Edit Category', ' invoice_categories' ),144 'update_item' => _x( 'Update Category', ' invoice_categories' ),145 'add_new_item' => _x( 'Add New Category', ' invoice_categories' ),146 'new_item_name' => _x( 'New Category', ' invoice_categories' ),147 'separate_items_with_commas' => _x( 'Separate categories with commas', ' invoice_categories' ),148 'add_or_remove_items' => _x( 'Add or remove categories', ' invoice_categories' ),149 'choose_from_most_used' => _x( 'Choose from the most used categories', ' file_categories' ),150 'menu_name' => _x( 'Invoice Categories', ' invoice_categories' ),137 'name' => _x( 'Client Invoice Categories', 'constellation-client-portal' ), 138 'singular_name' => _x( 'Client Invoice Category', 'constellation-client-portal' ), 139 'search_items' => _x( 'Search Categories', 'constellation-client-portal' ), 140 'popular_items' => _x( 'Popular Categories', 'constellation-client-portal' ), 141 'all_items' => _x( 'All Categories', 'constellation-client-portal' ), 142 'parent_item' => _x( 'Parent Category', 'constellation-client-portal' ), 143 'parent_item_colon' => _x( 'Parent Category:', 'constellation-client-portal' ), 144 'edit_item' => _x( 'Edit Category', 'constellation-client-portal' ), 145 'update_item' => _x( 'Update Category', 'constellation-client-portal' ), 146 'add_new_item' => _x( 'Add New Category', 'constellation-client-portal' ), 147 'new_item_name' => _x( 'New Category', 'constellation-client-portal' ), 148 'separate_items_with_commas' => _x( 'Separate categories with commas', 'constellation-client-portal' ), 149 'add_or_remove_items' => _x( 'Add or remove categories', 'constellation-client-portal' ), 150 'choose_from_most_used' => _x( 'Choose from the most used categories', 'constellation-client-portal' ), 151 'menu_name' => _x( 'Invoice Categories', 'constellation-client-portal' ), 151 152 ); 152 153 … … 193 194 194 195 $labels = array( 195 'name' => _x( 'Client Invoice Tags', ' invoice_tags' ),196 'singular_name' => _x( 'Client Invoice Tags', ' invoice_tags' ),197 'search_items' => _x( 'Search Tags', ' invoice_tags' ),198 'popular_items' => _x( 'Popular Tags', ' invoice_tags' ),199 'all_items' => _x( 'All Categories', ' invoice_tags' ),200 'parent_item' => _x( 'Parent Category', ' invoice_tags' ),201 'parent_item_colon' => _x( 'Parent Tag:', ' invoice_tags' ),202 'edit_item' => _x( 'Edit Tag', ' invoice_tags' ),203 'update_item' => _x( 'Update Tag', ' invoice_tags' ),204 'add_new_item' => _x( 'Add New Tag', ' invoice_tags' ),205 'new_item_name' => _x( 'New Tag', ' invoice_tags' ),206 'separate_items_with_commas' => _x( 'Separate tags with commas', ' invoice_tags' ),207 'add_or_remove_items' => _x( 'Add or remove tags', ' invoice_tags' ),208 'choose_from_most_used' => _x( 'Choose from the most used tags', ' invoice_tags' ),209 'menu_name' => _x( 'Invoice Tags', ' invoice_tags' ),196 'name' => _x( 'Client Invoice Tags', 'constellation-client-portal' ), 197 'singular_name' => _x( 'Client Invoice Tags', 'constellation-client-portal' ), 198 'search_items' => _x( 'Search Tags', 'constellation-client-portal' ), 199 'popular_items' => _x( 'Popular Tags', 'constellation-client-portal' ), 200 'all_items' => _x( 'All Categories', 'constellation-client-portal' ), 201 'parent_item' => _x( 'Parent Category', 'constellation-client-portal' ), 202 'parent_item_colon' => _x( 'Parent Tag:', 'constellation-client-portal' ), 203 'edit_item' => _x( 'Edit Tag', 'constellation-client-portal' ), 204 'update_item' => _x( 'Update Tag', 'constellation-client-portal' ), 205 'add_new_item' => _x( 'Add New Tag', 'constellation-client-portal' ), 206 'new_item_name' => _x( 'New Tag', 'constellation-client-portal' ), 207 'separate_items_with_commas' => _x( 'Separate tags with commas', 'constellation-client-portal' ), 208 'add_or_remove_items' => _x( 'Add or remove tags', 'constellation-client-portal' ), 209 'choose_from_most_used' => _x( 'Choose from the most used tags', 'constellation-client-portal' ), 210 'menu_name' => _x( 'Invoice Tags', 'constellation-client-portal' ), 210 211 ); 211 212 … … 243 244 244 245 } 245 246 247 /** 248 * Client Invoice Post Type fields and list table. 249 * 250 * Register the columns - Company, Status, Categories, and Doc ID. 251 */ 252 function accp_clientinvoice_column_register( $columns ) { 253 254 $new_columns = array(); 255 256 foreach ( $columns as $column_name => $column_info ) { 257 258 $new_columns[ $column_name ] = $column_info; 259 260 if ( 'title' === $column_name ) { 261 $new_columns['company'] = __( 'Company', 'accp' ); 262 $new_columns['status'] = __( 'Status', 'accp' ); 263 $new_columns['doc_id'] = __( 'Document ID', 'accp' ); 264 $new_columns['file_category'] = __( 'Category', 'accp' ); 265 $new_columns['due_date'] = __( 'Due Date', 'accp' ); 266 } 267 268 } 269 270 return $new_columns; 271 272 } 246 273 247 274 248 /** -
constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-settings.php
r3043713 r3062211 5 5 * Core settings related functionality. 6 6 */ 7 8 /** 9 * Exit if accessed directly. 10 */ 7 11 if ( ! defined( 'ABSPATH' ) ) { 8 exit; // Exit if accessed directly12 exit; 9 13 } 10 14 … … 55 59 add_submenu_page( 56 60 'accp-settings', 57 __( 'General Settings', ' accp' ),58 __( 'Settings', ' accp' ),61 __( 'General Settings', 'constellation-client-portal' ), 62 __( 'Settings', 'constellation-client-portal' ), 59 63 'manage_options', 60 64 'accp-settings', … … 1196 1200 'step' => array(), 1197 1201 'maxlength' => array(), 1198 'data-post-type' => array(), 1202 'data-post-type' => array(), 1203 'media' => array(), 1199 1204 ); 1200 1205 -
constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-users.php
r2920206 r3062211 11 11 */ 12 12 13 /** 14 * Exit if accessed directly. 15 */ 13 16 if ( ! defined( 'ABSPATH' ) ) { 14 15 exit; // Exit if accessed directly 16 17 exit; 17 18 } 18 19 … … 38 39 39 40 /** 40 * Initialize the class and set its properties.41 *42 41 * @since 1.0.0 43 42 * @param string $plugin_name The name of this plugin. … … 50 49 $this->accp_utility_functions = new ACCP_Utility_Functions(); 51 50 51 } 52 53 54 /** 55 * Add user profile fields. 56 * 57 * @param object $user - The user object. 58 * 59 * @hooked show_user_profile. 60 * @hooked edit_user_profile. 61 * @hooked user_new_form. 62 */ 63 function add_core_user_profile_fields($user){ 64 65 if( !is_admin() || !is_user_logged_in() || !current_user_can('manage_options') ) 66 return; 67 68 if( !$user || !is_object($user) ) 69 return; 70 71 $user_id = $user->ID; 72 73 if(!$user_id) 74 return; 75 76 /** 77 * Define the allowed html for wp_kses. 78 */ 79 $accp_settings = new ARS_Constellation_Client_Portal_Settings(); 80 $allowed_html = $accp_settings->get_customized_allowed_html_for_wp_kses(); 81 82 echo wp_kses( $this->get_core_user_fields_html($user, $user_id), $allowed_html ); 83 84 } 85 86 87 /** 88 * Get the core user profile fields html. 89 * 90 * @param object $user - The user object. 91 * @param int $user_id - The user ID. 92 */ 93 function get_core_user_fields_html($user, $user_id){ 94 95 if( !is_admin() || !is_user_logged_in() ) 96 return; 97 98 if( !$user || !$user_id ) 99 return; 100 101 $wp_post_statuses = get_post_statuses() ? array_keys( (array)get_post_statuses() ) : array(); 102 103 $html = ''; 104 105 $html .= '<h2>Constellation Client Information</h2>'; 106 107 $html .= '<table class="form-table">'; 108 109 /** 110 * Primary Company section. 111 */ 112 $html .= $this->get_user_primary_company_html($user, $user_id); 113 114 115 /** 116 * Client Status section. 117 */ 118 $html .= $this->get_user_client_status_html($user, $user_id); 119 120 121 /** 122 * Additional Assigned Companies section. 123 */ 124 $html .= $this->get_user_additional_companies_html($user, $user_id); 125 126 127 /** 128 * Allow content to be added after the core 129 * user content. 130 * 131 * Buffer the output of the hook so that it 132 * appears in the expected position. 133 * 134 * Hook - accp_after_user_profile_settings. 135 */ 136 if( is_admin() && is_user_logged_in() && current_user_can('manage_options') ){ 137 138 ob_start(); 139 140 do_action('accp_after_user_profile_settings', $user_id); 141 142 $html .= ob_get_contents(); 143 144 ob_end_clean(); 145 146 } 147 148 $html .= '</table>'; 149 150 return $html; 151 152 } 153 154 155 /** 156 * Get the user profile primary company section html. 157 * 158 * @param object $user - The user object. 159 * @param int $user_id - The user ID. 160 * 161 * @return string $html - The section html. 162 */ 163 function get_user_primary_company_html($user, $user_id){ 164 165 if( !is_admin() || !is_user_logged_in() ) 166 return; 167 168 if( !$user || !$user_id ) 169 return; 170 171 $saved_company = is_object($user) ? get_user_meta($user_id, 'client_company', true) : ''; 172 173 $html = ''; 174 175 $html .= '<tr>'; 176 177 $html .= '<th><label for="client_company">Company</label></th>'; 178 179 $html .= '<td>'; 180 181 if ( current_user_can('manage_options') ){ 182 183 $args = array( 184 'post_type' => 'accp_clientcompany', 185 ); 186 187 /** 188 * Include all defined WP post statuses, 189 * not just "publish." 190 */ 191 if(!empty($wp_post_statuses)){ 192 193 $args['post_status'] = $wp_post_statuses; 194 195 } 196 197 $company_list = get_pages($args); 198 199 $html .= '<select name="client_company" id="client_company">'; 200 201 $html .= '<option value="">Select a company...</option>'; 202 203 foreach( $company_list as $key => $company ){ 204 205 $company_id = $company->ID; 206 $company_name = $company->post_title; 207 $selected = $saved_company && (int)$saved_company === (int)$company_id ? "selected" : ""; 208 $post_status_class = ''; 209 210 if( $company->post_status != 'publish' ){ 211 212 $company_name = $company_name . ' (' . $company->post_status . ')'; 213 $post_status_class = "accp-non-published-post-option"; 214 215 } 216 217 $html .= '<option class="level-0 '. esc_attr($post_status_class) .'" value="'. esc_attr($company_id) .'" '. esc_attr($selected) .' >'. esc_html($company_name) .'</option>'; 218 219 } 220 221 $html .= '</select>'; 222 223 }else{ 224 225 if( !empty($saved_company) ){ 226 227 $html .= esc_html(get_the_title($saved_company)); 228 229 } 230 231 } 232 233 $html .= '<br />'; 234 235 $html .= '</td>'; 236 237 $html .= '</tr>'; 238 239 return $html; 240 241 } 242 243 244 /** 245 * Get the user profile client status section html. 246 * 247 * @param object $user - The user object. 248 * @param int $user_id - The user ID. 249 * 250 * @return string $html - The section html. 251 */ 252 function get_user_client_status_html($user, $user_id){ 253 254 if( !is_admin() || !is_user_logged_in() ) 255 return; 256 257 if( !$user || !$user_id ) 258 return; 259 260 $saved_status = is_object($user) ? get_user_meta($user->ID, 'client_status', true) : ''; 261 262 $html = ''; 263 264 $html .= '<tr>'; 265 266 $html .= '<th>'; 267 268 $html .= '<label for="client_status">'; 269 270 $html .= 'Client Status'; 271 272 if( is_user_logged_in() && current_user_can('manage_options') ){ 273 274 $html .= '<span class="accp-admin-tooltip-icon">i</span>'; 275 276 $html .= '<span class="accp-wp-admin-tooltip accp-wp-admin-tooltip-dark accp-wp-admin-has-tooltip-center accp-user-status-tooltip">A status of <strong>Inactive</strong> or <strong>Pending</strong> will prevent the user from accessing client pages, invoices, and files.</span>'; 277 278 } 279 280 $html .= '</label>'; 281 282 $html .= '</th>'; 283 284 $html .= '<td>'; 285 286 if ( current_user_can('manage_options') ){ 287 288 $html .= '<select name="client_status" id="client-status" value="'.esc_attr($saved_status).'">'; 289 290 $html .= '<option value="active" '. ($saved_status == "active" ? esc_attr("selected") : "") .'>Active</option>'; 291 292 $html .= '<option value="inactive" '. ($saved_status == "inactive" ? esc_attr("selected") : "") .'>Inactive</option>'; 293 294 $html .= '<option value="pending" '. ($saved_status == "pending" ? esc_attr("selected") : "") .'>Pending</option>'; 295 296 $html .= '</select>'; 297 298 }else{ 299 300 if(!empty($saved_status)){ 301 302 $html .= esc_html($saved_status); 303 304 } 305 306 } 307 308 $html .= '</td>'; 309 310 $html .= '</tr>'; 311 312 return $html; 313 314 } 315 316 317 /** 318 * Get the user profile additional companies section html. 319 * 320 * @param object $user - The user object. 321 * @param int $user_id - The user ID. 322 * 323 * @return string $html - The section html. 324 */ 325 function get_user_additional_companies_html($user, $user_id){ 326 327 if( !is_admin() || !is_user_logged_in() ) 328 return; 329 330 if( !$user || !$user_id ) 331 return; 332 333 $label = current_user_can('manage_options') ? 'Assign Additional Companies' : 'Additional Companies'; 334 $saved_companies = array(); 335 336 if(is_object($user)){ 337 338 if ( get_user_meta($user_id, 'client_additional_company', true) && !empty(get_user_meta($user_id, 'client_additional_company', true)) ){ 339 340 $saved_companies = (array)get_user_meta( $user_id, 'client_additional_company', true ); 341 342 } 343 344 } 345 346 $html = ''; 347 348 $html .= '<tr>'; 349 350 $html .= '<th>'; 351 352 $html .= '<label for="client_company">'. esc_html($label) .'</label>'; 353 354 $html .= '</th>'; 355 356 $html .= '<td>'; 357 358 if ( current_user_can('manage_options') ){ 359 360 $args = array( 361 'post_type' => 'accp_clientcompany', 362 ); 363 364 /** 365 * Include all defined WP post statuses, 366 * not just "publish." 367 */ 368 if(!empty($wp_post_statuses)){ 369 370 $args['post_status'] = $wp_post_statuses; 371 372 } 373 374 $company_list = get_pages($args); 375 376 $html .= '<select class="client-add-company-select" name="client_additional_company[]" value="" multiple="multiple" >'; 377 378 foreach( $company_list as $company ){ 379 380 $company_id = $company->ID; 381 $company_name = $company->post_title; 382 $selected = in_array( $company_id , $saved_companies ) ? "selected" : ""; 383 $post_status_class = ''; 384 385 if( $company->post_status != 'publish' ){ 386 387 $company_name = $company_name . ' (' . $company->post_status . ')'; 388 $post_status_class = "accp-non-published-post-option"; 389 390 } 391 392 393 $html .= '<option class="level-0 '. esc_attr($post_status_class) .'" value="'. esc_attr($company_id) .'" '. esc_attr($selected) .' >'. esc_html($company_name) .'</option>'; 394 395 396 } 397 398 $html .= '</select>'; 399 400 }else{ 401 402 if( !empty($saved_companies) ){ 403 404 $html .= '<ul>'; 405 406 foreach( $saved_companies as $saved_company ){ 407 408 $html .= '<li>' . esc_html(get_the_title($saved_company)) . '</li>'; 409 410 } 411 412 $html .= '</ul>'; 413 414 } 415 416 } 417 418 $html .= '</td>'; 419 420 $html .= '</tr>'; 421 422 return $html; 423 424 } 425 426 427 /** 428 * Check user global page suitability. If a user 429 * is assigned to only 1 company, they are suitable 430 * for global pages, otherwise they are not. 431 * 432 * @param int $user_id - The ID of the user to check. 433 * 434 * @return bool $is_eligible - true|false. 435 */ 436 function check_if_user_is_eligible_for_global_pages($user_id){ 437 438 $primary_company_id = get_user_meta($user_id, 'client_company', true); 439 $additional_company_ids = get_user_meta($user_id, 'client_additional_company', true); 440 441 /** 442 * Return true if a primary company is assigned and no 443 * additional companies are assigned. 444 */ 445 if( $primary_company_id && ( !$additional_company_ids || empty($additional_company_ids) ) ) 446 return true; 447 448 449 /** 450 * Return true if a primary company is not assigned and only 451 * one additional company is assigned. 452 */ 453 if( !$primary_company_id && $additional_company_ids && is_array($additional_company_ids) ){ 454 455 if( count($additional_company_ids) === 1) 456 return true; 457 458 } 459 460 461 /** 462 * Return true if a primary company is not assigned and 463 * no additional companies are assigned. 464 */ 465 if( !$primary_company_id && ( !$additional_company_ids || empty($additional_company_ids) ) ){ 466 467 return true; 468 469 } 470 471 return false; 472 473 } 474 475 476 /** 477 * Save user profile fields. 478 * 479 * @param int $user_id - The user ID. 480 * 481 * @hooked personal_options_update. 482 * @hooked edit_user_profile_update. 483 * @hooked user_register. 484 */ 485 function save_extra_user_profile_fields($user_id) { 486 487 if ( !current_user_can( 'edit_user', $user_id ) ) { 488 return false; 489 } 490 491 /** 492 * Assigned Company 493 */ 494 if(isset($_POST['client_company'])){ 495 496 $company_id = $this->accp_utility_functions->accp_sanitize_integers($_POST['client_company']); 497 update_user_meta( $user_id, 'client_company', $company_id ); 498 499 } 500 501 /** 502 * User Client Status 503 */ 504 if(isset($_POST['client_status'])){ 505 506 $client_status = filter_var($_POST['client_status'], FILTER_SANITIZE_STRING); 507 update_user_meta( $user_id, 'client_status', $client_status ); 508 509 } 510 511 /** 512 * Additional Companies 513 */ 514 if (!empty($_POST['client_additional_company'])){ 515 516 $sanitized_company_array = array(); 517 foreach( $_POST['client_additional_company'] as $additional_company_id ){ 518 519 $sanitized_company_array[] = $this->accp_utility_functions->accp_sanitize_integers($additional_company_id); 520 521 } 522 523 update_user_meta( $user_id, 'client_additional_company', $sanitized_company_array ); 524 525 }else{ 526 527 delete_user_meta( $user_id, 'client_additional_company'); 528 529 } 530 52 531 } 53 532 … … 231 710 232 711 } 712 233 713 234 714 } // END ARS_Constellation_Client_Portal_Users -
constellation-client-portal/trunk/admin/css/ars-constellation-client-portal-admin.css
r3043713 r3062211 1 1 /** 2 * Admin-specific CSS 3 */ 4 2 * Core Admin CSS. 3 */ 5 4 #client-meta .select2{ 6 5 width: 100% !important; … … 15 14 } 16 15 17 .home-page-hov-nav li {16 .home-page-hov-nav li{ 18 17 display: inline; 19 18 font-size: 13px; … … 36 35 } 37 36 38 .accp-number-column {37 .accp-number-column{ 39 38 width: 40px; 40 39 text-align: center; … … 47 46 } 48 47 49 .fa.fa-folder.dir-explorer-icon, .fa.fa-folder-open.dir-explorer-icon {48 .fa.fa-folder.dir-explorer-icon, .fa.fa-folder-open.dir-explorer-icon{ 50 49 font-size: 19px; 51 50 } … … 54 53 display: none; 55 54 } 56 57 /* .alternate, .striped > tbody > :nth-child(3n + 1) {58 background-color: #f9f9f9;59 } */60 55 61 56 .main-dir-row.even-row, .file-detail-row.even-row{ … … 67 62 } 68 63 69 .unassigned-text {64 .unassigned-text{ 70 65 color: #B1B1B1; 71 66 } 72 67 73 .file-controls {68 .file-controls{ 74 69 display: block; 75 70 width: 100%; … … 77 72 } 78 73 79 .file-del-confirm-div, .dir-del-confirm-div {74 .file-del-confirm-div, .dir-del-confirm-div{ 80 75 margin-bottom: 30px; 81 76 padding-bottom: 30px; … … 87 82 } 88 83 89 .del-btn-container, .del-dir-btn-container {84 .del-btn-container, .del-dir-btn-container{ 90 85 display: block; 91 86 margin-top: 8px; 92 87 } 93 88 94 .inactive-text {89 .inactive-text{ 95 90 color: #B1B1B1; 96 91 } 97 92 98 .small-note {93 .small-note{ 99 94 font-size: 11px; 100 95 font-style: italic; 101 96 } 102 97 103 .tax-role-exclude {98 .tax-role-exclude{ 104 99 margin-top: 15px; 105 100 margin-bottom: 40px; … … 113 108 .tax-role-exclude .select2, 114 109 .tax-company-exclude .select2, 115 .tax-custom-select .select2 {110 .tax-custom-select .select2{ 116 111 width: 95% !important; 117 112 } 118 113 119 .accp-settings-messages-and-errors-item.notice {114 .accp-settings-messages-and-errors-item.notice{ 120 115 padding-top: 20px; 121 116 padding-bottom: 20px; 122 117 } 123 118 124 .accp-settings-note.small-note {119 .accp-settings-note.small-note{ 125 120 display: block; 126 121 margin-top: 7px; 127 122 } 128 123 129 #accp-admin-main-content {124 #accp-admin-main-content{ 130 125 max-width: 100%; 131 126 background-color: #fff; … … 145 140 } 146 141 147 .company-assign-container .select2-selection__arrow {142 .company-assign-container .select2-selection__arrow{ 148 143 top: 10px !important; 149 144 right: 3px !important; 150 145 } 151 146 152 .accp-upgrade-tab-banner {147 .accp-upgrade-tab-banner{ 153 148 background-color: #005be0; 154 149 color: #FFF; … … 159 154 } 160 155 161 .accp-upgrade-tab-banner h2 {156 .accp-upgrade-tab-banner h2{ 162 157 color: #fff; 163 158 font-size: 40px; … … 165 160 } 166 161 167 .accp-upgrade-tab-banner p {162 .accp-upgrade-tab-banner p{ 168 163 font-size: 18px; 169 164 font-style: italic; … … 177 172 } 178 173 179 .accp-upgrade-tab-banner a {174 .accp-upgrade-tab-banner a{ 180 175 color: #fff; 181 176 text-decoration: none; … … 186 181 } 187 182 188 .accp-upgrade-tab-banner a::after {183 .accp-upgrade-tab-banner a::after{ 189 184 content: '>'; 190 185 font-weight: bold; … … 193 188 } 194 189 195 .accp-upgrade-button {190 .accp-upgrade-button{ 196 191 background-color: orange; 197 192 display: block; … … 213 208 } 214 209 215 .accp-settings-page-container .accp-upgrade-button {210 .accp-settings-page-container .accp-upgrade-button{ 216 211 border-radius: 8px; 217 212 } … … 225 220 } 226 221 227 .accp-setting-logo-container {222 .accp-setting-logo-container{ 228 223 background-color: #fff; 229 224 } 230 225 231 .accp-setting-logo-container img {226 .accp-setting-logo-container img{ 232 227 width: 80%; 233 228 max-width: 300px; … … 239 234 } 240 235 241 .delete-screen-notice {236 .delete-screen-notice{ 242 237 display: inline-block; 243 238 margin-top: 6px; … … 261 256 } 262 257 263 .accp-filemgmt-button.button {258 .accp-filemgmt-button.button{ 264 259 margin-right: 5px !important; 265 260 } 266 .accp-filemgmt-button.button:last-child {261 .accp-filemgmt-button.button:last-child{ 267 262 margin-right: 0px !important; 268 263 } … … 280 275 } 281 276 282 li.accp-filemgmt-button.button {277 li.accp-filemgmt-button.button{ 283 278 padding: 0 !important; 284 279 overflow: hidden; … … 286 281 } 287 282 288 .shortcode-markup {283 .shortcode-markup{ 289 284 border: 1px solid #ccc; 290 285 background-color: #efefef; … … 317 312 } 318 313 319 #curr_file_container {314 #curr_file_container{ 320 315 border-bottom: 1px solid #eee; 321 316 padding-bottom: 25px; … … 329 324 } 330 325 331 .wp-admin input[type="file"].accp-upload-btn {326 .wp-admin input[type="file"].accp-upload-btn{ 332 327 padding-left: 7px; 333 328 padding-right: 7px; … … 335 330 } 336 331 337 .accp-settings-section {332 .accp-settings-section{ 338 333 background-color: #fff; 339 334 padding-top: 10px; … … 346 341 } 347 342 348 .accp-settings-section h3 {343 .accp-settings-section h3{ 349 344 color: #3A3A3A; 350 345 } 351 346 352 .accp-settings-section h2 {347 .accp-settings-section h2{ 353 348 color: #005be0; 354 349 font-weight: normal; … … 356 351 } 357 352 358 ul.theme-thumb-list {353 ul.theme-thumb-list{ 359 354 list-style: none; 360 355 } 361 356 362 ul.theme-thumb-list li {357 ul.theme-thumb-list li{ 363 358 border: 1px solid #ccc; 364 359 background: #efefef; … … 368 363 369 364 /* Odd */ 370 ul.theme-thumb-list li:nth-child(2n+1) {365 ul.theme-thumb-list li:nth-child(2n+1){ 371 366 float: left; 372 367 } 373 368 374 369 /* Even */ 375 ul.theme-thumb-list li:nth-child(2n) {370 ul.theme-thumb-list li:nth-child(2n){ 376 371 float: right; 377 372 } … … 388 383 } 389 384 390 select[name="accp_login_redirect_select"] {385 select[name="accp_login_redirect_select"]{ 391 386 margin-top: 7px; 392 387 } 393 388 394 ul.accp-settings-tabs {389 ul.accp-settings-tabs{ 395 390 border-bottom: 1px solid #ddd; 396 391 margin-bottom: 25px; 397 392 } 398 393 399 .accp-settings-tabs li {394 .accp-settings-tabs li{ 400 395 display: inline-block; 401 396 background-color: #e0e0e0; … … 427 422 } 428 423 429 .accp-shortcode-col-heading {424 .accp-shortcode-col-heading{ 430 425 font-weight: bold; 431 426 color: #777; … … 451 446 } 452 447 453 input.accp-copy-text-enabled {448 input.accp-copy-text-enabled{ 454 449 cursor: pointer; 455 450 background-color: #eee; … … 464 459 } 465 460 466 .accp-shortcode-input-container:hover::after {467 display: block; 468 } 469 470 .accp-shortcode-input-container::after {461 .accp-shortcode-input-container:hover::after{ 462 display: block; 463 } 464 465 .accp-shortcode-input-container::after{ 471 466 content: "\f0c5"; 472 467 font-family: "Font Awesome 5 Free"; … … 477 472 } 478 473 479 .accp-shortcode-input-container.accp-element-copied::after {474 .accp-shortcode-input-container.accp-element-copied::after{ 480 475 content: "\f00c"; 481 476 font-family: "Font Awesome 5 Free"; … … 487 482 } 488 483 489 .accp-settings-tabs li:hover {484 .accp-settings-tabs li:hover{ 490 485 background-color: #fff; 491 486 } … … 507 502 } 508 503 509 .accp-settings-tabs a {504 .accp-settings-tabs a{ 510 505 text-decoration: none; 511 506 font-size: 11px; … … 515 510 } 516 511 517 .accp-settings-tabs a:focus {512 .accp-settings-tabs a:focus{ 518 513 outline: none; 519 514 -webkit-box-shadow: none; … … 529 524 } 530 525 531 .accp-create-page-container {526 .accp-create-page-container{ 532 527 margin-top: 15px; 533 528 } 534 529 535 .accp-new-page-title {530 .accp-new-page-title{ 536 531 margin-bottom: 10px; 537 532 } 538 533 539 .accp-generate-page-form .accp-create-new-page-instructions {534 .accp-generate-page-form .accp-create-new-page-instructions{ 540 535 margin-top: 25px; 541 536 display: block; … … 546 541 } 547 542 548 .tablenav .select2-selection.select2-selection--single {543 .tablenav .select2-selection.select2-selection--single{ 549 544 height: 100%; 550 545 border-radius: 3px; … … 559 554 } 560 555 561 label .title.accp-quickedit-invoice-status-label {556 label .title.accp-quickedit-invoice-status-label{ 562 557 width: auto !important; 563 558 margin-right: 5px !important; 564 559 } 565 560 566 .accp-admin-invoice-data-quickedit {561 .accp-admin-invoice-data-quickedit{ 567 562 margin-bottom: 0; 568 563 } 569 564 570 .accp-duplicate-dir-assignment-notice {565 .accp-duplicate-dir-assignment-notice{ 571 566 padding: 15px; 572 567 border: 2px solid #ff5e5e; … … 575 570 } 576 571 577 .accp-reassign-directory-button.button {572 .accp-reassign-directory-button.button{ 578 573 margin-top: 15px; 579 574 margin-bottom: 15px; 580 575 } 581 576 582 .accp-dir-reassign-option {577 .accp-dir-reassign-option{ 583 578 background-color: #f6f7f7; 584 579 padding-top: 10px; … … 590 585 } 591 586 592 .accp-field-note {587 .accp-field-note{ 593 588 font-style: italic; 594 589 color: #808080; … … 599 594 } 600 595 601 .accp-boxed-container {596 .accp-boxed-container{ 602 597 background-color: #f6f7f7; 603 598 border: 1px solid #eeefef; … … 606 601 } 607 602 608 .accp-boxed-container.current-assigned-company-container {603 .accp-boxed-container.current-assigned-company-container{ 609 604 margin-bottom: 20px; 610 605 } 611 606 612 .accp-boxed-container label {607 .accp-boxed-container label{ 613 608 font-weight: 600; 614 609 padding-top: 15px; 615 610 } 616 611 617 .accp-or-sparator {612 .accp-or-sparator{ 618 613 font-weight: 600; 619 614 } … … 640 635 } 641 636 642 .accp-wp-admin-tooltip {637 .accp-wp-admin-tooltip{ 643 638 position: absolute; 644 639 z-index: 1; … … 656 651 } 657 652 658 .accp-wp-admin-tooltip-dark {653 .accp-wp-admin-tooltip-dark{ 659 654 position: absolute; 660 655 z-index: 1; … … 672 667 } 673 668 674 .accp-wp-admin-tooltip.accp-user-status-tooltip {669 .accp-wp-admin-tooltip.accp-user-status-tooltip{ 675 670 left: 0; 676 671 } 677 672 678 .accp-wp-admin-tooltip::after {673 .accp-wp-admin-tooltip::after{ 679 674 content:''; 680 675 position: absolute; … … 689 684 } 690 685 691 .accp-wp-admin-tooltip-dark::after {686 .accp-wp-admin-tooltip-dark::after{ 692 687 border-top: solid 10px #3c434a; 693 688 } 694 689 695 .accp-wp-admin-has-tooltip-center {690 .accp-wp-admin-has-tooltip-center{ 696 691 left: 12%; 697 692 margin-top: -115px; 698 693 } 699 694 700 .accp-company-global-page-tooltip {695 .accp-company-global-page-tooltip{ 701 696 margin-top: -143px; 702 697 } 703 698 704 .accp-generate-page-form p.accp-create-new-page-instructions {699 .accp-generate-page-form p.accp-create-new-page-instructions{ 705 700 margin-top: 20px; 706 701 } 707 702 708 .accp-generate-new-page-field-container {703 .accp-generate-new-page-field-container{ 709 704 display: block; 710 705 margin-bottom: 10px; 711 706 } 712 707 713 .button.button-primary.accp-generate-new-page {708 .button.button-primary.accp-generate-new-page{ 714 709 margin-top: 15px; 715 710 } 716 711 717 .accp-unpublished-company-item {712 .accp-unpublished-company-item{ 718 713 padding: 10px; 719 714 background-color: #fff; … … 722 717 } 723 718 724 .accp-delete-unpublished-company-item {719 .accp-delete-unpublished-company-item{ 725 720 display: inline-block; 726 721 background-color: #C3C3C3; … … 743 738 } 744 739 745 option.accp-non-published-post-option {740 option.accp-non-published-post-option{ 746 741 color: #717171; 747 742 } 748 743 749 .accp-boxed-container label[for="accp_make_page_global"] {744 .accp-boxed-container label[for="accp_make_page_global"]{ 750 745 display: block; 751 746 padding-bottom: 15px; 752 747 } 753 748 754 .accp-boxed-container.accp-specify-company-field-container .select2-container {749 .accp-boxed-container.accp-specify-company-field-container .select2-container{ 755 750 padding-bottom: 15px; 756 751 } 757 752 758 .accp-boxed-container.current-assigned-company-container p {753 .accp-boxed-container.current-assigned-company-container p{ 759 754 padding-top: 15px; 760 755 padding-bottom: 15px; … … 769 764 } 770 765 771 .accp-dir-update-notice {766 .accp-dir-update-notice{ 772 767 border: 2px solid #c9d1de; 773 768 background-color: #e0e8f5; … … 775 770 } 776 771 777 .accp-dir-update-check-label {772 .accp-dir-update-check-label{ 778 773 display: block; 779 774 margin-bottom: 10px; 780 775 } 781 776 782 #accp-create-user-container {777 #accp-create-user-container{ 783 778 margin-top: 25px; 784 779 } 785 780 786 .accp-new-user-field {781 .accp-new-user-field{ 787 782 display: block; 788 783 margin-bottom: 20px; 789 784 } 790 785 791 .accp-set-width-label-85 {786 .accp-set-width-label-85{ 792 787 width: 85px; 793 788 display: inline-block; 794 789 } 795 790 796 #accp-autogenerate-password {791 #accp-autogenerate-password{ 797 792 margin-left: 10px; 798 793 } … … 812 807 } 813 808 814 #accp-assign-primary-user-container {809 #accp-assign-primary-user-container{ 815 810 border: 1px solid #eeefef; 816 811 margin-top: 25px; … … 822 817 } 823 818 824 .accp-assign-primary-user-heading {819 .accp-assign-primary-user-heading{ 825 820 display: block; 826 821 margin-top: 20px; … … 835 830 } 836 831 837 .accp-upgrade-pro-feature-item-container:hover {832 .accp-upgrade-pro-feature-item-container:hover{ 838 833 background-color: #005be0; 839 834 } … … 863 858 } 864 859 865 .accp-upgrade-pro-feature-item-container:hover > a .accp-upgrade-pro-feature-item-title {860 .accp-upgrade-pro-feature-item-container:hover > a .accp-upgrade-pro-feature-item-title{ 866 861 color: #fff; 867 862 } … … 875 870 } 876 871 877 .accp-upgrade-pro-feature-item-title {872 .accp-upgrade-pro-feature-item-title{ 878 873 font-size: 21px; 879 874 line-height: 27px; … … 881 876 } 882 877 883 .accp-upgrade-pro-feature-item-container p {878 .accp-upgrade-pro-feature-item-container p{ 884 879 color: #777; 885 880 font-size: 14px; 886 881 } 887 882 888 .accp-upgrade-pro-feature-item-container a {883 .accp-upgrade-pro-feature-item-container a{ 889 884 text-decoration: none; 890 885 width: 100%; … … 893 888 } 894 889 895 .accp-settings-section-inner {890 .accp-settings-section-inner{ 896 891 border-bottom: 1px solid #eee; 897 892 padding-bottom: 15px; … … 899 894 } 900 895 901 .company_status_row {896 .company_status_row{ 902 897 margin-bottom: 15px; 903 898 } … … 905 900 .company_status_row label, 906 901 .company_status_row input, 907 .company_status_row select {902 .company_status_row select{ 908 903 margin-right: 5px; 909 904 } 910 905 911 .company_status_row .accp-row-add {906 .company_status_row .accp-row-add{ 912 907 margin-left: 5px; 913 908 margin-right: 10px; 914 909 } 915 910 916 .company_status_row i {911 .company_status_row i{ 917 912 font-size: 15px; 918 913 position: relative; … … 921 916 } 922 917 923 .accp-add-status-row.button {918 .accp-add-status-row.button{ 924 919 cursor: pointer; 925 920 } … … 929 924 } 930 925 931 #accp-settings-sidebar-container {926 #accp-settings-sidebar-container{ 932 927 padding-left: 20px; 933 928 padding-top: 20px; … … 938 933 } 939 934 940 .accp-settings-page-container.wrap {935 .accp-settings-page-container.wrap{ 941 936 background-color: #fff; 942 937 min-height: 800px; 943 938 } 944 939 945 .accp-admin-main-content-header {940 .accp-admin-main-content-header{ 946 941 margin-bottom: 15px; 947 942 } … … 954 949 } 955 950 956 @media screen and (min-width: 980px) {957 958 .accp-upgrade-pro-feature-short-list {951 @media screen and (min-width: 980px){ 952 953 .accp-upgrade-pro-feature-short-list{ 959 954 display: grid; 960 955 grid-template-columns: auto auto auto; … … 966 961 } 967 962 968 #accp-admin-main-content {963 #accp-admin-main-content{ 969 964 margin-left: 200px; 970 965 } -
constellation-client-portal/trunk/admin/css/jquery-ui/1.11.1/themes/cupertino/jquery-ui.css
r2663884 r3062211 846 846 .ui-widget-content { 847 847 border: 1px solid #dddddd; 848 background: #f2f5f7 url("images/ui-bg_highlight-hard_100_f2f5f7_1x100.png") 50% top repeat-x;848 background: #f2f5f7 /* url("images/ui-bg_highlight-hard_100_f2f5f7_1x100.png") 50% top repeat-x */; 849 849 color: #362b36; 850 850 } … … 854 854 .ui-widget-header { 855 855 border: 1px solid #aed0ea; 856 background: #deedf7 url("images/ui-bg_highlight-soft_100_deedf7_1x100.png") 50% 50% repeat-x;856 background: #deedf7 /* url("images/ui-bg_highlight-soft_100_deedf7_1x100.png") 50% 50% repeat-x */; 857 857 color: #222222; 858 858 font-weight: bold; … … 868 868 .ui-widget-header .ui-state-default { 869 869 border: 1px solid #aed0ea; 870 background: #d7ebf9 url("images/ui-bg_glass_80_d7ebf9_1x400.png") 50% 50% repeat-x;870 background: #d7ebf9 /* url("images/ui-bg_glass_80_d7ebf9_1x400.png") 50% 50% repeat-x */; 871 871 font-weight: bold; 872 872 color: #2779aa; … … 885 885 .ui-widget-header .ui-state-focus { 886 886 border: 1px solid #74b2e2; 887 background: #e4f1fb url("images/ui-bg_glass_100_e4f1fb_1x400.png") 50% 50% repeat-x;887 background: #e4f1fb /* url("images/ui-bg_glass_100_e4f1fb_1x400.png") 50% 50% repeat-x */; 888 888 font-weight: bold; 889 889 color: #0070a3; … … 904 904 .ui-widget-header .ui-state-active { 905 905 border: 1px solid #2694e8; 906 background: #3baae3 url("images/ui-bg_glass_50_3baae3_1x400.png") 50% 50% repeat-x;906 background: #3baae3 /* url("images/ui-bg_glass_50_3baae3_1x400.png") 50% 50% repeat-x */; 907 907 font-weight: bold; 908 908 color: #ffffff; … … 921 921 .ui-widget-header .ui-state-highlight { 922 922 border: 1px solid #f9dd34; 923 background: #ffef8f url("images/ui-bg_highlight-soft_25_ffef8f_1x100.png") 50% top repeat-x;923 background: #ffef8f /* url("images/ui-bg_highlight-soft_25_ffef8f_1x100.png") 50% top repeat-x */; 924 924 color: #363636; 925 925 } … … 933 933 .ui-widget-header .ui-state-error { 934 934 border: 1px solid #cd0a0a; 935 background: #cd0a0a url("images/ui-bg_flat_15_cd0a0a_40x100.png") 50% 50% repeat-x;935 background: #cd0a0a /* url("images/ui-bg_flat_15_cd0a0a_40x100.png") 50% 50% repeat-x */; 936 936 color: #ffffff; 937 937 } … … 977 977 height: 16px; 978 978 } 979 .ui-icon,979 /* .ui-icon, 980 980 .ui-widget-content .ui-icon { 981 981 background-image: url("images/ui-icons_72a7cf_256x240.png"); … … 1000 1000 .ui-state-error-text .ui-icon { 1001 1001 background-image: url("images/ui-icons_ffffff_256x240.png"); 1002 } 1002 } */ 1003 1003 1004 1004 /* positioning */ … … 1212 1212 /* Overlays */ 1213 1213 .ui-widget-overlay { 1214 background: #eeeeee url("images/ui-bg_diagonals-thick_90_eeeeee_40x40.png") 50% 50% repeat;1214 background: #eeeeee /* url("images/ui-bg_diagonals-thick_90_eeeeee_40x40.png") 50% 50% repeat */; 1215 1215 opacity: .8; 1216 1216 filter: Alpha(Opacity=80); /* support: IE8 */ … … 1219 1219 margin: -7px 0 0 -7px; 1220 1220 padding: 7px; 1221 background: #000000 url("images/ui-bg_highlight-hard_70_000000_1x100.png") 50% top repeat-x;1221 background: #000000 /* url("images/ui-bg_highlight-hard_70_000000_1x100.png") 50% top repeat-x */; 1222 1222 opacity: .3; 1223 1223 filter: Alpha(Opacity=30); /* support: IE8 */ -
constellation-client-portal/trunk/admin/js/ars-constellation-client-portal-admin.js
r3043713 r3062211 5 5 accp_admin_make_company_select_field_required(); 6 6 7 accp_initiate_core_select2_fields(); 8 9 // Delete file associated with accp_clientfile post 10 // when 'permanently delete' is clicked 7 accp_initiate_core_select2_fields(); 8 9 accp_delete_file_attachment_on_post_permanent_delete(); 10 11 accp_delete_file_attachment_on_bulk_post_permanent_delete(); 12 13 accp_delete_file_attachment_on_post_empty_trash(); 14 15 accp_admin_toggle_file_reassign_form(); 16 17 accp_admin_toggle_file_replace_form(); 18 19 accp_reassign_post_company_on_click(); 20 21 accp_create_company_directory_on_click(); 22 23 accp_assign_company_directory_on_click(); 24 25 accp_generate_password_on_click(); 26 27 accp_toggle_create_new_primary_user_section(); 28 29 accp_assign_existing_primary_user_on_click(); 30 31 accp_create_and_assign_new_primary_user_on_click(); 32 33 accp_reassign_company_directory_on_click(); 34 35 accp_toggle_create_new_company_home_page_form(); 36 37 accp_generate_new_company_home_page_on_click(); 38 39 accp_dismiss_duplicate_dir_assignment_message_on_click(); 40 41 accp_save_bulk_edit_post_data(); 42 43 }); // End document ready. 44 45 46 function accp_save_invoice_bulk_edit(e){ 47 48 if( $('#invoice-status-bulk-edit-select').length ){ 49 50 /** 51 * Disable pointer events instead of setting 52 * a "disabled" property to allow native WP 53 * post data to be saved normally. 54 */ 55 accp_disable_pointer_events_by_event_target(e); 56 accp_add_and_show_status_spinner_after_bulk_add_buttons(e); 57 58 var post_ids = new Array(); 59 var invoice_status = $('#invoice-status-bulk-edit-select').val(); 60 var nonce = $('#accp-invoice-bulk-edit-section').attr('data-nonce'); 61 62 $( 'tr#bulk-edit ul#bulk-titles-list li button' ).each( function() { 63 post_ids.push( $( this ).attr( 'id' ).replace( /^(_)/i, '' ) ); 64 }); 65 66 if(invoice_status != "-1"){ 67 68 $.ajax({ 69 url: ajaxurl, 70 type: 'POST', 71 async: false, 72 data: { 73 action: 'accp_save_invoice_bulk_edit', 74 post_ids: post_ids, 75 invoice_status: invoice_status, 76 nonce: nonce 77 }, 78 success: function(data){ 79 80 81 }, 82 error: function(jqXHR, textStatus, errorThrown){ 83 84 accp_reset_pointer_events_by_selector('#bulk-edit'); 85 $('.accp-spinner-after-bulk-edit').remove(); 86 87 console.log(textStatus, errorThrown); 88 console.log(jqXHR); 89 }, 90 91 }); 92 93 } 94 95 } 96 97 } 98 99 100 function accp_save_file_bulk_edit(e){ 101 102 if( $('#file-status-bulk-edit-select').length ){ 103 104 /** 105 * Disable pointer events instead of setting 106 * a "disabled" property to allow native WP 107 * post data to be saved normally. 108 */ 109 accp_disable_pointer_events_by_event_target(e); 110 accp_add_and_show_status_spinner_after_bulk_add_buttons(e); 111 112 var post_ids = new Array(); 113 var file_status = $('#file-status-bulk-edit-select').val(); 114 var nonce = $('#accp-file-bulk-edit-section').attr('data-nonce'); 115 116 $( 'tr#bulk-edit ul#bulk-titles-list li button' ).each( function() { 117 post_ids.push( $( this ).attr( 'id' ).replace( /^(_)/i, '' ) ); 118 }); 119 120 if(file_status != "-1"){ 121 122 $.ajax({ 123 url: ajaxurl, 124 type: 'POST', 125 async: false, 126 data: { 127 action: 'accp_save_file_bulk_edit', 128 post_ids: post_ids, 129 file_status: file_status, 130 nonce: nonce 131 }, 132 success: function(data){ 133 134 135 }, 136 error: function(jqXHR, textStatus, errorThrown){ 137 138 accp_reset_pointer_events_by_selector('#bulk-edit'); 139 $('.accp-spinner-after-bulk-edit').remove(); 140 141 console.log(textStatus, errorThrown); 142 console.log(jqXHR); 143 }, 144 145 }); 146 147 } 148 149 } 150 151 } 152 153 154 function accp_save_global_file_bulk_edit(e){ 155 156 if( $('#global-file-status-bulk-edit-select').length ){ 157 158 /** 159 * Disable pointer events instead of setting 160 * a "disabled" property to allow native WP 161 * post data to be saved normally. 162 */ 163 accp_disable_pointer_events_by_event_target(e); 164 accp_add_and_show_status_spinner_after_bulk_add_buttons(e); 165 166 var post_ids = new Array(); 167 var file_status = $('#global-file-status-bulk-edit-select').val(); 168 var nonce = $('#accp-file-bulk-edit-section').attr('data-nonce'); 169 170 $( 'tr#bulk-edit ul#bulk-titles-list li button' ).each( function() { 171 post_ids.push( $( this ).attr( 'id' ).replace( /^(_)/i, '' ) ); 172 }); 173 174 if(file_status != "-1"){ 175 176 $.ajax({ 177 url: ajaxurl, 178 type: 'POST', 179 async: false, 180 data: { 181 action: 'accp_save_global_file_bulk_edit', 182 post_ids: post_ids, 183 file_status: file_status, 184 nonce: nonce 185 }, 186 success: function(data){ 187 188 189 190 }, 191 error: function(jqXHR, textStatus, errorThrown){ 192 193 accp_reset_pointer_events_by_selector('#bulk-edit'); 194 $('.accp-spinner-after-bulk-edit').remove(); 195 196 console.log(textStatus, errorThrown); 197 console.log(jqXHR); 198 }, 199 200 }); 201 202 } 203 204 } 205 206 } 207 208 209 function accp_admin_make_company_select_field_required(){ 210 211 if( $('.company-assign-container select#company-select').length > -1 ){ 212 $('select#company-select').attr('required', true); 213 } 214 215 } 216 217 218 function accp_admin_toggle_file_reassign_form(){ 219 220 $('#reassign-toggle').click(function () { 221 222 if ($('#reassign-form-container').is(":hidden")){ 223 224 $('#reassign-form-container').show('slow'); 225 $('.accp-hide-assigment').show(); 226 $('#reassign-toggle').text('Cancel'); 227 228 }else{ 229 230 $('#reassign-form-container').hide(); 231 $('.accp-hide-assigment').hide(); 232 $('#reassign-toggle').text('Reassign'); 233 234 } 235 236 }); 237 238 } 239 240 241 function accp_admin_toggle_file_replace_form(){ 242 243 $('#replace-file-toggle').click(function () { 244 245 if ($('.accp-file-replace-hide').is(":hidden")){ 246 247 $('.accp-file-replace-hide').show('slow'); 248 $('#replace-file-toggle').text('Cancel'); 249 250 }else{ 251 252 $('.accp-file-replace-hide').hide(); 253 $('#replace-file-toggle').text('Replace File'); 254 255 } 256 257 }); 258 259 } 260 261 262 function accp_add_and_show_status_spinner(e){ 263 264 var target_elem = e.target; 265 var unique_class = 'accp-' + Math.random().toString(36).slice(2) + '-spinner'; 266 var spinner_elem = '<span class="'+unique_class+' accp-spinner spinner" style="float: none;"></span>'; 267 var new_spinner_class = '.' + unique_class + '.accp-spinner.spinner'; 268 269 $(spinner_elem).insertAfter(target_elem); 270 $(new_spinner_class).css('visibility', 'visible'); 271 272 return new_spinner_class; 273 274 } 275 276 277 function accp_add_and_show_status_spinner_after_bulk_add_buttons(e){ 278 279 var target_elem = e.target.closest('.submit.inline-edit-save'); 280 var unique_class = 'accp-' + Math.random().toString(36).slice(2) + '-spinner'; 281 var spinner_elem = '<span class="'+unique_class+' accp-spinner spinner accp-spinner-after-bulk-edit" style="float: none;"></span>'; 282 var new_spinner_class = '.' + unique_class + '.accp-spinner.spinner'; 283 284 $(spinner_elem).appendTo(target_elem); 285 $(new_spinner_class).css('visibility', 'visible'); 286 287 return new_spinner_class; 288 289 } 290 291 292 function accp_disable_element_by_event_target(e){ 293 294 var target_elem = e.target; 295 296 $(target_elem).prop('disabled', true); 297 298 } 299 300 301 function accp_disable_pointer_events_by_event_target(e){ 302 303 var target_elem = e.target; 304 305 $(target_elem).attr('style', 'pointer-events: none;'); 306 307 } 308 309 function accp_reset_pointer_events_by_selector(selector){ 310 311 $(selector).attr('style', 'pointer-events: all;'); 312 313 } 314 315 316 function accp_remove_disabled_prop_from_element(selector){ 317 318 $(selector).prop('disabled', false); 319 320 } 321 322 323 function accp_initiate_core_select2_fields(){ 324 325 $('.client-add-company-select').select2({ 326 placeholder: 'Select a company...', 327 multiple: true, 328 allowClear: true, 329 tags: true, 330 tokenSeparators: [',', ' '] 331 }); 332 333 $('#company-select').select2({ 334 placeholder: 'Select a company...', 335 multiple: false, 336 allowClear: true, 337 tags: true, 338 tokenSeparators: [',', ' '] 339 }); 340 341 if($('select.accp_admin_list_filter').length){ 342 343 $('select.accp_admin_list_filter').select2({ 344 multiple: false 345 }); 346 347 } 348 349 } 350 351 352 function accp_delete_file_attachment_on_post_permanent_delete(){ 353 11 354 $('table a.submitdelete').click(function (e) { 12 355 … … 43 386 }, 44 387 45 }); 46 47 48 49 } 50 51 }); 52 53 54 /** 55 * Bulk delete clienfiles function - delete posts and files 56 * when posts are checked and the bulk permanently delete 57 * option is selected. 58 */ 59 $('#doaction').click(function (e) { 60 61 // Only do this on accp_clientfile or accp_clientinvoice delete pages 388 }); 389 390 } 391 392 }); 393 394 } 395 396 397 function accp_delete_file_attachment_on_bulk_post_permanent_delete(){ 398 399 $('#doaction').click(function (e) { 400 62 401 if ( 63 402 ( … … 82 421 var bulk_delete_nonce = $('#clientfile-admin-nonce').attr('data-nonce'); 83 422 84 $.ajax({ 85 type: 'POST', 86 url: ajaxurl, 87 cache: false, 88 headers: { 89 'cache-control': 'no-cache', 90 }, 91 data: { 92 action:'accp_bulk_delete_file_on_post_delete', 93 bulk_delete_nonce: bulk_delete_nonce, 94 del_file_post_id_json: del_file_post_id_json, 95 96 }, 97 success: function(data){ 98 99 window.location.reload(true); 100 101 }, 102 error: function(jqXHR, textStatus, errorThrown){ 103 console.log(textStatus, errorThrown); 104 console.log(jqXHR); 105 }, 106 107 }); 108 109 } 110 }); 111 112 113 /** 114 * Bulk delete clienfiles function - accp_clientfile empty trash button 115 */ 423 $.ajax({ 424 type: 'POST', 425 url: ajaxurl, 426 cache: false, 427 headers: { 428 'cache-control': 'no-cache', 429 }, 430 data: { 431 action:'accp_bulk_delete_file_on_post_delete', 432 bulk_delete_nonce: bulk_delete_nonce, 433 del_file_post_id_json: del_file_post_id_json, 434 435 }, 436 success: function(data){ 437 438 window.location.reload(true); 439 440 }, 441 error: function(jqXHR, textStatus, errorThrown){ 442 console.log(textStatus, errorThrown); 443 console.log(jqXHR); 444 }, 445 446 }); 447 448 } 449 }); 450 451 } 452 453 454 function accp_delete_file_attachment_on_post_empty_trash(){ 455 116 456 $('#delete_all').click(function (e) { 117 457 … … 139 479 140 480 $.ajax({ 141 type: 'POST', 142 url: ajaxurl, 143 cache: false, 144 headers: { 145 'cache-control': 'no-cache', 146 }, 147 data: { 148 action:'accp_bulk_delete_file_on_empty_trash', 149 empty_trash_nonce: empty_trash_nonce, 150 post_type: post_type 151 }, 152 success: function(data){ 153 154 window.location.reload(true); 155 156 }, 157 error: function(jqXHR, textStatus, errorThrown){ 158 console.log(textStatus, errorThrown); 159 console.log(jqXHR); 160 }, 161 162 }); 163 164 } 165 }); 166 167 accp_admin_toggle_file_reassign_form(); 168 169 accp_admin_toggle_file_replace_form(); 170 481 type: 'POST', 482 url: ajaxurl, 483 cache: false, 484 headers: { 485 'cache-control': 'no-cache', 486 }, 487 data: { 488 action:'accp_bulk_delete_file_on_empty_trash', 489 empty_trash_nonce: empty_trash_nonce, 490 post_type: post_type 491 }, 492 success: function(data){ 493 494 window.location.reload(true); 495 496 }, 497 error: function(jqXHR, textStatus, errorThrown){ 498 console.log(textStatus, errorThrown); 499 console.log(jqXHR); 500 }, 501 502 }); 503 504 } 505 506 }); 507 508 } 509 510 511 function accp_reassign_post_company_on_click(){ 171 512 172 513 $('#accp_reassign_btn').click(function (e) { 514 173 515 e.preventDefault(); 174 516 … … 215 557 }); 216 558 559 } 560 561 562 function accp_create_company_directory_on_click(){ 217 563 218 564 $('#accp-generate-dir-btn').click(function (e) { … … 285 631 }); 286 632 633 } 634 635 function accp_assign_company_directory_on_click(){ 287 636 288 637 $('#accp-assign-dir-btn').click(function (e) { … … 376 725 377 726 }); 727 728 } 729 730 function accp_generate_password_on_click(){ 378 731 379 732 $('#accp-autogenerate-password').click(function (e) { … … 415 768 }); 416 769 770 } 771 772 773 function accp_toggle_create_new_primary_user_section(){ 774 417 775 $('.accp-create-new-primary-user-btn').click(function (e) { 418 776 … … 424 782 425 783 }); 784 785 } 786 787 788 function accp_assign_existing_primary_user_on_click(){ 426 789 427 790 $('#accp-assign-existing-primary-user-btn').click(function (e) { … … 480 843 481 844 }); 845 846 } 847 848 849 function accp_create_and_assign_new_primary_user_on_click(){ 482 850 483 851 $('#accp-generate-new-user-btn').click(function (e) { … … 573 941 } 574 942 575 }); 576 943 }); 944 945 } 946 947 948 function accp_reassign_company_directory_on_click(){ 577 949 578 950 $('.accp-reassign-directory-button.button').click(function(){ … … 584 956 }); 585 957 958 } 959 960 961 function accp_toggle_create_new_company_home_page_form(){ 586 962 587 963 $('.accp-show-new-page-form').click(function () { … … 603 979 }); 604 980 981 } 982 983 984 function accp_generate_new_company_home_page_on_click(){ 605 985 606 986 $('.accp-generate-new-page').click(function (e) { … … 693 1073 694 1074 }); 1075 1076 } 1077 1078 1079 function accp_dismiss_duplicate_dir_assignment_message_on_click(){ 695 1080 696 1081 $('.accp-dismiss-dir-assigment-msg.button').click(function (e) { … … 730 1115 }); 731 1116 1117 } 1118 1119 1120 function accp_save_bulk_edit_post_data(){ 1121 732 1122 $('#bulk_edit').on( 'click', function(e) { 733 1123 … … 740 1130 }); 741 1131 742 743 }); // End document ready744 745 746 function accp_save_invoice_bulk_edit(e){747 748 if( $('#invoice-status-bulk-edit-select').length ){749 750 /**751 * Disable pointer events instead of setting752 * a "disabled" property to allow native WP753 * post data to be saved normally.754 */755 accp_disable_pointer_events_by_event_target(e);756 accp_add_and_show_status_spinner_after_bulk_add_buttons(e);757 758 var post_ids = new Array();759 var invoice_status = $('#invoice-status-bulk-edit-select').val();760 var nonce = $('#accp-invoice-bulk-edit-section').attr('data-nonce');761 762 $( 'tr#bulk-edit ul#bulk-titles-list li button' ).each( function() {763 post_ids.push( $( this ).attr( 'id' ).replace( /^(_)/i, '' ) );764 });765 766 if(invoice_status != "-1"){767 768 $.ajax({769 url: ajaxurl,770 type: 'POST',771 async: false,772 data: {773 action: 'accp_save_invoice_bulk_edit',774 post_ids: post_ids,775 invoice_status: invoice_status,776 nonce: nonce777 },778 success: function(data){779 780 781 },782 error: function(jqXHR, textStatus, errorThrown){783 784 accp_reset_pointer_events_by_selector('#bulk-edit');785 $('.accp-spinner-after-bulk-edit').remove();786 787 console.log(textStatus, errorThrown);788 console.log(jqXHR);789 },790 791 });792 793 }794 795 }796 797 }798 799 function accp_save_file_bulk_edit(e){800 801 if( $('#file-status-bulk-edit-select').length ){802 803 /**804 * Disable pointer events instead of setting805 * a "disabled" property to allow native WP806 * post data to be saved normally.807 */808 accp_disable_pointer_events_by_event_target(e);809 accp_add_and_show_status_spinner_after_bulk_add_buttons(e);810 811 var post_ids = new Array();812 var file_status = $('#file-status-bulk-edit-select').val();813 var nonce = $('#accp-file-bulk-edit-section').attr('data-nonce');814 815 $( 'tr#bulk-edit ul#bulk-titles-list li button' ).each( function() {816 post_ids.push( $( this ).attr( 'id' ).replace( /^(_)/i, '' ) );817 });818 819 if(file_status != "-1"){820 821 $.ajax({822 url: ajaxurl,823 type: 'POST',824 async: false,825 data: {826 action: 'accp_save_file_bulk_edit',827 post_ids: post_ids,828 file_status: file_status,829 nonce: nonce830 },831 success: function(data){832 833 834 },835 error: function(jqXHR, textStatus, errorThrown){836 837 accp_reset_pointer_events_by_selector('#bulk-edit');838 $('.accp-spinner-after-bulk-edit').remove();839 840 console.log(textStatus, errorThrown);841 console.log(jqXHR);842 },843 844 });845 846 }847 848 }849 850 }851 852 853 function accp_save_global_file_bulk_edit(e){854 855 if( $('#global-file-status-bulk-edit-select').length ){856 857 /**858 * Disable pointer events instead of setting859 * a "disabled" property to allow native WP860 * post data to be saved normally.861 */862 accp_disable_pointer_events_by_event_target(e);863 accp_add_and_show_status_spinner_after_bulk_add_buttons(e);864 865 var post_ids = new Array();866 var file_status = $('#global-file-status-bulk-edit-select').val();867 var nonce = $('#accp-file-bulk-edit-section').attr('data-nonce');868 869 $( 'tr#bulk-edit ul#bulk-titles-list li button' ).each( function() {870 post_ids.push( $( this ).attr( 'id' ).replace( /^(_)/i, '' ) );871 });872 873 if(file_status != "-1"){874 875 $.ajax({876 url: ajaxurl,877 type: 'POST',878 async: false,879 data: {880 action: 'accp_save_global_file_bulk_edit',881 post_ids: post_ids,882 file_status: file_status,883 nonce: nonce884 },885 success: function(data){886 887 888 889 },890 error: function(jqXHR, textStatus, errorThrown){891 892 accp_reset_pointer_events_by_selector('#bulk-edit');893 $('.accp-spinner-after-bulk-edit').remove();894 895 console.log(textStatus, errorThrown);896 console.log(jqXHR);897 },898 899 });900 901 }902 903 }904 905 }906 907 908 function accp_admin_make_company_select_field_required(){909 910 if($('.company-assign-container select#company-select').length > -1){911 $('select#company-select').attr('required', true);912 }913 914 }915 916 917 function accp_admin_toggle_file_reassign_form(){918 919 $('#reassign-toggle').click(function () {920 921 if ($('#reassign-form-container').is(":hidden")){922 923 $('#reassign-form-container').show('slow');924 $('.accp-hide-assigment').show();925 $('#reassign-toggle').text('Cancel');926 927 }else{928 929 $('#reassign-form-container').hide();930 $('.accp-hide-assigment').hide();931 $('#reassign-toggle').text('Reassign');932 933 }934 935 });936 937 }938 939 940 function accp_admin_toggle_file_replace_form(){941 942 $('#replace-file-toggle').click(function () {943 944 if ($('.accp-file-replace-hide').is(":hidden")){945 946 $('.accp-file-replace-hide').show('slow');947 $('#replace-file-toggle').text('Cancel');948 949 }else{950 951 $('.accp-file-replace-hide').hide();952 $('#replace-file-toggle').text('Replace File');953 954 }955 956 });957 958 }959 960 961 function accp_add_and_show_status_spinner(e){962 963 var target_elem = e.target;964 var unique_class = 'accp-' + Math.random().toString(36).slice(2) + '-spinner';965 var spinner_elem = '<span class="'+unique_class+' accp-spinner spinner" style="float: none;"></span>';966 var new_spinner_class = '.' + unique_class + '.accp-spinner.spinner';967 968 $(spinner_elem).insertAfter(target_elem);969 $(new_spinner_class).css('visibility', 'visible');970 971 return new_spinner_class;972 973 }974 975 976 function accp_add_and_show_status_spinner_after_bulk_add_buttons(e){977 978 var target_elem = e.target.closest('.submit.inline-edit-save');979 var unique_class = 'accp-' + Math.random().toString(36).slice(2) + '-spinner';980 var spinner_elem = '<span class="'+unique_class+' accp-spinner spinner accp-spinner-after-bulk-edit" style="float: none;"></span>';981 var new_spinner_class = '.' + unique_class + '.accp-spinner.spinner';982 983 $(spinner_elem).appendTo(target_elem);984 $(new_spinner_class).css('visibility', 'visible');985 986 return new_spinner_class;987 988 }989 990 991 function accp_disable_element_by_event_target(e){992 993 var target_elem = e.target;994 995 $(target_elem).prop('disabled', true);996 997 }998 999 1000 function accp_disable_pointer_events_by_event_target(e){1001 1002 var target_elem = e.target;1003 1004 $(target_elem).attr('style', 'pointer-events: none;');1005 1006 }1007 1008 function accp_reset_pointer_events_by_selector(selector){1009 1010 $(selector).attr('style', 'pointer-events: all;');1011 1012 }1013 1014 1015 function accp_remove_disabled_prop_from_element(selector){1016 1017 $(selector).prop('disabled', false);1018 1019 }1020 1021 1022 function accp_initiate_core_select2_fields(){1023 1024 $('.client-add-company-select').select2({1025 placeholder: 'Select a company...',1026 multiple: true,1027 allowClear: true,1028 tags: true,1029 tokenSeparators: [',', ' ']1030 });1031 1032 $('#company-select').select2({1033 placeholder: 'Select a company...',1034 multiple: false,1035 allowClear: true,1036 tags: true,1037 tokenSeparators: [',', ' ']1038 });1039 1040 if($('select.accp_admin_list_filter').length){1041 1042 $('select.accp_admin_list_filter').select2({1043 multiple: false1044 });1045 1046 }1047 1048 1132 } 1049 1133 -
constellation-client-portal/trunk/ars-constellation-client-portal.php
r3043713 r3062211 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.8. 07 * Version: 1.8.1 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.8. 0'); // Change the version in the header as well.57 define('ACCP_PLUGIN_VERSION', '1.8.1'); // 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__); 60 60 define('ACCP_PLUGIN_DIR_URL', plugin_dir_url( __FILE__ ) ); 61 define('ACCP_PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ) ); 61 62 62 63 -
constellation-client-portal/trunk/includes/ars-constellation-client-portal-install-uninstall.php
r2987566 r3062211 10 10 */ 11 11 12 /** 13 * Exit if accessed directly. 14 */ 12 15 if ( ! defined( 'ABSPATH' ) ) { 13 exit; // Exit if accessed directly16 exit; 14 17 } 15 18 … … 50 53 51 54 /** 52 * Add default Company Status options 53 * on plugin activation - leave the options/statuses 54 * in place on plugin deactivation in case the plugin is 55 * reactivated. 55 * Add default Company Status options on plugin activation - 56 * leave the options/statuses in place on plugin deactivation 57 * in case the plugin is reactivated. 56 58 */ 57 59 function add_default_company_statuses(){ … … 66 68 67 69 $new[] = array( 'label' => sanitize_text_field('Active'), 'value' => sanitize_text_field('active'), 'status_action' => sanitize_text_field('vis_no_action') ); 70 68 71 $new[] = array( 'label' => sanitize_text_field('Pending'), 'value' => sanitize_text_field('pending'), 'status_action' => sanitize_text_field('vis_no_action') ); 72 69 73 $new[] = array( 'label' => sanitize_text_field('Inactive'), 'value' => sanitize_text_field('inactive'), 'status_action' => sanitize_text_field('vis_no_action') ); 70 74 … … 102 106 $missing_statuses[] = 'pending'; 103 107 104 } 105 108 } 106 109 107 110 } -
constellation-client-portal/trunk/includes/class-ars-constellation-client-portal-utility-functions.php
r2946134 r3062211 285 285 286 286 /** 287 * Check if post type slug is a valid post type. 288 * 289 * @param string $slug - The slug to check. 290 * 291 * @return bool $is_valid_post_type - True if the slug is a valid post type or false if not. 292 */ 293 function check_if_post_type_slug_is_valid_post_type($slug){ 294 295 if(!$slug) 296 return false; 297 298 /** 299 * Get all post types. 300 */ 301 $post_types = get_post_types( array(), 'objects'); 302 303 foreach($post_types as $post_type){ 304 305 /** 306 * Check the post type name. 307 */ 308 $name = $post_type->name; 309 310 /** 311 * Return false if the post type name 312 * matches the slug being checked. 313 */ 314 if( $name === sanitize_text_field( strtolower($slug) ) ){ 315 316 $is_valid_post_type = true; 317 318 return $is_valid_post_type; 319 320 } 321 322 } 323 324 return false; 325 326 } 327 328 329 /** 287 330 * Check slug for uniqueness, and 288 331 * verify that it is not already in use -
constellation-client-portal/trunk/includes/class-ars-constellation-client-portal.php
r2973972 r3062211 10 10 */ 11 11 12 /** 13 * Exit if accessed directly. 14 */ 12 15 if ( ! defined( 'ABSPATH' ) ) { 13 exit; // Exit if accessed directly16 exit; 14 17 } 15 18 … … 48 51 * @since 1.0.0 49 52 */ 50 public function __construct() { 51 52 // Check for Premium version 53 if ( defined( 'ARS_CONSTELLATION_CLIENT_PORTAL_PREMIUM' ) ) { 54 55 $this->version = ARS_CONSTELLATION_CLIENT_PORTAL_PREMIUM; 56 $this->plugin_name = 'ars-constellation-client-portal-premium'; 57 58 // Check for Pro version 59 } elseif ( defined( 'ARS_CONSTELLATION_CLIENT_PORTAL_PRO' ) ) { 60 53 public function __construct() { 54 55 if ( defined( 'ARS_CONSTELLATION_CLIENT_PORTAL_PRO' ) ) { 56 61 57 $this->version = ARS_CONSTELLATION_CLIENT_PORTAL_PRO; 62 58 $this->plugin_name = 'ars-constellation-client-portal-pro'; 63 64 // Check for Basic version 65 } elseif ( defined( 'ARS_CONSTELLATION_CLIENT_PORTAL_PRO' ) ) { 59 60 } elseif ( defined( 'ARS_CONSTELLATION_CLIENT_PORTAL' ) ) { 66 61 67 62 $this->version = ARS_CONSTELLATION_CLIENT_PORTAL; 68 63 $this->plugin_name = 'ars-constellation-client-portal'; 69 70 // Fall back to defaults if nothing is defined 71 } else { 64 65 }else{ 72 66 73 67 $this->version = '1.0.0'; … … 75 69 76 70 } 77 78 //$this->plugin_name = 'ars-constellation-client-portal-premium';79 71 80 72 $this->load_dependencies(); … … 127 119 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-ars-constellation-client-portal-settings.php'; 128 120 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-ars-constellation-client-portal-utility-functions.php'; 129 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/shortcodes/class-ars-constellation-client-portal-list-shortcodes.php'; 130 131 132 133 134 /** 135 * Pro tier Admin functions 121 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/shortcodes/class-ars-constellation-client-portal-list-shortcodes.php'; 122 123 124 /** 125 * Pro tier Admin functions. 136 126 */ 137 127 if ( $this->plugin_name == 'ars-constellation-client-portal-pro' ){ … … 151 141 152 142 /** 153 * Pro tier Public functions 143 * Pro tier Public functions. 154 144 */ 155 145 if ( $this->plugin_name == 'ars-constellation-client-portal-pro' ){ … … 188 178 189 179 /** 190 * Register admin hooks 180 * Register admin hooks. 191 181 * 192 182 * @since 1.0.0 … … 204 194 $core_settings = new ARS_Constellation_Client_Portal_Settings(); 205 195 206 /* Core (Basic tier) hooks */ 196 /** 197 * Enqueue core styles and scripts. 198 */ 207 199 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); 208 200 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); … … 223 215 224 216 /** 217 * 225 218 * Direct file access redirects. 226 */ 227 228 // Prevent direct access to accp-clientfiles. 229 $this->loader->add_action( 'init', $plugin_admin, 'accp_file_redirect_init'); 230 231 // Add accp query_vars. 219 * 220 */ 221 222 /** 223 * Prevent direct access to accp-clientfiles. 224 */ 225 $this->loader->add_action( 'init', $plugin_admin, 'accp_file_redirect_init'); 226 227 228 /** 229 * Add accp query_vars. 230 */ 232 231 $this->loader->add_filter( 'query_vars', $plugin_admin, 'accp_query_vars' ); 233 232 234 // Parse accp query_vars. 235 $this->loader->add_action( 'parse_request', $plugin_admin, 'accp_parse_request' ); 236 237 // Plugin upgrade complete actions. 233 234 /** 235 * Parse accp query_vars. 236 */ 237 $this->loader->add_action( 'parse_request', $plugin_admin, 'accp_parse_request' ); 238 239 240 /** 241 * Plugin upgrade complete actions. 242 */ 238 243 $this->loader->add_action( 'upgrader_process_complete', $plugin_admin, 'accp_upgrade_completed', 10, 2 ); 239 244 240 // Run plugin initialization functions. 245 246 /** 247 * Run plugin initialization functions. 248 */ 241 249 $this->loader->add_action( 'admin_init', $plugin_admin, 'accp_plugin_initialize'); 242 243 // Maybe flush rewrite rules. 250 251 252 /** 253 * Maybe flush rewrite rules. 254 */ 244 255 $this->loader->add_action( 'init', $plugin_admin, 'accp_maybe_flush_rewrite_rules'); 245 256 … … 251 262 */ 252 263 253 // Client File - Register the 'accp_clientfile' post type 264 /** 265 * Client File - Register the 'accp_clientfile' post type. 266 */ 254 267 $this->loader->add_action( 'init', $plugin_client_file, 'accp_register_accp_clientfile' ); 255 268 256 // Client File - Register taxonomies for the 'accp_clientfile' post type 269 270 /** 271 * Client File - Register taxonomies for the 'accp_clientfile' post type. 272 */ 257 273 $this->loader->add_action( 'init', $plugin_client_file, 'accp_register_taxonomy_file_categories' ); 258 274 $this->loader->add_action( 'init', $plugin_client_file, 'accp_register_taxonomy_file_tags' ); 259 260 // Client File - WP list table columns 261 $this->loader->add_filter( 'manage_edit-accp_clientfile_columns', $plugin_client_file, 'clientfile_column_register' ); 275 276 277 /** 278 * Client File - WP list table columns. 279 */ 280 $this->loader->add_filter( 'manage_edit-accp_clientfile_columns', $plugin_admin, 'add_core_wp_list_table_columns' ); 262 281 $this->loader->add_action( 'manage_accp_clientfile_posts_custom_column', $plugin_client_file, 'clientfile_column_display_company_name', 10, 2 ); 263 282 $this->loader->add_action( 'manage_accp_clientfile_posts_custom_column', $plugin_client_file, 'accp_clientfile_column_display_file_status', 10, 2 ); … … 267 286 $this->loader->add_action( 'request', $plugin_client_file, 'clientfile_column_orderby' ); 268 287 269 // Client File - Add filter fields 288 289 /** 290 * Client File - Add filter fields. 291 */ 270 292 $this->loader->add_action( 'restrict_manage_posts', $plugin_client_file, 'accp_add_core_file_list_filter_fields', 10, 2 ); 271 293 $this->loader->add_filter( 'parse_query', $plugin_client_file, 'accp_core_file_additional_filters', 10, 1 ); 272 294 273 // Client File - Add metaboxes to client files 295 296 /** 297 * Client File - Add metaboxes to client files. 298 */ 274 299 $this->loader->add_action( 'admin_init', $plugin_client_file, 'rerender_file_status_meta_options' ); 275 300 $this->loader->add_action( 'save_post', $plugin_client_file, 'save_file_status_meta_options', 10, 1 ); 276 301 277 // Client File - Add Quick Edit fields. 302 303 /** 304 * Client File - Add Quick Edit fields. 305 */ 278 306 $this->loader->add_action( 'quick_edit_custom_box', $plugin_client_file, 'accp_add_file_quick_edit_fields', 10, 2 ); 279 280 // Client File - Add Bulk Edit fields. 307 308 309 /** 310 * Client File - Add Bulk Edit fields. 311 */ 281 312 $this->loader->add_action( 'bulk_edit_custom_box', $plugin_client_file, 'accp_add_file_bulk_edit_fields', 10, 2 ); 282 283 // Cliet File - Save File Quick Edit fields. 313 314 315 /** 316 * Cliet File - Save File Quick Edit fields. 317 */ 284 318 $this->loader->add_action('save_post_accp_clientfile', $plugin_client_file, 'accp_save_file_quick_edit_fields', 10, 1); 285 319 286 // Client File - save bulk edit fields ajax function. 320 321 /** 322 * Client File - save bulk edit fields ajax function. 323 */ 287 324 $this->loader->add_action( 'wp_ajax_accp_save_file_bulk_edit', $plugin_client_file, 'accp_save_file_bulk_edit'); 288 289 // Client File - Add filter fields 325 326 327 /** 328 * Client File - Add filter fields. 329 */ 290 330 $this->loader->add_action( 'restrict_manage_posts', $plugin_client_file, 'accp_add_core_file_list_filter_fields', 10, 2 ); 291 331 $this->loader->add_filter( 'parse_query', $plugin_client_file, 'accp_core_file_additional_filters', 10, 1 ); … … 298 338 */ 299 339 300 // Client Invoice - Register the 'clientinvoice' post type 340 /** 341 * Client Invoice - Register the 'clientinvoice' post type. 342 */ 301 343 $this->loader->add_action( 'init', $plugin_client_invoice, 'accp_register_accp_clientinvoice' ); 302 303 // Client Invoice - Register taxonomies for the 'clientinvoice' post type 344 345 346 /** 347 * Client Invoice - Register taxonomies for the 'clientinvoice' post type. 348 */ 304 349 $this->loader->add_action( 'init', $plugin_client_invoice, 'accp_register_taxonomy_invoice_categories' ); 305 350 $this->loader->add_action( 'init', $plugin_client_invoice, 'accp_register_taxonomy_invoice_tags' ); 306 351 307 // Client Invoice - WP list table columns 308 $this->loader->add_filter( 'manage_edit-accp_clientinvoice_columns', $plugin_client_invoice, 'accp_clientinvoice_column_register' ); 352 353 /** 354 * Client Invoice - WP list table columns. 355 */ 356 $this->loader->add_filter( 'manage_edit-accp_clientinvoice_columns', $plugin_admin, 'add_core_wp_list_table_columns' ); 309 357 $this->loader->add_action( 'manage_accp_clientinvoice_posts_custom_column', $plugin_client_invoice, 'accp_clientinvoice_column_display_company_name', 10, 2 ); 310 358 $this->loader->add_action( 'manage_accp_clientinvoice_posts_custom_column', $plugin_client_invoice, 'accp_clientinvoice_column_display_invoice_status', 10, 2 ); … … 314 362 $this->loader->add_action( 'request', $plugin_client_invoice, 'accp_clientinvoice_column_orderby' ); 315 363 316 // Client Invoice - Add Metaboxes to Client Invoices 364 365 /** 366 * Client Invoice - Add Metaboxes to Client Invoices. 367 */ 317 368 $this->loader->add_action( 'admin_init', $plugin_client_invoice, 'rerender_invoice_status_meta_options' ); 318 369 $this->loader->add_action( 'save_post', $plugin_client_invoice, 'save_invoice_status_meta_options', 10, 1 ); 319 370 320 // Client Invoice - Add Quick Edit fields. 321 $this->loader->add_action( 'quick_edit_custom_box', $plugin_client_invoice, 'accp_add_invoice_quick_edit_fields', 10, 2 ); 322 323 // Client Invoice - Add Bulk Edit fields. 324 $this->loader->add_action( 'bulk_edit_custom_box', $plugin_client_invoice, 'accp_add_invoice_bulk_edit_fields', 10, 2 ); 325 326 // Cliet Invoice - Save Invoice Quick Edit fields. 327 $this->loader->add_action('save_post_accp_clientinvoice', $plugin_client_invoice, 'accp_save_invoice_quick_edit_fields', 10, 1); 328 329 // Client Invoice - save bulk edit fields ajax function. 371 372 /** 373 * Client Invoice - Quick Edit fields. 374 */ 375 $this->loader->add_action( 'quick_edit_custom_box', $plugin_client_invoice, 'accp_add_invoice_quick_edit_fields', 10, 2 ); 376 $this->loader->add_action( 'bulk_edit_custom_box', $plugin_client_invoice, 'accp_add_invoice_bulk_edit_fields', 10, 2 ); 377 $this->loader->add_action('save_post_accp_clientinvoice', $plugin_client_invoice, 'accp_save_invoice_quick_edit_fields', 10, 1); 330 378 $this->loader->add_action( 'wp_ajax_accp_save_invoice_bulk_edit', $plugin_client_invoice, 'accp_save_invoice_bulk_edit'); 331 379 332 // Client Invoice - Add filter fields 380 /** 381 * Client Invoice - Add filter fields. 382 */ 333 383 $this->loader->add_action( 'restrict_manage_posts', $plugin_client_invoice, 'accp_add_core_invoice_list_filter_fields', 10, 2 ); 334 $this->loader->add_filter( 'parse_query', $plugin_client_invoice, 'accp_core_invoice_additional_filters', 10, 1 ); 335 336 // Delete file ajax function - when accp_clientfile or accp_clientinvoice post is permanently deleted 337 $this->loader->add_action( 'wp_ajax_accp_delete_file_on_post_delete', $plugin_admin, 'accp_delete_file_on_post_delete'); 338 339 // Bulk delete files ajax function - when accp_clientfile or accp_clientinvoice delete permanently button is clicked 340 $this->loader->add_action( 'wp_ajax_accp_bulk_delete_file_on_post_delete', $plugin_admin, 'accp_bulk_delete_file_on_post_delete'); 341 342 // Bulk delete files ajax function - when accp_clientfile or accp_clientinvoice empty trash button is clicked 343 $this->loader->add_action( 'wp_ajax_accp_bulk_delete_file_on_empty_trash', $plugin_admin, 'accp_bulk_delete_file_on_empty_trash'); 344 345 // Change the main submenu title to "Settings." 346 $this->loader->add_action( 'admin_menu', $core_settings, 'add_menu_accp_main_sub_title' ); 347 348 // Add Companies admin menu item/page 384 $this->loader->add_filter( 'parse_query', $plugin_client_invoice, 'accp_core_invoice_additional_filters', 10, 1 ); 385 386 387 /** 388 * Delete file attachments. 389 */ 390 $this->loader->add_action( 'wp_ajax_accp_delete_file_on_post_delete', $plugin_admin, 'accp_delete_file_on_post_delete'); 391 $this->loader->add_action( 'wp_ajax_accp_bulk_delete_file_on_post_delete', $plugin_admin, 'accp_bulk_delete_file_on_post_delete'); 392 $this->loader->add_action( 'wp_ajax_accp_bulk_delete_file_on_empty_trash', $plugin_admin, 'accp_bulk_delete_file_on_empty_trash'); 393 394 395 /** 396 * Change the main submenu title to "Settings." 397 */ 398 $this->loader->add_action( 'admin_menu', $core_settings, 'add_menu_accp_main_sub_title' ); 399 400 401 /** 402 * Add Companies admin menu item/page. 403 */ 349 404 $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_menu_accp_add_sub_menu_items_to_main_menu_item' ); 350 405 351 // Add core settings pages 352 $this->loader->add_action( 'admin_menu', $core_settings, 'add_accp_settings_pages_to_wp_admin' ); 353 354 // Add the main admin settings menu item 355 $this->loader->add_action( 'admin_menu', $core_settings, 'register_main_settings_menu_item' ); 356 357 // Add Settings admin menu item/page 358 //$this->loader->add_action( 'admin_menu', $plugin_admin, 'add_menu_accp_settings_page' ); // DEPRECATED 406 407 /** 408 * Add core settings pages. 409 */ 410 $this->loader->add_action( 'admin_menu', $core_settings, 'add_accp_settings_pages_to_wp_admin' ); 411 $this->loader->add_action( 'admin_menu', $core_settings, 'register_main_settings_menu_item' ); 359 412 $this->loader->add_action( 'admin_init', $core_settings, 'register_client_portal_settings' ); 360 413 361 //Add company select field to Client Pages 414 /** 415 * Add company select field to Client Pages. 416 */ 362 417 $this->loader->add_action( 'admin_init', $plugin_admin, 'rerender_company_select_meta_options' ); 363 $this->loader->add_action( 'save_post', $plugin_admin, 'save_client_company_meta_options' ); 364 365 //Add user profile fields 366 $this->loader->add_action( 'show_user_profile', $plugin_admin, 'extra_user_profile_fields' ); 367 $this->loader->add_action( 'edit_user_profile', $plugin_admin, 'extra_user_profile_fields' ); 368 $this->loader->add_action( 'user_new_form', $plugin_admin, 'extra_user_profile_fields' ); 369 $this->loader->add_action( 'personal_options_update', $plugin_admin, 'save_extra_user_profile_fields' ); 370 $this->loader->add_action( 'edit_user_profile_update', $plugin_admin, 'save_extra_user_profile_fields' ); 371 $this->loader->add_action( 'user_register', $plugin_admin, 'save_extra_user_profile_fields' ); 372 373 // Client Page and Client File Page - restrict access 374 $this->loader->add_action( 'wp', $plugin_admin, 'accp_restrict_client_page_access' ); 375 376 // Client Company Page - restrict access 377 $this->loader->add_action( 'wp', $plugin_admin, 'accp_restrict_company_page_access' ); 378 379 // Client File upload 418 $this->loader->add_action( 'save_post', $plugin_admin, 'save_client_company_meta_options' ); 419 420 421 /** 422 * Add user profile fields. 423 */ 424 $this->loader->add_action( 'show_user_profile', $plugin_users, 'add_core_user_profile_fields' ); 425 $this->loader->add_action( 'edit_user_profile', $plugin_users, 'add_core_user_profile_fields' ); 426 $this->loader->add_action( 'user_new_form', $plugin_users, 'add_core_user_profile_fields' ); 427 $this->loader->add_action( 'personal_options_update', $plugin_users, 'save_extra_user_profile_fields' ); 428 $this->loader->add_action( 'edit_user_profile_update', $plugin_users, 'save_extra_user_profile_fields' ); 429 $this->loader->add_action( 'user_register', $plugin_users, 'save_extra_user_profile_fields' ); 430 431 432 /** 433 * Restrict page access. 434 */ 435 $this->loader->add_action( 'wp', $plugin_admin, 'accp_restrict_client_page_access' ); 436 $this->loader->add_action( 'wp', $plugin_admin, 'accp_restrict_company_page_access' ); 437 438 439 /** 440 * Client File upload. 441 */ 380 442 $this->loader->add_action('post_edit_form_tag' , $plugin_admin, 'accp_update_post_edit_form_tag'); 381 443 $this->loader->add_action('admin_menu', $plugin_admin, 'accp_client_file_meta_box'); … … 390 452 */ 391 453 392 // Client Company - Register the 'accp_clientcompany' post type 454 /** 455 * Client Company - Register the 'accp_clientcompany' post type 456 */ 393 457 $this->loader->add_action( 'init', $plugin_company, 'accp_register_clientcompany' ); 394 458 395 // Client Company - WP list table columns 459 460 /** 461 * Client Company - WP list table columns. 462 */ 396 463 $this->loader->add_filter( 'manage_edit-accp_clientcompany_columns', $plugin_company, 'clientcompany_column_register' ); 397 464 $this->loader->add_action( 'manage_accp_clientcompany_posts_custom_column', $plugin_company, 'clientcompany_column_display_assigned_user_count', 10, 2 ); … … 401 468 $this->loader->add_action( 'manage_accp_clientcompany_posts_custom_column', $plugin_company, 'clientcompany_column_display_company_id', 10, 2 ); 402 469 403 // Client Company - Add custom fields 470 /** 471 * Client Company - Add custom fields. 472 */ 404 473 $this->loader->add_action( 'admin_init', $plugin_company, 'display_clientcompany_meta_options' ); 405 474 $this->loader->add_action( 'save_post', $plugin_company, 'save_clientcompany_meta_options', 10, 3 ); 406 475 407 // Client Company - Generate new Client Page on the Company page. AJAX function. 476 477 /** 478 * Client Company - Generate new Client Page on the Company page. AJAX function. 479 */ 408 480 $this->loader->add_action( 'wp_ajax_accp_generate_new_client_page', $plugin_company, 'accp_generate_new_client_page'); 409 481 410 // Client Company - Check for directory names assigned to more than one company. 482 483 /** 484 * Client Company - Check for directory names assigned to more than one company. 485 */ 411 486 $this->loader->add_action( 'wp_ajax_accp_dismiss_duplicate_dir_assignment_notice', $plugin_company, 'accp_dismiss_duplicate_dir_assignment_notice'); 412 487 413 // Create and assign new primary user ajax function 488 489 /** 490 * Create and assign new primary user ajax function. 491 */ 414 492 $this->loader->add_action( 'wp_ajax_accp_create_and_assign_primary_user', $plugin_company, 'accp_create_and_assign_primary_user'); 415 416 // Assign existing primary user ajax function 493 494 495 /** 496 * Assign existing primary user ajax function. 497 */ 417 498 $this->loader->add_action( 'wp_ajax_accp_assign_existing_primary_user', $plugin_company, 'accp_assign_existing_primary_user'); 418 499 … … 425 506 */ 426 507 427 // Client Pages - Register the 'accp_client_pages' post type 508 /** 509 * Client Pages - Register the 'accp_client_pages' post type. 510 */ 428 511 $this->loader->add_action( 'init', $plugin_client_pages, 'accp_register_client_pages_post_type' ); 429 512 430 // Client Pages - Register taxonomies for the 'accp_client_pages' post type 513 514 /** 515 * Client Pages - Register taxonomies for the 'accp_client_pages' post type. 516 */ 431 517 $this->loader->add_action( 'init', $plugin_client_pages, 'accp_register_taxonomy_client_page_categories' ); 432 518 $this->loader->add_action( 'init', $plugin_client_pages, 'accp_register_taxonomy_client_page_tags' ); 433 519 434 // Client Pages - WP list table columns 520 521 /** 522 * Client Pages - WP list table columns. 523 */ 435 524 $this->loader->add_filter( 'manage_accp_client_pages_posts_columns', $plugin_client_pages, 'accp_client_pages_column_register'); 436 525 $this->loader->add_action( 'manage_accp_client_pages_posts_custom_column', $plugin_client_pages, 'accp_client_pages_column_display_company_name', 10, 2 ); 437 526 438 // Reassign accp_clientfile ajax function 527 528 /** 529 * Reassign accp_clientfile ajax function. 530 */ 439 531 $this->loader->add_action( 'wp_ajax_accp_reassign_file_1', $plugin_admin, 'accp_reassign_file_1'); 440 441 // Generate company directory ajax function 532 533 534 /** 535 * Generate company directory ajax function. 536 */ 442 537 $this->loader->add_action( 'wp_ajax_accp_generate_company_dir', $plugin_admin, 'accp_generate_company_dir'); 443 538 444 // Specify company directory ajax function 539 540 /** 541 * Specify company directory ajax function. 542 */ 445 543 $this->loader->add_action( 'wp_ajax_accp_specify_company_dir', $plugin_admin, 'accp_specify_company_dir'); 446 544 447 // Clear Mime Type option ajax function 545 546 /** 547 * Clear Mime Type option ajax function. 548 */ 448 549 $this->loader->add_action( 'wp_ajax_accp_clear_mime_type_option', $plugin_admin, 'accp_clear_mime_type_option'); 449 550 450 // Generate User Password ajax function 451 $this->loader->add_action( 'wp_ajax_accp_generate_user_password', $plugin_admin, 'accp_generate_user_password'); 452 453 //Add content above the clienfile list table 551 552 /** 553 * Generate User Password ajax function. 554 */ 555 $this->loader->add_action( 'wp_ajax_accp_generate_user_password', $plugin_admin, 'accp_generate_user_password'); 556 557 558 /** 559 * Add content above the clienfile list table. 560 */ 454 561 $this->loader->add_action( 'all_admin_notices', $plugin_admin, 'accp_add_content_before_file_list_table', 10, 3); 455 562 456 // DEPRECATED - ACCP Hook - After File Upload 457 / /$this->loader->add_action( 'accp_after_file_upload', $plugin_admin, $call_back = NULL, 10, 2 );458 459 // File and Invoice Download AJAX function563 564 /** 565 * File and Invoice Download AJAX function. 566 */ 460 567 $this->loader->add_action('init', $plugin_admin, 'accp_get_download'); 461 568 462 // Add items to the plugin row actions menu in the plugin list 569 570 /** 571 * Add items to the plugin row actions menu in the plugin list. 572 */ 463 573 $this->loader->add_filter( 'plugin_action_links_' . plugin_basename(dirname(__DIR__) ) .'/ars-constellation-client-portal.php', $plugin_admin, 'accp_add_links_to_plugin_row_actions_menu', 10, 4 ); 574 464 575 465 // Add an upgrade link to the plugin menu in the WP plugin list - base plugin only. 466 if ( $this->plugin_name !== 'ars-constellation-client-portal-pro' && $this->plugin_name !== 'ars-constellation-client-portal-premium' ){ 576 /** 577 * Add an upgrade link to the plugin menu in the WP plugin list - base plugin only. 578 */ 579 if ( $this->plugin_name !== 'ars-constellation-client-portal-pro' ){ 580 467 581 $this->loader->add_filter( 'plugin_action_links_' . plugin_basename(dirname(__DIR__) ) .'/ars-constellation-client-portal.php', $plugin_admin, 'accp_add_upgrade_link_to_plugin_row_actions_menu', 10, 4 ); 582 468 583 } 469 584 470 // Add items to the plugin row meta. 471 $this->loader->add_filter( 'plugin_row_meta', $plugin_admin, 'accp_add_plugin_row_meta', 10, 4 ); 472 473 /* END Core (Basic tier) hooks */ 474 475 476 /* Pro tier hooks */ 477 if ( $this->plugin_name == 'ars-constellation-client-portal-pro' ){ 478 479 // Include the Pro hooks 585 586 /** 587 * Add items to the plugin row meta. 588 */ 589 $this->loader->add_filter( 'plugin_row_meta', $plugin_admin, 'accp_add_plugin_row_meta', 10, 4 ); 590 591 592 /** 593 * Pro tier hooks 594 */ 595 if ( $this->plugin_name == 'ars-constellation-client-portal-pro' ){ 596 480 597 $plugin_pro_admin = new ARS_Constellation_Client_Portal_Pro_Admin( $this->get_plugin_name(), $this->get_version() ); 481 598 $plugin_pro_email = new ARS_Constellation_Client_Portal_Pro_Email( $this->get_plugin_name(), $this->get_version() ); … … 487 604 } 488 605 606 489 607 /** 490 608 * Register public hooks … … 501 619 $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); 502 620 503 // Client File List shortcode - [accp_clientfiles] 621 /** 622 * Client File List shortcode - [accp_clientfiles]. 623 */ 504 624 $this->loader->add_shortcode( 'accp_clientfiles', $list_shortcodes, 'get_client_files_shortcode' ); 505 625 506 // Client Invoice List shortcode - [accp_clientinvoices] 626 627 /** 628 * Client Invoice List shortcode - [accp_clientinvoices]. 629 */ 507 630 $this->loader->add_shortcode( 'accp_clientinvoices', $list_shortcodes, 'get_client_invoices_shortcode' ); 508 631 509 632 510 // Client Home Page Link shortcode - [accp_my_company_page] 633 /** 634 * Client Home Page Link shortcode - [accp_my_company_page]. 635 */ 511 636 $this->loader->add_shortcode( 'accp_my_company_page', $plugin_public, 'accp_client_home_link' ); 512 513 /* Pro tier hooks */ 514 if ( $this->plugin_name == 'ars-constellation-client-portal-pro' ){ 515 516 // Include the Pro hooks 637 638 639 /** 640 * Pro tier hooks 641 */ 642 if ( $this->plugin_name == 'ars-constellation-client-portal-pro' ){ 643 517 644 $plugin_pro_public = new ARS_Constellation_Client_Portal_Pro_Public( $this->get_plugin_name(), $this->get_version() ); 518 645 require_once ( dirname(__DIR__) . '/pro/public/ars-constellation-client-portal-pro-public-hooks.php' ); 519 646 520 647 } 521 522 648 523 649 } -
constellation-client-portal/trunk/public/class-ars-constellation-client-portal-public.php
r2973972 r3062211 9 9 */ 10 10 11 /** 12 * Exit if accessed directly. 13 */ 11 14 if ( ! defined( 'ABSPATH' ) ) { 12 exit; // Exit if accessed directly15 exit; 13 16 } 14 17 -
constellation-client-portal/trunk/public/css/ars-constellation-client-portal-list-shortcode-styles.css
r3018869 r3062211 2 2 * List shortcode CSS. 3 3 */ 4 5 4 .file-thumb-align-float-left{ 6 5 float: left; 7 6 } 7 8 8 .file-thumb-align-float-right{ 9 9 float: right; 10 10 } 11 11 12 .file-thumb-align-left{ 12 13 text-align: left; 13 14 width: 100%; 14 15 } 16 15 17 .file-thumb-align-right{ 16 18 text-align: right; 17 19 width: 100%; 18 20 } 21 19 22 .file-thumb-align-center{ 20 23 text-align: center; 21 24 width: 100%; 22 25 } 26 23 27 .accp-past-due-notice{ 24 28 font-weight:bold; … … 31 35 vertical-align: middle; 32 36 } 37 33 38 .accp-due-date{ 34 39 font-size: 12px; 35 40 } 41 36 42 .accp-post-status{ 37 43 font-size: 12px; 38 44 } 45 39 46 .accp-list-item-meta .accp-post-meta-item:not(:last-child):after{ 40 47 content:'|'; … … 42 49 margin-right: 5px; 43 50 } 51 44 52 .accp-list-item-meta .accp-due-date.accp-post-meta-item::after{ 45 53 content: none; 46 54 } 55 47 56 .accp_documents_filelist .accp-file-list-item-title a{ 48 57 text-decoration-color: none; 49 58 } 59 50 60 .accp-file-list-item-title{ 51 61 margin-top: 12px; 52 62 display: block; 53 63 } 64 54 65 .accp-file-post-date{ 55 66 margin-top: 3px; 56 67 font-size: 14px; 57 68 } 69 58 70 .accp-item-container{ 59 71 background: #f9f9f9 none repeat scroll 0 0; … … 66 78 padding-top: 15px; 67 79 } 80 68 81 .accp_documents_filelist .accp-list-item-meta{ 69 82 margin-bottom: 10px; 70 83 } 84 71 85 .accp-page-nav-container{ 72 86 border: 1px solid #f9f9f9; 73 87 padding: 10px; 74 88 } 89 75 90 .accp-pay-btn{ 76 91 -moz-user-select: none; … … 90 105 transition: all 0.2s ease-out 0s; 91 106 } 107 92 108 .accp-pay-btn a{ 93 109 color: #fff; … … 98 114 display: block; 99 115 } 116 100 117 a.accp-pay-link{ 101 118 color: #fff; 102 119 } 120 103 121 .accp-view-dl-link-container a{ 104 122 font-size: 11px; 105 123 text-decoration: none; 106 124 } 125 107 126 .accp-pay-btn:hover{ 108 127 background-color: #3cacf6; -
constellation-client-portal/trunk/public/shortcodes/class-ars-constellation-client-portal-list-shortcodes.php
r3043713 r3062211 8 8 */ 9 9 10 /** 11 * Exit if accessed directly. 12 */ 10 13 if ( ! defined( 'ABSPATH' ) ) { 11 exit; // Exit if accessed directly14 exit; 12 15 } 13 16 … … 1277 1280 do_action('accp_after_invoice_list_pagination', $post_id, $shortcode_id, $list_instance); 1278 1281 1279 }else{ 1282 } 1283 1284 if( 'accp_clientfile' === $list_type ){ 1280 1285 1281 1286 do_action('accp_after_file_list_pagination', $post_id, $shortcode_id, $list_instance); 1287 1288 } 1289 1290 if( 'accp_global_file' === $list_type ){ 1291 1292 do_action('accp_after_global_file_list_pagination', $post_id, $shortcode_id, $list_instance); 1282 1293 1283 1294 } … … 2322 2333 } 2323 2334 2324 2325 2335 } -
constellation-client-portal/trunk/uninstall.php
r2862820 r3062211 10 10 */ 11 11 12 // Exit if not called from WordPress. 12 /** 13 * Exit if not called from WordPress. 14 */ 13 15 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { 14 16 exit;
Note: See TracChangeset
for help on using the changeset viewer.