XPressME Integration Kit

Trac


Ignore:
Timestamp:
Jul 9, 2009, 3:39:14 PM (15 years ago)
Author:
toemon
Message:

XPressME設定をサブメニュー化 fixes #179

File:
1 edited

Legend:

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

    r313 r328  
    192192        } 
    193193         
    194         function ReadPostData() 
    195         { 
    196                 $this->is_use_xoops_upload_path = stripslashes(trim($_POST['ch_is_use_xoops_upload_path'])); 
    197                 $this->is_theme_sidebar_disp = stripslashes(trim($_POST['ch_is_theme_sidebar_disp'])); 
    198                 $this->is_save_post_revision = stripslashes(trim($_POST['ch_is_save_post_revision'])); 
    199                 $this->is_postnavi_title_disp = stripslashes(trim($_POST['ch_is_postnavi_title_disp'])); 
    200                 $this->is_left_postnavi_old = stripslashes(trim($_POST['ch_is_left_postnavi_old'])); 
    201                 $this->old_post_link_text = stripslashes($_POST['ch_old_post_link_text']); 
    202                 if(empty($this->old_post_link_text)) $this->old_post_link_text = __('Older Post', 'xpressme'); 
    203                 $this->newer_post_link_text = stripslashes($_POST['ch_newer_post_link_text']); 
    204                 if(empty($this->newer_post_link_text)) $this->newer_post_link_text = __('Newer Post', 'xpressme'); 
    205                 $this->is_left_page_navi_old = stripslashes(trim($_POST['ch_is_left_page_navi_old'])); 
    206                 $this->old_page_link_text = stripslashes($_POST['ch_old_page_link_text']); 
    207                 if(empty($this->old_page_link_text)) $this->old_page_link_text = __('Older Entries', 'xpressme'); 
    208                 $this->newer_page_link_text = stripslashes($_POST['ch_newer_page_link_text']); 
    209                 if(empty($this->newer_page_link_text)) $this->newer_page_link_text = __('Newer Entries', 'xpressme'); 
    210                 $this->is_author_view_count = stripslashes(trim($_POST['ch_is_author_view_count'])); 
    211                 $this->is_sql_debug = stripslashes(trim($_POST['ch_is_sql_debug'])); 
    212                 //d3forum 
    213                 $d3forum_select = stripslashes(trim($_POST['ch_d3forum'])); 
    214                 if ($d3forum_select == 'none') { 
    215                         $this->is_use_d3forum = false; 
    216                         $this->d3forum_module_dir = ''; 
    217                         $this->d3forum_forum_id = ''; 
    218                         $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent'; 
    219                 } else { 
    220                         $d3f_set = explode('|', $d3forum_select); 
    221                         $this->is_use_d3forum = true; 
    222                         $this->d3forum_module_dir = $d3f_set[1]; 
    223                         $this->d3forum_forum_id = $d3f_set[2]; 
    224                         $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent'; 
    225                 } 
    226                 $this->is_d3forum_flat = stripslashes(trim($_POST['ch_d3forum_type'])); 
    227                 $this->is_d3forum_desc = stripslashes(trim($_POST['ch_d3forum_order'])); 
    228                 $this->d3forum_views_num = stripslashes(trim($_POST['ch_d3forum_view_num'])); 
    229                  
    230                 $this->is_content_excerpt = stripslashes(trim($_POST['ch_is_content_excerpt'])); 
    231                 $this->ascii_judged_rate = stripslashes(trim($_POST['ch_ascii_judged_rate'])); 
    232                 $this->excerpt_length_word = stripslashes(trim($_POST['ch_excerpt_length_word'])); 
    233                 $this->excerpt_length_character = stripslashes(trim($_POST['ch_excerpt_length_character'])); 
    234                 $this->more_link_text = stripslashes(trim($_POST['ch_more_link_text'])); 
    235                 $this->viewer_type = stripslashes(trim($_POST['ch_viewer_type'])); 
    236                 $this->is_multi_user = stripslashes(trim($_POST['ch_is_multi_user'])); 
    237                 $this->meta_keyword_type = stripslashes(trim($_POST['ch_meta_keyword_type'])); 
    238                 $this->meta_description_type = stripslashes(trim($_POST['ch_meta_description_type'])); 
    239                 $this->meta_robot_type = stripslashes(trim($_POST['ch_meta_robot_type'])); 
     194        function ReadPostData($post_data = null) 
     195        { 
     196                global $xoops_db; 
     197                 
     198                foreach ( (array) $post_data as $index_key => $value ){ 
     199                        if (preg_match('/^ch_/',$index_key)){  // case ch_ 
     200                                $indedx = preg_replace('/^ch_/', '', $index_key); 
     201                                $set_value = stripslashes(trim($value)); 
     202                                // post d3forum 
     203                                if ($indedx === 'd3forum') { 
     204                                        if ($value == 'none'){ 
     205                                                $this->is_use_d3forum = false; 
     206                                                $this->d3forum_module_dir = ''; 
     207                                                $this->d3forum_forum_id = ''; 
     208                                                $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent'; 
     209                                        } else { 
     210                                                $d3f_set = explode('|', $value); 
     211                                                $this->is_use_d3forum = true; 
     212                                                $this->d3forum_module_dir = $d3f_set[1]; 
     213                                                $this->d3forum_forum_id = $d3f_set[2]; 
     214                                                $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent'; 
     215                                        } 
     216                                } else { //post other 
     217                                        if(empty($set_value)){ 
     218                                                switch ($indedx) { 
     219                                                        case 'old_post_link_text': 
     220                                                                $set_value = __('Older Post', 'xpressme'); 
     221                                                                break; 
     222                                                        case 'newer_post_link_text': 
     223                                                                $set_value = __('Newer Post', 'xpressme'); 
     224                                                                break; 
     225                                                        case 'old_page_link_text': 
     226                                                                $set_value = __('Older Entries', 'xpressme'); 
     227                                                                break; 
     228                                                        case 'newer_page_link_text': 
     229                                                                $set_value = __('Newer Entries', 'xpressme'); 
     230                                                                break; 
     231                                                        default: 
     232                                                } 
     233                                        } 
     234                                        $this->$indedx = $value; 
     235                                } 
     236                        } // end of case 'ch_' 
     237                } // end of loop 
    240238 
    241239                global $xoops_db; 
     
    245243                 
    246244                foreach ($this->groupe_role as $groupe) { 
    247                         $post_name = 'role_gid_' . $groupe->groupid; 
    248                         $role = stripslashes(trim($_POST[$post_name])); 
    249                         $post_name = 'login_all_gid_' . $groupe->groupid; 
    250                         $login_all = stripslashes(trim($_POST[$post_name])); 
    251                         if (empty($login_all)) $login_all = '0'; 
    252                         $groupe->role = $role; 
    253                         $groupe->login_all = $login_all; 
    254                         $update_sql  = "UPDATE  $table "; 
    255                         $update_sql .= 'SET '; 
    256                         $update_sql .= "role  = '$role' , "; 
    257                         $update_sql .= "login_all  = $login_all "; 
    258                         $update_sql .= "WHERE (groupid = '$groupe->groupid' )"; 
    259                         $xoops_db->query($update_sql);                   
     245                        $post_role_gid = 'role_gid_' . $groupe->groupid; 
     246                        $login_all_gid = 'login_all_gid_' . $groupe->groupid; 
     247                        if (isset($post_data[$post_role_gid])){ 
     248                                $role = stripslashes(trim($post_data[$post_role_gid])); 
     249                                $login_all = stripslashes(trim($post_data[$login_all_gid])); 
     250                                if (empty($login_all)) $login_all = '0'; 
     251                                $groupe->role = $role; 
     252                                $groupe->login_all = $login_all; 
     253                                $update_sql  = "UPDATE  $table "; 
     254                                $update_sql .= 'SET '; 
     255                                $update_sql .= "role  = '$role' , "; 
     256                                $update_sql .= "login_all  = $login_all "; 
     257                                $update_sql .= "WHERE (groupid = '$groupe->groupid' )"; 
     258                                $xoops_db->query($update_sql);   
     259                        }                
    260260                } 
    261261        } 
     
    516516                $form .=  __('Select the Type of display of D3Forum comment.', 'xpressme') . " \n&emsp"; 
    517517                if ($this->is_d3forum_flat){ 
    518                         $form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='1' checked='checked' />" . __('Flat','xpressme') ."</label>\n"; 
    519                         $form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='0' />". __('Threaded','xpressme') . "</label>\n"; 
     518                        $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='1' checked='checked' />" . __('Flat','xpressme') ."</label>\n"; 
     519                        $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='0' />". __('Threaded','xpressme') . "</label>\n"; 
    520520                }else{ 
    521                         $form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='1' />" . __('Flat','xpressme') . "</label>\n"; 
    522                         $form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='0' checked='checked' />". __('Threaded','xpressme') ."</label>\n"; 
     521                        $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='1' />" . __('Flat','xpressme') . "</label>\n"; 
     522                        $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='0' checked='checked' />". __('Threaded','xpressme') ."</label>\n"; 
    523523                } 
    524524                $form .= '<br />'; 
    525525                $form .=  __('Select the order of display of D3Forum comment.', 'xpressme') . " \n&emsp"; 
    526526                if ($this->is_d3forum_desc){ 
    527                         $form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='1' checked='checked' />" . __('DESC','xpressme') ."</label>\n"; 
    528                         $form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='0' />". __('ASC','xpressme') . "</label>\n"; 
     527                        $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='1' checked='checked' />" . __('DESC','xpressme') ."</label>\n"; 
     528                        $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='0' />". __('ASC','xpressme') . "</label>\n"; 
    529529                }else{ 
    530                         $form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='1' />" . __('DESC','xpressme') . "</label>\n"; 
    531                         $form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='0' checked='checked' />". __('ASC','xpressme') ."</label>\n"; 
     530                        $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='1' />" . __('DESC','xpressme') . "</label>\n"; 
     531                        $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='0' checked='checked' />". __('ASC','xpressme') ."</label>\n"; 
    532532                } 
    533533                $form .= '<br />'; 
    534534                $form .=  __('Number of displays of D3Forum comments.', 'xpressme') ." \n"; 
    535                 $form .= '&emsp<label> <input name="ch_d3forum_view_num" type="text" size="3" maxlength="3" value="'  . $this->d3forum_views_num . '" /></label>'."\n"; 
     535                $form .= '&emsp<label> <input name="ch_d3forum_views_num" type="text" size="3" maxlength="3" value="'  . $this->d3forum_views_num . '" /></label>'."\n"; 
    536536 
    537537                $form .= '<div class="submit">'."\n";            
     
    679679        } 
    680680 
    681  
    682         function option_page() 
    683         { 
    684                 global $xoops_config; 
    685                  
    686                 $xoops_admin_url = $xoops_config->module_url . '/admin/index.php'; 
    687  
    688                 $do_message =''; 
    689                 if (!empty($_POST['submit_update'])) { 
    690                         $this->ReadPostData(); 
    691                         $this->SettingValueWrite('update'); 
    692                 } else if (isset($_POST['submit_reset'])) { 
    693                         $this->setDefault(); 
    694                         $this->SettingValueWrite('update'); 
    695                 } else if (isset($_POST['export_d3f'])) { 
    696                         $do_message  = 'export(' . $this->d3forum_module_dir . '--ID=' . $this->d3forum_forum_id . ')................'; 
    697                         $do_message .= wp_to_d3forum($this->d3forum_forum_id, $this->d3forum_module_dir); 
    698                         $do_message .= '....END'; 
    699                 } else if (isset($_POST['inport_d3f'])) { 
    700                         $do_message  = 'Import(' . $this->d3forum_module_dir . '--ID=' . $this->d3forum_forum_id . ')................'; 
    701                         $do_message .= d3forum_to_wp($this->d3forum_forum_id, $this->d3forum_module_dir); 
    702                         $do_message .= '....END'; 
    703                 }                
    704                  
    705                 echo    '<div class="wrap">'."\n"; 
    706                 echo            '<div id="icon-options-general" class="icon32"><br /></div>'."\n"; 
    707                 echo            '<h2>' . __('XPressME Configuration Page', 'xpressme') . "</h2><br>\n"; 
    708                 echo            '<div align="right"><a href="' . $xoops_admin_url . '"><h3>'. __('to XOOPS Modules Admin Page', 'xpressme') . '</h3></a></div>'; 
    709                 echo            '<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">'."\n" ; 
    710                 echo                    '<table class="form-table">'."\n"; 
    711                 echo                            $this->viewer_type_option(); 
    712                 echo                            $this->yes_no_radio_option('is_use_xoops_upload_path', 
    713                                                                                                 __('Media Upload Base Path','xpressme'), 
    714                                                                                                 __('Use XOOPS UPLOAD PATH','xpressme'), 
    715                                                                                                 __('USE WordPress BASE_PATH','xpressme') 
    716                                                                                                 ); 
    717                 echo                            $this->yes_no_radio_option('is_theme_sidebar_disp', 
    718                                                                                                 __('Thema Sidebar Display','xpressme'), 
    719                                                                                                 __('YES','xpressme'), 
    720                                                                                                 __('NO','xpressme') 
    721                                                                                                 ); 
    722                 echo                            $this->yes_no_radio_option('is_save_post_revision', 
    723                                                                                                 __('The change tracking of the post is preserved','xpressme'), 
    724                                                                                                 __('YES','xpressme'), 
    725                                                                                                 __('NO','xpressme') 
    726                                                                                                 ); 
    727                  
    728                 echo                            $this->yes_no_radio_option('is_multi_user', 
    729                                                                                                 __('Select Multi user mode','xpressme'), 
    730                                                                                                 __('YES','xpressme'), 
    731                                                                                                 __('NO','xpressme') 
    732                                                                                                 ); 
    733                  
    734                  
    735                 echo                            $this->single_post_navi_option(); 
    736                 echo                            $this->posts_page_navi_option(); 
    737                 echo                            $this->excerpt_option(); 
    738                  
    739                 echo                            $this->yes_no_radio_option('is_author_view_count', 
    740                                                                                                 __('Is the posts author views counted?','xpressme'), 
    741                                                                                                 __('YES','xpressme'), 
    742                                                                                                 __('NO','xpressme')              
    743                                                                                                 ); 
    744                 echo                            $this->header_meta_option(); 
    745                 echo                            $this->yes_no_radio_option('is_sql_debug', 
    746                                                                                                 __('Is SQL debugging window displayed?','xpressme'), 
    747                                                                                                 __('YES','xpressme'), 
    748                                                                                                 __('NO','xpressme')              
    749                                                                                                 ); 
    750                  
    751                 echo                            $this->groupe_role_option();             
    752                  
    753                 echo                            $this->d3forum_option($do_message);              
    754 //              $this->is_use_xoops_upload_path_html(); 
    755                 echo                    "</table>\n"; 
    756                  
    757                 echo            '<p class="submit">'."\n"; 
    758                 echo            '<input type="submit" value= "' . __('Update Config', 'xpressme') . '" name="submit_update" />' ."\n"; 
    759                 echo            '<input type="submit" value= "' . __('Preset Config', 'xpressme') . '" name="submit_reset" />' ."\n"; 
    760                 echo            "</p>\n"; 
    761  
    762                 echo            "</form>\n" ; 
    763                 echo    "</div>\n"; 
    764         } 
    765          
    766681        function xpress_upload_filter($uploads) 
    767682        { 
     
    836751                        </script>'; 
    837752                } 
    838         }        
    839          
    840         function set_d3forum_external_link_format() 
    841         { 
    842                 global $xoops_db; 
    843 /*              var $is_use_d3forum; 
    844                 var $d3forum_module_dir; 
    845                 var $d3forum_forum_id; 
    846                 var $d3forum_external_link_format; 
    847                 if ($this->$is_use_d3forum){ 
    848                         $content = ''; 
    849                         $content .= '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" />'; 
    850                         $content .= '<meta http-equiv="content-language" content="'._LANGCODE.'" />' ; 
    851                         $content .= '<title>XPressME SQL DEBUG</title>' ; 
    852                         $content .= '</head><body>'; 
    853                         $content .= $GLOBALS['XPress_SQL_Query']; 
    854                         $content .= '<div style="text-align:center;"><input class="formButton" value="CLOSE" type="button" onclick="javascript:window.close();" /></div></body></html>'; 
    855  
    856                         echo '<script type="text/javascript"> 
    857                                 <!--// 
    858                                 xpress_debug_window = window.open("", "xpress_debug", "width=680 , height=600 ,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no"); 
    859                                 xpress_debug_window.document.clear(); 
    860                                 xpress_debug_window.focus(); 
    861                                 '; 
    862                         $lines = preg_split("/(\r\n|\r|\n)( *)/", $content); 
    863                         foreach ($lines as $line) { 
    864                                 echo 'xpress_debug_window.document.writeln("'.str_replace('"', '\"', $line).'");'; 
    865                         } 
    866                         echo ' 
    867                                 xpress_debug_window.document.close(); 
    868                                 //--> 
    869                         </script>'; 
    870                 } 
    871 */ 
    872         }        
    873  
     753        } 
    874754} 
    875755?> 
Note: See TracChangeset for help on using the changeset viewer.