XPressME Integration Kit

Trac

source: trunk/wp-content/plugins/xpressme/include/custom_functions.php @ 33

Last change on this file since 33 was 33, checked in by toemon, 15 years ago

ポストナビリンクで表示内容を指定(「前の投稿」「次の投稿へ」等)したとき、オンマウスで投稿のタイトルを表示するようにした。

File size: 3.5 KB
Line 
1<?php
2       
3function xpress_credit($show = false)
4{
5        global $xoopsModule,$wp_version;
6       
7        $ret = '<a href="http://www.toemon.com"'. " target='_blank'" . '>XPressME Ver.' . sprintf('%.2f %s',$xoopsModule->getInfo('version'),$xoopsModule->getInfo('codename')) .'</a>';
8        if (strstr($wp_version,'ME')){
9                $ret .= '(included <a href="http://wpme.sourceforge.jp/" title="Powered by WordPress"'." target='_blank'". '>WordPress ' . $wp_version . '</a>)';
10        } else {
11                $ret .= '(included <a href="http://ja.wordpress.org/" title="Powered by WordPress"'." target='_blank'". '>WordPress ' . $wp_version . '</a>)';
12        }
13
14        if (empty($show))
15                return $ret;
16        else
17                echo $ret;
18}
19
20function xpress_convert_time($show = false)
21{
22        $ret =  timer_stop(0) .'sec. ';
23        if (empty($show))
24                return $ret;
25        else
26                echo $ret;
27}
28
29function xpress_is_theme_sidebar_disp(){
30        $config = new XPressME_Class();
31        return $config->is_theme_sidebar_disp;
32}       
33
34function xpress_left_arrow_post_link($show = false)
35{
36        $config = new XPressME_Class();
37        $ret = '';
38               
39        if($config->is_left_postnavi_old){
40                $link_title = $config->old_post_link_text;
41                ob_start();
42                if ($config->is_postnavi_title_disp)
43                        previous_post_link('&laquo; %link');
44                else
45                        previous_post_link('&laquo; %link',$link_title);
46                $ret = ob_get_contents();
47                ob_end_clean();
48        } else {
49                $link_title = $config->newer_post_link_text;
50                ob_start();
51                if ($config->is_postnavi_title_disp)
52                        next_post_link('&laquo; %link');
53                else
54                        next_post_link('&laquo; %link',$link_title);
55                $ret = ob_get_contents();
56                ob_end_clean();
57        }
58       
59        if ($config->is_postnavi_title_disp){
60                $on_mouse_show = $link_title;
61        } else  {
62                if($config->is_left_postnavi_old){
63                        ob_start();
64                                previous_post_link('%link');
65                                $on_mouse_show = ob_get_contents();
66                        ob_end_clean();
67                } else {
68                        ob_start();
69                                next_post_link('%link');
70                                $on_mouse_show = ob_get_contents();
71                        ob_end_clean();
72                }
73                $pattern = "<a[^>]*?>(.*)<\/a>";
74                preg_match("/".$pattern."/s",  $on_mouse_show, $body_matches);
75                $on_mouse_show = $body_matches[1];
76        }
77        $ret = str_replace('">','" title="'.$on_mouse_show . '">' , $ret);
78
79        if (empty($show))
80                return $ret;
81        else
82                echo $ret;     
83}
84
85function xpress_right_arrow_post_link($show = false)
86{
87        $config = new XPressME_Class();
88        $ret = '';             
89       
90        if($config->is_left_postnavi_old){
91                $link_title = $config->newer_post_link_text;
92                ob_start();
93                if ($config->is_postnavi_title_disp)
94                        next_post_link('%link &raquo;');
95                else
96                        next_post_link('%link &raquo;',$link_title);
97                $ret = ob_get_contents();
98                ob_end_clean();
99        } else {
100                $link_title = $config->old_post_link_text;
101                ob_start();
102                if ($config->is_postnavi_title_disp)
103                        previous_post_link('%link &raquo;');
104                else
105                        previous_post_link('%link &raquo;',$link_title);
106                $ret = ob_get_contents();
107                ob_end_clean();
108        }
109       
110        if ($config->is_postnavi_title_disp){
111                $on_mouse_show = $link_title;
112        } else  {
113                if($config->is_left_postnavi_old){
114                        ob_start();
115                                next_post_link('%link');
116                                $on_mouse_show = ob_get_contents();
117                        ob_end_clean();
118                } else {
119                        ob_start();
120                                previous_post_link('%link');
121                                $on_mouse_show = ob_get_contents();
122                        ob_end_clean();
123                }
124                $pattern = "<a[^>]*?>(.*)<\/a>";
125                preg_match("/".$pattern."/s",  $on_mouse_show, $body_matches);
126                $on_mouse_show = $body_matches[1];
127        }
128        $ret = str_replace('">','" title="'.$on_mouse_show . '">' , $ret);
129
130        if (empty($show))
131                return $ret;
132        else
133                echo $ret;     
134}
135?>
Note: See TracBrowser for help on using the repository browser.