- Timestamp:
- Jun 9, 2009, 5:37:04 PM (15 years ago)
- Location:
- trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php
r262 r272 1 1 <?php 2 function xpress_the_title($show = true) 3 { 2 function xpress_the_title($args = '') 3 { 4 $defaults = array( 5 'echo' => 1 6 ); 7 $r = wp_parse_args( $args, $defaults ); 8 9 extract( $r ); 10 4 11 $output = '<div class ="xpress-post-header">' . "\n"; 5 12 … … 34 41 $output .= '</div>' . "\n"; 35 42 36 if ( empty($show))37 return$output;38 else 39 echo$output;43 if ($echo) 44 echo $output; 45 else 46 return $output; 40 47 41 48 } … … 53 60 } 54 61 55 function xpress_selected_author($show=true ) { 62 function xpress_selected_author($args ='' ) { 63 $defaults = array( 64 'echo' => 1 65 ); 66 $r = wp_parse_args( $args, $defaults ); 67 68 extract( $r ); 69 56 70 $output = ''; 57 71 $author_cookie = get_xpress_dir_name() . "_select_author" ; … … 61 75 $output = $user_info->display_name; 62 76 } 63 if ( empty($show))64 return$output;65 else 66 echo$output;77 if ($echo) 78 echo $output; 79 else 80 return $output; 67 81 68 82 } 69 function xpress_selected_author_id($show=true ) { 83 function xpress_selected_author_id($args ='' ) { 84 $defaults = array( 85 'echo' => 1 86 ); 87 $r = wp_parse_args( $args, $defaults ); 88 89 extract( $r ); 70 90 $output = ''; 71 91 $author_cookie = get_xpress_dir_name() . "_select_author" ; … … 75 95 $output = ''; 76 96 } 77 if (empty($show)) 78 return $output; 79 else 80 echo $output; 81 82 } 83 84 function xpress_now_user_level($show=true ) { 97 if ($echo) 98 echo $output; 99 else 100 return $output; 101 } 102 103 function xpress_now_user_level($args ='' ) { 85 104 global $current_user; 105 $defaults = array( 106 'echo' => 1 107 ); 108 $r = wp_parse_args( $args, $defaults ); 109 110 extract( $r ); 111 86 112 $output = @$current_user->user_level; 87 if (empty($show)) 88 return $output; 89 else 90 echo $output; 91 } 92 93 94 function xpress_list_pings($trackback, $args, $depth) { 95 $GLOBALS['comment'] = $trackback; 96 echo '<li id="comment-<?php comment_ID(); ?>">'; 97 comment_author_link(); 98 } 99 100 function xpress_credit($show = true) 113 if ($echo) 114 echo $output; 115 else 116 return $output; 117 } 118 119 120 121 function xpress_credit($args ='') 101 122 { 102 123 global $wp_version , $xoops_config; … … 105 126 } 106 127 128 $defaults = array( 129 'echo' => 1 130 ); 131 $r = wp_parse_args( $args, $defaults ); 132 133 extract( $r ); 134 107 135 $xpress_version = $xoops_config->module_version; 108 136 $xpress_codename = $xoops_config->module_codename; 109 $ ret = '<a href="http://ja.xpressme.info"'. " target='_blank'" . '>XPressME Ver.' . sprintf('%.2f %s',$xpress_version,$xpress_codename) .'</a>';137 $output = '<a href="http://ja.xpressme.info"'. " target='_blank'" . '>XPressME Ver.' . sprintf('%.2f %s',$xpress_version,$xpress_codename) .'</a>'; 110 138 if ($xoops_config->is_wpmu) { 111 $ ret .= '(included <a href="http://mu.wordpress.org/" title="Powered by WordPress"'." target='_blank'". '>WordPress MU ' . $wpmu_version . '</a>)';139 $output .= '(included <a href="http://mu.wordpress.org/" title="Powered by WordPress"'." target='_blank'". '>WordPress MU ' . $wpmu_version . '</a>)'; 112 140 } else { 113 141 if (strstr($wp_version,'ME')){ 114 $ ret .= '(included <a href="http://wpme.sourceforge.jp/" title="Powered by WordPress"'." target='_blank'". '>WordPress ' . $wp_version . '</a>)';142 $output .= '(included <a href="http://wpme.sourceforge.jp/" title="Powered by WordPress"'." target='_blank'". '>WordPress ' . $wp_version . '</a>)'; 115 143 } else { 116 $ ret .= '(included <a href="http://wordpress.org/" title="Powered by WordPress"'." target='_blank'". '>WordPress ' . $wp_version . '</a>)';144 $output .= '(included <a href="http://wordpress.org/" title="Powered by WordPress"'." target='_blank'". '>WordPress ' . $wp_version . '</a>)'; 117 145 } 118 146 } 119 if (empty($show)) 120 return $ret; 121 else 122 echo $ret; 123 } 124 125 function xpress_convert_time($show = true) 126 { 127 $ret = timer_stop(0) .'sec. '; 128 if (empty($show)) 129 return $ret; 130 else 131 echo $ret; 147 if ($echo) 148 echo $output; 149 else 150 return $output; 151 } 152 153 function xpress_convert_time($args ='') 154 { 155 $defaults = array( 156 'echo' => 1, 157 'format' => '(%.3f sec.)' 158 ); 159 $r = wp_parse_args( $args, $defaults ); 160 161 extract( $r ); 162 163 $output = sprintf($format,timer_stop(0)); 164 if ($echo) 165 echo $output; 166 else 167 return $output; 132 168 } 133 169 … … 138 174 } 139 175 140 function xpress_left_arrow_post_link($ show = true)176 function xpress_left_arrow_post_link($args ='') 141 177 { 142 178 global $xpress_config; 179 $defaults = array( 180 'echo' => 1 181 ); 182 $r = wp_parse_args( $args, $defaults ); 183 184 extract( $r ); 185 143 186 $ret = ''; 144 187 … … 191 234 $on_mouse_show = $body_matches[1]; 192 235 } 193 $ ret = str_replace('">','" title="'.$on_mouse_show . '">' , $ret);194 195 if ( empty($show))196 return $ret;197 else 198 echo $ret;199 } 200 201 function xpress_right_arrow_post_link($ show = true)236 $output = str_replace('">','" title="'.$on_mouse_show . '">' , $ret); 237 238 if ($echo) 239 echo $output; 240 else 241 return $output; 242 } 243 244 function xpress_right_arrow_post_link($args ='') 202 245 { 203 246 global $xpress_config; 247 $defaults = array( 248 'echo' => 1 249 ); 250 $r = wp_parse_args( $args, $defaults ); 251 252 extract( $r ); 253 204 254 $ret = ''; 205 255 … … 252 302 $on_mouse_show = $body_matches[1]; 253 303 } 254 $ ret = str_replace('">','" title="'.$on_mouse_show . '">' , $ret);255 256 if ( empty($show))257 return $ret;258 else 259 echo $ret;304 $output = str_replace('">','" title="'.$on_mouse_show . '">' , $ret); 305 306 if ($echo) 307 echo $output; 308 else 309 return $output; 260 310 } 261 311 // page link 262 function xpress_left_arrow_posts_link($ show = true)312 function xpress_left_arrow_posts_link($args ='') 263 313 { 264 314 global $xpress_config; 265 $ret = ''; 315 $defaults = array( 316 'echo' => 1 317 ); 318 $r = wp_parse_args( $args, $defaults ); 319 320 extract( $r ); 321 322 $output = ''; 266 323 267 324 if($xpress_config->is_left_page_navi_old){ … … 269 326 ob_start(); 270 327 next_posts_link("« $link_title"); 271 $ ret = ob_get_contents();328 $output = ob_get_contents(); 272 329 ob_end_clean(); 273 330 } else { … … 275 332 ob_start(); 276 333 previous_posts_link("« $link_title"); 277 $ ret = ob_get_contents();278 ob_end_clean(); 279 } 280 281 if ( empty($show))282 return $ret;283 else 284 echo $ret;285 } 286 287 function xpress_right_arrow_posts_link($ show = true)334 $output = ob_get_contents(); 335 ob_end_clean(); 336 } 337 338 if ($echo) 339 echo $output; 340 else 341 return $output; 342 } 343 344 function xpress_right_arrow_posts_link($args ='') 288 345 { 289 346 global $xpress_config; 290 $ret = ''; 347 $defaults = array( 348 'echo' => 1 349 ); 350 $r = wp_parse_args( $args, $defaults ); 351 352 extract( $r ); 353 354 $output = ''; 291 355 292 356 if($xpress_config->is_left_page_navi_old){ … … 294 358 ob_start(); 295 359 previous_posts_link("$link_title »"); 296 $ ret = ob_get_contents();360 $output = ob_get_contents(); 297 361 ob_end_clean(); 298 362 } else { … … 300 364 ob_start(); 301 365 next_posts_link("$link_title »"); 302 $ ret = ob_get_contents();303 ob_end_clean(); 304 } 305 306 if ( empty($show))307 return $ret;308 else 309 echo $ret;366 $output = ob_get_contents(); 367 ob_end_clean(); 368 } 369 370 if ($echo) 371 echo $output; 372 else 373 return $output; 310 374 } 311 375 … … 336 400 // Set and retrieves post views given a post ID or post object. 337 401 // Retrieves post views given a post ID or post object. 338 function xpress_post_views_count($ post_id=0,$format= '',$show = true) {402 function xpress_post_views_count($args ='') { 339 403 global $xoops_db,$wpdb; 340 404 341 405 static $post_cache_views; 406 407 $defaults = array( 408 'post_id' => 0, 409 'format'=> __('views :%d','xpressme'), 410 'echo' => 1 411 ); 412 $r = wp_parse_args( $args, $defaults ); 413 414 extract( $r ); 342 415 343 416 if ( empty($post_id) ) { … … 361 434 if (empty($format)) $format = __('views :%d','xpressme'); 362 435 363 $ret = sprintf($format,$v_count); 364 365 if ($show) echo $ret; else return $ret; 436 $output = sprintf($format,$v_count); 437 438 if ($echo) 439 echo $output; 440 else 441 return $output; 366 442 } 367 443 … … 466 542 } 467 543 468 function xpress_post_new_link($ link_title = 'Post New',$display = true)544 function xpress_post_new_link($args ='') 469 545 { 470 546 global $xoops_config; 547 548 $defaults = array( 549 'link_title'=> 'Post New', 550 'echo' => 1 551 ); 552 $r = wp_parse_args( $args, $defaults ); 553 554 extract( $r ); 555 471 556 472 557 if ($xoops_config->wp_db_version > 5000){ … … 475 560 $output = '<a href="'. get_xpress_url() . '/wp-admin/post.php' . '">' . $link_title . '</a>'; 476 561 } 477 if ($display) 478 echo $output; 479 else 480 return $output; 481 } 482 483 function xpress_conditional_title($display = true) 484 { 485 $selected_author = xpress_selected_author(false); 562 if ($echo) 563 echo $output; 564 else 565 return $output; 566 } 567 568 function xpress_conditional_title($args ='') 569 { 570 $defaults = array( 571 'echo' => 1 572 ); 573 $r = wp_parse_args( $args, $defaults ); 574 575 extract( $r ); 576 577 $selected_author = xpress_selected_author('echo=0'); 486 578 487 579 $output = __('Main', 'xpressme'); … … 507 599 508 600 if (!empty($selected_author)){ 509 $selected_id = xpress_selected_author_id( false);601 $selected_id = xpress_selected_author_id('echo=0'); 510 602 // $output = get_avatar($selected_id,$size = '32') . sprintf(__('Article of %s', 'xpressme'), $selected_author) . ' - ' . $output; 511 603 if (empty($output)) … … 514 606 $output = sprintf(__('Article of %s', 'xpressme'), $selected_author) . ' - ' . $output; 515 607 } 516 if ($display) 517 echo $output; 518 else 519 return $output; 520 } 521 522 function xpress_pings_list($show = true){ 608 if ($echo) 609 echo $output; 610 else 611 return $output; 612 } 613 614 function xpress_pings_list($args =''){ 615 $defaults = array( 616 'echo' => 1 617 ); 618 $r = wp_parse_args( $args, $defaults ); 619 620 extract( $r ); 523 621 524 622 $trackbacks = xpress_get_pings(); … … 539 637 } 540 638 541 if ($show) echo $output; else return $output; 542 } 543 544 function xpress_pings_number( $zero = false, $one = false, $more = false, $deprecated = '' ) { 639 if ($echo) 640 echo $output; 641 else 642 return $output; 643 } 644 645 function xpress_pings_number( $args ='' ) { 646 $defaults = array( 647 'zero' => __('No Trackback/Pingback', 'xpressme'), 648 'one' => __('One Trackback/Pingback', 'xpressme'), 649 'more' => __('% TrackBack/Pingback', 'xpressme'), 650 'deprecated' => '', 651 'echo' => 1 652 ); 653 $r = wp_parse_args( $args, $defaults ); 654 655 extract( $r ); 656 545 657 $pings = xpress_get_pings(); 546 658 if (empty($pings)){ … … 550 662 } 551 663 if ( $number > 1 ) 552 $output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('% TrackBack/Pingback', 'xpressme') :$more);664 $output = str_replace('%', number_format_i18n($number), $more); 553 665 elseif ( $number == 0 ) 554 $output = ( false === $zero ) ? __('No Trackback/Pingback', 'xpressme') :$zero;666 $output = $zero; 555 667 else // must be one 556 $output = ( false === $one ) ? __('One Trackback/Pingback', 'xpressme') : $one; 557 558 echo $output; 668 $output = $one; 669 670 if ($echo) 671 echo $output; 672 else 673 return $output; 559 674 } 560 675 … … 608 723 } 609 724 610 function xpress_get_calendar($ sun_color = '#DB0000' ,$sat_color = '#004D99' ,$initial = true) {725 function xpress_get_calendar($args = '') { 611 726 global $wpdb, $m, $monthnum, $year, $wp_locale, $posts , $xoops_config; 612 727 728 $defaults = array( 729 sun_color => '#DB0000', 730 sat_color => '#004D99', 731 initial => true 732 ); 733 $r = wp_parse_args( $args, $defaults ); 734 735 extract( $r ); 613 736 if ($xoops_config->is_wp20){ 614 737 ob_start(); -
trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/functions_for_wp20.php
r271 r272 262 262 } 263 263 264 // ADD WP 2.2.0265 function wp_parse_args( $args, $defaults = '' ) {266 if ( is_object( $args ) )267 $r = get_object_vars( $args );268 elseif ( is_array( $args ) )269 $r =& $args;270 else271 wp_parse_str( $args, $r );272 273 if ( is_array( $defaults ) )274 return array_merge( $defaults, $r );275 return $r;276 }277 278 // ADD WP 2.2.1279 function wp_parse_str( $string, &$array ) {280 parse_str( $string, $array );281 if ( get_magic_quotes_gpc() )282 $array = stripslashes_deep( $array );283 $array = apply_filters( 'wp_parse_str', $array );284 }285 286 264 /** 287 265 * @ignore
Note: See TracChangeset
for help on using the changeset viewer.