prefix = get_xoops_prefix(); $xoops_db->tables = array('modules', 'newblocks', 'users'); $xpress_config = new XPressME_Class(); require_once dirname( __FILE__ ).'/include/pluggable-override.php' ; require_once dirname( __FILE__ ).'/include/functions_for_wp_old.php' ; if (!is_wordpress_style() && ( !empty($xpress_config->theme_select) || $xpress_config->theme_select != 'use_wordpress_select') && !is_buddypress_active() ){ add_filter('stylesheet', 'xpress_Stylesheet'); add_filter('template', 'xpress_ThemeTemplate'); } function xpress_Stylesheet($stylesheet) { global $xpress_config; $theme = $xpress_config->theme_select; $theme = get_theme($theme); if (empty($theme)) { return $stylesheet; } return $theme['Stylesheet']; } function xpress_ThemeTemplate($template) { global $xpress_config; $theme = $xpress_config->theme_select; $theme = get_theme($theme); if (empty($theme)) { return $template; } return $theme['Template']; } function my_plugin_menu() { global $xpress_config,$xoops_config; $plugin_url = WP_PLUGIN_URL."/xpressme/"; // Add a new top-level menu: add_menu_page('XPressME','XPressME', 8, __FILE__, 'display_option_page' , $plugin_url.'/images/menu_icon.png'); // Add submenus to the custom top-level menu: add_submenu_page(__FILE__, __('Display Settings', 'xpressme'), __('Display Settings', 'xpressme'), 8, __FILE__, 'display_option_page'); add_submenu_page(__FILE__, __('Integration Settings', 'xpressme'), __('Integration Settings', 'xpressme'), 8, 'integration_option_page', 'integration_option_page'); add_submenu_page(__FILE__, __('Other Settings', 'xpressme'), __('Other Settings', 'xpressme'), 8, 'other_option_page', 'other_option_page'); // if (function_exists('wp_remote_get')) if(!xpress_is_multiblog() || xpress_is_multiblog_root()){ add_submenu_page(__FILE__, __('Upgrade', 'xpressme'), __('Upgrade', 'xpressme'), 8, 'upgrade_page', 'upgrade_page'); add_submenu_page(__FILE__, __('to Modules Admin', 'xpressme'), __('to Modules Admin', 'xpressme'), 8, 'redirect_xoops_admin', 'redirect_xoops_admin'); } } function blog_charset_check() { $lang= WPLANG; $blog_charset = get_option('blog_charset'); switch ($lang) { case 'ja_EUC': if ($blog_charset !=='EUC-JP') update_option('blog_charset', 'EUC-JP' ); break; case 'ja_UTF': case 'ja': if ($blog_charset !=='UTF-8') update_option('blog_charset', 'UTF-8' ); break; default: } } // enable multibyte username if( ! function_exists( 'sanitize_user_multibyte_at_update' ) ){ function sanitize_user_multibyte_at_update($username, $raw_username, $strict){ if (isset($_POST['action']) && $_POST['action'] == 'update'){ if ($raw_username !== "" && $username !== $raw_username){ return $raw_username; } } return $username; } } add_filter('sanitize_user', "sanitize_user_multibyte_at_update" ,10,3); add_action('admin_menu', 'my_plugin_menu'); add_filter("upload_dir",array(&$xpress_config, 'xpress_upload_filter'), 1); // Change wp-include/wp_upload_dir() if (!$xpress_config->is_save_post_revision){ remove_action( 'pre_post_update', 'wp_save_post_revision' ); // Not Save Post Revision } add_action("wp_meta" , "wp_meta_add_xpress_menu"); // add xpress menu in wp_meta //XOOPS Bloack Cache Refresh add_action("comment_post", "block_cache_refresh"); add_action("edit_comment", "block_cache_refresh"); add_action("wp_set_comment_status","block_cache_refresh"); //wp_delete_comment() at deleted add_action("deleted_post", "block_cache_refresh"); add_action("publish_post", "block_cache_refresh"); add_action("edit_post", "block_cache_refresh"); add_action("private_to_published", "block_cache_refresh"); add_action("transition_post_status", "block_cache_refresh"); add_action("the_content", "set_post_views_count"); // blog charset check add_action("init", "blog_charset_check"); //XOOPS notifiction require_once dirname( __FILE__ ).'/include/notify_functions.php' ; add_action("transition_post_status", "onaction_publish_post_notify" ,10 , 3); // add_action("edit_post", "onaction_edit_post_notify"); add_action("comment_post", "onaction_comment_notify"); // add_action("approve_comment" , "onaction_comment_apobe_notify"); add_action("wp_set_comment_status" , "onaction_comment_apobe_notify"); // user data sync user_sync_to_xoops($user_id) require_once dirname( __FILE__ ).'/include/user_sync_xoops.php' ; add_action('profile_update', 'user_sync_to_xoops'); add_action('user_register', 'user_sync_to_xoops'); add_action('delete_blog', 'blog_group_role_delete',10,2); //at multi blog delete add_action('wpmu_new_blog', 'blog_group_role_add',10,2); //at multi blog delete //require_once('../include/custom_functions.php'); //D3Forum Comment Integration if ($xpress_config->is_use_d3forum){ require_once dirname( __FILE__ ).'/include/d3forum_comment_synchro.php' ; add_action("comment_post", "onaction_comment_post"); add_action("edit_comment", "onaction_edit_comment"); add_action("delete_comment","onaction_delete_comment"); add_action("delete_post", "onaction_delete_post"); add_action("wp_set_comment_status" , "onaction_comment_apobe"); add_action("publish_post", "onaction_comment_close"); // comment trashed untrashed action add_action("trashed_post_comments", "onaction_trashed_post_comments"); add_action("untrashed_post_comments", "onaction_untrashed_post_comments"); add_action("trashed_comment", "onaction_trashed_comment"); add_action("untrashed_comment", "onaction_untrashed_comment"); add_filter('comments_template', "disp_d3forum_comments" ); } //The trackback and the pingback are excluded from the count of the comment. add_filter('get_comments_number', 'xpress_comment_count', 0); // Query filter for MultiUser add_filter('query','xpress_query_filter'); //add_action("init", "xpress_set_author_cookie"); if(xpress_is_wp_version('<','2.1')){ // It is called before parse_request() makes $GET. add_action("query_vars", "xpress_set_author_cookie"); } else { // It is called at the end of parse_request(). add_filter('request', 'xpress_set_author_cookie'); } // SQL debug windows add_filter('query', array(&$xpress_config, 'xpress_sql_debug')); add_action('admin_footer', array(&$xpress_config, 'displayDebugLog')); add_action('wp_footer', array(&$xpress_config, 'displayDebugLog')); // Multi Blog default Themes function my_new_blog_template($blog_id) { $default_theme = 'xpress_default'; update_blog_option($blog_id, 'template',$default_theme); update_blog_option($blog_id, 'stylesheet', $default_theme); } add_action('wpmu_new_blog','my_new_blog_template',0,1); function redirect_xoops_admin() { global $xoops_config,$xpress_config; $xoops_admin_url = $xoops_config->module_url . '/admin/index.php'; wp_redirect($xoops_admin_url); } function display_option_page() { global $xoops_config,$xpress_config; $xoops_admin_url = $xoops_config->module_url . '/admin/index.php'; $do_message =''; if (!empty($_POST['submit_update'])) { $xpress_config->ReadPostData($_POST); $xpress_config->SettingValueWrite('update'); } else if (isset($_POST['submit_reset'])) { $xpress_config->setDefault(); $xpress_config->SettingValueWrite('update'); } echo '