XPressME Integration Kit

Trac


Ignore:
Timestamp:
Mar 7, 2009, 11:05:20 PM (15 years ago)
Author:
toemon
Message:

D3Forumのフォーラムリストボックスからコメント統合を選択するための設定画面を作成
設定値はXPressME_Classクラスの
is_use_d3forum;
d3forum_module_dir;
d3forum_forum_id;
d3forum_external_link_format;
プロパティーから取得できます。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/plugins/xpressme/xpressme_class.php

    r95 r99  
    1515        var $is_sql_debug; 
    1616        var $groupe_role; 
    17  
     17        var $is_use_d3forum; 
     18        var $d3forum_module_dir; 
     19        var $d3forum_forum_id; 
     20        var $d3forum_external_link_format; 
    1821        //constructor 
    1922        function XPressME_Class() 
     
    4952                $this->is_author_view_count = false; 
    5053                $this->is_sql_debug = false; 
     54                $this->is_use_d3forum = false; 
     55                $this->d3forum_module_dir = ''; 
     56                $this->d3forum_forum_id = ''; 
     57                $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent'; 
    5158        } 
    5259         
     
    7986                        'newer_post_link_text' => $this->newer_post_link_text, 
    8087                        'is_author_view_count' => $this->is_author_view_count, 
    81                         'is_sql_debug' => $this->is_sql_debug 
     88                        'is_sql_debug' => $this->is_sql_debug, 
     89                        'is_use_d3forum' =>     $this->is_use_d3forum, 
     90                        'd3forum_module_dir' => $this->d3forum_module_dir, 
     91                        'd3forum_forum_id' => $this->d3forum_forum_id, 
     92                        'd3forum_external_link_format' => $this->d3forum_external_link_format 
    8293                ); 
    8394                if ($mode == 'add_new') { 
     
    144155                $this->is_author_view_count = stripslashes(trim($_POST['ch_is_author_view_count'])); 
    145156                $this->is_sql_debug = stripslashes(trim($_POST['ch_is_sql_debug'])); 
     157                //d3forum 
     158                $d3forum_select = stripslashes(trim($_POST['ch_d3forum'])); 
     159                if ($d3forum_select == 'none') { 
     160                        $this->is_use_d3forum = false; 
     161                        $this->d3forum_module_dir = ''; 
     162                        $this->d3forum_forum_id = ''; 
     163                        $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent'; 
     164                } else { 
     165                        $d3f_set = explode('|', $d3forum_select); 
     166                        $this->is_use_d3forum = true; 
     167                        $this->d3forum_module_dir = $d3f_set[1]; 
     168                        $this->d3forum_forum_id = $d3f_set[2]; 
     169                        $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent'; 
     170                } 
    146171                 
    147172                global $xoops_db; 
     
    256281 
    257282        } 
    258                  
     283         
     284        function d3forum_option(){ 
     285                global $xoops_db; 
     286                 
     287                $d3frum_list = array(); 
     288                $module_dir_path = get_xoops_root_path(); 
     289                 
     290                $forum_list  = '<select name="ch_d3forum">' . "\n"; 
     291                 
     292                if ($this->is_use_d3forum != true) 
     293                        $selected = ' selected="selected"'; 
     294                else 
     295                        $selected = ''; 
     296                $forum_list .= '<option value="none"' . $selected . '>' . __('Do Not Comment Integration.', 'xpressme') . "</option>\n"; 
     297 
     298                // Form making for forum selection of D3forum 
     299                $modules_table = get_xoops_prefix() .'modules'; 
     300                $sql = "SELECT mid,name,isactive,dirname FROM $modules_table WHERE isactive = 1"; 
     301                $modules = $xoops_db->get_results($sql); 
     302                foreach ($modules as $module) { 
     303                        $file_path = $module_dir_path . '/modules/' . $module->dirname . '/mytrustdirname.php';                  
     304                        if (! file_exists($file_path)) continue; 
     305                        $array_files = file($file_path); 
     306                        // It is checked whether there is character string "$mytrustdirname ='d3forum'"in the file. 
     307                        foreach ($array_files as $aeey_file){ 
     308                                if( preg_match( "/\s*($mytrustdirname)\s*(=)\s*([\"'])(d3forum)([\"'])/", $aeey_file ) ) { 
     309                                        $forums_tb = get_xoops_prefix() . $module->dirname . '_forums'; 
     310                                        $cat_tb = get_xoops_prefix() . $module->dirname . '_categories'; 
     311                                        $sql= "SELECT * FROM $forums_tb LEFT JOIN $cat_tb ON $forums_tb.cat_id = $cat_tb.cat_id"; 
     312                                        $forums = $xoops_db->get_results($sql); 
     313                                        foreach ($forums as $forum) { 
     314                                                if (($module->dirname == $this->d3forum_module_dir) &&  ($forum->forum_id == $this->d3forum_forum_id)) 
     315                                                        $selected = ' selected="selected"'; 
     316                                                else 
     317                                                        $selected = ''; 
     318                                                $forum_div = 'forum|' . $module->dirname . '|' .  $forum->forum_id; 
     319                                                $forum_select = "$module->name($module->dirname) $forum->cat_title-$forum->forum_title(ID=$forum->forum_id)"; 
     320                                                $forum_list .= '<option value="' . $forum_div . '" ' . $selected . '>' . $forum_select . "</option>\n"; 
     321                                        } 
     322                                        break; 
     323                                } 
     324                        } 
     325                        $form .= '<br>';                         
     326                } 
     327                $forum_list .= '</select>' . "\n"; 
     328 
     329                $form  = '<tr>' . "\n"; 
     330                $form .= '<th><label for="d3forum">' .__('Comment integration with D3Forum', 'xpressme') . '</label></th>' . "\n"; 
     331                $form .=  "<td>\n"; 
     332                $form .=  __('Select the forum of D3Forum that does the comment integration from the following lists.', 'xpressme') ."<br />\n"; 
     333                $form .=  $forum_list."\n"; 
     334                $form .= '<br /><br /><br /><br /><br /><br /><br />'; 
     335                $form .=  "</td>\n"; 
     336                $form .=  "</tr><tr>\n"; 
     337                return $form; 
     338        } 
     339 
    259340        function option_page() 
    260341        { 
     
    316397                                                                                                ); 
    317398                 
    318                 echo                            $this->groupe_role_option();                             
     399                echo                            $this->groupe_role_option();             
     400                 
     401                echo                            $this->d3forum_option();                 
    319402//              $this->is_use_xoops_upload_path_html(); 
    320403                echo                    "</table>\n"; 
Note: See TracChangeset for help on using the changeset viewer.