| @@ -1,8 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /* |
| 4 | 4 | * @Author ParaTheme |
| 5 | +* @Folder Team/Includes | |
| 6 | +* @version 3.0.5 | |
| 7 | + | |
| 5 | 8 | * Copyright: 2015 ParaTheme |
| 6 | 9 | */ |
| 7 | 10 | |
| 8 | 11 | if ( ! defined('ABSPATH')) exit; // if direct access |
| @@ -40,39 +43,24 @@ | ||
| 40 | 43 | |
| 41 | 44 | public function team_member_social_field() |
| 42 | 45 | { |
| 43 | 46 | |
| 44 | -/* | |
| 45 | 47 | $social_field = array( |
| 46 | - "mobile"=>"Mobile", | |
| 47 | - "website"=>"Website", | |
| 48 | - "email"=>"Email", | |
| 49 | - "skype"=>"Skype", | |
| 50 | - "facebook"=>"Facebook", | |
| 51 | - "twitter"=>"Twitter", | |
| 52 | - "googleplus"=>"Google plus", | |
| 53 | - "pinterest"=>"Pinterest", | |
| 54 | - "linkedin"=>"Linkedin", | |
| 55 | - "vimeo"=>"Vimeo", | |
| 48 | + "mobile"=>"mobile", | |
| 49 | + "website"=>"website", | |
| 50 | + "email"=>"email", | |
| 51 | + "skype"=>"skype", | |
| 52 | + "facebook"=>"facebook", | |
| 53 | + "twitter"=>"twitter", | |
| 54 | + "googleplus"=>"googleplus", | |
| 55 | + "pinterest"=>"pinterest", | |
| 56 | + "linkedin"=>"linkedin", | |
| 57 | + "vimeo"=>"vimeo", | |
| 56 | 58 | ); |
| 57 | 59 | |
| 58 | -*/ | |
| 59 | - | |
| 60 | - | |
| 61 | - | |
| 62 | - $social_field = array( | |
| 63 | - "mobile"=>array('meta_key'=>"mobile",'name'=>"Mobile",'icon'=>'','visibility'=>'1','can_remove'=>'no',), | |
| 64 | - "website"=>array('meta_key'=>"website",'name'=>"Website",'icon'=>'','visibility'=>'1','can_remove'=>'no',), | |
| 65 | - "email"=>array('meta_key'=>"email",'name'=>"Email",'icon'=>'','visibility'=>'1','can_remove'=>'no',), | |
| 66 | - "skype"=>array('meta_key'=>"skype",'name'=>"Skype",'icon'=>'','visibility'=>'1','can_remove'=>'no',), | |
| 67 | - "facebook"=>array('meta_key'=>"facebook",'name'=>"Facebook",'icon'=>'','visibility'=>'1','can_remove'=>'yes',), | |
| 68 | - "twitter"=>array('meta_key'=>"twitter",'name'=>"Twitter",'icon'=>'','visibility'=>'1','can_remove'=>'yes',), | |
| 69 | - "googleplus"=>array('meta_key'=>"googleplus",'name'=>"Google plus",'icon'=>'','visibility'=>'1','can_remove'=>'yes',), | |
| 70 | - "pinterest"=>array('meta_key'=>"pinterest",'name'=>"Pinterest",'icon'=>'','visibility'=>'1','can_remove'=>'yes',), | |
| 71 | - "linkedin"=>array('meta_key'=>"linkedin",'name'=>"Linkedin",'icon'=>'','visibility'=>'1','can_remove'=>'yes',), | |
| 72 | - "vimeo"=>array('meta_key'=>"vimeo",'name'=>"Vimeo",'icon'=>'','visibility'=>'1','can_remove'=>'yes',), | |
| 73 | - ); | |
| 74 | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 75 | 63 | return apply_filters( 'team_member_social_field', $social_field ); |
| 76 | 64 | |
| 77 | 65 | } |
| 78 | 66 | |
| @@ -85,18 +73,14 @@ | ||
| 85 | 73 | |
| 86 | 74 | $team_grid_items = array( |
| 87 | 75 | 'thumbnail'=>__('Thumbnail','team'), |
| 88 | 76 | 'title'=>__('Title','team'), |
| 89 | - 'position'=>__('Position / Role','team'), | |
| 90 | - 'content'=>__('Content / Biography','team'), | |
| 91 | - 'social'=>__('Social','team'), | |
| 77 | + 'position'=>__('Position','team'), | |
| 78 | + 'content'=>__('Content','team'), | |
| 79 | + 'social'=>__('Social','team'), | |
| 92 | 80 | ); |
| 93 | 81 | |
| 94 | - $team_grid_items = apply_filters('team_grid_items',$team_grid_items); | |
| 95 | - | |
| 96 | - | |
| 97 | 82 | return $team_grid_items; |
| 98 | - | |
| 99 | 83 | } |
| 100 | 84 | |
| 101 | 85 | |
| 102 | 86 | |
| @@ -104,13 +88,11 @@ | ||
| 104 | 88 | |
| 105 | 89 | public function team_themes($themes = array()) |
| 106 | 90 | { |
| 107 | 91 | |
| 108 | - $themes = array( | |
| 92 | + $themes = array( | |
| 109 | 93 | 'flat'=>'Flat', |
| 110 | - 'rounded'=>'Rounded', | |
| 111 | - 'zoom-out'=>'Zoom Out', | |
| 112 | - | |
| 94 | + 'rounded'=>'Rounded', | |
| 113 | 95 | ); |
| 114 | 96 | |
| 115 | 97 | foreach(apply_filters( 'team_themes', $themes ) as $theme_key=> $theme_name) |
| 116 | 98 | { |
| @@ -128,19 +110,17 @@ | ||
| 128 | 110 | $main_dir = team_plugin_dir.'themes/'; |
| 129 | 111 | |
| 130 | 112 | $themes_dir = array( |
| 131 | 113 | 'flat'=>$main_dir.'flat', |
| 132 | - 'rounded'=>$main_dir.'rounded', | |
| 133 | - 'zoom-out'=>$main_dir.'zoom-out', | |
| 134 | - | |
| 114 | + 'rounded'=>$main_dir.'rounded', | |
| 135 | 115 | ); |
| 136 | - | |
| 137 | - | |
| 116 | + | |
| 138 | 117 | foreach(apply_filters( 'team_themes_dir', $themes_dir ) as $theme_key=> $theme_dir) |
| 139 | 118 | { |
| 140 | 119 | $theme_list_dir[$theme_key] = $theme_dir; |
| 141 | 120 | } |
| 142 | 121 | |
| 122 | + | |
| 143 | 123 | return $theme_list_dir; |
| 144 | 124 | |
| 145 | 125 | } |
| 146 | 126 | |
| @@ -150,92 +130,146 @@ | ||
| 150 | 130 | $main_url = team_plugin_url.'themes/'; |
| 151 | 131 | |
| 152 | 132 | $themes_url = array( |
| 153 | 133 | 'flat'=>$main_url.'flat', |
| 154 | - 'rounded'=>$main_url.'rounded', | |
| 155 | - 'zoom-out'=>$main_url.'zoom-out', | |
| 134 | + 'rounded'=>$main_url.'rounded', | |
| 156 | 135 | ); |
| 157 | - | |
| 136 | + | |
| 158 | 137 | foreach(apply_filters( 'team_themes_url', $themes_url ) as $theme_key=> $theme_url) |
| 159 | 138 | { |
| 160 | 139 | $theme_list_url[$theme_key] = $theme_url; |
| 161 | 140 | } |
| 162 | 141 | |
| 142 | + return $theme_list_url; | |
| 163 | 143 | |
| 144 | + } | |
| 164 | 145 | |
| 165 | - return $theme_list_url; | |
| 166 | 146 | |
| 167 | - } | |
| 168 | 147 | |
| 148 | +public function team_get_all_post_ids($postid) | |
| 149 | + { | |
| 150 | + | |
| 151 | + $team_post_ids = get_post_meta( $postid, 'team_post_ids', true ); | |
| 152 | + | |
| 153 | + | |
| 154 | + $return_string = ''; | |
| 155 | + $return_string .= '<ul style="margin: 0;">'; | |
| 169 | 156 | |
| 170 | -// Single Team Member | |
| 157 | + $args_product = array( | |
| 158 | + 'post_type' => array('team_member'), | |
| 159 | + 'posts_per_page' => -1, | |
| 160 | + ); | |
| 171 | 161 | |
| 162 | + $member_query = new WP_Query( $args_product ); | |
| 163 | + | |
| 164 | + if($member_query->have_posts()) | |
| 165 | + | |
| 166 | + { | |
| 167 | + while($member_query->have_posts()): $member_query->the_post(); | |
| 168 | + | |
| 169 | + | |
| 170 | + $return_string .= '<li><label ><input class="team_post_ids" type="checkbox" name="team_post_ids['.get_the_ID().']" value ="'.get_the_ID().'" '; | |
| 171 | + | |
| 172 | + if ( isset( $team_post_ids[get_the_ID()] ) ) | |
| 173 | + { | |
| 174 | + $return_string .= "checked"; | |
| 175 | + } | |
| 176 | + | |
| 177 | + $return_string .= '/>'; | |
| 178 | + | |
| 179 | + $return_string .= get_the_title().'</label ></li>'; | |
| 180 | + | |
| 181 | + endwhile; | |
| 182 | + wp_reset_query(); | |
| 183 | + } | |
| 184 | + | |
| 172 | 185 | |
| 186 | + | |
| 187 | + | |
| 188 | + else | |
| 189 | + { | |
| 190 | + $return_string .= '<span style="color:#f00;">'.__('Sorry No Post Found, Please create some team member first.','team'); | |
| 191 | + } | |
| 173 | 192 | |
| 193 | + | |
| 174 | 194 | |
| 175 | - public function team_single_themes($themes = array()) | |
| 195 | + | |
| 196 | + $return_string .= '</ul>'; | |
| 197 | + return $return_string; | |
| 198 | + | |
| 199 | + } | |
| 200 | + | |
| 201 | + public function team_get_taxonomy_category($postid) | |
| 176 | 202 | { |
| 177 | - | |
| 178 | - $themes = array( | |
| 179 | - 'flat'=>'Flat', | |
| 180 | - | |
| 181 | - ); | |
| 203 | + | |
| 204 | + $team_taxonomy = array('team_group'); | |
| 205 | + | |
| 206 | + if(empty($team_taxonomy)) | |
| 207 | + { | |
| 208 | + $team_taxonomy= ""; | |
| 209 | + } | |
| 210 | + $team_taxonomy_terms = get_post_meta( $postid, 'team_taxonomy_terms', true ); | |
| 211 | + | |
| 182 | 212 | |
| 183 | - foreach(apply_filters( 'team_single_themes', $themes ) as $theme_key=> $theme_name) | |
| 213 | + if(empty($team_taxonomy_terms)) | |
| 184 | 214 | { |
| 185 | - $theme_list[$theme_key] = $theme_name; | |
| 215 | + $team_taxonomy_terms =array('none'); // an empty array when no category element selected | |
| 216 | + | |
| 186 | 217 | } |
| 187 | - | |
| 188 | - | |
| 189 | - return $theme_list; | |
| 190 | - | |
| 191 | - } | |
| 192 | 218 | |
| 193 | - | |
| 194 | - public function team_single_themes_dir($themes_dir = array()) | |
| 195 | - { | |
| 196 | - $main_dir = team_plugin_dir.'themes-single/'; | |
| 197 | - $themes_dir = $this->team_themes(); | |
| 198 | - | |
| 199 | - foreach($themes_dir as $theme_key=> $theme_dir) | |
| 219 | + if(!isset($_POST['taxonomy'])) | |
| 200 | 220 | { |
| 201 | - $theme_list_dir[$theme_key] = $main_dir.$theme_key; | |
| 221 | + $taxonomy =$team_taxonomy; | |
| 202 | 222 | } |
| 203 | - | |
| 204 | - return $theme_list_dir; | |
| 205 | - | |
| 206 | - } | |
| 207 | - | |
| 208 | - | |
| 209 | - public function team_single_themes_url($themes_url = array()) | |
| 210 | - { | |
| 211 | - $main_url = team_plugin_url.'themes-single/'; | |
| 212 | - $themes_url = $this->team_themes(); | |
| 213 | - | |
| 214 | - foreach($themes_url as $theme_key=> $theme_url) | |
| 223 | + else | |
| 215 | 224 | { |
| 216 | - $theme_list_url[$theme_key] = $main_url.$theme_key; | |
| 225 | + $taxonomy = $_POST['taxonomy']; | |
| 217 | 226 | } |
| 218 | - | |
| 219 | - return $theme_list_url; | |
| 220 | - | |
| 227 | + | |
| 228 | + | |
| 229 | + $args=array( | |
| 230 | + 'orderby' => 'name', | |
| 231 | + 'order' => 'ASC', | |
| 232 | + 'taxonomy' => $taxonomy, | |
| 233 | + ); | |
| 234 | + | |
| 235 | + $categories = get_categories($args); | |
| 236 | + | |
| 237 | + | |
| 238 | + if(empty($categories)) | |
| 239 | + { | |
| 240 | + echo __("No Items Found!",'team'); | |
| 241 | + } | |
| 242 | + | |
| 243 | + | |
| 244 | + $return_string = ''; | |
| 245 | + $return_string .= '<ul style="margin: 0;">'; | |
| 246 | + | |
| 247 | + foreach($categories as $category){ | |
| 248 | + | |
| 249 | + if(array_search($category->cat_ID, $team_taxonomy_terms)) | |
| 250 | + { | |
| 251 | + $return_string .= '<li class='.$category->cat_ID.'><label ><input class="team_taxonomy_terms" checked type="checkbox" name="team_taxonomy_terms['.$category->cat_ID.']" value ="'.$category->cat_ID.'" />'.$category->cat_name.'</label ></li>'; | |
| 252 | + } | |
| 253 | + | |
| 254 | + else | |
| 255 | + { | |
| 256 | + $return_string .= '<li class='.$category->cat_ID.'><label ><input class="team_taxonomy_terms" type="checkbox" name="team_taxonomy_terms['.$category->cat_ID.']" value ="'.$category->cat_ID.'" />'.$category->cat_name.'</label ></li>'; | |
| 257 | + } | |
| 258 | + | |
| 259 | + } | |
| 260 | + | |
| 261 | + $return_string .= '</ul>'; | |
| 262 | + | |
| 263 | + return $return_string; | |
| 264 | + | |
| 265 | + if(isset($_POST['taxonomy'])) | |
| 266 | + { | |
| 267 | + die(); | |
| 268 | + } | |
| 269 | + | |
| 270 | + | |
| 221 | 271 | } |
| 222 | - | |
| 223 | - | |
| 224 | - | |
| 225 | - | |
| 226 | - | |
| 227 | - | |
| 228 | - | |
| 229 | - | |
| 230 | - | |
| 231 | - | |
| 232 | - | |
| 233 | - | |
| 234 | - | |
| 235 | - | |
| 236 | - | |
| 237 | - | |
| 238 | 272 | |
| 239 | 273 | public function team_share_plugin() |
| 240 | 274 | { |
| 241 | 275 | |