1 | <?php
|
---|
2 | /*
|
---|
3 | * XPressME - WordPress for XOOPS
|
---|
4 | *
|
---|
5 | * @copyright XPressME Project http://www.toemon.com
|
---|
6 | * @license http://www.fsf.org/copyleft/gpl.html GNU public license
|
---|
7 | * @author toemon
|
---|
8 | * @package module::xpress
|
---|
9 | */
|
---|
10 |
|
---|
11 | /*
|
---|
12 | * There is a function that detects the kind of the page that the access is here.
|
---|
13 | */
|
---|
14 |
|
---|
15 | function is_xpress_index_page_call(){
|
---|
16 | $xpress_root_index = basename(dirname(dirname( __FILE__ ))) . '/index.php';
|
---|
17 | $php_script_name = $_SERVER['SCRIPT_NAME'];
|
---|
18 | $php_query_string = $_SERVER['QUERY_STRING'];
|
---|
19 | if (strstr($php_script_name,$xpress_root_index) !== false) {
|
---|
20 | if (strstr($php_query_string,'preview') === false) return true; else return false;;
|
---|
21 | } else {
|
---|
22 | return false;
|
---|
23 | }
|
---|
24 | }
|
---|
25 |
|
---|
26 | function is_admin_page_call(){
|
---|
27 | $xpress_root_index = basename(dirname(dirname( __FILE__ ))) . '/wp-admin';
|
---|
28 | $php_script_name = $_SERVER['SCRIPT_NAME'];
|
---|
29 | if (strstr($php_script_name,$xpress_root_index) !== false) return true; else return false;
|
---|
30 | }
|
---|
31 |
|
---|
32 | function is_media_upload_page_call(){
|
---|
33 | $xpress_root_indexs[0] = basename(dirname(dirname( __FILE__ ))) . '/wp-admin/async-upload.php';
|
---|
34 | $php_script_name = $_SERVER['SCRIPT_NAME'];
|
---|
35 | foreach ($xpress_root_indexs as $xpress_root_index) {
|
---|
36 | if (strstr($php_script_name,$xpress_root_index) !== false) return true;
|
---|
37 | }
|
---|
38 | return false;
|
---|
39 | }
|
---|
40 |
|
---|
41 | function is_xmlrpc_call(){
|
---|
42 |
|
---|
43 | $xpress_root_index = basename(dirname(dirname( __FILE__ ))) . '/xmlrpc.php';
|
---|
44 | $php_script_name = $_SERVER['SCRIPT_NAME'];
|
---|
45 | if(strstr($php_script_name,$xpress_root_index) !== false) $ret = true; else $ret = false;
|
---|
46 | $xmlrpc_debug = 0;
|
---|
47 |
|
---|
48 |
|
---|
49 | if ($xmlrpc_debug) {
|
---|
50 | $_debug_file = './wp-content/debug.log';
|
---|
51 | $log_data = '';
|
---|
52 | $log_data .= 'is_xmlrpc_call()***********************************************************************'. "\n";
|
---|
53 | if ($ret) $ret_val = 'true'; else $ret_val = 'false';
|
---|
54 | $log_data .= 'return value = ' . $ret_val . "\n";
|
---|
55 |
|
---|
56 | foreach($_SERVER as $key => $value){
|
---|
57 | $log_data .= $key . ' = ' . $value . "\n";
|
---|
58 | }
|
---|
59 |
|
---|
60 | $_fp = fopen($_debug_file, 'a');
|
---|
61 | fwrite($_fp, $log_data);
|
---|
62 | fwrite($_fp, "\n\n");
|
---|
63 | fclose($_fp);
|
---|
64 | }
|
---|
65 | return $ret;
|
---|
66 | }
|
---|
67 |
|
---|
68 | function is_wp_cron_call(){
|
---|
69 | $xpress_root_index = basename(dirname(dirname( __FILE__ ))) . '/wp-cron.php';
|
---|
70 | $php_script_name = $_SERVER['SCRIPT_NAME'];
|
---|
71 | if (strstr($php_script_name,$xpress_root_index) !== false) return true; else return false;
|
---|
72 | }
|
---|
73 |
|
---|
74 | ?>
|
---|