[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 | {
|
---|
| 27 | global $xpress_config;
|
---|
[311] | 28 | $plugin_url = WP_PLUGIN_URL."/xpressme/";
|
---|
| 29 |
|
---|
| 30 | // add_options_page('XPressME', __('XPressME Settings', 'xpressme'), 8, 'xpressme_config', array(&$xpress_config, 'option_page'));
|
---|
[302] | 31 | // * Top Level Menu
|
---|
[313] | 32 | add_menu_page('XPressME','XPressME', 8, 'xpressme_config', array(&$xpress_config, 'option_page'), $plugin_url.'/images/menu_icon.png');
|
---|
[311] | 33 | add_submenu_page('xpressme_config', __('XPressME Settings', 'xpressme'), __('XPressME Settings', 'xpressme'), 8, 'xpressme_config', array(&$xpress_config, 'option_page'));
|
---|
[307] | 34 | // add_submenu_page('xpressme_config', 'Test Sublevel2', __('to XOOPS Admin', 'xpressme'), 8, 'to_xoops_admin', array(&$xpress_config, 'to_xoops_admin'));
|
---|
[302] | 35 | }
|
---|
| 36 | add_action('admin_menu', 'my_plugin_menu');
|
---|
| 37 |
|
---|
[144] | 38 | add_filter("upload_dir",array(&$xpress_config, 'xpress_upload_filter'), 1); // Change wp-include/wp_upload_dir()
|
---|
| 39 | if (!$xpress_config->is_save_post_revision){
|
---|
[28] | 40 | remove_action( 'pre_post_update', 'wp_save_post_revision' ); // Not Save Post Revision
|
---|
| 41 | }
|
---|
[145] | 42 | add_action("wp_meta" , "wp_meta_add_xpress_menu"); // add xpress menu in wp_meta
|
---|
[182] | 43 |
|
---|
| 44 | //Site URL check
|
---|
| 45 | add_filter('option_home', "safe_site_url_filter");
|
---|
| 46 | add_filter('option_siteurl', "safe_site_url_filter");
|
---|
| 47 |
|
---|
[96] | 48 |
|
---|
| 49 | //XOOPS Bloack Cache Refresh
|
---|
[46] | 50 | add_action("comment_post", "block_cache_refresh");
|
---|
| 51 | add_action("edit_comment", "block_cache_refresh");
|
---|
[96] | 52 | add_action("wp_set_comment_status","block_cache_refresh"); //wp_delete_comment() at deleted
|
---|
| 53 | add_action("deleted_post", "block_cache_refresh");
|
---|
[46] | 54 | add_action("publish_post", "block_cache_refresh");
|
---|
| 55 | add_action("edit_post", "block_cache_refresh");
|
---|
| 56 | add_action("private_to_published", "block_cache_refresh");
|
---|
[96] | 57 | add_action("transition_post_status", "block_cache_refresh");
|
---|
[46] | 58 |
|
---|
[51] | 59 | add_action("the_content", "set_post_views_count");
|
---|
| 60 |
|
---|
[61] | 61 | //XOOPS notifiction
|
---|
| 62 | require_once dirname( __FILE__ ).'/include/notify_functions.php' ;
|
---|
[91] | 63 | add_action("transition_post_status", "onaction_publish_post_notify" ,10 , 3);
|
---|
[61] | 64 | // add_action("edit_post", "onaction_edit_post_notify");
|
---|
| 65 | add_action("comment_post", "onaction_comment_notify");
|
---|
| 66 | // add_action("approve_comment" , "onaction_comment_apobe_notify");
|
---|
| 67 | add_action("wp_set_comment_status" , "onaction_comment_apobe_notify");
|
---|
[51] | 68 |
|
---|
[72] | 69 | // user data sync user_sync_to_xoops($user_id)
|
---|
| 70 | require_once dirname( __FILE__ ).'/include/user_sync_xoops.php' ;
|
---|
| 71 | add_action('profile_update', 'user_sync_to_xoops');
|
---|
| 72 | add_action('user_register', 'user_sync_to_xoops');
|
---|
[32] | 73 | //require_once('../include/custom_functions.php');
|
---|
[88] | 74 |
|
---|
[104] | 75 | //D3Forum Comment Integration
|
---|
[144] | 76 | if ($xpress_config->is_use_d3forum){
|
---|
[104] | 77 | require_once dirname( __FILE__ ).'/include/d3forum_comment_synchro.php' ;
|
---|
| 78 | add_action("comment_post", "onaction_comment_post");
|
---|
| 79 | add_action("edit_comment", "onaction_edit_comment");
|
---|
| 80 | add_action("delete_comment","onaction_delete_comment");
|
---|
| 81 | add_action("delete_post", "onaction_delete_post");
|
---|
| 82 | add_action("wp_set_comment_status" , "onaction_comment_apobe");
|
---|
| 83 |
|
---|
| 84 |
|
---|
| 85 | add_filter('comments_template', "disp_d3forum_comments" );
|
---|
| 86 |
|
---|
| 87 | }
|
---|
| 88 |
|
---|
[155] | 89 |
|
---|
| 90 |
|
---|
[147] | 91 | //The trackback and the pingback are excluded from the count of the comment.
|
---|
| 92 | add_filter('get_comments_number', 'xpress_comment_count', 0);
|
---|
[104] | 93 |
|
---|
[155] | 94 | // Query filter for MultiUser
|
---|
| 95 | add_filter('query','xpress_query_filter');
|
---|
[236] | 96 | //add_action("init", "xpress_set_author_cookie");
|
---|
[281] | 97 | if(xpress_is_wp20()){
|
---|
| 98 | // It is called before parse_request() makes $GET.
|
---|
| 99 | add_action("query_vars", "xpress_set_author_cookie");
|
---|
| 100 | } else {
|
---|
| 101 | // It is called at the end of parse_request().
|
---|
| 102 | add_filter('request', 'xpress_set_author_cookie');
|
---|
| 103 | }
|
---|
[155] | 104 |
|
---|
[88] | 105 | // SQL debug windows
|
---|
[144] | 106 | add_filter('query', array(&$xpress_config, 'xpress_sql_debug'));
|
---|
| 107 | add_action('admin_footer', array(&$xpress_config, 'displayDebugLog'));
|
---|
[280] | 108 | add_action('wp_footer', array(&$xpress_config, 'displayDebugLog'));
|
---|
| 109 |
|
---|
[18] | 110 | ?> |
---|