Changeset 711496
- Timestamp:
- 05/11/2013 08:01:17 PM (13 years ago)
- File:
-
- 1 edited
-
show-hide-author/trunk/show_hide_author.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
show-hide-author/trunk/show_hide_author.php
r681308 r711496 245 245 // Get post id 246 246 global $post; 247 $ID = $post->ID; 248 // Get and prepare current url 249 $replace = array('/http:\/\/www./', '/https:\/\/www./', '/www./', '/\n\r/'); 250 $with = array('', '', '', '\n'); 251 $current_url_nohttp = preg_replace($replace, $with, $url); 252 $options_array = get_option('show_author_options'); 253 // Get and prepare Show url 254 $option_urls_show_nohttp = preg_replace($replace, $with, $options_array['option_url_show']); 255 $urls_show_array = explode("\n", $option_urls_show_nohttp); 256 // Get and prepare Hide url 257 $option_urls_hide_nohttp = preg_replace($replace, $with, $options_array['option_url_hide']); 258 $urls_hide_array = explode("\n", $option_urls_hide_nohttp); 259 // If nothing submitted, hide the name everywhere 260 if(!is_array($options_array)) { 261 remove_author(); 262 } 263 // If current url in Show urls 264 else if(in_array($current_url_nohttp, $urls_show_array)) { 265 // Show Author 266 } 267 // If current url in Hide urls 268 else if(in_array($current_url_nohttp, $urls_hide_array)) { 269 remove_author(); 270 } 271 // Post Types 272 else if(in_array('individual', $options_array) && get_post_meta( $ID, '_show_author_inthis_post', true ) == 'inthis_post') { 273 // Show Author 274 } else if(in_array('individual', $options_array) && get_post_meta( $ID, '_show_author_inthis_post', true ) == 'not_inthis_post') { 275 remove_author(); 276 } else if(empty($options_array) || !in_array(get_post_type($ID), $options_array)) { 277 remove_author(); 278 } else { 279 // Show Author 247 if( isset($post->ID) ) // Fix 404 Warning 248 { 249 $ID = $post->ID; 250 // Get and prepare current url 251 $replace = array('/http:\/\/www./', '/https:\/\/www./', '/www./', '/\n\r/'); 252 $with = array('', '', '', '\n'); 253 $current_url_nohttp = preg_replace($replace, $with, $url); 254 $options_array = get_option('show_author_options'); 255 // Get and prepare Show url 256 $option_urls_show_nohttp = preg_replace($replace, $with, $options_array['option_url_show']); 257 $urls_show_array = explode("\n", $option_urls_show_nohttp); 258 // Get and prepare Hide url 259 $option_urls_hide_nohttp = preg_replace($replace, $with, $options_array['option_url_hide']); 260 $urls_hide_array = explode("\n", $option_urls_hide_nohttp); 261 // If nothing submitted, hide the name everywhere 262 if(!is_array($options_array)) { 263 remove_author(); 264 } 265 // If current url in Show urls 266 else if(in_array($current_url_nohttp, $urls_show_array)) { 267 // Show Author 268 } 269 // If current url in Hide urls 270 else if(in_array($current_url_nohttp, $urls_hide_array)) { 271 remove_author(); 272 } 273 // Post Types 274 else if(in_array('individual', $options_array) && get_post_meta( $ID, '_show_author_inthis_post', true ) == 'inthis_post') { 275 // Show Author 276 } else if(in_array('individual', $options_array) && get_post_meta( $ID, '_show_author_inthis_post', true ) == 'not_inthis_post') { 277 remove_author(); 278 } else if(empty($options_array) || !in_array(get_post_type($ID), $options_array)) { 279 remove_author(); 280 } else { 281 // Show Author 282 } 280 283 } 281 284 }
Note: See TracChangeset
for help on using the changeset viewer.