@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * Display the importer administration screen |
| 79 | 79 | */ |
| 80 | 80 | public function display_page() { |
| 81 | - ?> |
|
| 81 | + ?> |
|
| 82 | 82 | <div class="wrap"> |
| 83 | 83 | <?php screen_icon(); ?> |
| 84 | 84 | |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | </ul> |
| 101 | 101 | |
| 102 | 102 | <?php } else { |
| 103 | - do_action('lsx_tour_importer_admin_tab_'.$_GET['tab']); |
|
| 104 | - } ?> |
|
| 103 | + do_action('lsx_tour_importer_admin_tab_'.$_GET['tab']); |
|
| 104 | + } ?> |
|
| 105 | 105 | </div> |
| 106 | 106 | <?php |
| 107 | 107 | } |
@@ -148,37 +148,37 @@ discard block |
||
| 148 | 148 | * set_taxonomy with some terms |
| 149 | 149 | */ |
| 150 | 150 | public function set_taxonomy($taxonomy,$terms,$id) { |
| 151 | - $result=array(); |
|
| 152 | - if(!empty($data)) |
|
| 153 | - { |
|
| 154 | - foreach($data as $k) |
|
| 155 | - { |
|
| 156 | - if($id) |
|
| 157 | - { |
|
| 158 | - if(!$term = term_exists(trim($k), $tax)) |
|
| 159 | - { |
|
| 160 | - $term = wp_insert_term(trim($k), $tax); |
|
| 161 | - if ( is_wp_error($term) ) |
|
| 162 | - { |
|
| 163 | - echo $term->get_error_message(); |
|
| 164 | - } |
|
| 165 | - else |
|
| 166 | - { |
|
| 167 | - wp_set_object_terms( $id, intval($term['term_id']), $taxonomy,true); |
|
| 168 | - } |
|
| 169 | - } |
|
| 170 | - else |
|
| 171 | - { |
|
| 172 | - wp_set_object_terms( $id, intval($term['term_id']), $taxonomy,true); |
|
| 173 | - } |
|
| 174 | - } |
|
| 175 | - else |
|
| 176 | - { |
|
| 177 | - $result[]=trim($k); |
|
| 178 | - } |
|
| 179 | - } |
|
| 180 | - } |
|
| 181 | - return $result; |
|
| 151 | + $result=array(); |
|
| 152 | + if(!empty($data)) |
|
| 153 | + { |
|
| 154 | + foreach($data as $k) |
|
| 155 | + { |
|
| 156 | + if($id) |
|
| 157 | + { |
|
| 158 | + if(!$term = term_exists(trim($k), $tax)) |
|
| 159 | + { |
|
| 160 | + $term = wp_insert_term(trim($k), $tax); |
|
| 161 | + if ( is_wp_error($term) ) |
|
| 162 | + { |
|
| 163 | + echo $term->get_error_message(); |
|
| 164 | + } |
|
| 165 | + else |
|
| 166 | + { |
|
| 167 | + wp_set_object_terms( $id, intval($term['term_id']), $taxonomy,true); |
|
| 168 | + } |
|
| 169 | + } |
|
| 170 | + else |
|
| 171 | + { |
|
| 172 | + wp_set_object_terms( $id, intval($term['term_id']), $taxonomy,true); |
|
| 173 | + } |
|
| 174 | + } |
|
| 175 | + else |
|
| 176 | + { |
|
| 177 | + $result[]=trim($k); |
|
| 178 | + } |
|
| 179 | + } |
|
| 180 | + } |
|
| 181 | + return $result; |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
@@ -188,21 +188,21 @@ discard block |
||
| 188 | 188 | if(post_type_exists('team')) { ?> |
| 189 | 189 | <ul> |
| 190 | 190 | <?php |
| 191 | - $team_args=array( |
|
| 192 | - 'post_type' => 'team', |
|
| 193 | - 'post_status' => 'publish', |
|
| 194 | - 'nopagin' => true, |
|
| 195 | - 'fields' => 'ids' |
|
| 196 | - ); |
|
| 197 | - $team_members = new WP_Query($team_args); |
|
| 198 | - if($team_members->have_posts()){ |
|
| 199 | - foreach($team_members->posts as $member){ ?> |
|
| 191 | + $team_args=array( |
|
| 192 | + 'post_type' => 'team', |
|
| 193 | + 'post_status' => 'publish', |
|
| 194 | + 'nopagin' => true, |
|
| 195 | + 'fields' => 'ids' |
|
| 196 | + ); |
|
| 197 | + $team_members = new WP_Query($team_args); |
|
| 198 | + if($team_members->have_posts()){ |
|
| 199 | + foreach($team_members->posts as $member){ ?> |
|
| 200 | 200 | <li><input class="team" <?php $this->checked($selected,$member); ?> type="checkbox" value="<?php echo $member; ?>" /> <?php echo get_the_title($member); ?></li> |
| 201 | 201 | <?php } |
| 202 | - }else{ ?> |
|
| 202 | + }else{ ?> |
|
| 203 | 203 | <li><input class="team" type="checkbox" value="0" /> <?php _e('None','wetu-importer'); ?></li> |
| 204 | 204 | <?php } |
| 205 | - ?> |
|
| 205 | + ?> |
|
| 206 | 206 | </ul> |
| 207 | 207 | <?php } |
| 208 | 208 | } |
@@ -254,40 +254,40 @@ discard block |
||
| 254 | 254 | if(false !== $id){ |
| 255 | 255 | if(empty($this->found_attachments)){ |
| 256 | 256 | |
| 257 | - $attachments_args = array( |
|
| 258 | - 'post_parent' => $id, |
|
| 259 | - 'post_status' => 'inherit', |
|
| 260 | - 'post_type' => 'attachment', |
|
| 261 | - 'order' => 'ASC', |
|
| 262 | - ); |
|
| 257 | + $attachments_args = array( |
|
| 258 | + 'post_parent' => $id, |
|
| 259 | + 'post_status' => 'inherit', |
|
| 260 | + 'post_type' => 'attachment', |
|
| 261 | + 'order' => 'ASC', |
|
| 262 | + ); |
|
| 263 | 263 | |
| 264 | - $attachments = new WP_Query($attachments_args); |
|
| 265 | - if($attachments->have_posts()){ |
|
| 266 | - foreach($attachments->posts as $attachment){ |
|
| 267 | - $this->found_attachments[$attachment->ID] = str_replace(array('.jpg','.png','.jpeg'),'',$attachment->post_title); |
|
| 268 | - $this->gallery_meta[] = $attachment->ID; |
|
| 269 | - } |
|
| 270 | - } |
|
| 264 | + $attachments = new WP_Query($attachments_args); |
|
| 265 | + if($attachments->have_posts()){ |
|
| 266 | + foreach($attachments->posts as $attachment){ |
|
| 267 | + $this->found_attachments[$attachment->ID] = str_replace(array('.jpg','.png','.jpeg'),'',$attachment->post_title); |
|
| 268 | + $this->gallery_meta[] = $attachment->ID; |
|
| 269 | + } |
|
| 270 | + } |
|
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
| 276 | 276 | * Checks to see if an item is selected. |
| 277 | - * |
|
| 278 | - * @param $haystack array|string |
|
| 279 | - * @param $needle string |
|
| 280 | - * @return string |
|
| 277 | + * |
|
| 278 | + * @param $haystack array|string |
|
| 279 | + * @param $needle string |
|
| 280 | + * @return string |
|
| 281 | 281 | */ |
| 282 | 282 | public function checked($haystack=false,$needle='') { |
| 283 | - $return = ''; |
|
| 284 | - if(!is_array($haystack)){ |
|
| 283 | + $return = ''; |
|
| 284 | + if(!is_array($haystack)){ |
|
| 285 | 285 | $haystack = array($haystack); |
| 286 | - } |
|
| 287 | - if(in_array($needle,$haystack)){ |
|
| 286 | + } |
|
| 287 | + if(in_array($needle,$haystack)){ |
|
| 288 | 288 | $return = 'checked="checked"'; |
| 289 | - } |
|
| 290 | - return $return; |
|
| 289 | + } |
|
| 290 | + return $return; |
|
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | $wetu_importer_admin = new WETU_Importer_Admin(); |
| 294 | 294 | \ No newline at end of file |