XPressME Integration Kit

Trac

source: branches/Ver3.0/xpressme_integration_kit/admin/help/wp_install_help.php @ 757

Last change on this file since 757 was 757, checked in by toemon, 13 years ago

ConfigFromXoopsクラスを廃止し、modInfoクラスを使用するように変更
WP2.2以下で使用するテンプレートold_templateの廃止

File size: 3.9 KB
Line 
1<?php
2        function text_indent($text,$num = 1,$css_option='')
3        {
4                $ret = '';
5                $px = 24 * $num;
6                $ret = '<div style="padding-left:' .$px .'px;'.$css_option.'">';
7                $ret .= $text . '</div>';
8                return $ret;
9        }
10
11        function get_download_info($locale='')
12        {
13                global $modInfo;
14                $local_package = '';
15                $mysql_version = preg_replace('/[^0-9.].*/', '', $modInfo->get_mysql_version());
16                $php_version = $modInfo->get_php_version();
17
18                if (empty($locale)) $locale = $modInfo->get_wpLang();
19
20/* test         
21                $mysql_version='4.0.27';
22                $php_version = '4.1.1';
23*/
24                // wprdpress original option
25                // ?version=$wp_version&php=$php_version&locale=$locale&mysql=$mysql_version&local_package=$local_package";
26                $option = "?php=$php_version&locale=$locale&mysql=$mysql_version&local_package=$local_package";
27                $url = "http://api.wordpress.org/core/version-check/1.5/" .$option;
28                $handle = @fopen($url,'r');
29                if ($handle) {
30                        $ans = array();
31                        $num = 0;
32                        $pos = 0;
33                while (($buffer = fgets($handle, 4096)) !== false) {
34                        $buffer = trim($buffer);
35                        if (strlen($buffer) == 0) {
36                                $num++;
37                                $pos=0;
38                        } else {
39                                $ans[$num][$pos] = $buffer;
40                                $pos++;
41                        }
42                }
43                if (!feof($handle)) {
44                        echo "Error: unexpected fgets() fail\n";
45                }
46                fclose($handle);
47                }
48                $ressponce = $ans[0][0];
49                $site_url = $ans[0][1];
50                $download_url = $ans[0][2];
51                $wp_version = $ans[0][3];
52                $download_lang = $ans[0][4];
53//              print_r($ans);
54                if (isset($ans[1])){
55                        $en_download_url = $ans[1][2];
56                }
57                $ret = text_indent('(Check URL: '.$url.')',3);
58                if ($locale == $download_lang){
59                        $ret .= text_indent(sprintf(_AM_XP2_WP_INFO_1,$locale),2);
60                        $ret .= text_indent('<a href="'.$download_url.'">' . $download_url .'</a>' ,3);
61                        if (!empty($en_download_url)){
62                                $ret .= text_indent(_AM_XP2_WP_INFO_4,2);
63                                $ret .= text_indent('<a href="'.$en_download_url .'">' . $en_download_url .'</a>' ,3);
64                        }
65                } else {
66                        $ret .= text_indent(sprintf(_AM_XP2_WP_INFO_2,$locale));
67                        $ret .= text_indent(_AM_XP2_WP_INFO_3,2);
68                        $ret .= text_indent('<a href="http://codex.wordpress.org/WordPress_in_Your_Language" target="   _blank">WordPress_in_Your_Language</a>' ,3);
69                        $ret .= text_indent(_AM_XP2_WP_INFO_4,2);
70                        $ret .= text_indent('<a href="'.$download_url.'">' . $download_url .'</a>' ,3);
71                }
72                echo $ret;
73        }
74}
75       
76        function wp_install_guide(){
77                global $modInfo;
78                $mydirpath = dirname( dirname( dirname( __FILE__ ) ) ) ;
79                $mydirname = basename(dirname( dirname( dirname( __FILE__ ) ) )) ;
80                $xoops_lang = @$GLOBALS["xoopsConfig"]['language'];
81                if (!$modInfo->is_wp_file_found()){
82                        //Download
83                        echo $modInfo->get_mod_image_link('check_bad_s.png');
84                        echo '<font size="4" >'._AM_XP2_WP_CHK_0 .'</font><br />';
85                        echo '<br />';
86                        echo text_indent(_AM_XP2_WP_CHK_1 . _AM_XP2_WP_CHK_2);
87                        echo '<br />';
88                        echo text_indent(_AM_XP2_WP_STEP_1,1,'font-weight:bold;');
89                        echo get_download_info('ja');
90                        echo '<br />';
91                        // Uncompress
92                        echo text_indent(_AM_XP2_WP_STEP_2,1,'font-weight:bold;');
93                        echo text_indent(_AM_XP2_WP_INFO_5,2);                 
94                        echo '<br />';
95                        echo '<div style="padding-left:60px;">'.$modInfo->get_mod_image_link('wp_uncompless.png') . '</div>';
96                        echo '<br />';
97                        // Upload Wordpress
98                        echo text_indent(_AM_XP2_WP_STEP_3,1,'font-weight:bold;');
99                        printf(text_indent(_AM_XP2_WP_INFO_6,2),$mydirname);                   
100                        printf(text_indent(_AM_XP2_WP_INFO_7,3),$mydirpath);                   
101                        echo text_indent(_AM_XP2_WP_INFO_8,2);
102                        echo '<br />';
103                        echo '<div style="padding-left:60px;">'.$modInfo->get_mod_image_link('wp_upload.png') . '</div>';
104                        echo '<br />';
105                        //Install
106                        echo text_indent(_AM_XP2_WP_STEP_4,1,'font-weight:bold;');
107                        echo text_indent(_AM_XP2_WP_INFO_9,2);                 
108
109                } else {
110                        echo $modInfo->get_mod_image_link('check_good_s.png');
111                        echo '<font size="4" >'._AM_XP2_WP_CHK_0 .'</font><br />';
112                        echo '<br />';
113                }
114        }
115?>
Note: See TracBrowser for help on using the repository browser.