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