blob: 6f0f336f4843421eaf675f4d4b7ca683cf653e38 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
<?php
header( 'Content-Type: application/json; charset=UTF-8' );
require_once( '../../../../wp-config.php' );
if ( ! class_exists( 'WMobilePack_Export' ) ) {
require_once( WMP_PLUGIN_PATH . 'export/class-export.php' );
}
// Disable error reporting because these methods are used as callbacks by the mobile web app
error_reporting( 0 );
if ( isset( $_GET['content'] ) ) {
$export = new WMobilePack_Export();
if ( isset( $_GET['callback'] ) ) {
// filter callback param
$callback = filter_var($_GET['callback'], FILTER_SANITIZE_STRING);
header( 'Content-Type: application/javascript' );
switch ( $_GET['content'] ) {
case 'exportcategories':
echo $callback . '(' . $export->export_categories() . ')';
break;
case 'exportcategory':
echo $callback . '(' . $export->export_category() . ')';
break;
case 'exportarticles':
echo $callback . '(' . $export->export_articles() . ')';
break;
case 'exportarticle':
echo $callback . '(' . $export->export_article() . ')';
break;
case 'exportcomments':
echo $callback . '(' . $export->export_comments() . ')';
break;
case 'savecomment':
echo $callback . '(' . $export->save_comment() . ')';
break;
case 'exportpages':
echo $callback . '(' . $export->export_pages() . ')';
break;
case 'exportpage':
echo $callback . '(' . $export->export_page() . ')';
break;
default:
echo $callback . '({"error":"No export requested"})';
}
} else {
if ( ! class_exists( 'WMobilePack_Export_Settings' ) ) {
require_once(WMP_PLUGIN_PATH.'/export/class-export-settings.php');
}
$export_settings = new WMobilePack_Export_Settings();
switch ( $_GET['content'] ) {
case 'androidmanifest':
case 'mozillamanifest':
if ( isset( $_GET['premium'] ) && $_GET['premium'] == 1 ) {
echo $export_settings->export_manifest_premium();
} else {
echo $export_settings->export_manifest();
}
break;
case 'apptexts':
$format = 'javascript';
if (isset($_GET['format']) && $_GET['format'] == 'json') {
$format = 'json';
}
$app_texts = $export_settings->load_language($_GET['locale'], $format);
if ( $app_texts !== false ) {
header( 'Content-Type: application/' . $format);
echo $app_texts;
}
break;
case 'exportsettings':
echo $export_settings->export_settings();
break;
default:
echo '{"error":"No export requested","status":0}';
}
}
}
|