| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * LSX_TO_Team_Admin | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @package   LSX_TO_Team_Admin | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @author    LightSpeed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @license   GPL-2.0+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * @link | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * @copyright 2017 LightSpeedDevelopment | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * Main plugin class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * @package LSX_TO_Team_Admin | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * @author  LightSpeed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | class LSX_TO_Team_Admin extends LSX_TO_Team { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | 	 * Constructor | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 22 |  |  | 	 */ | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  | 	public function __construct() { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  | 		$this->set_vars(); | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  | 		add_action( 'init', array( $this, 'init' ), 20 ); | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  | 		add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 ); | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  | 		add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 ); | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  | 		add_filter( 'lsx_get_taxonomies_configs', array( $this, 'taxonomy_config' ), 10, 1 ); | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  | 		add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  | 		add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  | 		add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  | 		add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  | 		add_filter( 'lsx_to_review_custom_fields', array( $this, 'custom_fields' ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  | 		add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  | 		add_filter( 'lsx_to_taxonomies', array( $this, 'to_register_taxonomy' ), 10, 1 ); | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  | 		add_filter( 'lsx_to_framework_taxonomies', array( $this, 'to_register_taxonomy' ), 10, 1 ); | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  | 		add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'to_register_taxonomy_plural' ), 10, 1 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 	} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 	/** | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | 	 * Register the taxonomy with the TO plugin | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 	 * @since 0.1.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 	public function to_register_taxonomy( $taxonomies ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 		$taxonomies['role'] = esc_attr__( 'Role', 'to-team' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 		return $taxonomies; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 	} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 	/** | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 	 * Register the taxonomy with the TO plugin | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 	 * @since 0.1.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 	public function to_register_taxonomy_plural( $taxonomies ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 		$taxonomies['role'] = esc_attr__( 'Roles', 'to-team' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 		return $taxonomies; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  | 	} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 	 * Output the form field for this metadata when adding a new term | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 	 * @since 0.1.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 	public function init() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 		if ( function_exists( 'lsx_to_get_taxonomies' ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 			$this->taxonomies = array_keys( lsx_to_get_taxonomies() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | 		add_filter( 'lsx_to_taxonomy_widget_taxonomies', array( $this, 'widget_taxonomies' ), 10, 1 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 		if ( false !== $this->taxonomies ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | 			add_action( 'create_term', array( $this, 'save_meta' ), 10, 2 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 			add_action( 'edit_term', array( $this, 'save_meta' ), 10, 2 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 			foreach ( $this->taxonomies as $taxonomy ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | 				add_action( "{$taxonomy}_edit_form_fields", array( $this, 'add_expert_form_field' ), 3, 1 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 		add_action( 'lsx_to_framework_team_tab_content', array( $this, 'general_settings' ), 10, 2 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 		add_action( 'lsx_to_framework_team_tab_content', array( $this, 'archive_settings' ), 10, 2 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  | 	} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  | 	/** | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  | 	 * Register the activity post type config | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  | 	 * @param  $objects | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  | 	 * @return   array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  | 	public function post_type_config( $objects ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  | 		foreach ( $this->post_types as $key => $label ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  | 			if ( file_exists( LSX_TO_TEAM_PATH . 'includes/post-types/config-' . $key . '.php' ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | 				$objects[ $key ] = include LSX_TO_TEAM_PATH . 'includes/post-types/config-' . $key . '.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  | 		return	$objects; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  | 	} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  | 	/** | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  | 	 * Register the activity metabox config | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  | 	 * @param  $meta_boxes | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  | 	 * @return   array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  | 	public function meta_box_config( $meta_boxes ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  | 		foreach ( $this->post_types as $key => $label ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  | 			if ( file_exists( LSX_TO_TEAM_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  | 				$meta_boxes[ $key ] = include LSX_TO_TEAM_PATH . 'includes/metaboxes/config-' . $key . '.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  | 		return 	$meta_boxes; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  | 	} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  | 	/** | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  | 	 * Register the Role taxonomy | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  | 	 * @return    null | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  | 	public function taxonomy_config( $taxonomies ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  | 		if ( file_exists( LSX_TO_TEAM_PATH . 'includes/taxonomies/config-role.php' ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  | 			$taxonomies['role'] = include LSX_TO_TEAM_PATH . 'includes/taxonomies/config-role.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  | 		return 	$taxonomies; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  | 	} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  | 	/** | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  | 	 * Adds in the fields to the Tour Operators Post Types. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  | 	public function custom_fields( $fields ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  | 		global $post, $typenow, $current_screen; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  | 		if ( $post && $post->post_type ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  | 			$post_type = $post->post_type; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  | 		} elseif ( $typenow ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  | 			$post_type = $typenow; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | 		} elseif ( $current_screen && $current_screen->post_type ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  | 			$post_type = $current_screen->post_type; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  | 		} elseif ( isset( $_REQUEST['post_type'] ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | 			$post_type = sanitize_key( $_REQUEST['post_type'] ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  | 		} elseif ( isset( $_REQUEST['post'] ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  | 			$post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  | 		} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  | 			$post_type = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  | 		if ( false !== $post_type ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  | 			$fields[] = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  | 				'id' => 'team_title', | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  | 				'name' => 'Teams', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  | 				'type' => 'title', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  | 				'cols' => 12, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  | 			); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  | 			$fields[] = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  | 				'id' => 'team_to_' . $post_type, | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  | 				'name' => 'Specials related with this ' . $post_type, | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | 				'type' => 'post_select', | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  | 				'use_ajax' => false, | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  | 				'query' => array( | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  | 					'post_type' => 'team', | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  | 					'nopagin' => true, | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  | 					'posts_per_page' => '-1', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | 					'orderby' => 'title', | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  | 					'order' => 'ASC', | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  | 				), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  | 				'repeatable' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  | 				'allow_none' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  | 				'cols' => 12, | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  | 			); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  | 		return $fields; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  | 	} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | 	/** | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | 	 * Output the form field for this metadata when adding a new term | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  | 	 * @since 0.1.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  | 	public function add_expert_form_field( $term = false ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  | 		if ( is_object( $term ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  | 			$value = get_term_meta( $term->term_id, 'expert', true ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  | 		} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  | 			$value = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  | 		$experts = get_posts( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  | 			array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  | 				'post_type' => 'team', | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | 				'posts_per_page' => -1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  | 				'orderby' => 'menu_order', | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  | 				'order' => 'ASC', | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | 			) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  | 		?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  | 		<tr class="form-field form-required term-expert-wrap"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  | 			<th scope="row"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  | 				<label for="expert"><?php esc_html_e( 'Expert', 'to-team' ); ?></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  | 			</th> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  | 			<td> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  | 				<select name="expert" id="expert" aria-required="true"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  | 					<option value=""><?php esc_html_e( 'None', 'to-team' ); ?></option> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  | 					<?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  | 						foreach ( $experts as $expert ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  | 						echo '<option value="' . esc_attr( $expert->ID ) . '"' . selected( $value, $expert->ID, false ) . '>' . esc_html( $expert->post_title ) . '</option>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  | 						} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  | 					?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  | 				</select> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  | 				<?php wp_nonce_field( 'lsx_to_team_save_term_expert', 'lsx_to_team_term_expert_nonce' ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  | 			</td> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  | 		</tr> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  | 		<?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  | 	} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  | 	 * Saves the Taxnomy term banner image | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  | 	 * @since 0.1.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  | 	 * @param  int     $term_id | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  | 	 * @param  string  $taxonomy | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  | 	public function save_meta( $term_id = 0, $taxonomy = '' ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  | 		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  | 		if ( ! isset( $_POST['expert'] ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  | 		if ( check_admin_referer( 'lsx_to_team_save_term_expert', 'lsx_to_team_term_expert_nonce' ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  | 			$meta = ! empty( sanitize_text_field( wp_unslash( $_POST['expert'] ) ) ) ? sanitize_text_field( wp_unslash( $_POST['expert'] ) )	: ''; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  | 			if ( empty( $meta ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  | 				delete_term_meta( $term_id, 'expert' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  | 			} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  | 				update_term_meta( $term_id, 'expert', $meta ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  | 	} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  | 	/** | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  | 	 * Adds the team specific options | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  | 	public function general_settings( $post_type = false, $tab = false ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  | 		if ( 'general' !== $tab ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  | 			return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  | 		$experts = get_posts( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  | 			array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  | 				'post_type' => 'team', | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  | 				'posts_per_page' => -1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  | 				'orderby' => 'menu_order', | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  | 				'order' => 'ASC', | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  | 			) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  | 		?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  | 		<tr class="form-field"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  | 			<th scope="row"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  | 				<label for="disable_team_panel"><?php esc_html_e( 'Disable Team Panel', 'to-team' ); ?></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  | 			</th> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  | 			<td> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  | 				<input type="checkbox" {{#if disable_team_panel}} checked="checked" {{/if}} name="disable_team_panel" /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  | 				<small><?php esc_html_e( 'This disables the team member panel on all post types.', 'to-team' ); ?></small> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  | 			</td> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  | 		</tr> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  | 		<tr class="form-field-wrap"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  | 			<th scope="row"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  | 				<label> Select your consultants</label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  | 			</th> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  | 			<td> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  | 				<?php foreach ( $experts as $expert ) : ?> | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  | 					<label for="expert-<?php echo esc_attr( $expert->ID ) ?>"> | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  | 						<input type="checkbox" {{#if expert-<?php echo esc_attr( $expert->ID ) ?>}} checked="checked" {{/if}} name="expert-<?php echo esc_attr( $expert->ID ) ?>" id="expert-<?php echo esc_attr( $expert->ID ) ?>" value="<?php echo esc_attr( $expert->ID ) ?>" /> <?php echo esc_html( $expert->post_title ) ?> | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  | 					</label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  | 					<br> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  | 				<?php endforeach ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  | 			</td> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  | 		</tr> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  | 		<?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  | 	} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  | 	/** | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  | 	 * Adds the team specific options | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  | 	public function archive_settings( $post_type = false, $tab = false ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  | 		if ( 'archives' !== $tab ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  | 			return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  | 		?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  | 		<tr class="form-field"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  | 			<th scope="row"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  | 				<label for="group_items_by_role"><?php esc_html_e( 'Group by Role', 'to-team' ); ?></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  | 			</th> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  | 			<td> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  | 				<input type="checkbox" {{#if group_items_by_role}} checked="checked" {{/if}} name="group_items_by_role" /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  | 				<small><?php esc_html_e( 'This groups archive items by role taxonomy and display the role title.', 'to-team' ); ?></small> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  | 			</td> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  | 		</tr> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  | 		<?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  | 	} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 318 |  |  | new LSX_TO_Team_Admin(); | 
            
                                                        
            
                                    
            
            
                | 319 |  |  |  |