Plugin Directory

Changeset 3062211


Ignore:
Timestamp:
04/01/2024 05:33:31 PM (23 months ago)
Author:
arstudios
Message:

Release 1.8.1.

Location:
constellation-client-portal
Files:
131 added
1 deleted
21 edited

Legend:

Unmodified
Added
Removed
  • constellation-client-portal/trunk/README.txt

    r3043713 r3062211  
    55Requires at least: 5.0.0
    66Tested up to: 6.4
    7 Stable tag: 1.8.0
     7Stable tag: 1.8.1
    88Requires PHP: 7.4
    99License: GPLv3 or later
     
    206206
    207207== 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
    208232= 1.8.0 (Pro) - 2024-3-1 =
    209233* 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  
    1111 */
    1212
     13/**
     14 * Exit if accessed directly.
     15 */
    1316if ( ! defined( 'ABSPATH' ) ) {
    14 
    15     exit; // Exit if accessed directly
    16 
     17    exit;
    1718}
    1819
     
    8990    }
    9091
     92
    9193    /**
    9294     * Register the JavaScript for the admin area.
     
    108110     * File Check Redirects
    109111     *
    110      * Prevent direct access to clientfiles
     112     * Prevent direct access to clientfiles.
    111113     */
    112114    function accp_file_redirect_init() {
     
    180182
    181183    /**
    182      * Add ACCP query_vars
     184     * Add ACCP query_vars.
    183185     */
    184186    function accp_query_vars( $query_vars ){
     
    234236                 */
    235237               
    236                 // Exit if the pro check class does not exist.
     238                /**
     239                 * Exit if the pro check class does not exist.
     240                 */
    237241                if( !class_exists('ARS_Constellation_Client_Portal_Pro_File_Checks') ){
    238242
     
    300304
    301305                }
    302 
    303306               
    304307            }
     
    339342    }
    340343
     344
    341345    /**
    342346     * Load requested file.
     
    349353        if($checks_passed == false) return;
    350354
    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         */
    352358        $file_path = parse_url( esc_url_raw($request_uri), PHP_URL_PATH);
    353359
    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         */
    355364        $home_path = $this->accp_get_wp_home_path();
    356365        $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         */
    360372        $mime = wp_check_filetype($file);
    361373
     
    387399
    388400        /**
    389          * Actually serve the file.
     401         * Serve the file.
    390402         */
    391403        readfile( $file );
     
    453465        if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) {
    454466         
    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            }
    464476
    465477        }
     
    470482    /**
    471483     * 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.
    472491     */
    473492    function accp_add_plugin_row_meta( $links, $file ) {
    474493
    475494        if ( strpos( $file, plugin_basename( dirname(__DIR__) ) ) !== false ) {
     495
    476496            $new_links = array(
    477497                '<a href="https://adrianrodriguezstudios.com/documentation-constellation-client-portal/" target="_blank">Documentation</a>'
    478                 );
     498            );
    479499           
    480500            $links = array_merge( $links, $new_links );
     501
    481502        }
    482503       
     
    488509    /**
    489510     * 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}.
    490520     */
    491521    function accp_add_links_to_plugin_row_actions_menu( $actions, $plugin_file, $plugin_data, $context ){       
     
    505535    }
    506536
    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}.
    510549     */
    511550    function accp_add_upgrade_link_to_plugin_row_actions_menu( $actions, $plugin_file, $plugin_data, $context ){       
     
    526565     *
    527566     * 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.
    529568     */
    530569    function accp_delete_file_on_post_delete(){
     
    638677                $note_id = get_the_ID();
    639678
    640                 // Delete the note post.
     679                /**
     680                 * Delete the note post.
     681                 */
    641682                wp_delete_post($note_id, true);
    642683
     
    670711            die ();
    671712       
    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.
    673714        $included_post_types = array( 'accp_clientinvoice', 'accp_clientfile', 'accp_global_file' );
    674715       
     
    760801        $nonce = filter_var($_POST['empty_trash_nonce'], FILTER_SANITIZE_STRING);
    761802
    762         if ( ! wp_verify_nonce( $nonce, 'clientfile_admin_nonce' ) )
     803        if ( !wp_verify_nonce( $nonce, 'clientfile_admin_nonce' ) )
    763804            die ();
    764805
     
    793834                if($post_type !== 'accp_clientcompany'){
    794835
    795                     // Check if the post has file.
     836                    /**
     837                     * Check if the post has a file.
     838                     */
    796839                    if (!empty($accp_file)  ) {
    797840
     
    855898
    856899    /**
    857      * Restrict access to Client Pages, Client File and
    858      * Client Invoice, and Global File posts on front-end.
     900     * Restrict access to Client Pages, Client File, Client Invoice,
     901     * and Global File posts on the front-end.
    859902     */
    860903    function accp_restrict_client_page_access(){
     
    9671010        $current_user_id = $current_user->ID;
    9681011
    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         */
    9711016        $args  = array(
    9721017          'meta_query' => array(
     
    9941039        foreach ($users as $user) {
    9951040            $user_id_array[] = $user->ID;
    996         }
    997        
     1041        }       
    9981042
    9991043        if( $post_type == 'accp_clientcompany' ){
     
    10121056
    10131057            }
    1014         }
     1058
     1059        }
     1060
    10151061    }
    10161062
     
    10181064    /**
    10191065     * 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.
    10201070     */
    10211071    function accp_get_company_dir($company_id) {       
    10221072
    1023         if( !isset($company_id) ) return false;
     1073        if( !isset($company_id) )
     1074            return false;
    10241075       
    10251076        $dir = get_post_meta($company_id, 'accp_dir', true);
     
    10381089
    10391090    /**
    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.
    10411094     *
    10421095     * Add 'enctype="multipart/form-data"' to allow
    10431096     * for file upload support.
     1097     *
     1098     * @hooked post_edit_form_tag.
    10441099     */
    10451100    function accp_update_post_edit_form_tag() {
     
    10621117    }
    10631118
    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.
    10661125     */
    10671126    public function accp_client_file_meta_box() {
    10681127       
    1069         $screens = array( 'accp_clientfile', 'accp_clientinvoice' );
    1070        
     1128        $screens = array( 'accp_clientfile', 'accp_clientinvoice' );       
    10711129        $is_pro = $this->accp_utility_functions->is_pro_plugin($this->plugin_name);
    10721130
     
    10871145
    10881146    /**
    1089      * Client file meta boxes.
     1147     * Client file attachment meta box content.
    10901148     *
    10911149     * Adds the file upload and current file UI.
     
    11251183             * Verify that the actual file (not post) still exists.
    11261184             */
    1127             clearstatcache();           
     1185            clearstatcache();
    11281186           
    11291187            if ( file_exists($accp_file_full_path) ):               
     
    12671325
    12681326    /**
    1269      * Reassign file to another company
     1327     * Reassign file to another company - AJAX function.
    12701328     */
    12711329    function accp_reassign_file_1(){
     
    14061464
    14071465    /**
    1408      * Generate a Company Directory - AJAX
     1466     * Generate a company directory - AJAX.
    14091467     */
    14101468    function accp_generate_company_dir(){
     
    14361494
    14371495        $new_company_dir = get_post_meta($company_id, 'accp_dir', true);
    1438 
    14391496        $accp_clientfiles_full_dir_path = $this->accp_utility_functions->accp_get_clientfiles_path();
    14401497       
     
    14541511            mkdir($new_company_path);
    14551512
     1513
    14561514            /**
    14571515             * Add the new directory name post meta.
     
    14591517            add_post_meta( $company_id, 'accp_dir', $new_company_dir );
    14601518
     1519
    14611520            /**
    14621521             * Add a note indicating that the new dir was created - Pro feature.
     
    14871546
    14881547            $new_dir_name = $new_company_dir;
     1548
    14891549
    14901550            /**
     
    15701630    /**
    15711631     * 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.
    15721635     */
    15731636    function accp_add_directory_update_note($company_id, $note_content){
     
    15761639            return;
    15771640
    1578         if(class_exists('ARS_Constellation_Client_Portal_Pro_Notes')){
     1641        if( class_exists('ARS_Constellation_Client_Portal_Pro_Notes') ){
    15791642
    15801643            $accp_notes = new ARS_Constellation_Client_Portal_Pro_Notes($this->version, $this->plugin_name);
     
    15911654    }
    15921655
    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).
    15961663     */
    15971664    function accp_move_files_to_another_directory($old_dir_name, $new_dir_name){
    15981665
    1599         if(!is_admin() || !current_user_can('manage_options'))
     1666        if( !is_admin() || !current_user_can('manage_options') )
    16001667            die();
    16011668
     
    16061673        $new_dir_name = filter_var(preg_replace("/[^-\w,]/", "", $new_dir_name), FILTER_SANITIZE_STRING);
    16071674
    1608         if(!$old_dir_name || !$new_dir_name)
     1675        if( !$old_dir_name || !$new_dir_name )
    16091676            return false;
    16101677
    1611         if($old_dir_name == $new_dir_name)
     1678        if( $old_dir_name == $new_dir_name )
    16121679            return false;
    16131680       
     
    17391806
    17401807    /**
    1741      * Specify a Company Directory - AJAX
     1808     * Specify a company directory - AJAX.
    17421809     */
    17431810    function accp_specify_company_dir(){
     
    18891956
    18901957
    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.
    19581965     */
    19591966    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() )           
    19851969            return wp_die('Invalid command.');
    19861970       
     
    19881972            return $post_id;
    19891973       
     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;   
    19901995       
    19911996        /**
     
    20032008            update_post_meta($post_id, 'accp_user', $company_id);
    20042009
    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
    20082033        /**
    20092034         *  Verify that the file field is not empty.
     
    20122037         * are used to verify and handle the upload.
    20132038         */
    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             */
    20172044            $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             */
    20202050            if(!empty($enabled_option_list)){
    20212051
     
    20312061
    20322062            }
    2033            
     2063
    20342064           
    20352065            /**
    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.
    20372074             */
    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) ) {                             
    20542076               
    20552077                /**
    2056                  * Prep upload.
     2078                 * Upload the file.
    20572079                 */             
    20582080                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
    20602084                }
    20612085   
    2062                 if(isset($upload['error']) && $upload['error'] != 0) {
     2086                if( isset($upload['error']) && $upload['error'] != 0 ){
    20632087                   
    20642088                    wp_die( 'There was an error uploading your file. ' . $upload['error'] );               
     
    20672091
    20682092                    /**
    2069                      * Update save uploaded file info to post meta.
     2093                     * Save uploaded file info to post meta.
    20702094                     */
    20712095                    update_post_meta($post_id, 'accp_file', $upload);                   
     
    20762100                     * company directory if it doesn't already exist.
    20772101                     */
    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);
    20882103
    20892104
     
    20962111                    //do_action('accp_after_file_upload', $post_id, $company_id);             
    20972112
    2098                     if ( !file_exists( $company_dir )){
    2099 
    2100                         copy($source_file, $company_dir);
    2101 
    2102                     }
    21032113
    21042114                    /**
    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.
    21092117                     */
    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);
    21152119
    21162120                }
     
    21212125
    21222126            }
     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);
    21232234
    21242235        }       
     
    21512262            return $default_dir;       
    21522263       
    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           
    21542289        $base_dir = $this->wp_uploads_base_dir_const . '/accp-clientfiles';
    21552290        $base_url = $this->wp_uploads_base_url_const . '/accp-clientfiles';
     
    21742309
    21752310    /**
    2176      * File and Invoice Dowload Function
     2311     * File attachment front-end download functionality.
    21772312     */
    21782313    public function accp_get_download(){
     
    21822317        if( !isset($_GET['accp-dl-id'])  ) return;     
    21832318
    2184         if( !is_user_logged_in() ) {
     2319        if( !is_user_logged_in() ){
     2320
    21852321            wp_redirect( wp_login_url($_SERVER['REQUEST_URI']) );
    21862322            exit;
     2323
    21872324        }       
    21882325       
    21892326        $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;
    21942333
    21952334        $file_company_id = get_post_meta($file_id, 'accp_user', true);
     
    22182357
    22192358        $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);       
    22222360        $accp_dir_and_filename = $company_dir_name . '/' . basename($accp_file['file']);
    22232361        $accp_file_path = $this->wp_uploads_base_dir_const . '/accp-clientfiles/' . $accp_dir_and_filename;
     
    22332371
    22342372    /**
    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."
    22362378     */
    22372379    private function accp_output_file($file, $name, $mime_type = '', $action = 'download') {
     
    22442386         */
    22452387        $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 ) );
    22472389       
    22482390        /**
     
    22502392         */
    22512393        if($file_extension == 'jpeg'){
     2394
    22522395            $file_extension = 'jpg';
     2396
    22532397        }
    22542398
     
    22602404
    22612405                if( strtolower($file_extension) == strtolower($value['file_extension']) ){
     2406
    22622407                    $mime_type = $value['file_extension'];
    22632408                    break;
     2409
    22642410                }
    22652411
     
    22692415
    22702416        if( $mime_type == '' || $mime_type == NULL || $mime_type == 'undefined'){
     2417
    22712418            $mime_type = 'application/force-download';
     2419
    22722420        }       
    22732421       
     
    23172465        $bytes_send = 0;
    23182466
    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']) )
    23222470                fseek($file, $range);
    23232471
    2324             while(!feof($file) && (!connection_aborted()) && ($bytes_send < $updated_length)){
     2472            while( !feof($file) && (!connection_aborted()) && ($bytes_send < $updated_length) ){
    23252473
    23262474                $buffer = fread($file, $chunk_size);
     
    23472495    /**
    23482496     * 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.
    23492501     */
    23502502    private function set_base_file_headers($mime_type, $action, $name){
     
    23722524       
    23732525        if(ini_get('zlib.output_compression')){
     2526
    23742527            ini_set('zlib.output_compression', 'Off');
     2528
    23752529        }
    23762530
     
    23862540        $screen = 'accp_client_pages';
    23872541       
    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');
    23892543
    23902544    }
     
    24762630            $current_screen = get_current_screen();
    24772631
    2478             if( $current_screen->id === "accp_client_pages" ) {
     2632            if( 'accp_client_pages' === $current_screen->id ) {
    24792633
    24802634                global $post;
     
    25272681        }
    25282682
    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.
    28732688     */
    28742689    function accp_add_content_before_file_list_table(){
     
    29122727     * Define MIME Types.
    29132728     *
    2914      * @return array Returns list of defined mime types (enabled and disabled).
     2729     * @return array $mime_types - Array of defined mime types (enabled and disabled).
    29152730     */
    29162731    function accp_defined_file_mime_types(){
     
    30322847     * Get Enabled ACCP Mime Type Options
    30332848     *
    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     *
    30352851     * Option value = $enabled_mime_types['value'].
    30362852     */
     
    30442860           
    30452861            if( get_option($value['option_name']) ){
     2862
    30462863                $enabled_mime_types[] = $value;
     2864
    30472865            }
    30482866
     
    30562874    /**
    30572875     * Get Enabled TCP Mime Type Option Values
    3058      * @return array Returns list of enabled (only) mime type option values.
     2876     * @return array $enabled_mime_type_vals - Array of enabled (only) mime type option values.
    30592877     */
    30602878    function accp_get_enabled_mime_type_option_values(){
     
    30652883
    30662884        foreach ($enabled_mime_types as $key => $value) {
     2885
    30672886            $enabled_mime_type_vals[] = $value['value'];
     2887
    30682888        }
    30692889
     
    30722892    }
    30732893
    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           
    30852895    /**
    30862896     * Add Client Portal sub menu items
     
    30912901        /**
    30922902         * 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         */         
    30952904        add_submenu_page('accp-settings', 'Companies', 'Companies', 'manage_options', 'edit.php?post_type=accp_clientcompany' );       
    30962905
     
    32173026    /**
    32183027     * 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.
    32193034     */
    32203035    function add_wp_user_list_columns($columns){
     
    32293044    /**
    32303045     * 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.
    32313054     */
    32323055    function add_wp_user_list_column_content($output, $column_name, $user_id){
     
    33623185
    33633186    /**
    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.
    33693190     * @param string $type - The type of message type from the
    33703191     * list of available WP admin notice type classes (notice-error,
     
    34303251
    34313252    /**
    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'
    34333254     * option is present and set to 'rewrite-flush-needed.'
    34343255     *
    3435      * @hooked to init.
     3256     * @hooked init.
    34363257     */
    34373258    function accp_maybe_flush_rewrite_rules(){
     
    35893410    }
    35903411
     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
    35913480} //End ARS_Constellation_Client_Portal_Admin Class
  • constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-client-pages.php

    r3043713 r3062211  
    1111 */
    1212
     13/**
     14 * Exit if accessed directly.
     15 */
    1316if ( ! defined( 'ABSPATH' ) ) {
    14     exit; // Exit if accessed directly
     17    exit;
    1518}
    1619
     
    6669
    6770        $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' ),
    8083        );
    8184
     
    142145
    143146        $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' ),
    159162        );
    160163
     
    209212
    210213        $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' ),
    226229        );
    227230
  • constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-company.php

    r3043713 r3062211  
    1111 */
    1212
     13/**
     14 * Exit if accessed directly.
     15 */
    1316if ( ! defined( 'ABSPATH' ) ) {
    14     exit; // Exit if accessed directly
     17    exit;
    1518}
    1619
     
    3639
    3740    /**
    38      * Initialize the class and set its properties.
    39      *
    4041     * @since    1.0.0
    4142     * @param      string    $plugin_name       The name of this plugin.
     
    5960
    6061        $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' ),
    7374        );
    7475
     
    321322
    322323            add_meta_box("company-home-page", "Company Home Page", array($this, "display_home_page_meta_options"), $screen, "side");       
     324           
    323325            add_meta_box("company-upload-dir", "Company Upload Directory", array($this, "display_company_upload_meta_options"), $screen, "normal", "high");     
     326           
    324327            add_meta_box("company-primary-user", "Company Primary User", array($this, "display_company_primary_user_meta_options"), $screen, "normal", "high");
     328           
    325329            add_meta_box("company-users", "Company Users", array($this, "display_company_user_meta_options"), $screen, "normal", "high");
    326330
  • constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-core-authorization.php

    r3043713 r3062211  
    3434
    3535    /**
    36      * Initialize the class and set its properties.
    37      *
    3836     * @since    1.0.0
    3937     * @param      string    $plugin_name       The name of this plugin.
     
    5351     *
    5452     * @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.
    5554     * @return bool $authorized true|false - true if authorized, and false if not authorized.
    5655     */
     
    177176     *
    178177     * @param int $company_id - the post ID of the company to verify.
     178     * @param int $user_id - the user ID of the current user.
    179179     * @return bool $authorized true|false - true if authorized, and false if not authorized.
    180180     */
     
    292292     * Get the additional assigned companies for a user.
    293293     *
    294      * @param int $user_id - the ID of the user to check.
    295      * @return array $additional_companies - array of comapny ID's that
     294     * @param int $user_id - The ID of the user to check.
     295     * @return array $additional_companies - Array of comapny ID's that
    296296     * the user is assigned to, if any.
    297297     */
  • constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-core-file-checks.php

    r2906601 r3062211  
    1111 */
    1212
     13/**
     14 * Exit if accessed directly.
     15 */
    1316if ( ! defined( 'ABSPATH' ) ) {
    14     exit; // Exit if accessed directly
     17    exit;
    1518}
    1619
     
    3639
    3740    /**
    38      * Initialize the class
    39      *
    4041     * @since    1.0.0
    4142     * @param      string    $plugin_name The name of this plugin.
     
    7677    /**
    7778     * Direct file access base checks.
     79     *
     80     * @param string $request_uri - The file URL.
    7881     */
    7982    function accp_direct_file_access_base_checks($request_uri){
  • constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-file.php

    r3043713 r3062211  
    1111 */
    1212
     13/**
     14 * Exit if accessed directly.
     15 */
    1316if ( ! defined( 'ABSPATH' ) ) {
    14     exit; // Exit if accessed directly
     17    exit;
    1518}
    1619
     
    6669
    6770        $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' ),
    8083        );
    8184
     
    133136
    134137        $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' ),
    150153        );
    151154
     
    192195
    193196        $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' ),
    209212        );
    210213
     
    240243
    241244        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    }   
    270246
    271247
     
    388364    function accp_add_core_file_list_filter_fields($post_type, $which){     
    389365
    390         if($post_type != 'accp_clientfile') return;
     366        if( $post_type != 'accp_clientfile' )
     367            return;
    391368
    392369        /**
  • constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-invoice.php

    r3043713 r3062211  
    1111 */
    1212
     13/**
     14 * Exit if accessed directly.
     15 */
    1316if ( ! defined( 'ABSPATH' ) ) {
    14     exit; // Exit if accessed directly
     17    exit;
    1518}
    1619
     
    3639
    3740    /**
    38      * Initialize the class and set its properties.
    39      *
    4041     * @since    1.0.0
    4142     * @param      string    $plugin_name       The name of this plugin.
     
    6667
    6768        $labels = array(
    68             'name' => _x( 'Client Invoices', 'clientinvoice' ),
    69             'singular_name' => _x( 'Client Invoice', 'clientinvoice' ),
    70             'add_new' => _x( 'Add New', 'clientinvoice' ),
    71             'add_new_item' => _x( 'Add New Client Invoice', 'clientinvoice' ),
    72             'edit_item' => _x( 'Edit Client Invoice', 'clientinvoice' ),
    73             'new_item' => _x( 'New Client Invoice', 'clientinvoice' ),
    74             'view_item' => _x( 'View Client Invoice', 'clientinvoice' ),
    75             'search_items' => _x( 'Search Client Invoices', 'clientinvoice' ),
    76             'not_found' => _x( 'No client invoices found', 'clientinvoice' ),
    77             'not_found_in_trash' => _x( 'No client invoices found in Trash', 'clientinvoice' ),
    78             'parent_item_colon' => _x( 'Parent Client Invoice:', 'clientinvoice' ),
    79             'menu_name' => _x( 'Client Invoices', 'clientinvoice' ),
     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' ),
    8081        );
    8182
     
    134135
    135136        $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' ),
    151152        );
    152153
     
    193194
    194195        $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' ),
    210211        );
    211212
     
    243244
    244245    }   
    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   
    273247
    274248    /**
  • constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-settings.php

    r3043713 r3062211  
    55 * Core settings related functionality.
    66 */
     7
     8/**
     9 * Exit if accessed directly.
     10 */
    711if ( ! defined( 'ABSPATH' ) ) {
    8     exit; // Exit if accessed directly
     12    exit;
    913}
    1014
     
    5559        add_submenu_page(
    5660            'accp-settings',
    57             __( 'General Settings', 'accp' ),
    58             __( 'Settings', 'accp' ),
     61            __( 'General Settings', 'constellation-client-portal' ),
     62            __( 'Settings', 'constellation-client-portal' ),
    5963            'manage_options',         
    6064            'accp-settings',
     
    11961200            'step'        => array(),
    11971201            'maxlength'   => array(),
    1198             'data-post-type' => array(),           
     1202            'data-post-type' => array(),
     1203            'media'       => array(),
    11991204        );
    12001205
  • constellation-client-portal/trunk/admin/class-ars-constellation-client-portal-users.php

    r2920206 r3062211  
    1111 */
    1212
     13/**
     14 * Exit if accessed directly.
     15 */
    1316if ( ! defined( 'ABSPATH' ) ) {
    14 
    15     exit; // Exit if accessed directly
    16 
     17    exit;
    1718}
    1819
     
    3839
    3940    /**
    40      * Initialize the class and set its properties.
    41      *
    4241     * @since    1.0.0
    4342     * @param      string    $plugin_name       The name of this plugin.
     
    5049        $this->accp_utility_functions = new ACCP_Utility_Functions();       
    5150
     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           
    52531    }
    53532
     
    231710
    232711    }
     712   
    233713
    234714} // END ARS_Constellation_Client_Portal_Users
  • constellation-client-portal/trunk/admin/css/ars-constellation-client-portal-admin.css

    r3043713 r3062211  
    11/**
    2  * Admin-specific CSS
    3  */
    4  
     2 * Core Admin CSS.
     3 */
    54#client-meta .select2{
    65    width: 100% !important;
     
    1514}
    1615
    17 .home-page-hov-nav li {
     16.home-page-hov-nav li{
    1817    display: inline;
    1918    font-size: 13px;
     
    3635}
    3736
    38 .accp-number-column {
     37.accp-number-column{
    3938    width: 40px;
    4039    text-align: center;
     
    4746}
    4847
    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{
    5049    font-size: 19px;
    5150}
     
    5453    display: none;
    5554}
    56 
    57 /* .alternate, .striped > tbody > :nth-child(3n + 1) {
    58     background-color: #f9f9f9;
    59 } */
    6055
    6156.main-dir-row.even-row, .file-detail-row.even-row{
     
    6762}
    6863
    69 .unassigned-text {
     64.unassigned-text{
    7065    color: #B1B1B1;
    7166}
    7267
    73 .file-controls {
     68.file-controls{
    7469    display: block;
    7570    width: 100%;
     
    7772}
    7873
    79 .file-del-confirm-div, .dir-del-confirm-div {
     74.file-del-confirm-div, .dir-del-confirm-div{
    8075    margin-bottom: 30px;
    8176    padding-bottom: 30px;
     
    8782}
    8883
    89 .del-btn-container, .del-dir-btn-container {
     84.del-btn-container, .del-dir-btn-container{
    9085    display: block;
    9186    margin-top: 8px;
    9287}
    9388
    94 .inactive-text {
     89.inactive-text{
    9590    color: #B1B1B1;
    9691}
    9792
    98 .small-note {
     93.small-note{
    9994    font-size: 11px;
    10095    font-style: italic;
    10196}
    10297
    103 .tax-role-exclude {
     98.tax-role-exclude{
    10499    margin-top: 15px;
    105100    margin-bottom: 40px;
     
    113108.tax-role-exclude .select2,
    114109.tax-company-exclude .select2,
    115 .tax-custom-select .select2 {
     110.tax-custom-select .select2{
    116111    width: 95% !important;
    117112}
    118113
    119 .accp-settings-messages-and-errors-item.notice {
     114.accp-settings-messages-and-errors-item.notice{
    120115    padding-top: 20px;
    121116    padding-bottom: 20px;
    122117}
    123118
    124 .accp-settings-note.small-note {
     119.accp-settings-note.small-note{
    125120    display: block;
    126121    margin-top: 7px;
    127122}
    128123
    129 #accp-admin-main-content {
     124#accp-admin-main-content{
    130125    max-width: 100%;
    131126    background-color: #fff;
     
    145140}
    146141
    147 .company-assign-container .select2-selection__arrow {
     142.company-assign-container .select2-selection__arrow{
    148143    top: 10px !important;
    149144    right: 3px !important;
    150145}
    151146
    152 .accp-upgrade-tab-banner {
     147.accp-upgrade-tab-banner{
    153148    background-color: #005be0;
    154149    color: #FFF;
     
    159154}
    160155
    161 .accp-upgrade-tab-banner h2 {
     156.accp-upgrade-tab-banner h2{
    162157    color: #fff;
    163158    font-size: 40px;
     
    165160}
    166161
    167 .accp-upgrade-tab-banner p {
     162.accp-upgrade-tab-banner p{
    168163    font-size: 18px;
    169164    font-style: italic;
     
    177172}
    178173
    179 .accp-upgrade-tab-banner a {
     174.accp-upgrade-tab-banner a{
    180175    color: #fff;
    181176    text-decoration: none;
     
    186181}
    187182
    188 .accp-upgrade-tab-banner a::after {
     183.accp-upgrade-tab-banner a::after{
    189184    content: '>';
    190185    font-weight: bold;
     
    193188}
    194189
    195 .accp-upgrade-button {
     190.accp-upgrade-button{
    196191    background-color: orange;
    197192    display: block;
     
    213208}
    214209
    215 .accp-settings-page-container .accp-upgrade-button {
     210.accp-settings-page-container .accp-upgrade-button{
    216211    border-radius: 8px;
    217212}
     
    225220}
    226221
    227 .accp-setting-logo-container {
     222.accp-setting-logo-container{
    228223    background-color: #fff;   
    229224}
    230225
    231 .accp-setting-logo-container img {   
     226.accp-setting-logo-container img{   
    232227    width: 80%;
    233228    max-width: 300px;
     
    239234}
    240235
    241 .delete-screen-notice {
     236.delete-screen-notice{
    242237    display: inline-block;
    243238    margin-top: 6px;
     
    261256}
    262257
    263 .accp-filemgmt-button.button {
     258.accp-filemgmt-button.button{
    264259    margin-right: 5px !important;
    265260}
    266 .accp-filemgmt-button.button:last-child {
     261.accp-filemgmt-button.button:last-child{
    267262    margin-right: 0px !important;
    268263}
     
    280275}
    281276
    282 li.accp-filemgmt-button.button {
     277li.accp-filemgmt-button.button{
    283278    padding: 0 !important;
    284279    overflow: hidden;
     
    286281}
    287282
    288 .shortcode-markup {
     283.shortcode-markup{
    289284    border: 1px solid #ccc;
    290285    background-color: #efefef;
     
    317312}
    318313
    319 #curr_file_container {
     314#curr_file_container{
    320315    border-bottom: 1px solid #eee;
    321316    padding-bottom: 25px;
     
    329324}
    330325
    331 .wp-admin input[type="file"].accp-upload-btn {
     326.wp-admin input[type="file"].accp-upload-btn{
    332327    padding-left: 7px;
    333328    padding-right: 7px;
     
    335330}
    336331
    337 .accp-settings-section {
     332.accp-settings-section{
    338333    background-color: #fff;
    339334    padding-top: 10px;
     
    346341}
    347342
    348 .accp-settings-section h3 {
     343.accp-settings-section h3{
    349344    color: #3A3A3A;
    350345}
    351346
    352 .accp-settings-section h2 {
     347.accp-settings-section h2{
    353348    color: #005be0;
    354349    font-weight: normal;
     
    356351}
    357352
    358 ul.theme-thumb-list {
     353ul.theme-thumb-list{
    359354    list-style: none;
    360355}
    361356
    362 ul.theme-thumb-list li {
     357ul.theme-thumb-list li{
    363358    border: 1px solid #ccc;
    364359    background: #efefef;
     
    368363
    369364/* Odd */
    370 ul.theme-thumb-list li:nth-child(2n+1) {
     365ul.theme-thumb-list li:nth-child(2n+1){
    371366    float: left;
    372367}
    373368
    374369/* Even */
    375 ul.theme-thumb-list li:nth-child(2n) {
     370ul.theme-thumb-list li:nth-child(2n){
    376371    float: right;
    377372}
     
    388383}
    389384
    390 select[name="accp_login_redirect_select"] {
     385select[name="accp_login_redirect_select"]{
    391386    margin-top: 7px;
    392387}
    393388
    394 ul.accp-settings-tabs {
     389ul.accp-settings-tabs{
    395390    border-bottom: 1px solid #ddd;
    396391    margin-bottom: 25px;
    397392}
    398393
    399 .accp-settings-tabs li {
     394.accp-settings-tabs li{
    400395    display: inline-block;
    401396    background-color: #e0e0e0;
     
    427422}
    428423
    429 .accp-shortcode-col-heading {
     424.accp-shortcode-col-heading{
    430425    font-weight: bold;
    431426    color: #777;
     
    451446}
    452447
    453 input.accp-copy-text-enabled {
     448input.accp-copy-text-enabled{
    454449    cursor: pointer;
    455450    background-color: #eee;
     
    464459}
    465460
    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{
    471466    content: "\f0c5";
    472467    font-family: "Font Awesome 5 Free";
     
    477472}
    478473
    479 .accp-shortcode-input-container.accp-element-copied::after {
     474.accp-shortcode-input-container.accp-element-copied::after{
    480475    content: "\f00c";
    481476    font-family: "Font Awesome 5 Free";
     
    487482}
    488483
    489 .accp-settings-tabs li:hover {
     484.accp-settings-tabs li:hover{
    490485    background-color: #fff;   
    491486}
     
    507502}
    508503
    509 .accp-settings-tabs a {
     504.accp-settings-tabs a{
    510505    text-decoration: none;
    511506    font-size: 11px;
     
    515510}
    516511
    517 .accp-settings-tabs a:focus {
     512.accp-settings-tabs a:focus{
    518513    outline: none;
    519514    -webkit-box-shadow: none;
     
    529524}
    530525
    531 .accp-create-page-container {
     526.accp-create-page-container{
    532527    margin-top: 15px;
    533528}
    534529
    535 .accp-new-page-title {   
     530.accp-new-page-title{   
    536531    margin-bottom: 10px;
    537532}
    538533
    539 .accp-generate-page-form .accp-create-new-page-instructions {
     534.accp-generate-page-form .accp-create-new-page-instructions{
    540535    margin-top: 25px;
    541536    display: block;
     
    546541}
    547542
    548 .tablenav .select2-selection.select2-selection--single {
     543.tablenav .select2-selection.select2-selection--single{
    549544    height: 100%;
    550545    border-radius: 3px;
     
    559554}
    560555
    561 label .title.accp-quickedit-invoice-status-label {
     556label .title.accp-quickedit-invoice-status-label{
    562557    width: auto !important;
    563558    margin-right: 5px !important;
    564559}
    565560
    566 .accp-admin-invoice-data-quickedit {
     561.accp-admin-invoice-data-quickedit{
    567562    margin-bottom: 0;
    568563}
    569564
    570 .accp-duplicate-dir-assignment-notice {
     565.accp-duplicate-dir-assignment-notice{
    571566    padding: 15px;
    572567    border: 2px solid #ff5e5e;
     
    575570}
    576571
    577 .accp-reassign-directory-button.button {
     572.accp-reassign-directory-button.button{
    578573    margin-top: 15px;
    579574    margin-bottom: 15px;
    580575}
    581576
    582 .accp-dir-reassign-option {
     577.accp-dir-reassign-option{
    583578    background-color: #f6f7f7;
    584579    padding-top: 10px;
     
    590585}
    591586
    592 .accp-field-note {
     587.accp-field-note{
    593588    font-style: italic;
    594589    color: #808080;
     
    599594}
    600595
    601 .accp-boxed-container {
     596.accp-boxed-container{
    602597    background-color: #f6f7f7;
    603598    border: 1px solid #eeefef;
     
    606601}
    607602
    608 .accp-boxed-container.current-assigned-company-container {
     603.accp-boxed-container.current-assigned-company-container{
    609604    margin-bottom: 20px;
    610605}
    611606
    612 .accp-boxed-container label {
     607.accp-boxed-container label{
    613608    font-weight: 600;
    614609    padding-top: 15px;
    615610}
    616611
    617 .accp-or-sparator {
     612.accp-or-sparator{
    618613    font-weight: 600;
    619614}
     
    640635}
    641636
    642 .accp-wp-admin-tooltip {
     637.accp-wp-admin-tooltip{
    643638    position: absolute;
    644639    z-index: 1;
     
    656651}
    657652
    658 .accp-wp-admin-tooltip-dark {
     653.accp-wp-admin-tooltip-dark{
    659654    position: absolute;
    660655    z-index: 1;
     
    672667}
    673668
    674 .accp-wp-admin-tooltip.accp-user-status-tooltip {
     669.accp-wp-admin-tooltip.accp-user-status-tooltip{
    675670    left: 0;
    676671}
    677672
    678 .accp-wp-admin-tooltip::after {
     673.accp-wp-admin-tooltip::after{
    679674    content:'';
    680675    position: absolute;
     
    689684}
    690685
    691 .accp-wp-admin-tooltip-dark::after {
     686.accp-wp-admin-tooltip-dark::after{
    692687    border-top: solid 10px #3c434a;
    693688}
    694689
    695 .accp-wp-admin-has-tooltip-center {
     690.accp-wp-admin-has-tooltip-center{
    696691    left: 12%;
    697692    margin-top: -115px;
    698693}
    699694
    700 .accp-company-global-page-tooltip {
     695.accp-company-global-page-tooltip{
    701696    margin-top: -143px;
    702697}
    703698
    704 .accp-generate-page-form p.accp-create-new-page-instructions {
     699.accp-generate-page-form p.accp-create-new-page-instructions{
    705700    margin-top: 20px;
    706701}
    707702
    708 .accp-generate-new-page-field-container {
     703.accp-generate-new-page-field-container{
    709704    display: block;
    710705    margin-bottom: 10px;
    711706}
    712707
    713 .button.button-primary.accp-generate-new-page {
     708.button.button-primary.accp-generate-new-page{
    714709    margin-top: 15px;
    715710}
    716711
    717 .accp-unpublished-company-item {
     712.accp-unpublished-company-item{
    718713    padding: 10px;
    719714    background-color: #fff;
     
    722717}
    723718
    724 .accp-delete-unpublished-company-item {
     719.accp-delete-unpublished-company-item{
    725720    display: inline-block;
    726721    background-color: #C3C3C3;
     
    743738}
    744739
    745 option.accp-non-published-post-option {
     740option.accp-non-published-post-option{
    746741    color: #717171;
    747742}
    748743
    749 .accp-boxed-container label[for="accp_make_page_global"] {
     744.accp-boxed-container label[for="accp_make_page_global"]{
    750745    display: block;
    751746    padding-bottom: 15px;
    752747}
    753748
    754 .accp-boxed-container.accp-specify-company-field-container .select2-container {
     749.accp-boxed-container.accp-specify-company-field-container .select2-container{
    755750    padding-bottom: 15px;
    756751}
    757752
    758 .accp-boxed-container.current-assigned-company-container p {
     753.accp-boxed-container.current-assigned-company-container p{
    759754    padding-top: 15px;
    760755    padding-bottom: 15px;
     
    769764}
    770765
    771 .accp-dir-update-notice {
     766.accp-dir-update-notice{
    772767    border: 2px solid #c9d1de;
    773768    background-color: #e0e8f5;
     
    775770}
    776771
    777 .accp-dir-update-check-label {
     772.accp-dir-update-check-label{
    778773    display: block;
    779774    margin-bottom: 10px;
    780775}
    781776
    782 #accp-create-user-container {
     777#accp-create-user-container{
    783778    margin-top: 25px;
    784779}
    785780
    786 .accp-new-user-field {
     781.accp-new-user-field{
    787782    display: block;
    788783    margin-bottom: 20px;
    789784}
    790785
    791 .accp-set-width-label-85 {
     786.accp-set-width-label-85{
    792787    width: 85px;
    793788    display: inline-block;
    794789}
    795790
    796 #accp-autogenerate-password {
     791#accp-autogenerate-password{
    797792    margin-left: 10px;
    798793}
     
    812807}
    813808
    814 #accp-assign-primary-user-container {
     809#accp-assign-primary-user-container{
    815810    border: 1px solid #eeefef;
    816811    margin-top: 25px;
     
    822817}
    823818
    824 .accp-assign-primary-user-heading {
     819.accp-assign-primary-user-heading{
    825820    display: block;
    826821    margin-top: 20px;
     
    835830}
    836831
    837 .accp-upgrade-pro-feature-item-container:hover {
     832.accp-upgrade-pro-feature-item-container:hover{
    838833    background-color: #005be0;
    839834}
     
    863858}
    864859
    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{
    866861    color: #fff;
    867862}
     
    875870}
    876871
    877 .accp-upgrade-pro-feature-item-title {
     872.accp-upgrade-pro-feature-item-title{
    878873    font-size: 21px;
    879874    line-height: 27px;
     
    881876}
    882877
    883 .accp-upgrade-pro-feature-item-container p {
     878.accp-upgrade-pro-feature-item-container p{
    884879    color: #777;
    885880    font-size: 14px;
    886881}
    887882
    888 .accp-upgrade-pro-feature-item-container a {
     883.accp-upgrade-pro-feature-item-container a{
    889884    text-decoration: none;
    890885    width: 100%;
     
    893888}
    894889
    895 .accp-settings-section-inner {
     890.accp-settings-section-inner{
    896891    border-bottom: 1px solid #eee;
    897892    padding-bottom: 15px;
     
    899894}
    900895
    901 .company_status_row {
     896.company_status_row{
    902897    margin-bottom: 15px;
    903898}
     
    905900.company_status_row label,
    906901.company_status_row input,
    907 .company_status_row select {
     902.company_status_row select{
    908903    margin-right: 5px;
    909904}
    910905
    911 .company_status_row .accp-row-add {
     906.company_status_row .accp-row-add{
    912907    margin-left: 5px;
    913908    margin-right: 10px;
    914909}
    915910
    916 .company_status_row i {
     911.company_status_row i{
    917912    font-size: 15px;
    918913    position: relative;
     
    921916}
    922917
    923 .accp-add-status-row.button {
     918.accp-add-status-row.button{
    924919    cursor: pointer;   
    925920}
     
    929924}
    930925
    931 #accp-settings-sidebar-container {
     926#accp-settings-sidebar-container{
    932927    padding-left: 20px;
    933928    padding-top: 20px;
     
    938933}
    939934
    940 .accp-settings-page-container.wrap {
     935.accp-settings-page-container.wrap{
    941936    background-color: #fff;
    942937    min-height: 800px;
    943938}
    944939
    945 .accp-admin-main-content-header {
     940.accp-admin-main-content-header{
    946941    margin-bottom: 15px;
    947942}
     
    954949}
    955950
    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{
    959954        display: grid;
    960955        grid-template-columns: auto auto auto;
     
    966961    }
    967962
    968     #accp-admin-main-content {
     963    #accp-admin-main-content{
    969964        margin-left: 200px;
    970965    }
  • constellation-client-portal/trunk/admin/css/jquery-ui/1.11.1/themes/cupertino/jquery-ui.css

    r2663884 r3062211  
    846846.ui-widget-content {
    847847    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 */;
    849849    color: #362b36;
    850850}
     
    854854.ui-widget-header {
    855855    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 */;
    857857    color: #222222;
    858858    font-weight: bold;
     
    868868.ui-widget-header .ui-state-default {
    869869    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 */;
    871871    font-weight: bold;
    872872    color: #2779aa;
     
    885885.ui-widget-header .ui-state-focus {
    886886    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 */;
    888888    font-weight: bold;
    889889    color: #0070a3;
     
    904904.ui-widget-header .ui-state-active {
    905905    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 */;
    907907    font-weight: bold;
    908908    color: #ffffff;
     
    921921.ui-widget-header .ui-state-highlight {
    922922    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 */;
    924924    color: #363636;
    925925}
     
    933933.ui-widget-header .ui-state-error {
    934934    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 */;
    936936    color: #ffffff;
    937937}
     
    977977    height: 16px;
    978978}
    979 .ui-icon,
     979/* .ui-icon,
    980980.ui-widget-content .ui-icon {
    981981    background-image: url("images/ui-icons_72a7cf_256x240.png");
     
    10001000.ui-state-error-text .ui-icon {
    10011001    background-image: url("images/ui-icons_ffffff_256x240.png");
    1002 }
     1002} */
    10031003
    10041004/* positioning */
     
    12121212/* Overlays */
    12131213.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 */;
    12151215    opacity: .8;
    12161216    filter: Alpha(Opacity=80); /* support: IE8 */
     
    12191219    margin: -7px 0 0 -7px;
    12201220    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 */;
    12221222    opacity: .3;
    12231223    filter: Alpha(Opacity=30); /* support: IE8 */
  • constellation-client-portal/trunk/admin/js/ars-constellation-client-portal-admin.js

    r3043713 r3062211  
    55        accp_admin_make_company_select_field_required();
    66       
    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       
    11354        $('table a.submitdelete').click(function (e) {
    12355           
     
    43386                    },         
    44387                                   
    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           
    62401            if (
    63402                (
     
    82421                var bulk_delete_nonce = $('#clientfile-admin-nonce').attr('data-nonce');                                   
    83422
    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       
    116456         $('#delete_all').click(function (e) {     
    117457           
     
    139479               
    140480                $.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(){
    171512
    172513        $('#accp_reassign_btn').click(function (e) {
     514
    173515            e.preventDefault();         
    174516
     
    215557        });
    216558
     559    }
     560
     561
     562    function accp_create_company_directory_on_click(){
    217563
    218564        $('#accp-generate-dir-btn').click(function (e) {
     
    285631        });
    286632
     633    }
     634
     635    function accp_assign_company_directory_on_click(){
    287636
    288637        $('#accp-assign-dir-btn').click(function (e) {
     
    376725
    377726        });
     727
     728    }
     729
     730    function accp_generate_password_on_click(){
    378731
    379732        $('#accp-autogenerate-password').click(function (e) {
     
    415768        });
    416769
     770    }
     771
     772
     773    function accp_toggle_create_new_primary_user_section(){     
     774
    417775        $('.accp-create-new-primary-user-btn').click(function (e) {
    418776
     
    424782
    425783        });
     784
     785    }
     786
     787
     788    function accp_assign_existing_primary_user_on_click(){
    426789
    427790        $('#accp-assign-existing-primary-user-btn').click(function (e) {
     
    480843           
    481844        });
     845
     846    }
     847
     848
     849    function accp_create_and_assign_new_primary_user_on_click(){
    482850
    483851        $('#accp-generate-new-user-btn').click(function (e) {           
     
    573941            }
    574942           
    575         });     
    576 
     943        });
     944
     945    }
     946
     947
     948    function accp_reassign_company_directory_on_click(){
    577949
    578950        $('.accp-reassign-directory-button.button').click(function(){
     
    584956        });
    585957
     958    }
     959
     960
     961    function accp_toggle_create_new_company_home_page_form(){
    586962
    587963        $('.accp-show-new-page-form').click(function () {           
     
    603979        });
    604980
     981    }
     982
     983
     984    function accp_generate_new_company_home_page_on_click(){
    605985
    606986        $('.accp-generate-new-page').click(function (e) {
     
    6931073
    6941074        });
     1075
     1076    }
     1077
     1078
     1079    function accp_dismiss_duplicate_dir_assignment_message_on_click(){
    6951080
    6961081        $('.accp-dismiss-dir-assigment-msg.button').click(function (e) {
     
    7301115        });
    7311116
     1117    }
     1118
     1119
     1120    function accp_save_bulk_edit_post_data(){
     1121
    7321122        $('#bulk_edit').on( 'click', function(e) {     
    7331123
     
    7401130        });
    7411131
    742 
    743     }); // End document ready
    744 
    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 setting
    752              * a "disabled" property to allow native WP
    753              * 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: nonce
    777                     },
    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 setting
    805              * a "disabled" property to allow native WP
    806              * 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: nonce
    830                     },
    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 setting
    859              * a "disabled" property to allow native WP
    860              * 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: nonce
    884                     },
    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: false                         
    1044             });
    1045 
    1046         }
    1047 
    10481132    }
    10491133
  • constellation-client-portal/trunk/ars-constellation-client-portal.php

    r3043713 r3062211  
    55 * Plugin URI:        https://adrianrodriguezstudios.com/constellation-client-portal/
    66 * 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.0
     7 * Version:           1.8.1
    88 * Author:            ARS
    99 * Author URI:        https://adrianrodriguezstudios.com
     
    5555     */
    5656    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.
    5858    define( ACCP_PLUGIN_NAME, ACCP_PLUGIN_VERSION );
    5959    define('ACCP_PLUGIN_FILE_NAME', __FILE__);
    6060    define('ACCP_PLUGIN_DIR_URL', plugin_dir_url( __FILE__ ) );
     61    define('ACCP_PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ) );
    6162
    6263
  • constellation-client-portal/trunk/includes/ars-constellation-client-portal-install-uninstall.php

    r2987566 r3062211  
    1010 */
    1111
     12/**
     13 * Exit if accessed directly.
     14 */
    1215if ( ! defined( 'ABSPATH' ) ) {
    13     exit; // Exit if accessed directly
     16    exit;
    1417}
    1518
     
    5053
    5154/**
    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.
    5658 */
    5759function add_default_company_statuses(){
     
    6668
    6769        $new[] = array( 'label' => sanitize_text_field('Active'), 'value' => sanitize_text_field('active'), 'status_action' => sanitize_text_field('vis_no_action') );
     70       
    6871        $new[] = array( 'label' => sanitize_text_field('Pending'), 'value' => sanitize_text_field('pending'), 'status_action' => sanitize_text_field('vis_no_action') );
     72       
    6973        $new[] = array( 'label' => sanitize_text_field('Inactive'), 'value' => sanitize_text_field('inactive'), 'status_action' => sanitize_text_field('vis_no_action') );
    7074
     
    102106                $missing_statuses[] = 'pending';
    103107
    104             }   
    105 
     108            }
    106109
    107110        }
  • constellation-client-portal/trunk/includes/class-ars-constellation-client-portal-utility-functions.php

    r2946134 r3062211  
    285285
    286286    /**
     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    /**
    287330     * Check slug for uniqueness, and
    288331     * verify that it is not already in use
  • constellation-client-portal/trunk/includes/class-ars-constellation-client-portal.php

    r2973972 r3062211  
    1010 */
    1111
     12/**
     13 * Exit if accessed directly.
     14 */
    1215if ( ! defined( 'ABSPATH' ) ) {
    13     exit; // Exit if accessed directly
     16    exit;
    1417}
    1518
     
    4851     * @since    1.0.0
    4952     */
    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
    6157            $this->version = ARS_CONSTELLATION_CLIENT_PORTAL_PRO;
    6258            $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' ) ) {
    6661
    6762            $this->version = ARS_CONSTELLATION_CLIENT_PORTAL;
    6863            $this->plugin_name = 'ars-constellation-client-portal';
    69        
    70         // Fall back to defaults if nothing is defined
    71         } else {
     64
     65        }else{
    7266
    7367            $this->version = '1.0.0';
     
    7569
    7670        }
    77        
    78         //$this->plugin_name = 'ars-constellation-client-portal-premium';
    7971
    8072        $this->load_dependencies();
     
    127119        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-ars-constellation-client-portal-settings.php';
    128120        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.
    136126         */
    137127        if ( $this->plugin_name == 'ars-constellation-client-portal-pro' ){         
     
    151141
    152142        /**
    153          * Pro tier Public functions
     143         * Pro tier Public functions.
    154144         */
    155145        if ( $this->plugin_name == 'ars-constellation-client-portal-pro' ){         
     
    188178
    189179    /**
    190      * Register admin hooks
     180     * Register admin hooks.
    191181     *
    192182     * @since    1.0.0
     
    204194        $core_settings = new ARS_Constellation_Client_Portal_Settings();       
    205195
    206         /* Core (Basic tier) hooks */
     196        /**
     197         * Enqueue core styles and scripts.
     198         */
    207199        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
    208200        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
     
    223215
    224216        /**
     217         *
    225218         * 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         */
    232231        $this->loader->add_filter( 'query_vars', $plugin_admin, 'accp_query_vars' );
    233232
    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         */
    238243        $this->loader->add_action( 'upgrader_process_complete', $plugin_admin, 'accp_upgrade_completed', 10, 2 );
    239244
    240         // Run plugin initialization functions.
     245
     246        /**
     247         * Run plugin initialization functions.
     248         */
    241249        $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         */
    244255        $this->loader->add_action( 'init', $plugin_admin, 'accp_maybe_flush_rewrite_rules');
    245256       
     
    251262         */
    252263
    253         // Client File - Register the 'accp_clientfile' post type
     264        /**
     265         * Client File - Register the 'accp_clientfile' post type.
     266         */
    254267        $this->loader->add_action( 'init', $plugin_client_file, 'accp_register_accp_clientfile' );
    255268
    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         */
    257273        $this->loader->add_action( 'init', $plugin_client_file, 'accp_register_taxonomy_file_categories' );
    258274        $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' );               
    262281        $this->loader->add_action( 'manage_accp_clientfile_posts_custom_column', $plugin_client_file, 'clientfile_column_display_company_name', 10, 2 );
    263282        $this->loader->add_action( 'manage_accp_clientfile_posts_custom_column', $plugin_client_file, 'accp_clientfile_column_display_file_status', 10, 2 );
     
    267286        $this->loader->add_action( 'request', $plugin_client_file, 'clientfile_column_orderby' );
    268287
    269         // Client File - Add filter fields
     288
     289        /**
     290         * Client File - Add filter fields.
     291         */
    270292        $this->loader->add_action( 'restrict_manage_posts', $plugin_client_file, 'accp_add_core_file_list_filter_fields', 10, 2 );
    271293        $this->loader->add_filter( 'parse_query', $plugin_client_file, 'accp_core_file_additional_filters', 10, 1 );
    272294
    273         // Client File - Add metaboxes to client files
     295
     296        /**
     297         * Client File - Add metaboxes to client files.
     298         */
    274299        $this->loader->add_action( 'admin_init', $plugin_client_file, 'rerender_file_status_meta_options' );
    275300        $this->loader->add_action( 'save_post', $plugin_client_file, 'save_file_status_meta_options', 10, 1 );
    276301
    277         // Client File - Add Quick Edit fields.
     302
     303        /**
     304         * Client File - Add Quick Edit fields.
     305         */
    278306        $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         */
    281312        $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         */
    284318        $this->loader->add_action('save_post_accp_clientfile', $plugin_client_file, 'accp_save_file_quick_edit_fields', 10, 1);
    285319
    286         // Client File - save bulk edit fields ajax function.
     320
     321        /**
     322         * Client File - save bulk edit fields ajax function.
     323         */
    287324        $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         */
    290330        $this->loader->add_action( 'restrict_manage_posts', $plugin_client_file, 'accp_add_core_file_list_filter_fields', 10, 2 );
    291331        $this->loader->add_filter( 'parse_query', $plugin_client_file, 'accp_core_file_additional_filters', 10, 1 );
     
    298338         */
    299339
    300         // Client Invoice - Register the 'clientinvoice' post type
     340        /**
     341         * Client Invoice - Register the 'clientinvoice' post type.
     342         */
    301343        $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         */
    304349        $this->loader->add_action( 'init', $plugin_client_invoice, 'accp_register_taxonomy_invoice_categories' );
    305350        $this->loader->add_action( 'init', $plugin_client_invoice, 'accp_register_taxonomy_invoice_tags' );
    306351
    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' );             
    309357        $this->loader->add_action( 'manage_accp_clientinvoice_posts_custom_column', $plugin_client_invoice, 'accp_clientinvoice_column_display_company_name', 10, 2 );
    310358        $this->loader->add_action( 'manage_accp_clientinvoice_posts_custom_column', $plugin_client_invoice, 'accp_clientinvoice_column_display_invoice_status', 10, 2 );
     
    314362        $this->loader->add_action( 'request', $plugin_client_invoice, 'accp_clientinvoice_column_orderby' );
    315363
    316         // Client Invoice - Add Metaboxes to Client Invoices
     364
     365        /**
     366         * Client Invoice - Add Metaboxes to Client Invoices.
     367         */
    317368        $this->loader->add_action( 'admin_init', $plugin_client_invoice, 'rerender_invoice_status_meta_options' );
    318369        $this->loader->add_action( 'save_post', $plugin_client_invoice, 'save_invoice_status_meta_options', 10, 1 );
    319370
    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);       
    330378        $this->loader->add_action( 'wp_ajax_accp_save_invoice_bulk_edit', $plugin_client_invoice, 'accp_save_invoice_bulk_edit');
    331379       
    332         // Client Invoice - Add filter fields
     380        /**
     381         * Client Invoice - Add filter fields.
     382         */
    333383        $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         */
    349404        $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_menu_accp_add_sub_menu_items_to_main_menu_item' );
    350405
    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' );     
    359412        $this->loader->add_action( 'admin_init', $core_settings, 'register_client_portal_settings' );       
    360413
    361         //Add company select field to Client Pages
     414        /**
     415         * Add company select field to Client Pages.
     416         */
    362417        $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         */
    380442        $this->loader->add_action('post_edit_form_tag' , $plugin_admin, 'accp_update_post_edit_form_tag');
    381443        $this->loader->add_action('admin_menu', $plugin_admin, 'accp_client_file_meta_box');       
     
    390452         */
    391453
    392         // Client Company - Register the 'accp_clientcompany' post type
     454        /**
     455         * Client Company - Register the 'accp_clientcompany' post type
     456         */
    393457        $this->loader->add_action( 'init', $plugin_company, 'accp_register_clientcompany' );
    394458
    395         // Client Company - WP list table columns
     459
     460        /**
     461         * Client Company - WP list table columns.
     462         */
    396463        $this->loader->add_filter( 'manage_edit-accp_clientcompany_columns', $plugin_company, 'clientcompany_column_register' );
    397464        $this->loader->add_action( 'manage_accp_clientcompany_posts_custom_column', $plugin_company, 'clientcompany_column_display_assigned_user_count', 10, 2 );
     
    401468        $this->loader->add_action( 'manage_accp_clientcompany_posts_custom_column', $plugin_company, 'clientcompany_column_display_company_id', 10, 2 );
    402469       
    403         // Client Company - Add custom fields
     470        /**
     471         * Client Company - Add custom fields.
     472         */
    404473        $this->loader->add_action( 'admin_init', $plugin_company, 'display_clientcompany_meta_options' );
    405474        $this->loader->add_action( 'save_post', $plugin_company, 'save_clientcompany_meta_options', 10, 3 );
    406475
    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         */
    408480        $this->loader->add_action( 'wp_ajax_accp_generate_new_client_page', $plugin_company, 'accp_generate_new_client_page');
    409481
    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         */
    411486        $this->loader->add_action( 'wp_ajax_accp_dismiss_duplicate_dir_assignment_notice', $plugin_company, 'accp_dismiss_duplicate_dir_assignment_notice');
    412487
    413         // Create and assign new primary user ajax function
     488
     489        /**
     490         * Create and assign new primary user ajax function.
     491         */
    414492        $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         */
    417498        $this->loader->add_action( 'wp_ajax_accp_assign_existing_primary_user', $plugin_company, 'accp_assign_existing_primary_user');     
    418499       
     
    425506         */
    426507
    427         // Client Pages - Register the 'accp_client_pages' post type
     508        /**
     509         * Client Pages - Register the 'accp_client_pages' post type.
     510         */
    428511        $this->loader->add_action( 'init', $plugin_client_pages, 'accp_register_client_pages_post_type' );
    429512
    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         */
    431517        $this->loader->add_action( 'init', $plugin_client_pages, 'accp_register_taxonomy_client_page_categories' );
    432518        $this->loader->add_action( 'init', $plugin_client_pages, 'accp_register_taxonomy_client_page_tags' );
    433519
    434         // Client Pages - WP list table columns
     520
     521        /**
     522         * Client Pages - WP list table columns.
     523         */
    435524        $this->loader->add_filter( 'manage_accp_client_pages_posts_columns', $plugin_client_pages, 'accp_client_pages_column_register');
    436525        $this->loader->add_action( 'manage_accp_client_pages_posts_custom_column', $plugin_client_pages, 'accp_client_pages_column_display_company_name', 10, 2 );
    437526
    438         // Reassign accp_clientfile ajax function
     527
     528        /**
     529         * Reassign accp_clientfile ajax function.
     530         */
    439531        $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         */
    442537        $this->loader->add_action( 'wp_ajax_accp_generate_company_dir', $plugin_admin, 'accp_generate_company_dir');
    443538
    444         // Specify company directory ajax function
     539
     540        /**
     541         * Specify company directory ajax function.
     542         */
    445543        $this->loader->add_action( 'wp_ajax_accp_specify_company_dir', $plugin_admin, 'accp_specify_company_dir');
    446544
    447         // Clear Mime Type option ajax function
     545
     546        /**
     547         * Clear Mime Type option ajax function.
     548         */
    448549        $this->loader->add_action( 'wp_ajax_accp_clear_mime_type_option', $plugin_admin, 'accp_clear_mime_type_option');
    449550
    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         */
    454561        $this->loader->add_action( 'all_admin_notices', $plugin_admin, 'accp_add_content_before_file_list_table', 10, 3);
    455562
    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 function
     563
     564        /**
     565         * File and Invoice Download AJAX function.
     566         */
    460567        $this->loader->add_action('init', $plugin_admin, 'accp_get_download');
    461568
    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         */
    463573        $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
    464575               
    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
    467581            $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
    468583        }
    469584
    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           
    480597            $plugin_pro_admin = new ARS_Constellation_Client_Portal_Pro_Admin( $this->get_plugin_name(), $this->get_version() );
    481598            $plugin_pro_email = new ARS_Constellation_Client_Portal_Pro_Email( $this->get_plugin_name(), $this->get_version() );
     
    487604    }
    488605
     606
    489607    /**
    490608     * Register public hooks
     
    501619        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );       
    502620       
    503         // Client File List shortcode - [accp_clientfiles]     
     621        /**
     622         * Client File List shortcode - [accp_clientfiles].
     623         */
    504624        $this->loader->add_shortcode( 'accp_clientfiles', $list_shortcodes, 'get_client_files_shortcode' );
    505625
    506         // Client Invoice List shortcode - [accp_clientinvoices]       
     626
     627        /**
     628         * Client Invoice List shortcode - [accp_clientinvoices].
     629         */
    507630        $this->loader->add_shortcode( 'accp_clientinvoices', $list_shortcodes, 'get_client_invoices_shortcode' );
    508631       
    509632
    510         // Client Home Page Link shortcode - [accp_my_company_page]     
     633        /**
     634         * Client Home Page Link shortcode - [accp_my_company_page].
     635         */     
    511636        $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       
    517644            $plugin_pro_public = new ARS_Constellation_Client_Portal_Pro_Public( $this->get_plugin_name(), $this->get_version() );
    518645            require_once ( dirname(__DIR__)  . '/pro/public/ars-constellation-client-portal-pro-public-hooks.php'  );   
    519646           
    520647        }
    521 
    522648       
    523649    }   
  • constellation-client-portal/trunk/public/class-ars-constellation-client-portal-public.php

    r2973972 r3062211  
    99 */
    1010
     11/**
     12 * Exit if accessed directly.
     13 */
    1114if ( ! defined( 'ABSPATH' ) ) {
    12     exit; // Exit if accessed directly
     15    exit;
    1316}
    1417
  • constellation-client-portal/trunk/public/css/ars-constellation-client-portal-list-shortcode-styles.css

    r3018869 r3062211  
    22 * List shortcode CSS.
    33 */
    4 
    54.file-thumb-align-float-left{
    65    float: left;
    76}
     7
    88.file-thumb-align-float-right{
    99    float: right;
    1010}
     11
    1112.file-thumb-align-left{
    1213    text-align: left;
    1314    width: 100%;
    1415}
     16
    1517.file-thumb-align-right{
    1618    text-align: right;
    1719    width: 100%;
    1820}
     21
    1922.file-thumb-align-center{
    2023    text-align: center;
    2124    width: 100%;
    2225}
     26
    2327.accp-past-due-notice{
    2428    font-weight:bold;
     
    3135    vertical-align: middle;
    3236}
     37
    3338.accp-due-date{
    3439    font-size: 12px;
    3540}
     41
    3642.accp-post-status{
    3743    font-size: 12px;   
    3844}
     45
    3946.accp-list-item-meta .accp-post-meta-item:not(:last-child):after{
    4047    content:'|';
     
    4249    margin-right: 5px;
    4350}
     51
    4452.accp-list-item-meta .accp-due-date.accp-post-meta-item::after{
    4553    content: none;
    4654}
     55
    4756.accp_documents_filelist .accp-file-list-item-title a{
    4857    text-decoration-color: none;
    4958}
     59
    5060.accp-file-list-item-title{
    5161    margin-top: 12px;
    5262    display: block;
    5363}
     64
    5465.accp-file-post-date{
    5566    margin-top: 3px;
    5667    font-size: 14px;
    5768}
     69
    5870.accp-item-container{
    5971    background: #f9f9f9 none repeat scroll 0 0;
     
    6678    padding-top: 15px;
    6779}
     80
    6881.accp_documents_filelist .accp-list-item-meta{
    6982    margin-bottom: 10px;
    7083}
     84
    7185.accp-page-nav-container{
    7286    border: 1px solid #f9f9f9;
    7387    padding: 10px;
    7488}
     89
    7590.accp-pay-btn{
    7691    -moz-user-select: none;
     
    90105    transition: all 0.2s ease-out 0s;               
    91106}
     107
    92108.accp-pay-btn a{
    93109    color: #fff;
     
    98114    display: block;
    99115}
     116
    100117a.accp-pay-link{
    101118    color: #fff;
    102119}
     120
    103121.accp-view-dl-link-container a{
    104122    font-size: 11px;
    105123    text-decoration: none;
    106124}
     125
    107126.accp-pay-btn:hover{
    108127    background-color: #3cacf6;
  • constellation-client-portal/trunk/public/shortcodes/class-ars-constellation-client-portal-list-shortcodes.php

    r3043713 r3062211  
    88 */
    99
     10/**
     11 * Exit if accessed directly.
     12 */
    1013if ( ! defined( 'ABSPATH' ) ) {
    11     exit; // Exit if accessed directly
     14    exit;
    1215}
    1316
     
    12771280                do_action('accp_after_invoice_list_pagination', $post_id, $shortcode_id, $list_instance);
    12781281
    1279             }else{
     1282            }
     1283           
     1284            if( 'accp_clientfile' === $list_type ){
    12801285
    12811286                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);
    12821293
    12831294            }
     
    23222333    }
    23232334
    2324 
    23252335}
  • constellation-client-portal/trunk/uninstall.php

    r2862820 r3062211  
    1010 */
    1111
    12 // Exit if not called from WordPress.
     12/**
     13 * Exit if not called from WordPress.
     14 */
    1315if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
    1416    exit;
Note: See TracChangeset for help on using the changeset viewer.