| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * LSX_TO_Team | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @package   LSX_TO_Team | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @author    LightSpeed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @license   GPL-2.0+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * @link | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * @copyright {year} LightSpeedDevelopment | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | if ( ! class_exists( 'LSX_TO_Team' ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | 	 * Main plugin class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | 	 * @package LSX_TO_Team | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | 	 * @author  LightSpeed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | 	class LSX_TO_Team { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | 		 * The plugins id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | 		 */ | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | 		public $plugin_slug = 'to-team'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | 		 * The post types the plugin registers | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | 		 */ | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 		public $post_types = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 		 * The singular post types the plugin registers | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 		 */ | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 		public $post_types_singular = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 		 * An array of the post types slugs plugin registers | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 		 */ | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 		public $post_type_slugs = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 		 * The taxonomies the plugin registers | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 		 */ | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 		public $taxonomies = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 		 * The taxonomies the plugin registers (plural) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 		 */ | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 		public $taxonomies_plural = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 		 * Site users | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 		 */ | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 		public $site_users = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 		 * Constructor | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 		public function __construct() { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 			// Set the variables. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 			$this->set_vars(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  | 			$this->lsx_to_search_integration(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 			// Make TO last plugin to load. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 			add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 			add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 			if ( false !== $this->post_types ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 				add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 				add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  | 				add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | 				add_filter( 'lsx_to_settings_path', array( $this, 'plugin_path' ), 10, 2 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | 			} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | 			if ( false !== $this->taxonomies ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 				add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | 				add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 			require_once LSX_TO_TEAM_PATH . '/classes/class-lsx-to-team-admin.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | 			require_once LSX_TO_TEAM_PATH . '/classes/class-lsx-to-team-frontend.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  | 			require_once LSX_TO_TEAM_PATH . '/includes/template-tags.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  | 			// flush_rewrite_rules. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 			register_activation_hook( LSX_TO_TEAM_CORE, array( $this, 'register_activation_hook' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 			add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  | 			add_filter( 'wpseo_schema_graph_pieces', array( $this, 'add_graph_pieces' ), 11, 2 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  | 		} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  | 		 * Include the post type for the search integration | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 93 |  |  | 		 */ | 
            
                                                                        
                            
            
                                    
            
            
                | 94 |  |  | 		public function lsx_to_search_integration() { | 
            
                                                                        
                            
            
                                    
            
            
                | 95 |  |  | 			add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter' ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 96 |  |  | 			add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  | 		} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  | 		 * Load the plugin text domain for translation. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  | 		public function load_plugin_textdomain() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  | 			load_plugin_textdomain( 'to-team', false, basename( LSX_TO_TEAM_PATH ) . '/languages' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  | 		} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  | 		 * Sets the plugins variables | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  | 		public function set_vars() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  | 			$this->post_types = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | 				'team' => __( 'Team', 'to-team' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  | 			); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  | 			$this->post_types_singular = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  | 				'team' => __( 'Team Member', 'to-team' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  | 			); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  | 			$this->post_type_slugs = array_keys( $this->post_types ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  | 			$users = get_users(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  | 			foreach ( $users as $user ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  | 				$this->site_users[] = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  | 					'name' => $user->display_name, | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  | 					'value' => $user->ID, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  | 				); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  | 		} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  | 		/** | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  | 		 * Adds our post types to an array via a filter | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  | 		public function plugin_path( $path, $post_type ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  | 			if ( false !== $this->post_types && array_key_exists( $post_type, $this->post_types ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  | 				$path = LSX_TO_TEAM_PATH; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  | 			return $path; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  | 		} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  | 		/** | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  | 		 * Adds our post types to an array via a filter | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  | 		public function post_types_slugs_filter( $post_types ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  | 			if ( is_array( $post_types ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | 				$post_types = array_merge( $post_types, $this->post_type_slugs ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  | 			} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  | 				$post_types = $this->post_type_slugs; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  | 			return $post_types; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  | 		} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  | 		/** | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  | 		 * Adds our post types to an array via a filter | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  | 		public function post_types_filter( $post_types ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  | 			if ( is_array( $post_types ) && is_array( $this->post_types ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  | 				$post_types = array_merge( $post_types, $this->post_types ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  | 			} elseif ( is_array( $this->post_types ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  | 				$post_types = $this->post_types; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  | 			return $post_types; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  | 		} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | 		/** | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  | 		 * Adds our post types to an array via a filter | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  | 		public function post_types_singular_filter( $post_types_singular ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  | 			if ( is_array( $post_types_singular ) && is_array( $this->post_types_singular ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  | 				$post_types_singular = array_merge( $post_types_singular, $this->post_types_singular ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | 			} elseif ( is_array( $this->post_types_singular ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  | 				$post_types_singular = $this->post_types_singular; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  | 			return $post_types_singular; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  | 		} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  | 		/** | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  | 		 * Adds our taxonomies to an array via a filter | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  | 		public function taxonomies_filter( $taxonomies ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  | 			if ( is_array( $taxonomies ) && is_array( $this->taxonomies ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | 				$taxonomies = array_merge( $taxonomies, $this->taxonomies ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | 			} elseif ( is_array( $this->taxonomies ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  | 				$taxonomies = $this->taxonomies; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  | 			return $taxonomies; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  | 		} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  | 		/** | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  | 		 * Adds our taxonomies_plural to an array via a filter | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  | 		public function taxonomies_plural_filter( $taxonomies_plural ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  | 			if ( is_array( $taxonomies_plural ) && is_array( $this->taxonomies_plural ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  | 				$taxonomies_plural = array_merge( $taxonomies_plural, $this->taxonomies_plural ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  | 			} elseif ( is_array( $this->taxonomies_plural ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | 				$taxonomies_plural = $this->taxonomies_plural; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | 			return $taxonomies_plural; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  | 		} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  | 		 * Make TO last plugin to load. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  | 		public function activated_plugin() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  | 			// @codingStandardsIgnoreLine | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  | 			if ( $plugins = get_option( 'active_plugins' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  | 				$search = preg_grep( '/.*\/tour-operator\.php/', $plugins ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  | 				$key = array_search( $search, $plugins ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  | 				if ( is_array( $search ) && count( $search ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  | 					foreach ( $search as $key => $path ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  | 						array_splice( $plugins, $key, 1 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  | 						array_push( $plugins, $path ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  | 						update_option( 'active_plugins', $plugins ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  | 					} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  | 		} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  | 		 * On plugin activation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  | 		public function register_activation_hook() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  | 			if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  | 				set_transient( '_tour_operators_team_flush_rewrite_rules', 1, 30 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  | 		} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  | 		 * On plugin activation (check) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  | 		public function register_activation_hook_check() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  | 			if ( ! get_transient( '_tour_operators_team_flush_rewrite_rules' ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  | 				return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  | 			delete_transient( '_tour_operators_team_flush_rewrite_rules' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  | 			flush_rewrite_rules(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  | 		} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  | 		 * Adds Schema pieces to our output. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  | 		 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  | 		 * @param array                 $pieces  Graph pieces to output. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  | 		 * @param \WPSEO_Schema_Context $context Object with context variables. | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  | 		 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  | 		 * @return array $pieces Graph pieces to output. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  | 		public function add_graph_pieces( $pieces, $context ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  | 			if ( class_exists( 'LSX_TO_Schema_Graph_Piece' ) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  | 				require_once LSX_TO_TEAM_PATH . 'classes/class-lsx-to-team-schema.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  | 				$pieces[] = new LSX_TO_Team_Schema( $context ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  | 			} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  | 			return $pieces; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  | 		} | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  | 	global $lsx_to_team; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  | 	$lsx_to_team = new LSX_TO_Team(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |  | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 266 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 267 |  |  |  |