[18] | 1 | <?php
|
---|
| 2 | /*
|
---|
| 3 | Plugin Name: Plugin for XPressME
|
---|
[193] | 4 | Plugin URI: http://ja.xpressme.info
|
---|
[18] | 5 | Description: Plugin for XPressME (custom function,filter,action)
|
---|
| 6 | Author: toemon
|
---|
[193] | 7 | Version: 1.0
|
---|
| 8 | Author URI: http://ja.xpressme.info
|
---|
[18] | 9 | */
|
---|
[19] | 10 | require_once('xpressme_class.php');
|
---|
[75] | 11 |
|
---|
[95] | 12 | require_once dirname( __FILE__ ).'/include/custom_functions.php' ; // XPressME functions for themes
|
---|
| 13 | require_once dirname( __FILE__ ).'/include/xpress_common_functions.php' ;
|
---|
[46] | 14 |
|
---|
| 15 | $xoops_db = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
|
---|
| 16 | $xoops_db->prefix = get_xoops_prefix();
|
---|
| 17 | $xoops_db->tables = array('modules', 'newblocks', 'users');
|
---|
| 18 |
|
---|
[144] | 19 | $xpress_config = new XPressME_Class();
|
---|
[83] | 20 |
|
---|
| 21 | require_once dirname( __FILE__ ).'/include/pluggable-override.php' ;
|
---|
[252] | 22 | if ($xoops_config->is_wp20)
|
---|
| 23 | require_once dirname( __FILE__ ).'/include/functions_for_wp20.php' ;
|
---|
[83] | 24 |
|
---|
[302] | 25 | function my_plugin_menu()
|
---|
| 26 | {
|
---|
[328] | 27 | global $xpress_config,$xoops_config;
|
---|
| 28 |
|
---|
[311] | 29 | $plugin_url = WP_PLUGIN_URL."/xpressme/";
|
---|
| 30 |
|
---|
[328] | 31 | // Add a new top-level menu:
|
---|
| 32 | add_menu_page('XPressME','XPressME', 8, __FILE__, 'display_option_page' , $plugin_url.'/images/menu_icon.png');
|
---|
| 33 | // Add submenus to the custom top-level menu:
|
---|
| 34 | add_submenu_page(__FILE__, __('Display Settings', 'xpressme'), __('Display Settings', 'xpressme'), 8, __FILE__, 'display_option_page');
|
---|
| 35 | add_submenu_page(__FILE__, __('Integration Settings', 'xpressme'), __('Integration Settings', 'xpressme'), 8, 'integration_option_page', 'integration_option_page');
|
---|
| 36 | add_submenu_page(__FILE__, __('Other Settings', 'xpressme'), __('Other Settings', 'xpressme'), 8, 'other_option_page', 'other_option_page');
|
---|
| 37 | // add_submenu_page(__FILE__, __('XPressME Settings', 'xpressme'), __('XPressME Settings', 'xpressme'), 8, 'option_page', 'option_page');
|
---|
[302] | 38 | }
|
---|
| 39 | add_action('admin_menu', 'my_plugin_menu');
|
---|
| 40 |
|
---|
[144] | 41 | add_filter("upload_dir",array(&$xpress_config, 'xpress_upload_filter'), 1); // Change wp-include/wp_upload_dir()
|
---|
| 42 | if (!$xpress_config->is_save_post_revision){
|
---|
[28] | 43 | remove_action( 'pre_post_update', 'wp_save_post_revision' ); // Not Save Post Revision
|
---|
| 44 | }
|
---|
[145] | 45 | add_action("wp_meta" , "wp_meta_add_xpress_menu"); // add xpress menu in wp_meta
|
---|
[182] | 46 |
|
---|
| 47 | //Site URL check
|
---|
| 48 | add_filter('option_home', "safe_site_url_filter");
|
---|
| 49 | add_filter('option_siteurl', "safe_site_url_filter");
|
---|
| 50 |
|
---|
[96] | 51 |
|
---|
| 52 | //XOOPS Bloack Cache Refresh
|
---|
[46] | 53 | add_action("comment_post", "block_cache_refresh");
|
---|
| 54 | add_action("edit_comment", "block_cache_refresh");
|
---|
[96] | 55 | add_action("wp_set_comment_status","block_cache_refresh"); //wp_delete_comment() at deleted
|
---|
| 56 | add_action("deleted_post", "block_cache_refresh");
|
---|
[46] | 57 | add_action("publish_post", "block_cache_refresh");
|
---|
| 58 | add_action("edit_post", "block_cache_refresh");
|
---|
| 59 | add_action("private_to_published", "block_cache_refresh");
|
---|
[96] | 60 | add_action("transition_post_status", "block_cache_refresh");
|
---|
[46] | 61 |
|
---|
[51] | 62 | add_action("the_content", "set_post_views_count");
|
---|
| 63 |
|
---|
[61] | 64 | //XOOPS notifiction
|
---|
| 65 | require_once dirname( __FILE__ ).'/include/notify_functions.php' ;
|
---|
[91] | 66 | add_action("transition_post_status", "onaction_publish_post_notify" ,10 , 3);
|
---|
[61] | 67 | // add_action("edit_post", "onaction_edit_post_notify");
|
---|
| 68 | add_action("comment_post", "onaction_comment_notify");
|
---|
| 69 | // add_action("approve_comment" , "onaction_comment_apobe_notify");
|
---|
| 70 | add_action("wp_set_comment_status" , "onaction_comment_apobe_notify");
|
---|
[51] | 71 |
|
---|
[72] | 72 | // user data sync user_sync_to_xoops($user_id)
|
---|
| 73 | require_once dirname( __FILE__ ).'/include/user_sync_xoops.php' ;
|
---|
| 74 | add_action('profile_update', 'user_sync_to_xoops');
|
---|
| 75 | add_action('user_register', 'user_sync_to_xoops');
|
---|
[32] | 76 | //require_once('../include/custom_functions.php');
|
---|
[88] | 77 |
|
---|
[104] | 78 | //D3Forum Comment Integration
|
---|
[144] | 79 | if ($xpress_config->is_use_d3forum){
|
---|
[104] | 80 | require_once dirname( __FILE__ ).'/include/d3forum_comment_synchro.php' ;
|
---|
| 81 | add_action("comment_post", "onaction_comment_post");
|
---|
| 82 | add_action("edit_comment", "onaction_edit_comment");
|
---|
| 83 | add_action("delete_comment","onaction_delete_comment");
|
---|
| 84 | add_action("delete_post", "onaction_delete_post");
|
---|
| 85 | add_action("wp_set_comment_status" , "onaction_comment_apobe");
|
---|
| 86 |
|
---|
| 87 |
|
---|
| 88 | add_filter('comments_template', "disp_d3forum_comments" );
|
---|
| 89 |
|
---|
| 90 | }
|
---|
| 91 |
|
---|
[155] | 92 |
|
---|
| 93 |
|
---|
[147] | 94 | //The trackback and the pingback are excluded from the count of the comment.
|
---|
| 95 | add_filter('get_comments_number', 'xpress_comment_count', 0);
|
---|
[104] | 96 |
|
---|
[155] | 97 | // Query filter for MultiUser
|
---|
| 98 | add_filter('query','xpress_query_filter');
|
---|
[236] | 99 | //add_action("init", "xpress_set_author_cookie");
|
---|
[281] | 100 | if(xpress_is_wp20()){
|
---|
| 101 | // It is called before parse_request() makes $GET.
|
---|
| 102 | add_action("query_vars", "xpress_set_author_cookie");
|
---|
| 103 | } else {
|
---|
| 104 | // It is called at the end of parse_request().
|
---|
| 105 | add_filter('request', 'xpress_set_author_cookie');
|
---|
| 106 | }
|
---|
[155] | 107 |
|
---|
[88] | 108 | // SQL debug windows
|
---|
[144] | 109 | add_filter('query', array(&$xpress_config, 'xpress_sql_debug'));
|
---|
| 110 | add_action('admin_footer', array(&$xpress_config, 'displayDebugLog'));
|
---|
[280] | 111 | add_action('wp_footer', array(&$xpress_config, 'displayDebugLog'));
|
---|
| 112 |
|
---|
[328] | 113 | /*
|
---|
| 114 | function option_page()
|
---|
| 115 | {
|
---|
| 116 | global $xoops_config,$xpress_config;
|
---|
| 117 |
|
---|
| 118 | $xoops_admin_url = $xoops_config->module_url . '/admin/index.php';
|
---|
| 119 |
|
---|
| 120 | $do_message ='';
|
---|
| 121 | if (!empty($_POST['submit_update'])) {
|
---|
| 122 | $xpress_config->ReadPostData($_POST);
|
---|
| 123 | $xpress_config->SettingValueWrite('update');
|
---|
| 124 | } else if (isset($_POST['submit_reset'])) {
|
---|
| 125 | $xpress_config->setDefault();
|
---|
| 126 | $xpress_config->SettingValueWrite('update');
|
---|
| 127 | } else if (isset($_POST['export_d3f'])) {
|
---|
| 128 | $do_message = 'export(' . $xpress_config->d3forum_module_dir . '--ID=' . $xpress_config->d3forum_forum_id . ')................';
|
---|
| 129 | $do_message .= wp_to_d3forum($xpress_config->d3forum_forum_id, $xpress_config->d3forum_module_dir);
|
---|
| 130 | $do_message .= '....END';
|
---|
| 131 | } else if (isset($_POST['inport_d3f'])) {
|
---|
| 132 | $do_message = 'Import(' . $xpress_config->d3forum_module_dir . '--ID=' . $xpress_config->d3forum_forum_id . ')................';
|
---|
| 133 | $do_message .= d3forum_to_wp($xpress_config->d3forum_forum_id, $xpress_config->d3forum_module_dir);
|
---|
| 134 | $do_message .= '....END';
|
---|
| 135 | }
|
---|
| 136 |
|
---|
| 137 | echo '<div class="wrap">'."\n";
|
---|
| 138 | echo '<div id="icon-options-general" class="icon32"><br /></div>'."\n";
|
---|
| 139 | echo '<h2>' . __('XPressME Configuration Page', 'xpressme') . "</h2><br>\n";
|
---|
| 140 | echo '<div align="right"><a href="' . $xoops_admin_url . '"><h3>'. __('to XOOPS Modules Admin Page', 'xpressme') . '</h3></a></div>';
|
---|
| 141 | echo '<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">'."\n" ;
|
---|
| 142 | echo '<table class="form-table">'."\n";
|
---|
| 143 | echo $xpress_config->viewer_type_option();
|
---|
| 144 | echo $xpress_config->yes_no_radio_option('is_use_xoops_upload_path',
|
---|
| 145 | __('Media Upload Base Path','xpressme'),
|
---|
| 146 | __('Use XOOPS UPLOAD PATH','xpressme'),
|
---|
| 147 | __('USE WordPress BASE_PATH','xpressme')
|
---|
| 148 | );
|
---|
| 149 | echo $xpress_config->yes_no_radio_option('is_theme_sidebar_disp',
|
---|
| 150 | __('Thema Sidebar Display','xpressme'),
|
---|
| 151 | __('YES','xpressme'),
|
---|
| 152 | __('NO','xpressme')
|
---|
| 153 | );
|
---|
| 154 | echo $xpress_config->yes_no_radio_option('is_save_post_revision',
|
---|
| 155 | __('The change tracking of the post is preserved','xpressme'),
|
---|
| 156 | __('YES','xpressme'),
|
---|
| 157 | __('NO','xpressme')
|
---|
| 158 | );
|
---|
| 159 |
|
---|
| 160 | echo $xpress_config->yes_no_radio_option('is_multi_user',
|
---|
| 161 | __('Select Multi user mode','xpressme'),
|
---|
| 162 | __('YES','xpressme'),
|
---|
| 163 | __('NO','xpressme')
|
---|
| 164 | );
|
---|
| 165 |
|
---|
| 166 |
|
---|
| 167 | echo $xpress_config->single_post_navi_option();
|
---|
| 168 | echo $xpress_config->posts_page_navi_option();
|
---|
| 169 | echo $xpress_config->excerpt_option();
|
---|
| 170 |
|
---|
| 171 | echo $xpress_config->yes_no_radio_option('is_author_view_count',
|
---|
| 172 | __('Is the posts author views counted?','xpressme'),
|
---|
| 173 | __('YES','xpressme'),
|
---|
| 174 | __('NO','xpressme')
|
---|
| 175 | );
|
---|
| 176 | echo $xpress_config->header_meta_option();
|
---|
| 177 | echo $xpress_config->yes_no_radio_option('is_sql_debug',
|
---|
| 178 | __('Is SQL debugging window displayed?','xpressme'),
|
---|
| 179 | __('YES','xpressme'),
|
---|
| 180 | __('NO','xpressme')
|
---|
| 181 | );
|
---|
| 182 |
|
---|
| 183 | echo $xpress_config->groupe_role_option();
|
---|
| 184 |
|
---|
| 185 | echo $xpress_config->d3forum_option($do_message);
|
---|
| 186 | // $xpress_config->is_use_xoops_upload_path_html();
|
---|
| 187 | echo "</table>\n";
|
---|
| 188 |
|
---|
| 189 | echo '<p class="submit">'."\n";
|
---|
| 190 | echo '<input type="submit" value= "' . __('Update Config', 'xpressme') . '" name="submit_update" />' ."\n";
|
---|
| 191 | echo '<input type="submit" value= "' . __('Preset Config', 'xpressme') . '" name="submit_reset" />' ."\n";
|
---|
| 192 | echo "</p>\n";
|
---|
| 193 |
|
---|
| 194 | echo "</form>\n" ;
|
---|
| 195 | echo "</div>\n";
|
---|
| 196 | }
|
---|
| 197 | */
|
---|
| 198 |
|
---|
| 199 | function display_option_page()
|
---|
| 200 | {
|
---|
| 201 | global $xoops_config,$xpress_config;
|
---|
| 202 |
|
---|
| 203 | $xoops_admin_url = $xoops_config->module_url . '/admin/index.php';
|
---|
| 204 |
|
---|
| 205 | $do_message ='';
|
---|
| 206 | if (!empty($_POST['submit_update'])) {
|
---|
| 207 | $xpress_config->ReadPostData($_POST);
|
---|
| 208 | $xpress_config->SettingValueWrite('update');
|
---|
| 209 | } else if (isset($_POST['submit_reset'])) {
|
---|
| 210 | $xpress_config->setDefault();
|
---|
| 211 | $xpress_config->SettingValueWrite('update');
|
---|
| 212 | }
|
---|
| 213 |
|
---|
| 214 | echo '<div class="wrap">'."\n";
|
---|
| 215 | echo '<div id="icon-options-general" class="icon32"><br /></div>'."\n";
|
---|
[332] | 216 | echo '<h2>' . __('XPressME Display Setting', 'xpressme') . "</h2><br>\n";
|
---|
[328] | 217 | echo '<div align="right"><a href="' . $xoops_admin_url . '"><h3>'. __('to XOOPS Modules Admin Page', 'xpressme') . '</h3></a></div>';
|
---|
| 218 | echo '<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">'."\n" ;
|
---|
| 219 | echo '<table class="form-table">'."\n";
|
---|
| 220 | echo $xpress_config->viewer_type_option();
|
---|
| 221 | echo $xpress_config->yes_no_radio_option('is_theme_sidebar_disp',
|
---|
| 222 | __('Thema Sidebar Display','xpressme'),
|
---|
| 223 | __('YES','xpressme'),
|
---|
| 224 | __('NO','xpressme')
|
---|
| 225 | );
|
---|
| 226 | echo $xpress_config->single_post_navi_option();
|
---|
| 227 | echo $xpress_config->posts_page_navi_option();
|
---|
| 228 | echo $xpress_config->excerpt_option();
|
---|
| 229 | echo "</table>\n";
|
---|
| 230 |
|
---|
| 231 | echo '<p class="submit">'."\n";
|
---|
| 232 | echo '<input type="submit" value= "' . __('Update Config', 'xpressme') . '" name="submit_update" />' ."\n";
|
---|
| 233 | echo '<input type="submit" value= "' . __('Preset Config', 'xpressme') . '" name="submit_reset" />' ."\n";
|
---|
| 234 | echo "</p>\n";
|
---|
| 235 |
|
---|
| 236 | echo "</form>\n" ;
|
---|
| 237 | echo "</div>\n";
|
---|
| 238 | }
|
---|
| 239 |
|
---|
| 240 | function integration_option_page()
|
---|
| 241 | {
|
---|
| 242 | global $xoops_config,$xpress_config;
|
---|
| 243 |
|
---|
| 244 | $xoops_admin_url = $xoops_config->module_url . '/admin/index.php';
|
---|
| 245 |
|
---|
| 246 | $do_message ='';
|
---|
| 247 | if (!empty($_POST['submit_update'])) {
|
---|
| 248 | $xpress_config->ReadPostData($_POST);
|
---|
| 249 | $xpress_config->SettingValueWrite('update');
|
---|
| 250 | } else if (isset($_POST['submit_reset'])) {
|
---|
| 251 | $xpress_config->setDefault();
|
---|
| 252 | $xpress_config->SettingValueWrite('update');
|
---|
| 253 | } else if (isset($_POST['export_d3f'])) {
|
---|
| 254 | $do_message = 'export(' . $xpress_config->d3forum_module_dir . '--ID=' . $xpress_config->d3forum_forum_id . ')................';
|
---|
| 255 | $do_message .= wp_to_d3forum($xpress_config->d3forum_forum_id, $xpress_config->d3forum_module_dir);
|
---|
| 256 | $do_message .= '....END';
|
---|
| 257 | } else if (isset($_POST['inport_d3f'])) {
|
---|
| 258 | $do_message = 'Import(' . $xpress_config->d3forum_module_dir . '--ID=' . $xpress_config->d3forum_forum_id . ')................';
|
---|
| 259 | $do_message .= d3forum_to_wp($xpress_config->d3forum_forum_id, $xpress_config->d3forum_module_dir);
|
---|
| 260 | $do_message .= '....END';
|
---|
| 261 | }
|
---|
| 262 |
|
---|
| 263 | echo '<div class="wrap">'."\n";
|
---|
| 264 | echo '<div id="icon-options-general" class="icon32"><br /></div>'."\n";
|
---|
[332] | 265 | echo '<h2>' . __('XPressME Integration Setting', 'xpressme') . "</h2><br>\n";
|
---|
[328] | 266 | echo '<div align="right"><a href="' . $xoops_admin_url . '"><h3>'. __('to XOOPS Modules Admin Page', 'xpressme') . '</h3></a></div>';
|
---|
| 267 | echo '<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">'."\n" ;
|
---|
| 268 | echo '<table class="form-table">'."\n";
|
---|
| 269 | echo $xpress_config->yes_no_radio_option('is_use_xoops_upload_path',
|
---|
| 270 | __('Media Upload Base Path','xpressme'),
|
---|
| 271 | __('Use XOOPS UPLOAD PATH','xpressme'),
|
---|
| 272 | __('USE WordPress BASE_PATH','xpressme')
|
---|
| 273 | );
|
---|
| 274 |
|
---|
| 275 | echo $xpress_config->groupe_role_option();
|
---|
| 276 |
|
---|
| 277 | echo $xpress_config->d3forum_option($do_message);
|
---|
| 278 | echo "</table>\n";
|
---|
| 279 |
|
---|
| 280 | echo '<p class="submit">'."\n";
|
---|
| 281 | echo '<input type="submit" value= "' . __('Update Config', 'xpressme') . '" name="submit_update" />' ."\n";
|
---|
| 282 | echo '<input type="submit" value= "' . __('Preset Config', 'xpressme') . '" name="submit_reset" />' ."\n";
|
---|
| 283 | echo "</p>\n";
|
---|
| 284 |
|
---|
| 285 | echo "</form>\n" ;
|
---|
| 286 | echo "</div>\n";
|
---|
| 287 | }
|
---|
| 288 |
|
---|
| 289 | function other_option_page()
|
---|
| 290 | {
|
---|
| 291 | global $xoops_config,$xpress_config;
|
---|
| 292 |
|
---|
| 293 | $xoops_admin_url = $xoops_config->module_url . '/admin/index.php';
|
---|
| 294 |
|
---|
| 295 | $do_message ='';
|
---|
| 296 | if (!empty($_POST['submit_update'])) {
|
---|
| 297 | $xpress_config->ReadPostData($_POST);
|
---|
| 298 | $xpress_config->SettingValueWrite('update');
|
---|
| 299 | } else if (isset($_POST['submit_reset'])) {
|
---|
| 300 | $xpress_config->setDefault();
|
---|
| 301 | $xpress_config->SettingValueWrite('update');
|
---|
| 302 | }
|
---|
| 303 |
|
---|
| 304 | echo '<div class="wrap">'."\n";
|
---|
| 305 | echo '<div id="icon-options-general" class="icon32"><br /></div>'."\n";
|
---|
[332] | 306 | echo '<h2>' . __('XPressME Other Setting', 'xpressme') . "</h2><br>\n";
|
---|
[328] | 307 | echo '<div align="right"><a href="' . $xoops_admin_url . '"><h3>'. __('to XOOPS Modules Admin Page', 'xpressme') . '</h3></a></div>';
|
---|
| 308 | echo '<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">'."\n" ;
|
---|
| 309 | echo '<table class="form-table">'."\n";
|
---|
| 310 | echo $xpress_config->yes_no_radio_option('is_save_post_revision',
|
---|
| 311 | __('The change tracking of the post is preserved','xpressme'),
|
---|
| 312 | __('YES','xpressme'),
|
---|
| 313 | __('NO','xpressme')
|
---|
| 314 | );
|
---|
| 315 |
|
---|
| 316 | echo $xpress_config->yes_no_radio_option('is_multi_user',
|
---|
| 317 | __('Select Multi user mode','xpressme'),
|
---|
| 318 | __('YES','xpressme'),
|
---|
| 319 | __('NO','xpressme')
|
---|
| 320 | );
|
---|
| 321 | echo $xpress_config->yes_no_radio_option('is_author_view_count',
|
---|
| 322 | __('Is the posts author views counted?','xpressme'),
|
---|
| 323 | __('YES','xpressme'),
|
---|
| 324 | __('NO','xpressme')
|
---|
| 325 | );
|
---|
| 326 | echo $xpress_config->header_meta_option();
|
---|
| 327 | echo $xpress_config->yes_no_radio_option('is_sql_debug',
|
---|
| 328 | __('Is SQL debugging window displayed?','xpressme'),
|
---|
| 329 | __('YES','xpressme'),
|
---|
| 330 | __('NO','xpressme')
|
---|
| 331 | );
|
---|
| 332 | echo "</table>\n";
|
---|
| 333 |
|
---|
| 334 | echo '<p class="submit">'."\n";
|
---|
| 335 | echo '<input type="submit" value= "' . __('Update Config', 'xpressme') . '" name="submit_update" />' ."\n";
|
---|
| 336 | echo '<input type="submit" value= "' . __('Preset Config', 'xpressme') . '" name="submit_reset" />' ."\n";
|
---|
| 337 | echo "</p>\n";
|
---|
| 338 |
|
---|
| 339 | echo "</form>\n" ;
|
---|
| 340 | echo "</div>\n";
|
---|
| 341 | }
|
---|
| 342 |
|
---|
[18] | 343 | ?> |
---|