| 1 | <?php | 
|---|
| 2 |  | 
|---|
| 3 | load_plugin_textdomain('xpressme', 'wp-content/plugins/xpressme/language'); | 
|---|
| 4 |  | 
|---|
| 5 | class XPressME_Class{ | 
|---|
| 6 | var $pluginName = 'xpressme'; | 
|---|
| 7 | var $is_use_xoops_upload_path; | 
|---|
| 8 | var $is_theme_sidebar_disp; | 
|---|
| 9 | var $is_save_post_revision; | 
|---|
| 10 | var $is_postnavi_title_disp; | 
|---|
| 11 | var $is_left_postnavi_old; | 
|---|
| 12 | var $old_post_link_text; | 
|---|
| 13 | var $newer_post_link_text; | 
|---|
| 14 | var $is_left_page_navi_old; | 
|---|
| 15 | var $old_page_link_text; | 
|---|
| 16 | var $newer_page_link_text; | 
|---|
| 17 | var $is_author_view_count; | 
|---|
| 18 | var $is_sql_debug; | 
|---|
| 19 | var $groupe_role; | 
|---|
| 20 | var $is_use_d3forum; | 
|---|
| 21 | var $d3forum_module_dir; | 
|---|
| 22 | var $d3forum_forum_id; | 
|---|
| 23 | var $d3forum_external_link_format; | 
|---|
| 24 | var $is_content_excerpt; | 
|---|
| 25 | var $ascii_judged_rate; | 
|---|
| 26 | var $excerpt_length_word; | 
|---|
| 27 | var $excerpt_length_character; | 
|---|
| 28 | var $excerpt_more_link_text; | 
|---|
| 29 | var $more_link_text; | 
|---|
| 30 | var $viewer_type; | 
|---|
| 31 | var $is_multi_user; | 
|---|
| 32 | var $meta_keyword_type; | 
|---|
| 33 | var $meta_description_type; | 
|---|
| 34 | var $meta_robot_type; | 
|---|
| 35 | var $is_dashboard_blog_disp; | 
|---|
| 36 | var $is_dashboard_forum_disp; | 
|---|
| 37 | var $theme_select; | 
|---|
| 38 | var $is_block_error_display; | 
|---|
| 39 | //constructor | 
|---|
| 40 | function XPressME_Class() | 
|---|
| 41 | { | 
|---|
| 42 | global $xoops_db; | 
|---|
| 43 |  | 
|---|
| 44 | $this->setdefault();    //not setting propaty load | 
|---|
| 45 | $this->SettingValueRead(); | 
|---|
| 46 | } | 
|---|
| 47 |  | 
|---|
| 48 | //Set Default Value | 
|---|
| 49 | function setDefault() | 
|---|
| 50 | { | 
|---|
| 51 | global $xoops_config; | 
|---|
| 52 | if($xoops_config->is_wpmu) | 
|---|
| 53 | $this->is_use_xoops_upload_path = false; | 
|---|
| 54 | else | 
|---|
| 55 | $this->is_use_xoops_upload_path = true; | 
|---|
| 56 | $this->is_use_xoops_upload_path = true; | 
|---|
| 57 | $this->is_theme_sidebar_disp = false; | 
|---|
| 58 | $this->is_save_post_revision = true; | 
|---|
| 59 | $this->is_postnavi_title_disp = true; | 
|---|
| 60 | $this->is_left_postnavi_old = true; | 
|---|
| 61 | $this->old_post_link_text = __('Older Post', 'xpressme'); | 
|---|
| 62 | $this->newer_post_link_text = __('Newer Post', 'xpressme'); | 
|---|
| 63 | $this->is_left_page_navi_old = true; | 
|---|
| 64 | $this->old_page_link_text = __('Older Entries', 'xpressme'); | 
|---|
| 65 | $this->newer_page_link_text = __('Newer Entries', 'xpressme'); | 
|---|
| 66 | $this->is_author_view_count = false; | 
|---|
| 67 | $this->is_sql_debug = false; | 
|---|
| 68 | $this->is_use_d3forum = false; | 
|---|
| 69 | $this->d3forum_module_dir = ''; | 
|---|
| 70 | $this->d3forum_forum_id = ''; | 
|---|
| 71 | $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent'; | 
|---|
| 72 | $this->is_d3forum_flat = true; | 
|---|
| 73 | $this->is_d3forum_desc = true; | 
|---|
| 74 | $this->d3forum_views_num = 10; | 
|---|
| 75 | $this->is_content_excerpt = true; | 
|---|
| 76 | $this->ascii_judged_rate = 90; | 
|---|
| 77 | $this->excerpt_length_word = 40; | 
|---|
| 78 | $this->excerpt_length_character = 120; | 
|---|
| 79 | $this->excerpt_more_link_text = __('Read the rest of this entry »', 'xpressme'); | 
|---|
| 80 | $this->more_link_text = __('Read the rest of this entry »', 'xpressme'); | 
|---|
| 81 | $this->viewer_type = 'xoops'; | 
|---|
| 82 | $this->is_multi_user = false; | 
|---|
| 83 | $this->meta_keyword_type = 'xoops'; | 
|---|
| 84 | $this->meta_description_type = 'xoops'; | 
|---|
| 85 | $this->meta_robot_type = 'xoops'; | 
|---|
| 86 | $this->is_dashboard_blog_disp = true; | 
|---|
| 87 | $this->is_dashboard_forum_disp = true; | 
|---|
| 88 | $this->theme_select = 'use_wordpress_select'; | 
|---|
| 89 | $this->is_block_error_display = true; | 
|---|
| 90 | } | 
|---|
| 91 |  | 
|---|
| 92 | function SettingValueRead() | 
|---|
| 93 | { | 
|---|
| 94 | global $xoops_db; | 
|---|
| 95 | $options = get_option('xpressme_option'); | 
|---|
| 96 | if (!$options) { | 
|---|
| 97 | $this->setDefault(); | 
|---|
| 98 | $this->SettingValueWrite('add_new'); | 
|---|
| 99 | } else { | 
|---|
| 100 | foreach ($options as $option_name => $option_value){ | 
|---|
| 101 | $this-> {$option_name} = $option_value; | 
|---|
| 102 | } | 
|---|
| 103 | } | 
|---|
| 104 | if (!empty($xoops_db))  // at install trap | 
|---|
| 105 | $this->GroupeRoleRead(); | 
|---|
| 106 | } | 
|---|
| 107 |  | 
|---|
| 108 | // mode 0:add  1:update | 
|---|
| 109 | function SettingValueWrite($mode) | 
|---|
| 110 | { | 
|---|
| 111 | global $xoops_config; | 
|---|
| 112 | if($xoops_config->is_wpmu) $this->is_use_xoops_upload_path = false; | 
|---|
| 113 |  | 
|---|
| 114 | $write_options = array ( | 
|---|
| 115 | 'is_use_xoops_upload_path' => $this->is_use_xoops_upload_path , | 
|---|
| 116 | 'is_theme_sidebar_disp' => $this->is_theme_sidebar_disp , | 
|---|
| 117 | 'is_save_post_revision' => $this->is_save_post_revision , | 
|---|
| 118 | 'is_postnavi_title_disp' => $this->is_postnavi_title_disp , | 
|---|
| 119 | 'is_left_postnavi_old' => $this->is_left_postnavi_old , | 
|---|
| 120 | 'old_post_link_text' => $this->old_post_link_text , | 
|---|
| 121 | 'newer_post_link_text' => $this->newer_post_link_text, | 
|---|
| 122 | 'is_left_page_navi_old' => $this->is_left_page_navi_old , | 
|---|
| 123 | 'old_page_link_text' => $this->old_page_link_text , | 
|---|
| 124 | 'newer_page_link_text' => $this->newer_page_link_text, | 
|---|
| 125 | 'is_author_view_count' => $this->is_author_view_count, | 
|---|
| 126 | 'is_sql_debug' => $this->is_sql_debug, | 
|---|
| 127 | 'is_use_d3forum' =>     $this->is_use_d3forum, | 
|---|
| 128 | 'd3forum_module_dir' => $this->d3forum_module_dir, | 
|---|
| 129 | 'd3forum_forum_id' => $this->d3forum_forum_id, | 
|---|
| 130 | 'd3forum_external_link_format' => $this->d3forum_external_link_format, | 
|---|
| 131 | 'is_d3forum_flat' => $this->is_d3forum_flat, | 
|---|
| 132 | 'is_d3forum_desc' => $this->is_d3forum_desc, | 
|---|
| 133 | 'd3forum_views_num' =>$this->d3forum_views_num, | 
|---|
| 134 | 'is_content_excerpt' => $this->is_content_excerpt, | 
|---|
| 135 | 'ascii_judged_rate' => $this->ascii_judged_rate, | 
|---|
| 136 | 'excerpt_length_word' => $this->excerpt_length_word, | 
|---|
| 137 | 'excerpt_length_character' => $this->excerpt_length_character, | 
|---|
| 138 | 'excerpt_more_link_text' => $this->excerpt_more_link_text, | 
|---|
| 139 | 'more_link_text' => $this->more_link_text, | 
|---|
| 140 | 'viewer_type' => $this->viewer_type, | 
|---|
| 141 | 'is_multi_user' => $this->is_multi_user, | 
|---|
| 142 | 'meta_keyword_type' => $this->meta_keyword_type, | 
|---|
| 143 | 'meta_description_type' => $this->meta_description_type, | 
|---|
| 144 | 'meta_robot_type' => $this->meta_robot_type, | 
|---|
| 145 | 'is_dashboard_blog_disp' => $this->is_dashboard_blog_disp, | 
|---|
| 146 | 'is_dashboard_forum_disp' => $this->is_dashboard_forum_disp, | 
|---|
| 147 | 'theme_select' => $this->theme_select, | 
|---|
| 148 | 'is_block_error_display' => $this->is_block_error_display | 
|---|
| 149 | ); | 
|---|
| 150 | if ($mode == 'add_new') { | 
|---|
| 151 | add_option('xpressme_option', $write_options); | 
|---|
| 152 | } else { | 
|---|
| 153 | update_option("xpressme_option", $write_options); | 
|---|
| 154 | } | 
|---|
| 155 | } | 
|---|
| 156 |  | 
|---|
| 157 | function GroupeRoleRead() { | 
|---|
| 158 | global $xoops_db; | 
|---|
| 159 |  | 
|---|
| 160 | // table sync | 
|---|
| 161 | $table = get_wp_prefix() . 'group_role'; | 
|---|
| 162 | $xoops_group = get_xoops_prefix() . 'groups'; | 
|---|
| 163 | $xoops_group_permission = get_xoops_prefix() . 'group_permission'; | 
|---|
| 164 |  | 
|---|
| 165 | $module_id = get_xpress_modid(); | 
|---|
| 166 |  | 
|---|
| 167 | $sql=  "SELECT * FROM $table"; | 
|---|
| 168 | $before_groupes = $xoops_db->get_results($sql); | 
|---|
| 169 |  | 
|---|
| 170 | $sql = "DELETE FROM $table"; | 
|---|
| 171 | $xoops_db->query($sql); | 
|---|
| 172 |  | 
|---|
| 173 | $sql =  "SELECT *  FROM $xoops_group_permission WHERE gperm_itemid = $module_id"; | 
|---|
| 174 | $gperms = $xoops_db->get_results($sql); | 
|---|
| 175 |  | 
|---|
| 176 | $sql =  "SELECT * FROM $xoops_group WHERE group_type <> 'Anonymous'"; | 
|---|
| 177 | $groupes = $xoops_db->get_results($sql); | 
|---|
| 178 | $insert_sql = ''; | 
|---|
| 179 | foreach ($groupes as $groupe) { | 
|---|
| 180 | $parmsql =  "SELECT *  FROM $xoops_group_permission WHERE gperm_itemid = $module_id AND gperm_groupid = $groupe->groupid"; | 
|---|
| 181 | $gperms = $xoops_db->get_results($parmsql); | 
|---|
| 182 | $parmission = ''; | 
|---|
| 183 | foreach ($gperms as $gperm) { | 
|---|
| 184 | $parmission = $gperm->gperm_name; | 
|---|
| 185 | if ($parmission == 'module_admin') break; | 
|---|
| 186 | } | 
|---|
| 187 |  | 
|---|
| 188 | if (!empty($parmission)){ | 
|---|
| 189 | $role = ''; | 
|---|
| 190 | foreach ($before_groupes as $before_groupe) { | 
|---|
| 191 | if ($groupe->groupid == $before_groupe->groupid) { | 
|---|
| 192 | $role = $before_groupe->role; | 
|---|
| 193 | $login_all = $before_groupe->login_all; | 
|---|
| 194 | } | 
|---|
| 195 | } | 
|---|
| 196 | if ($parmission == 'module_admin') $role = 'administrator'; | 
|---|
| 197 |  | 
|---|
| 198 | $insert_sql  = "INSERT INTO  $table "; | 
|---|
| 199 | $insert_sql .= "(groupid , name , description , group_type , role , login_all) "; | 
|---|
| 200 | $insert_sql .= "VALUES ("; | 
|---|
| 201 | $insert_sql .= $groupe->groupid . ', '; | 
|---|
| 202 | $insert_sql .= "'" . $groupe->name . "' , "; | 
|---|
| 203 | $insert_sql .= "'" . $groupe->description . "' , "; | 
|---|
| 204 | $insert_sql .= "'" . $parmission . "' , "; | 
|---|
| 205 | $insert_sql .= "'" . $role . "' , '"; | 
|---|
| 206 | $insert_sql .= $login_all . "')"; | 
|---|
| 207 | $xoops_db->query($insert_sql); | 
|---|
| 208 | } | 
|---|
| 209 | } | 
|---|
| 210 |  | 
|---|
| 211 | $sql=  "SELECT * FROM $table"; | 
|---|
| 212 |  | 
|---|
| 213 | $this->groupe_role =  $xoops_db->get_results($sql); | 
|---|
| 214 | $sql=  "SELECT * FROM $table"; | 
|---|
| 215 | } | 
|---|
| 216 |  | 
|---|
| 217 | function ReadPostData($post_data = null) | 
|---|
| 218 | { | 
|---|
| 219 | global $xoops_db; | 
|---|
| 220 |  | 
|---|
| 221 | foreach ( (array) $post_data as $index_key => $value ){ | 
|---|
| 222 | if (preg_match('/^ch_/',$index_key)){  // case ch_ | 
|---|
| 223 | $indedx = preg_replace('/^ch_/', '', $index_key); | 
|---|
| 224 | $set_value = stripslashes(trim($value)); | 
|---|
| 225 | // post d3forum | 
|---|
| 226 | if ($indedx === 'd3forum') { | 
|---|
| 227 | if ($value == 'none'){ | 
|---|
| 228 | $this->is_use_d3forum = false; | 
|---|
| 229 | $this->d3forum_module_dir = ''; | 
|---|
| 230 | $this->d3forum_forum_id = ''; | 
|---|
| 231 | $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent'; | 
|---|
| 232 | } else { | 
|---|
| 233 | $d3f_set = explode('|', $value); | 
|---|
| 234 | $this->is_use_d3forum = true; | 
|---|
| 235 | $this->d3forum_module_dir = $d3f_set[1]; | 
|---|
| 236 | $this->d3forum_forum_id = $d3f_set[2]; | 
|---|
| 237 | $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent'; | 
|---|
| 238 | } | 
|---|
| 239 | } else { //post other | 
|---|
| 240 | if(empty($set_value)){ | 
|---|
| 241 | switch ($indedx) { | 
|---|
| 242 | case 'old_post_link_text': | 
|---|
| 243 | $set_value = __('Older Post', 'xpressme'); | 
|---|
| 244 | break; | 
|---|
| 245 | case 'newer_post_link_text': | 
|---|
| 246 | $set_value = __('Newer Post', 'xpressme'); | 
|---|
| 247 | break; | 
|---|
| 248 | case 'old_page_link_text': | 
|---|
| 249 | $set_value = __('Older Entries', 'xpressme'); | 
|---|
| 250 | break; | 
|---|
| 251 | case 'newer_page_link_text': | 
|---|
| 252 | $set_value = __('Newer Entries', 'xpressme'); | 
|---|
| 253 | break; | 
|---|
| 254 | case 'excerpt_more_link_text': | 
|---|
| 255 | $set_value = __('Read the rest of this entry »', 'xpressme'); | 
|---|
| 256 | break; | 
|---|
| 257 | case 'theme_select': | 
|---|
| 258 | $set_value = 'use_wordpress_select'; | 
|---|
| 259 | break; | 
|---|
| 260 |  | 
|---|
| 261 | default: | 
|---|
| 262 | } | 
|---|
| 263 | } | 
|---|
| 264 | $this->$indedx = $value; | 
|---|
| 265 | } | 
|---|
| 266 | } // end of case 'ch_' | 
|---|
| 267 | } // end of loop | 
|---|
| 268 |  | 
|---|
| 269 | global $xoops_config; | 
|---|
| 270 | if($xoops_config->is_wpmu) $this->is_use_xoops_upload_path = false; | 
|---|
| 271 |  | 
|---|
| 272 | $table = get_wp_prefix() . 'group_role'; | 
|---|
| 273 | //              $sql=  "SELECT * FROM $table"; | 
|---|
| 274 | //              $this->groupe_role =  $xoops_db->get_results($sql);  // before Read | 
|---|
| 275 |  | 
|---|
| 276 | foreach ($this->groupe_role as $groupe) { | 
|---|
| 277 | $post_role_gid = 'role_gid_' . $groupe->groupid; | 
|---|
| 278 | $login_all_gid = 'login_all_gid_' . $groupe->groupid; | 
|---|
| 279 | if (isset($post_data[$post_role_gid])){ | 
|---|
| 280 | $role = stripslashes(trim($post_data[$post_role_gid])); | 
|---|
| 281 | $login_all = stripslashes(trim($post_data[$login_all_gid])); | 
|---|
| 282 | if (empty($login_all)) $login_all = '0'; | 
|---|
| 283 | $groupe->role = $role; | 
|---|
| 284 | $groupe->login_all = $login_all; | 
|---|
| 285 | $update_sql  = "UPDATE  $table "; | 
|---|
| 286 | $update_sql .= 'SET '; | 
|---|
| 287 | $update_sql .= "role  = '$role' , "; | 
|---|
| 288 | $update_sql .= "login_all  = $login_all "; | 
|---|
| 289 | $update_sql .= "WHERE (groupid = '$groupe->groupid' )"; | 
|---|
| 290 | $xoops_db->query($update_sql); | 
|---|
| 291 | } | 
|---|
| 292 | } | 
|---|
| 293 | } | 
|---|
| 294 |  | 
|---|
| 295 | function yes_no_radio_option($option_name,$option_desc,$yes = '',$no= '' , $disible=false){ | 
|---|
| 296 | if (empty( $yes ))  $yes = __('YES','xpressme') ; | 
|---|
| 297 | if (empty( $no ))  $no = __('NO','xpressme') ; | 
|---|
| 298 | $value = $this->{$option_name}; | 
|---|
| 299 | $ans_name = 'ch_' . $option_name; | 
|---|
| 300 |  | 
|---|
| 301 | $form  =  "<tr>\n"; | 
|---|
| 302 | $form .=  '<th><label for="images_to_link">' . $option_desc . "</label></th>\n"; | 
|---|
| 303 | $form .=  "<td>\n"; | 
|---|
| 304 | $form .=  $this->yes_no_radio_option_sub($option_name,$yes,$no,$disible); | 
|---|
| 305 | $form .=  "</td>\n"; | 
|---|
| 306 | $form .=  "</tr>\n"; | 
|---|
| 307 |  | 
|---|
| 308 | return $form; | 
|---|
| 309 |  | 
|---|
| 310 | } | 
|---|
| 311 | function yes_no_radio_option_sub($option_name,$yes = '',$no= '',$disible=false){ | 
|---|
| 312 | if ($disible) $disible_str = ' disabled="disabled"'; else $disible_str = ''; | 
|---|
| 313 |  | 
|---|
| 314 | if (empty( $yes ))  $yes = __('YES','xpressme') ; | 
|---|
| 315 | if (empty( $no ))  $no = __('NO','xpressme') ; | 
|---|
| 316 | $value = $this->{$option_name}; | 
|---|
| 317 | $ans_name = 'ch_' . $option_name; | 
|---|
| 318 | if ($value){ | 
|---|
| 319 | $form .= "<label><input type='radio' name='". $ans_name . "' value='1' checked='checked' $disible_str />" . $yes ."</label><br />\n"; | 
|---|
| 320 | $form .= "<label><input type='radio' name='". $ans_name . "' value='0' $disible_str />". $no . "</label>\n"; | 
|---|
| 321 | }else{ | 
|---|
| 322 | $form .= "<label><input type='radio' name='". $ans_name . "' value='1' $disible_str />" . $yes . "</label><br />\n"; | 
|---|
| 323 | $form .= "<label><input type='radio' name='". $ans_name . "' value='0' checked='checked' $disible_str />". $no ."</label>\n"; | 
|---|
| 324 | } | 
|---|
| 325 | return $form; | 
|---|
| 326 | } | 
|---|
| 327 |  | 
|---|
| 328 |  | 
|---|
| 329 | function text_option($option_name,$option_desc){ | 
|---|
| 330 | $value = $this->{$option_name}; | 
|---|
| 331 | $ans_name = 'ch_' . $option_name; | 
|---|
| 332 |  | 
|---|
| 333 | $form  =  "<tr>\n"; | 
|---|
| 334 | $form .=  '<th><label for="images_to_link">' . $option_desc . "</label></th>\n"; | 
|---|
| 335 | $form .=  "<td>\n"; | 
|---|
| 336 | $form .= $this->text_option_sub($option_name); | 
|---|
| 337 | $form .=  "</td>\n"; | 
|---|
| 338 | $form .=  "</tr>\n"; | 
|---|
| 339 |  | 
|---|
| 340 | return $form; | 
|---|
| 341 |  | 
|---|
| 342 | } | 
|---|
| 343 |  | 
|---|
| 344 | function text_option_sub($option_name){ | 
|---|
| 345 | $value = $this->{$option_name}; | 
|---|
| 346 | $ans_name = 'ch_' . $option_name; | 
|---|
| 347 |  | 
|---|
| 348 | $form = '<label> <input name="'. $ans_name . '" type="text" size="25" maxlength="50" value="'  . $value . '" /></label>'."\n"; | 
|---|
| 349 | return $form; | 
|---|
| 350 |  | 
|---|
| 351 | } | 
|---|
| 352 |  | 
|---|
| 353 |  | 
|---|
| 354 | function single_post_navi_option(){ | 
|---|
| 355 | $form = ''; | 
|---|
| 356 | $form .= '<tr><th><label for="single_page_navi">' .__('Single Post Navi Setting', 'xpressme') . '</label></th>'; | 
|---|
| 357 | $form .= "<td>\n"; | 
|---|
| 358 | $form .= "<table>\n"; | 
|---|
| 359 | $form .= "<tr>\n"; | 
|---|
| 360 |  | 
|---|
| 361 | $form .= "<td>" . __('Adjustment of Navi link display position','xpressme') . "</td>\n"; | 
|---|
| 362 | $form .= "<td>\n"; | 
|---|
| 363 | $form .=  $this->yes_no_radio_option_sub('is_left_postnavi_old', | 
|---|
| 364 | __("'Old Post Link' is displayed in the left, and 'Newer Post Link' is displayed in the right",'xpressme'), | 
|---|
| 365 | __("'Newer Post Link' is displayed in the left, and 'Old Post Link' is displayed in the right",'xpressme') | 
|---|
| 366 | ); | 
|---|
| 367 | $form .= "</td>\n"; | 
|---|
| 368 | $form .= "</tr>\n"; | 
|---|
| 369 |  | 
|---|
| 370 | $form .= "<tr>\n"; | 
|---|
| 371 | $form .= "<td>" . __('Select Display name of PostNavi Link','xpressme') . "</td>\n"; | 
|---|
| 372 | $form .= "<td>\n"; | 
|---|
| 373 | $form .=  $this->yes_no_radio_option_sub('is_postnavi_title_disp', | 
|---|
| 374 | __('Title of post','xpressme'), | 
|---|
| 375 | __('Title of Navi','xpressme') | 
|---|
| 376 | ); | 
|---|
| 377 | $form .= "</td>\n"; | 
|---|
| 378 | $form .= "</tr>\n"; | 
|---|
| 379 |  | 
|---|
| 380 | $form .= "<tr>\n"; | 
|---|
| 381 | $form .= "<td>" . __('Display Navi Title of Old Post Link','xpressme') . "</td>\n"; | 
|---|
| 382 | $form .= "<td>\n"; | 
|---|
| 383 | $form .=  $this->text_option_sub('old_post_link_text'); | 
|---|
| 384 | $form .= "</td>\n"; | 
|---|
| 385 | $form .= "</tr>\n"; | 
|---|
| 386 |  | 
|---|
| 387 | $form .= "<tr>\n"; | 
|---|
| 388 | $form .= "<td>" . __('Display Navi Title of Newer Post Link','xpressme') . "</td>\n"; | 
|---|
| 389 | $form .= "<td>\n"; | 
|---|
| 390 | $form .=  $this->text_option_sub('newer_post_link_text'); | 
|---|
| 391 | $form .= "</td>\n"; | 
|---|
| 392 | $form .= "</tr>\n"; | 
|---|
| 393 |  | 
|---|
| 394 | $form .= "</table></td></tr>\n"; | 
|---|
| 395 | return $form; | 
|---|
| 396 |  | 
|---|
| 397 | } | 
|---|
| 398 |  | 
|---|
| 399 | function posts_page_navi_option(){ | 
|---|
| 400 | $form = ''; | 
|---|
| 401 | $form .= '<tr><th><label for="posts_page_navi">' .__('Posts List Page Navi Setting', 'xpressme') . '</label></th>'; | 
|---|
| 402 | $form .= "<td>\n"; | 
|---|
| 403 | $form .= "<table>\n"; | 
|---|
| 404 | $form .= "<tr>\n"; | 
|---|
| 405 |  | 
|---|
| 406 | $form .= "<td>" . __('Adjustment of Navi link display position','xpressme') . "</td>\n"; | 
|---|
| 407 | $form .= "<td>\n"; | 
|---|
| 408 | $form .=  $this->yes_no_radio_option_sub('is_left_page_navi_old', | 
|---|
| 409 | __("'Old Page Link' is displayed in the left, and 'Newer Page Link' is displayed in the right",'xpressme'), | 
|---|
| 410 | __("'Newer Page Link' is displayed in the left, and 'Old Page Link' is displayed in the right",'xpressme') | 
|---|
| 411 | ); | 
|---|
| 412 | $form .= "</td>\n"; | 
|---|
| 413 | $form .= "</tr>\n"; | 
|---|
| 414 |  | 
|---|
| 415 | $form .= "<tr>\n"; | 
|---|
| 416 | $form .= "<td>" . __('Display Navi Title of Old Page Link','xpressme') . "</td>\n"; | 
|---|
| 417 | $form .= "<td>\n"; | 
|---|
| 418 | $form .=  $this->text_option_sub('old_page_link_text'); | 
|---|
| 419 | $form .= "</td>\n"; | 
|---|
| 420 | $form .= "</tr>\n"; | 
|---|
| 421 |  | 
|---|
| 422 | $form .= "<tr>\n"; | 
|---|
| 423 | $form .= "<td>" . __('Display Navi Title of Newer Page Link','xpressme') . "</td>\n"; | 
|---|
| 424 | $form .= "<td>\n"; | 
|---|
| 425 | $form .=  $this->text_option_sub('newer_page_link_text'); | 
|---|
| 426 | $form .= "</td>\n"; | 
|---|
| 427 | $form .= "</tr>\n"; | 
|---|
| 428 |  | 
|---|
| 429 | $form .= "</table></td></tr>\n"; | 
|---|
| 430 | return $form; | 
|---|
| 431 |  | 
|---|
| 432 | } | 
|---|
| 433 |  | 
|---|
| 434 | function dashboard_display_option(){ | 
|---|
| 435 | $form = ''; | 
|---|
| 436 | $form .= '<tr><th><label for="posts_page_navi">' .__('Dashboard feed Display Setting', 'xpressme') . '</label></th>'; | 
|---|
| 437 | $form .= "<td>\n"; | 
|---|
| 438 | $form .= "<table>\n"; | 
|---|
| 439 |  | 
|---|
| 440 | $form .= "<tr>\n"; | 
|---|
| 441 |  | 
|---|
| 442 | $form .= "<td>" . __('Display XPressMe Integration Kit Blog','xpressme') . "</td>\n"; | 
|---|
| 443 | $form .= "<td>\n"; | 
|---|
| 444 | $form .=  $this->yes_no_radio_option_sub('is_dashboard_blog_disp', | 
|---|
| 445 | __('YES','xpressme'), | 
|---|
| 446 | __('NO','xpressme') | 
|---|
| 447 | ); | 
|---|
| 448 | $form .= "</td>\n"; | 
|---|
| 449 | $form .= "</tr>\n"; | 
|---|
| 450 |  | 
|---|
| 451 | $form .= "<tr>\n"; | 
|---|
| 452 |  | 
|---|
| 453 | $form .= "<td>" . __('Display XPressMe Integration Kit Forum','xpressme') . "</td>\n"; | 
|---|
| 454 | $form .= "<td>\n"; | 
|---|
| 455 | $form .=  $this->yes_no_radio_option_sub('is_dashboard_forum_disp', | 
|---|
| 456 | __('YES','xpressme'), | 
|---|
| 457 | __('NO','xpressme') | 
|---|
| 458 | ); | 
|---|
| 459 | $form .= "</td>\n"; | 
|---|
| 460 | $form .= "</tr>\n"; | 
|---|
| 461 |  | 
|---|
| 462 | $form .= "</table></td></tr>\n"; | 
|---|
| 463 | return $form; | 
|---|
| 464 | } | 
|---|
| 465 |  | 
|---|
| 466 | function groupe_role_option($disible=false){ | 
|---|
| 467 | global $wp_roles , $xoops_db; | 
|---|
| 468 |  | 
|---|
| 469 | if ($disible) $disible_str = ' disabled="disabled"'; else $disible_str = ''; | 
|---|
| 470 | $form = ''; | 
|---|
| 471 | $form .= '<tr><th><label for="role">' .__('Role Setting at Login', 'xpressme') . '</label></th>'; | 
|---|
| 472 | $form .= '<td>'; | 
|---|
| 473 | $form .= "<table>\n"; | 
|---|
| 474 | $form .= '<tr><td>' . __('XOOPS Groupe', 'xpressme') . '</td><td>' . __('WordPress Role', 'xpressme') . '</td><td>' . __('Role is set at each login', 'xpressme') . "</td></tr>\n"; | 
|---|
| 475 | foreach ($this->groupe_role as $groupe) { | 
|---|
| 476 | $form .= "<tr>"; | 
|---|
| 477 | $form .= "<td> $groupe->name </td>"; | 
|---|
| 478 | $form .= "<td>\n" . '<select name="role_gid_'.$groupe->groupid . '" id="role_gid_' . $groupe->groupid . '"' . $disible_str . '>' . "\n";; | 
|---|
| 479 | $role_list = ''; | 
|---|
| 480 | $group_has_role = false; | 
|---|
| 481 |  | 
|---|
| 482 | $select_value = $groupe->role; | 
|---|
| 483 |  | 
|---|
| 484 |  | 
|---|
| 485 |  | 
|---|
| 486 | foreach($wp_roles->role_names as $role => $name) { | 
|---|
| 487 | $name = translate_with_context($name); | 
|---|
| 488 | if ( $role == $select_value) { | 
|---|
| 489 | $selected = ' selected="selected"'; | 
|---|
| 490 | $group_has_role = true; | 
|---|
| 491 | } else { | 
|---|
| 492 | $selected = ''; | 
|---|
| 493 | } | 
|---|
| 494 | if ($groupe->group_type != 'module_admin'|| !empty($selected)) { | 
|---|
| 495 | $role_list .= "<option value=\"{$role}\"{$selected}>{$name}</option>\n"; | 
|---|
| 496 | } | 
|---|
| 497 | } | 
|---|
| 498 | if ($groupe->group_type != 'module_admin') { | 
|---|
| 499 | if ( $group_has_role ) { | 
|---|
| 500 | $role_list .= '<option value="default">' . __('Default Role of WordPress', 'xpressme') . "</option>\n"; | 
|---|
| 501 | $role_list .= '<option value="">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n"; | 
|---|
| 502 | } else { | 
|---|
| 503 | if ($select_value == 'default'){ | 
|---|
| 504 | $role_list .= '<option value="default" selected="selected">' . __('Default Role of WordPress', 'xpressme') . "</option>\n"; | 
|---|
| 505 | $role_list .= '<option value="">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n"; | 
|---|
| 506 | } else { | 
|---|
| 507 | $role_list .= '<option value="default">' . __('Default Role of WordPress', 'xpressme') . "</option>\n"; | 
|---|
| 508 | $role_list .= '<option value="" selected="selected">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n"; | 
|---|
| 509 | } | 
|---|
| 510 | } | 
|---|
| 511 | } | 
|---|
| 512 | $form .= $role_list . "</select>\n</td>"; | 
|---|
| 513 | if ($groupe->login_all){ | 
|---|
| 514 | $form .= '<td> <input type="checkbox" name="login_all_gid_' . $groupe->groupid . '" value="1" checked ></td>'; | 
|---|
| 515 | } else { | 
|---|
| 516 | $form .= '<td> <input type="checkbox" name="login_all_gid_' . $groupe->groupid . '" value="1"></td>'; | 
|---|
| 517 | } | 
|---|
| 518 | $form .= "</tr>\n"; | 
|---|
| 519 | } | 
|---|
| 520 | if ($disible) | 
|---|
| 521 | $form .= '<tr><p>' . __('Only the Admin can set Group Role Setting','xpressme') . "</p></tr>\n"; | 
|---|
| 522 | $form .= "</table></td></tr>\n"; | 
|---|
| 523 | return $form; | 
|---|
| 524 |  | 
|---|
| 525 | } | 
|---|
| 526 |  | 
|---|
| 527 | function d3forum_option($do_message = ''){ | 
|---|
| 528 | global $xoops_db,$xoops_config; | 
|---|
| 529 |  | 
|---|
| 530 | $d3frum_list = array(); | 
|---|
| 531 | $module_dir_path = get_xoops_root_path(); | 
|---|
| 532 |  | 
|---|
| 533 | $forum_list  = '<select name="ch_d3forum">' . "\n"; | 
|---|
| 534 |  | 
|---|
| 535 | if ($this->is_use_d3forum != true) | 
|---|
| 536 | $selected = ' selected="selected"'; | 
|---|
| 537 | else | 
|---|
| 538 | $selected = ''; | 
|---|
| 539 |  | 
|---|
| 540 | if ($xoops_config->is_wpmu) { | 
|---|
| 541 | $forum_list .= '<option value="none"' . $selected . '>' . __('WordPress MU cannot integrate the comments.', 'xpressme') . "</option>\n"; | 
|---|
| 542 | } else { | 
|---|
| 543 | $forum_list .= '<option value="none"' . $selected . '>' . __('Do Not Comment Integration.', 'xpressme') . "</option>\n"; | 
|---|
| 544 |  | 
|---|
| 545 | // Form making for forum selection of D3forum | 
|---|
| 546 | $modules_table = get_xoops_prefix() .'modules'; | 
|---|
| 547 | $sql = "SELECT mid,name,isactive,dirname FROM $modules_table WHERE isactive = 1"; | 
|---|
| 548 | $modules = $xoops_db->get_results($sql); | 
|---|
| 549 | foreach ($modules as $module) { | 
|---|
| 550 | $file_path = $module_dir_path . '/modules/' . $module->dirname . '/mytrustdirname.php'; | 
|---|
| 551 | if (! file_exists($file_path)) continue; | 
|---|
| 552 | $array_files = file($file_path); | 
|---|
| 553 | // It is checked whether there is character string "$mytrustdirname ='d3forum'"in the file. | 
|---|
| 554 | foreach ($array_files as $aeey_file){ | 
|---|
| 555 | if( preg_match( "/\s*(mytrustdirname)\s*(=)\s*([\"'])(d3forum)([\"'])/", $aeey_file ) ) { | 
|---|
| 556 | $forums_tb = get_xoops_prefix() . $module->dirname . '_forums'; | 
|---|
| 557 | $cat_tb = get_xoops_prefix() . $module->dirname . '_categories'; | 
|---|
| 558 | $sql= "SELECT * FROM $forums_tb LEFT JOIN $cat_tb ON $forums_tb.cat_id = $cat_tb.cat_id"; | 
|---|
| 559 | $forums = $xoops_db->get_results($sql); | 
|---|
| 560 | foreach ($forums as $forum) { | 
|---|
| 561 | if (($module->dirname == $this->d3forum_module_dir) &&  ($forum->forum_id == $this->d3forum_forum_id)) | 
|---|
| 562 | $selected = ' selected="selected"'; | 
|---|
| 563 | else | 
|---|
| 564 | $selected = ''; | 
|---|
| 565 | $forum_div = 'forum|' . $module->dirname . '|' .  $forum->forum_id; | 
|---|
| 566 | $forum_select = "$module->name($module->dirname) $forum->cat_title-$forum->forum_title(ID=$forum->forum_id)"; | 
|---|
| 567 | $forum_list .= '<option value="' . $forum_div . '" ' . $selected . '>' . $forum_select . "</option>\n"; | 
|---|
| 568 | } | 
|---|
| 569 | break; | 
|---|
| 570 | } | 
|---|
| 571 | } | 
|---|
| 572 | $forum_list .= '<br>'; | 
|---|
| 573 | } | 
|---|
| 574 | } | 
|---|
| 575 | $forum_list .= '</select>' . "\n"; | 
|---|
| 576 |  | 
|---|
| 577 | $form  = '<tr>' . "\n"; | 
|---|
| 578 | $form .= '<th><label for="d3forum">' .__('Comment integration with D3Forum', 'xpressme') . '</label></th>' . "\n"; | 
|---|
| 579 | $form .=  "<td>\n"; | 
|---|
| 580 | $form .=  __('Select the forum of D3Forum that does the comment integration from the following lists.', 'xpressme') ."<br />\n"; | 
|---|
| 581 | $form .=  $forum_list."\n"; | 
|---|
| 582 | $form .= '<br /><br />'; | 
|---|
| 583 | if ($this->is_use_d3forum) { | 
|---|
| 584 | if ($this->is_use_d3forum)  $disible = ''; else $disible = 'disabled'; | 
|---|
| 585 | $form .=  __('Select the Type of display of D3Forum comment.', 'xpressme') . " \n&emsp"; | 
|---|
| 586 | if ($this->is_d3forum_flat){ | 
|---|
| 587 | $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='1' checked='checked' />" . __('Flat','xpressme') ."</label>\n"; | 
|---|
| 588 | $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='0' />". __('Threaded','xpressme') . "</label>\n"; | 
|---|
| 589 | }else{ | 
|---|
| 590 | $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='1' />" . __('Flat','xpressme') . "</label>\n"; | 
|---|
| 591 | $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='0' checked='checked' />". __('Threaded','xpressme') ."</label>\n"; | 
|---|
| 592 | } | 
|---|
| 593 | $form .= '<br />'; | 
|---|
| 594 | $form .=  __('Select the order of display of D3Forum comment.', 'xpressme') . " \n&emsp"; | 
|---|
| 595 | if ($this->is_d3forum_desc){ | 
|---|
| 596 | $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='1' checked='checked' />" . __('DESC','xpressme') ."</label>\n"; | 
|---|
| 597 | $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='0' />". __('ASC','xpressme') . "</label>\n"; | 
|---|
| 598 | }else{ | 
|---|
| 599 | $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='1' />" . __('DESC','xpressme') . "</label>\n"; | 
|---|
| 600 | $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='0' checked='checked' />". __('ASC','xpressme') ."</label>\n"; | 
|---|
| 601 | } | 
|---|
| 602 | $form .= '<br />'; | 
|---|
| 603 | $form .=  __('Number of displays of D3Forum comments.', 'xpressme') ." \n"; | 
|---|
| 604 | $form .= '&emsp<label> <input name="ch_d3forum_views_num" type="text" size="3" maxlength="3" value="'  . $this->d3forum_views_num . '" /></label>'."\n"; | 
|---|
| 605 | $form .= '<div class="submit">'."\n"; | 
|---|
| 606 | $form .=  __('The import and the export between Wordpress Comments and the D3Forum Posts can be done. ', 'xpressme') ."<br />\n"; | 
|---|
| 607 | $form .= '<input type="submit" value= "' . __('Export to D3Forum', 'xpressme') . '" name="export_d3f" ' . $disible . ' >' ."\n"; | 
|---|
| 608 | $form .= '<input type="submit" value= "' . __('Import from D3Forum', 'xpressme') . '" name="inport_d3f" ' . $disible . ' >' ."<br />\n"; | 
|---|
| 609 | $form .= '</div>'."\n"; | 
|---|
| 610 | if (!empty($do_message)){ | 
|---|
| 611 | $form .= '<div>' . $do_message . '</div>'; | 
|---|
| 612 | } | 
|---|
| 613 | } | 
|---|
| 614 | $form .=  "</td>\n"; | 
|---|
| 615 | $form .=  "</tr><tr>\n"; | 
|---|
| 616 | return $form; | 
|---|
| 617 | } | 
|---|
| 618 |  | 
|---|
| 619 | function excerpt_option(){ | 
|---|
| 620 | $form = ''; | 
|---|
| 621 | $form .= '<tr><th><label for="excerpt">' .__('Contents Excerpt Setting', 'xpressme') . '</label></th>'; | 
|---|
| 622 | $form .= "<td>\n"; | 
|---|
| 623 | $form .= "<table>\n"; | 
|---|
| 624 | $form .= "<tr>\n"; | 
|---|
| 625 |  | 
|---|
| 626 | $form .= "<td>" . __('Is the excerpt display done with the archive of contents?','xpressme') . "</td>\n"; | 
|---|
| 627 | $form .= "<td>\n"; | 
|---|
| 628 | $form .=  $this->yes_no_radio_option_sub('is_content_excerpt'); | 
|---|
| 629 | $form .= "</td>\n"; | 
|---|
| 630 | $form .= "</tr>\n"; | 
|---|
| 631 |  | 
|---|
| 632 | $form .= "<tr>\n"; | 
|---|
| 633 | $form .= "<td>" . __('When ASCII character more than the set ratio is included, it is judged ASCII contents. ','xpressme') . "</td>\n"; | 
|---|
| 634 | $form .= "<td>\n"; | 
|---|
| 635 | $form .=  $this->text_option_sub('ascii_judged_rate'); | 
|---|
| 636 | $form .= "</td>\n"; | 
|---|
| 637 | $form .= "</tr>\n"; | 
|---|
| 638 |  | 
|---|
| 639 | $form .= "<tr>\n"; | 
|---|
| 640 | $form .= "<td>" . __('Excerpt length of word for ASCII contents','xpressme') . "</td>\n"; | 
|---|
| 641 | $form .= "<td>\n"; | 
|---|
| 642 | $form .=  $this->text_option_sub('excerpt_length_word'); | 
|---|
| 643 | $form .= "</td>\n"; | 
|---|
| 644 | $form .= "</tr>\n"; | 
|---|
| 645 |  | 
|---|
| 646 | $form .= "<tr>\n"; | 
|---|
| 647 | $form .= "<td>" . __('Excerpt length of character for multibyte contents','xpressme') . "</td>\n"; | 
|---|
| 648 | $form .= "<td>\n"; | 
|---|
| 649 | $form .=  $this->text_option_sub('excerpt_length_character'); | 
|---|
| 650 | $form .= "</td>\n"; | 
|---|
| 651 | $form .= "</tr>\n"; | 
|---|
| 652 |  | 
|---|
| 653 | $form .= "<tr>\n"; | 
|---|
| 654 | $form .= "<td>" . __('This text is displayed in the link that reads contents not excerpted.(Is not displayed for the blank.)','xpressme') . "</td>\n"; | 
|---|
| 655 | $form .= "<td>\n"; | 
|---|
| 656 | $form .=  $this->text_option_sub('excerpt_more_link_text'); | 
|---|
| 657 | $form .= "</td>\n"; | 
|---|
| 658 | $form .= "</tr>\n"; | 
|---|
| 659 |  | 
|---|
| 660 | $form .= "<tr>\n"; | 
|---|
| 661 | $form .= "<td>" . __('This text is displayed in the link that more tag (<!--more-->). ','xpressme') . "</td>\n"; | 
|---|
| 662 | $form .= "<td>\n"; | 
|---|
| 663 | $form .=  $this->text_option_sub('more_link_text'); | 
|---|
| 664 | $form .= "</td>\n"; | 
|---|
| 665 | $form .= "</tr>\n"; | 
|---|
| 666 |  | 
|---|
| 667 | $form .= "</table></td></tr>\n"; | 
|---|
| 668 | return $form; | 
|---|
| 669 | } | 
|---|
| 670 |  | 
|---|
| 671 | function viewer_type_option(){ | 
|---|
| 672 | $form  = "<tr>\n"; | 
|---|
| 673 | $form .= '<th><label for="viewer_type">' .__('Display Mode Setting', 'xpressme') . '</label></th>'; | 
|---|
| 674 | $form .= "<td>\n"; | 
|---|
| 675 |  | 
|---|
| 676 | $form .=  __('Select the XPressME Display Mode.', 'xpressme') ."\n"; | 
|---|
| 677 | $form .= '<select name="ch_viewer_type">' . "\n"; | 
|---|
| 678 |  | 
|---|
| 679 | $form .= '<option value="xoops" '; | 
|---|
| 680 | if ($this->viewer_type == 'xoops') $form .= ' selected="selected"'; | 
|---|
| 681 | $form .= '>'.__('Xoops Mode', 'xpressme') ."</option>\n"; | 
|---|
| 682 |  | 
|---|
| 683 | $form .= '<option value="wordpress" '; | 
|---|
| 684 | if ($this->viewer_type == 'wordpress') $form .= ' selected="selected"'; | 
|---|
| 685 | $form .= '>'.__('WordPress Mode', 'xpressme') ."</option>\n"; | 
|---|
| 686 |  | 
|---|
| 687 | $form .= '<option value="user_select" '; | 
|---|
| 688 | if ($this->viewer_type == 'user_select') $form .= ' selected="selected"'; | 
|---|
| 689 | $form .= '>'.__('User select', 'xpressme') ."</option>\n"; | 
|---|
| 690 |  | 
|---|
| 691 | $form .= "</select><br />\n"; | 
|---|
| 692 |  | 
|---|
| 693 | // Theme Select | 
|---|
| 694 | $form .=  __('Select the theme used in the XOOPS Mode.', 'xpressme') ."\n"; | 
|---|
| 695 | $form .= '<select name="ch_theme_select">' . "\n"; | 
|---|
| 696 |  | 
|---|
| 697 | $form .= '<option value="use_wordpress_select" '; | 
|---|
| 698 | if ($this->theme_select == 'use_wordpress_select') $form .= ' selected="selected"'; | 
|---|
| 699 | $form .= '>'.__('Use WordPress Selected Themes', 'xpressme') ."</option>\n"; | 
|---|
| 700 |  | 
|---|
| 701 | $themes = get_themes(); | 
|---|
| 702 | $theme_names = array_keys($themes); | 
|---|
| 703 | natcasesort($theme_names); | 
|---|
| 704 | foreach ($theme_names as $theme_name) { | 
|---|
| 705 | if ($theme_name == 'My Themes') continue; | 
|---|
| 706 | $form .= '<option value="' . $theme_name .'" '; | 
|---|
| 707 | if ($this->theme_select == $theme_name) $form .= ' selected="selected"'; | 
|---|
| 708 | $form .= '>'.$theme_name ."</option>\n"; | 
|---|
| 709 | } | 
|---|
| 710 | $form .= "</select><br />\n"; | 
|---|
| 711 | $form .= "</td></tr>\n"; | 
|---|
| 712 | return $form; | 
|---|
| 713 | } | 
|---|
| 714 |  | 
|---|
| 715 | function header_meta_option(){ | 
|---|
| 716 | $form  = "<tr>\n"; | 
|---|
| 717 | $form .= '<th><label for="header_type">' .__('Header Meta Option', 'xpressme') . '</label></th>'; | 
|---|
| 718 | $form .= "<td>\n"; | 
|---|
| 719 | $form .= "<table>\n"; | 
|---|
| 720 | $form .= "<tr>\n"; | 
|---|
| 721 |  | 
|---|
| 722 | $form .=  "<td>" . __('Select the Header keyword.', 'xpressme')  . "</td>\n"; | 
|---|
| 723 | $form .= "<td>\n"; | 
|---|
| 724 | $form .= '<select name="ch_meta_keyword_type">' . "\n"; | 
|---|
| 725 | $form .= '<option value="xoops" '; | 
|---|
| 726 | if ($this->meta_keyword_type == 'xoops') $form .= ' selected="selected"'; | 
|---|
| 727 | $form .= '>'.__('Xoops KeyWord', 'xpressme') ."</option>\n"; | 
|---|
| 728 | $form .= '<option value="wordpress" '; | 
|---|
| 729 | if ($this->meta_keyword_type == 'wordpress') $form .= ' selected="selected"'; | 
|---|
| 730 | $form .= '>'.__('WordPress KeyWord', 'xpressme') ."</option>\n"; | 
|---|
| 731 | $form .= '<option value="wordpress_xoops" '; | 
|---|
| 732 | if ($this->meta_keyword_type == 'wordpress_xoops') $form .= ' selected="selected"'; | 
|---|
| 733 | $form .= '>'.__('WordPress & Xoops KeyWord', 'xpressme') ."</option>\n"; | 
|---|
| 734 | $form .= "</select><br />\n"; | 
|---|
| 735 | $form .= "</td>\n"; | 
|---|
| 736 | $form .= "</tr>\n"; | 
|---|
| 737 |  | 
|---|
| 738 | $form .= "<tr>\n"; | 
|---|
| 739 | $form .=  "<td>" . __('Select the Header Description.', 'xpressme') . "</td>\n"; | 
|---|
| 740 | $form .= "<td>\n"; | 
|---|
| 741 | $form .= '<select name="ch_meta_description_type">' . "\n"; | 
|---|
| 742 | $form .= '<option value="xoops" '; | 
|---|
| 743 | if ($this->meta_description_type == 'xoops') $form .= ' selected="selected"'; | 
|---|
| 744 | $form .= '>'.__('Xoops Description', 'xpressme') ."</option>\n"; | 
|---|
| 745 | $form .= '<option value="wordpress" '; | 
|---|
| 746 | if ($this->meta_description_type == 'wordpress') $form .= ' selected="selected"'; | 
|---|
| 747 | $form .= '>'.__('WordPress Description', 'xpressme') ."</option>\n"; | 
|---|
| 748 | $form .= '<option value="wordpress_xoops" '; | 
|---|
| 749 | if ($this->meta_description_type == 'wordpress_xoops') $form .= ' selected="selected"'; | 
|---|
| 750 | $form .= '>'.__('WordPress & Xoops Description', 'xpressme') ."</option>\n"; | 
|---|
| 751 | $form .= "</select><br />\n"; | 
|---|
| 752 | $form .= "</td>\n"; | 
|---|
| 753 | $form .= "</tr>\n"; | 
|---|
| 754 |  | 
|---|
| 755 | $form .= "<tr>\n"; | 
|---|
| 756 | $form .=  "<td>" . __('Select the Header Robots Index.', 'xpressme') . "</td>\n"; | 
|---|
| 757 | $form .= "<td>\n"; | 
|---|
| 758 | $form .= '<select name="ch_meta_robot_type">' . "\n"; | 
|---|
| 759 | $form .= '<option value="xoops" '; | 
|---|
| 760 | if ($this->meta_robot_type == 'xoops') $form .= ' selected="selected"'; | 
|---|
| 761 | $form .= '>'.__('Xoops Robots Index', 'xpressme') ."</option>\n"; | 
|---|
| 762 | $form .= '<option value="wordpress" '; | 
|---|
| 763 | if ($this->meta_robot_type == 'wordpress') $form .= ' selected="selected"'; | 
|---|
| 764 | $form .= '>'.__('WordPress Robots Index', 'xpressme') ."</option>\n"; | 
|---|
| 765 | $form .= "</select><br />\n"; | 
|---|
| 766 | $form .= "</td>\n"; | 
|---|
| 767 | $form .= "</tr>\n"; | 
|---|
| 768 |  | 
|---|
| 769 | $form .= "</table>\n"; | 
|---|
| 770 |  | 
|---|
| 771 | $form .= "</tr>\n"; | 
|---|
| 772 | return $form; | 
|---|
| 773 | } | 
|---|
| 774 |  | 
|---|
| 775 | function xpress_upload_filter($uploads) | 
|---|
| 776 | { | 
|---|
| 777 | global $xoops_config; | 
|---|
| 778 | if ($this->is_use_xoops_upload_path){ | 
|---|
| 779 | $wordpress_dir = ABSPATH ; | 
|---|
| 780 | $xoops_dir = $xoops_config->xoops_upload_path . '/'; | 
|---|
| 781 | $wordpress_base_url = get_option( 'siteurl' ); | 
|---|
| 782 | $xoops_upload_url = $xoops_config->xoops_upload_url; | 
|---|
| 783 |  | 
|---|
| 784 | @rmdir($uploads[path]);  //remove wordpress side uploads_dir | 
|---|
| 785 |  | 
|---|
| 786 | $uploads[path] =  str_replace ($wordpress_dir, $xoops_dir, $uploads[path]); | 
|---|
| 787 | $uploads[basedir] = str_replace ($wordpress_dir, $xoops_dir, $uploads[basedir]); | 
|---|
| 788 | $uploads[url] = str_replace ($wordpress_base_url, $xoops_upload_url, $uploads[url]); | 
|---|
| 789 | $uploads[baseurl] = str_replace ($wordpress_base_url, $xoops_upload_url, $uploads[baseurl]); | 
|---|
| 790 |  | 
|---|
| 791 | // Make sure we have an uploads dir | 
|---|
| 792 | if ( ! wp_mkdir_p( $uploads[path] ) ) { | 
|---|
| 793 | $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $uploads[path] ); | 
|---|
| 794 | return array( 'error' => $message ); | 
|---|
| 795 | } | 
|---|
| 796 | } | 
|---|
| 797 | return $uploads; | 
|---|
| 798 | } | 
|---|
| 799 |  | 
|---|
| 800 | // SQL DEBUG TEST | 
|---|
| 801 | function is_sql_debug_permission() | 
|---|
| 802 | { | 
|---|
| 803 | global $current_user; | 
|---|
| 804 |  | 
|---|
| 805 | if (!is_object($current_user)) return false; | 
|---|
| 806 | if ($this->is_sql_debug && ($current_user->user_level >= 10)) | 
|---|
| 807 | return true; | 
|---|
| 808 | else | 
|---|
| 809 | return false; | 
|---|
| 810 | } | 
|---|
| 811 |  | 
|---|
| 812 | function xpress_sql_debug($query_strings) | 
|---|
| 813 | { | 
|---|
| 814 | if ($this->is_sql_debug_permission()){ | 
|---|
| 815 | if (empty($GLOBALS['XPress_SQL_Query'])) $GLOBALS['XPress_SQL_Query'] = ''; | 
|---|
| 816 | $GLOBALS['XPress_SQL_Query'] .= $query_strings . '<br /><br />'; | 
|---|
| 817 | } | 
|---|
| 818 | return $query_strings; | 
|---|
| 819 | } | 
|---|
| 820 |  | 
|---|
| 821 | function displayDebugLog() | 
|---|
| 822 | { | 
|---|
| 823 | if ($this->is_sql_debug_permission()){ | 
|---|
| 824 | $content = ''; | 
|---|
| 825 | $content .= '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" />'; | 
|---|
| 826 | $content .= '<meta http-equiv="content-language" content="'._LANGCODE.'" />' ; | 
|---|
| 827 | $content .= '<title>XPressME SQL DEBUG</title>' ; | 
|---|
| 828 | $content .= '</head><body>'; | 
|---|
| 829 | $content .= $GLOBALS['XPress_SQL_Query']; | 
|---|
| 830 | $content .= '<div style="text-align:center;"><input class="formButton" value="CLOSE" type="button" onclick="javascript:window.close();" /></div></body></html>'; | 
|---|
| 831 |  | 
|---|
| 832 | echo '<script type="text/javascript"> | 
|---|
| 833 | <!--// | 
|---|
| 834 | 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"); | 
|---|
| 835 | xpress_debug_window.document.clear(); | 
|---|
| 836 | xpress_debug_window.focus(); | 
|---|
| 837 | '; | 
|---|
| 838 | $lines = preg_split("/(\r\n|\r|\n)( *)/", $content); | 
|---|
| 839 | foreach ($lines as $line) { | 
|---|
| 840 | echo 'xpress_debug_window.document.writeln("'.str_replace('"', '\"', $line).'");'; | 
|---|
| 841 | } | 
|---|
| 842 | echo ' | 
|---|
| 843 | xpress_debug_window.document.close(); | 
|---|
| 844 | //--> | 
|---|
| 845 | </script>'; | 
|---|
| 846 | } | 
|---|
| 847 | } | 
|---|
| 848 | } | 
|---|
| 849 | ?> | 
|---|