Changeset 145 for trunk/wp-content/plugins/xpressme/include
- Timestamp:
- Mar 31, 2009, 7:00:25 PM (16 years ago)
- Location:
- trunk/wp-content/plugins/xpressme/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/plugins/xpressme/include/custom_functions.php
r144 r145 31 31 function xpress_is_theme_sidebar_disp(){ 32 32 global $xpress_config; 33 if (is_wordpress_style()) return true; 33 34 return $xpress_config->is_theme_sidebar_disp; 34 35 } … … 276 277 } 277 278 278 function xpress_the_content($more_link_text = '',$excerpt_size = 0,$show = true) 279 { 280 $content = get_the_content(); 281 if($excerpt_size > 0) { 282 283 $content = apply_filters('the_excerpt_rss', $content); 284 $content = strip_tags($content); 285 286 if (mb_strlen($content) > $excerpt_size){ 287 $content = mb_substr($content, 0, $excerpt_size); 288 $content .= '... '; 289 if (!empty($more_link_text)) $content .= '<p align="center"><a href="'. get_permalink() . "\">".$more_link_text .'</a></p>'; 279 function get_xpress_excerpt_contents($excerpt_length_word,$excerpt_length_character,$more_link_text = '') { 280 global $post,$xpress_config; 281 282 $blog_encoding = get_option('blog_charset'); 283 $text = get_the_content(''); 284 $text = strip_shortcodes( $text ); 285 $text = apply_filters('the_content', $text); 286 $text = str_replace(']]>', ']]>', $text); 287 $text = strip_tags($text); 288 $is_almost_ascii = ($xpress_config->ascii_judged_rate < round(@(mb_strlen($text, $blog_encoding) / strlen($text)) * 100)) ? true : false; 289 if($is_almost_ascii) { 290 $words = explode(' ', $text, $excerpt_length_word + 1); 291 292 if(count($words) > $excerpt_length_word) { 293 array_pop($words); 294 array_push($words, ' ... '); 295 $text = implode(' ', $words); 296 if (!empty($more_link_text)) $text .= '<p align="center"><a href="'. get_permalink() . "\">".$more_link_text .'</a></p>'; 297 290 298 } 291 299 } 300 elseif(mb_strlen($text, $blog_encoding) > $excerpt_length_character) { 301 $text = mb_substr($text, 0, $xpress_config->excerpt_length_character, $blog_encoding) . ' ... '; 302 if (!empty($more_link_text)) $text .= '<p align="center"><a href="'. get_permalink() . "\">".$more_link_text .'</a></p>'; 303 } 304 305 return $text; 306 } 307 308 function xpress_the_content($more_link_text = null, $stripteaser = 0, $more_file = '',$show = true) 309 { 310 global $post,$xpress_config; 311 312 313 if ($xpress_config->is_content_excerpt){ 314 $excerpt_length_word = $xpress_config->excerpt_length_word; 315 $excerpt_length_character = $xpress_config->excerpt_length_character; 316 $more_link_text = $xpress_config->more_link_text; 317 $content = get_xpress_excerpt_contents($excerpt_length_word,$excerpt_length_character,$more_link_text); 318 } else { 319 $content = get_the_content($more_link_text,$stripteaser,$more_file); 320 $content = apply_filters('the_content', $content); 321 $content = str_replace(']]>', ']]>', $content); 322 } 292 323 if(empty($show)) return $content; 293 324 echo $content; -
trunk/wp-content/plugins/xpressme/include/xpress_common_functions.php
r141 r145 154 154 } 155 155 } 156 function is_wordpress_style() 157 { 158 global $xpress_config; 159 160 if ($xpress_config->viewer_type == 'wordpress') return true; 161 if ($xpress_config->viewer_type == 'xoops') return false; 162 163 // user select 164 $get_style = isset($_GET["style"]) ? $_GET["style"] : ''; 165 $cookie_style = isset($_COOKIE["xpress_style"]) ? $_COOKIE["xpress_style"] : ''; 166 167 // set style 168 if (!empty($get_style)){ 169 $style = $get_style; 170 } else { 171 if (!empty($cookie_style)){ 172 $style = $cookie_style; 173 } else { 174 $style = 'x'; 175 } 176 } 177 178 // set cookie 179 if (empty($cookie_style)){ 180 setcookie("xpress_style", $style); 181 $_COOKIE["xpress_style"] = $style; 182 } else { 183 if ($style != $cookie_style) { 184 setcookie("xpress_style", $style); 185 $_COOKIE["xpress_style"] = $style; 186 } 187 } 188 if ($style == 'w') { 189 return true; 190 } else { 191 return false; 192 } 193 } 194 195 function wp_meta_add_xpress_menu() 196 { 197 global $xpress_config; 198 if ($xpress_config->viewer_type == 'user_select'){ 199 echo disp_mode_set(); 200 } 201 if (function_exists('wp_theme_switcher') ) { 202 echo '<li>' . __('Themes') . ':'; 203 wp_theme_switcher('dropdown'); 204 echo '</li>'; 205 } 206 } 207 208 function disp_mode_set(){ 209 global $xpress_config; 210 211 $select =""; 212 if ($xpress_config->viewer_type == 'user_select'){ 213 $style = isset($_GET["style"]) ? $_GET["style"] : (isset($_COOKIE["xpress_style"]) ? $_COOKIE["xpress_style"] : ""); 214 215 switch($style) { 216 case 'w': 217 $select ='<li><a href="'.get_settings('siteurl').'/?style=x" title="'. __('Switch to XOOPS mode','xpressme').'">'.__('Switch to XOOPS mode','xpressme').'</a></li>'; 218 // $select.='<img src="'. get_settings('siteurl').'/images/external.png" alt="'.__('Switch to XOOPS mode','xpressme') . '"></a></li>'; 219 break; 220 case 'x': 221 $select='<li><a href="'.get_settings('siteurl').'/?style=w" title="'.__('Switch to WordPress mode','xpressme').'">'.__('Switch to WordPress mode','xpressme').'</a></li>'; 222 break; 223 default: 224 $select='<li><a href="'.get_settings('siteurl').'/?style=w" title="'.__('Switch to WordPress mode','xpressme').'">'.__('Switch to WordPress mode','xpressme').'</a></li>'; 225 break; 226 } 227 } 228 return $select; 229 } 230 231 156 232 ?>
Note: See TracChangeset
for help on using the changeset viewer.