summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2017-05-20 17:02:17 -0400
committerAnthony G. Basile <blueness@gentoo.org>2017-05-20 17:02:17 -0400
commit7110857caa2bec4dc45c2f2eeba3e537e82fae79 (patch)
tree840bdbd374eb3b4d88e38c7110c897608f770737 /plugins/wordpress-mobile-pack/export
parentUpdate Aksimet v3.3.1, Jetpack v 4.9, Public Post Preview v 2.6.0 (diff)
downloadblogs-gentoo-7110857caa2bec4dc45c2f2eeba3e537e82fae79.tar.gz
blogs-gentoo-7110857caa2bec4dc45c2f2eeba3e537e82fae79.tar.bz2
blogs-gentoo-7110857caa2bec4dc45c2f2eeba3e537e82fae79.zip
Update wordpress-mobile-pack 3.0
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'plugins/wordpress-mobile-pack/export')
-rwxr-xr-xplugins/wordpress-mobile-pack/export/class-export-settings.php329
-rwxr-xr-xplugins/wordpress-mobile-pack/export/class-export.php348
-rwxr-xr-xplugins/wordpress-mobile-pack/export/content.php21
3 files changed, 400 insertions, 298 deletions
diff --git a/plugins/wordpress-mobile-pack/export/class-export-settings.php b/plugins/wordpress-mobile-pack/export/class-export-settings.php
new file mode 100755
index 00000000..f68e2a39
--- /dev/null
+++ b/plugins/wordpress-mobile-pack/export/class-export-settings.php
@@ -0,0 +1,329 @@
+<?php
+
+if ( ! class_exists( 'WMobilePack_Export_Settings' ) ) {
+
+ /**
+ * Class WMobilePack_Export_Settings
+ *
+ * Contains methods for exporting settings, manifest and language files
+ */
+ class WMobilePack_Export_Settings
+ {
+
+ /**
+ *
+ * Create an uploads management object and return it
+ *
+ * @return object
+ *
+ */
+ protected function get_uploads_manager()
+ {
+ return new WMobilePack_Uploads();
+ }
+
+ /**
+ *
+ * Create a manager Application object and return it
+ *
+ * @return object
+ *
+ */
+ protected function get_application_manager()
+ {
+ if (!class_exists('WMobilePack_Application')){
+ require_once(WMP_PLUGIN_PATH.'frontend/class-application.php');
+ }
+
+ return new WMobilePack_Application();
+ }
+
+ /**
+ *
+ * Load app texts for the current locale.
+ *
+ * The JSON files with translations for each language are located in frontend/locales.
+ *
+ * @param $locale
+ * @param $response_type = javascript | list
+ * @return bool|mixed
+ *
+ */
+ public function load_language($locale, $response_type = 'javascript')
+ {
+
+ if (!class_exists('WMobilePack_Application'))
+ require_once(WMP_PLUGIN_PATH.'frontend/class-application.php');
+
+ $language_file = WMobilePack_Application::check_language_file($locale);
+
+ if ($language_file !== false) {
+
+ $appTexts = file_get_contents($language_file);
+ $appTextsJson = json_decode($appTexts, true);
+
+ if ($appTextsJson && !empty($appTextsJson) && array_key_exists('APP_TEXTS', $appTextsJson)) {
+
+ if ($response_type == 'javascript')
+ return 'var APP_TEXTS = ' . json_encode($appTextsJson['APP_TEXTS']);
+ elseif ($response_type == 'json')
+ return json_encode($appTextsJson['APP_TEXTS']);
+ else
+ return $appTextsJson;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ *
+ * Export manifest files for Android or Mozilla.
+ *
+ * The method receives a single GET param:
+ *
+ * - content = 'androidmanifest' or 'mozillamanifest'
+ */
+ public function export_manifest()
+ {
+
+ // set blog name
+ $blog_name = get_bloginfo("name");
+
+ // init response depending on the manifest type
+ if (isset($_GET['content']) && $_GET['content'] == 'androidmanifest') {
+
+ $arr_manifest = array(
+ 'name' => $blog_name,
+ 'start_url' => home_url(),
+ 'display' => 'standalone',
+ 'orientation' => 'any'
+ );
+
+ if (!class_exists('WMobilePack_Themes_Config')) {
+ require_once(WMP_PLUGIN_PATH . 'inc/class-wmp-themes-config.php');
+ }
+
+ $background_color = WMobilePack_Themes_Config::get_manifest_background();
+
+ if ($background_color !== false){
+ $arr_manifest['theme_color'] = $background_color;
+ $arr_manifest['background_color'] = $background_color;
+ }
+
+ } else {
+
+ // remove domain name from the launch path
+ $launch_path = home_url();
+ $launch_path = str_replace('http://' . $_SERVER['HTTP_HOST'], '', $launch_path);
+ $launch_path = str_replace('https://' . $_SERVER['HTTP_HOST'], '', $launch_path);
+
+ $arr_manifest = array(
+ 'name' => $blog_name,
+ 'launch_path' => $launch_path,
+ 'developer' => array(
+ "name" => $blog_name
+ )
+ );
+ }
+
+ // load icon from the local settings and folder
+ $icon_path = WMobilePack_Options::get_setting('icon');
+
+ if ($icon_path != '') {
+
+ $WMP_Uploads = $this->get_uploads_manager();
+ $icon_path = $WMP_Uploads->get_file_url($icon_path);
+ }
+
+ // set icon depending on the manifest file type
+ if ($icon_path != '') {
+
+ if ($_GET['content'] == 'androidmanifest') {
+
+ $arr_manifest['icons'] = array(
+ array(
+ "src" => $icon_path,
+ "sizes" => "192x192"
+ )
+ );
+
+ } else {
+ $arr_manifest['icons'] = array(
+ '152' => $icon_path,
+ );
+ }
+ }
+
+ return json_encode($arr_manifest);
+
+ }
+
+ /**
+ * Export manifest files for Android or Mozilla (Premium settings).
+ *
+ * The method receives a single GET param:
+ *
+ * - content = 'androidmanifest' or 'mozillamanifest'
+ *
+ * @return string
+ */
+ public function export_manifest_premium(){
+
+ if (WMobilePack_Options::get_setting('premium_active') == 1 && WMobilePack_Options::get_setting('premium_api_key') != ''){
+
+ if (!class_exists('WMobilePack_Premium'))
+ require_once(WMP_PLUGIN_PATH.'inc/class-wmp-premium.php');
+
+ $premium_manager = new WMobilePack_Premium();
+ $arr_config_premium = $premium_manager->get_premium_config();
+
+ if ($arr_config_premium !== null){
+
+ if (!isset($arr_config_premium['domain_name']) || $arr_config_premium['domain_name'] == '') {
+
+ $blog_name = $arr_config_premium['title'];
+
+ if (isset($arr_config_premium['kit_type']) && $arr_config_premium['kit_type'] == 'wpmp') {
+ $blog_name = urldecode($blog_name);
+ }
+
+ // init response depending on the manifest type
+ if (isset($_GET['content']) && $_GET['content'] == 'androidmanifest') {
+
+ $arr_manifest = array(
+ 'name' => $blog_name,
+ 'start_url' => home_url(),
+ 'display' => 'standalone'
+ );
+
+ } else {
+
+ // remove domain name from the launch path
+ $launch_path = home_url();
+ $launch_path = str_replace('http://' . $_SERVER['HTTP_HOST'], '', $launch_path);
+ $launch_path = str_replace('https://' . $_SERVER['HTTP_HOST'], '', $launch_path);
+
+ $arr_manifest = array(
+ 'name' => $blog_name,
+ 'launch_path' => $launch_path,
+ 'developer' => array(
+ "name" => $blog_name
+ )
+ );
+ }
+
+ // load icon path
+ $icon_path = false;
+
+ if (isset($arr_config_premium['icon_path']) && $arr_config_premium['icon_path'] != '') {
+
+ // Check if we have a secure https connection
+ $is_secure = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443;
+
+ $cdn_apps = $is_secure ? $arr_config_premium['cdn_apps_https'] : $arr_config_premium['cdn_apps'];
+ $icon_path = $cdn_apps . "/" . $arr_config_premium['shorten_url'] . '/' . $arr_config_premium['icon_path'];
+ }
+
+ // set icon depending on the manifest file type
+ if ($icon_path != false) {
+
+ if ($_GET['content'] == 'androidmanifest') {
+
+ $arr_manifest['icons'] = array(
+ array(
+ "src" => $icon_path,
+ "sizes" => "192x192"
+ )
+ );
+
+ } else {
+ $arr_manifest['icons'] = array(
+ '152' => $icon_path,
+ );
+ }
+ }
+
+ return json_encode($arr_manifest);
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ * Export settings file.
+ *
+ */
+ public function export_settings()
+ {
+
+ $app = $this->get_application_manager();
+ $app_settings = $app->load_app_settings();
+
+ $frontend_path = plugins_url()."/".WMP_DOMAIN."/frontend/";
+ $export_path = plugins_url()."/".WMP_DOMAIN."/export/";
+
+ $settings = array();
+
+ $settings['export'] = array(
+
+ 'categories' => array(
+ 'find' => $export_path . 'content.php?content=exportcategories',
+ 'findOne' => $export_path . 'content.php?content=exportcategory'
+ ),
+
+ 'posts' => array(
+ 'find' => $export_path . 'content.php?content=exportarticles',
+ 'findOne' => $export_path . 'content.php?content=exportarticle'
+ ),
+
+ 'pages' => array(
+ 'find' => $export_path . 'content.php?content=exportpages',
+ 'findOne' => $export_path . 'content.php?content=exportpage'
+ ),
+
+ 'comments' => array(
+ 'find' => $export_path . 'content.php?content=exportcomments',
+ 'insert' => $export_path . 'content.php?content=savecomment'
+ )
+ );
+
+ $settings['translate'] = array(
+ 'path' => $export_path.'content.php?content=apptexts&locale='.get_locale().'&format=json',
+ 'language' => $app->get_language(get_locale())
+ );
+
+ $settings['socialMedia'] = array(
+ 'facebook' => (bool)$app_settings['enable_facebook'],
+ 'twitter' => (bool)$app_settings['enable_twitter'],
+ 'google' => (bool)$app_settings['enable_google']
+ );
+
+ $settings['commentsToken'] = $app_settings['comments_token'];
+
+ if ($app_settings['posts_per_page'] == 'single') {
+ $settings['articlesPerCard'] = 1;
+
+ } elseif ($app_settings['posts_per_page'] == 'double') {
+ $settings['articlesPerCard'] = 2;
+
+ } else {
+ $settings['articlesPerCard'] = 'auto';
+ }
+
+ if ($app_settings['display_website_link']) {
+ $spliter = parse_url(home_url(), PHP_URL_QUERY) ? '&' : '?';
+ $settings['websiteUrl'] = home_url() . $spliter . WMobilePack_Cookie::$prefix . 'theme_mode=desktop';
+ }
+
+ $settings['logo'] = $app_settings['logo'];
+ $settings['icon'] = $app_settings['icon'];
+ $settings['defaultCover'] = $app_settings['cover'] != '' ? $app_settings['cover'] : $frontend_path."images/pattern-".rand(1, 6).".jpg";
+
+ return json_encode($settings);
+
+ }
+
+ }
+}
diff --git a/plugins/wordpress-mobile-pack/export/class-export.php b/plugins/wordpress-mobile-pack/export/class-export.php
index d7a4a6cb..98f91e14 100755
--- a/plugins/wordpress-mobile-pack/export/class-export.php
+++ b/plugins/wordpress-mobile-pack/export/class-export.php
@@ -1375,7 +1375,6 @@ if ( ! class_exists( 'WMobilePack_Export' ) ) {
exit();
}
-
/**
*
* The exportPages method is used for exporting all the visible pages.
@@ -1400,7 +1399,11 @@ if ( ! class_exists( 'WMobilePack_Export' ) ) {
*
* - callback = The JavaScript callback method
* - content = 'exportpages'
+ * - page = (optional) Used for pagination
+ * - rows = (optional) Number of rows per page, used for pagination
+ * - limit = (optional) Deprecated, alias for 'rows'. Should be removed after migrating Sencha apps.
*
+ * @todo Eliminate pages with inactive grandparents when using pagination params ('page' and 'rows').
*/
public function export_pages()
{
@@ -1408,25 +1411,43 @@ if ( ! class_exists( 'WMobilePack_Export' ) ) {
// init pages arrays
$arr_pages = array();
- // set args for pages
- $limit = 100;
+ // init pagination params
+ $pagination = false;
+ if (isset($_GET["page"]) && is_numeric($_GET["page"])) {
+ $pagination = $_GET["page"];
+ }
+
+ $rows = false;
+
+ if (isset($_GET["rows"]) && is_numeric($_GET["rows"])){
+
+ $rows = $_GET["rows"];
+
+ if ($pagination === false){
+ $pagination = 1;
+ }
+
+ } elseif (isset($_GET["limit"]) && is_numeric($_GET["limit"])){
+ $rows = $_GET["limit"];
+ } else {
+ $rows = $pagination ? 5 : 100;
+ }
$args = array(
- 'post__not_in' => $this->inactive_pages,
- 'numberposts' => $limit,
- 'posts_per_page' => $limit,
- 'post_status' => 'publish',
'post_type' => 'page',
- 'post_password' => ''
+ 'post_status' => 'publish',
+ 'post_password' => '',
+ 'post__not_in' => $this->inactive_pages,
+ 'posts_per_page' => $rows,
+ 'post_parent__not_in' => $this->inactive_pages,
+ 'orderby' => 'menu_order parent title',
+ 'order' => 'ASC'
);
- if (get_bloginfo('version') >= 3.6) {
-
- $args['post_parent__not_in'] = $this->inactive_pages;
+ if ($pagination !== false){
+ $args['paged'] = $pagination;
+ }
- $args['orderby'] = 'menu_order title';
- $args['order'] = 'ASC';
- }
// remove inline style for the photos types of posts
add_filter('use_default_gallery_style', '__return_false');
@@ -1435,10 +1456,16 @@ if ( ! class_exists( 'WMobilePack_Export' ) ) {
if ($pages_query->have_posts()) {
- // get array with the ordered pages by hierarchy
- $order_pages = array_keys(get_page_hierarchy($pages_query->posts));
+ // get array with the ordered pages by hierarchy
+ $order_pages = array();
+
+ if ($pagination === false){
+ $order_pages = array_keys(get_page_hierarchy($pages_query->posts));
+ }
- if (!empty($order_pages)) {
+ if (!empty($order_pages) || $pagination !== false) {
+
+ $index = 0;
while ($pages_query->have_posts()) {
@@ -1459,7 +1486,12 @@ if ( ! class_exists( 'WMobilePack_Export' ) ) {
$content = apply_filters("the_content", get_option(WMobilePack_Options::$prefix.'page_' . $page->ID));
// if the page and its parent are visible, they should exist in the order array
- $index_order = array_search($page->ID, $order_pages);
+ if ($pagination === false) {
+ $index_order = array_search($page->ID, $order_pages);
+ } else {
+ $index_order = ($pagination - 1) * $rows + $index;
+ $index++;
+ }
if (is_numeric($index_order)) {
@@ -1482,7 +1514,11 @@ if ( ! class_exists( 'WMobilePack_Export' ) ) {
}
}
- return '{"pages":' . json_encode($arr_pages) . "}";
+ if ($pagination && $rows) {
+ return '{"pages":' . json_encode($arr_pages) . ',"pagination":' .json_encode(array('page' => $pagination, 'rows' => $rows)).'}';
+ } else {
+ return '{"pages":' . json_encode($arr_pages) . '}';
+ }
}
@@ -1578,279 +1614,5 @@ if ( ! class_exists( 'WMobilePack_Export' ) ) {
return '{"error":"Invalid post id"}';
}
-
-
- /**
- *
- * Export manifest files for Android or Mozilla.
- *
- * The method receives a single GET param:
- *
- * - content = 'androidmanifest' or 'mozillamanifest'
- */
- public function export_manifest()
- {
-
- // set blog name
- $blog_name = get_bloginfo("name");
-
- // init response depending on the manifest type
- if (isset($_GET['content']) && $_GET['content'] == 'androidmanifest') {
-
- $arr_manifest = array(
- 'name' => $blog_name,
- 'start_url' => home_url(),
- 'display' => 'standalone',
- 'orientation' => 'any'
- );
-
- if (!class_exists('WMobilePack_Themes_Config')) {
- require_once(WMP_PLUGIN_PATH . 'inc/class-wmp-themes-config.php');
- }
-
- $background_color = WMobilePack_Themes_Config::get_manifest_background();
-
- if ($background_color !== false){
- $arr_manifest['theme_color'] = $background_color;
- $arr_manifest['background_color'] = $background_color;
- }
-
- } else {
-
- // remove domain name from the launch path
- $launch_path = home_url();
- $launch_path = str_replace('http://' . $_SERVER['HTTP_HOST'], '', $launch_path);
- $launch_path = str_replace('https://' . $_SERVER['HTTP_HOST'], '', $launch_path);
-
- $arr_manifest = array(
- 'name' => $blog_name,
- 'launch_path' => $launch_path,
- 'developer' => array(
- "name" => $blog_name
- )
- );
- }
-
- // load icon from the local settings and folder
- $icon_path = WMobilePack_Options::get_setting('icon');
-
- if ($icon_path != '') {
-
- $WMP_Uploads = $this->get_uploads_manager();
- $icon_path = $WMP_Uploads->get_file_url($icon_path);
- }
-
- // set icon depending on the manifest file type
- if ($icon_path != '') {
-
- if ($_GET['content'] == 'androidmanifest') {
-
- $arr_manifest['icons'] = array(
- array(
- "src" => $icon_path,
- "sizes" => "192x192"
- )
- );
-
- } else {
- $arr_manifest['icons'] = array(
- '152' => $icon_path,
- );
- }
- }
-
- return json_encode($arr_manifest);
-
- }
-
-
- /**
- * Export manifest files for Android or Mozilla (Premium settings).
- *
- * The method receives a single GET param:
- *
- * - content = 'androidmanifest' or 'mozillamanifest'
- *
- * @return string
- */
- public function export_manifest_premium(){
-
- if (WMobilePack_Options::get_setting('premium_active') == 1 && WMobilePack_Options::get_setting('premium_api_key') != ''){
-
- if (!class_exists('WMobilePack_Premium'))
- require_once(WMP_PLUGIN_PATH.'inc/class-wmp-premium.php');
-
- $premium_manager = new WMobilePack_Premium();
- $arr_config_premium = $premium_manager->get_premium_config();
-
- if ($arr_config_premium !== null){
-
- if (!isset($arr_config_premium['domain_name']) || $arr_config_premium['domain_name'] == '') {
-
- $blog_name = $arr_config_premium['title'];
-
- if (isset($arr_config_premium['kit_type']) && $arr_config_premium['kit_type'] == 'wpmp') {
- $blog_name = urldecode($blog_name);
- }
-
- // init response depending on the manifest type
- if (isset($_GET['content']) && $_GET['content'] == 'androidmanifest') {
-
- $arr_manifest = array(
- 'name' => $blog_name,
- 'start_url' => home_url(),
- 'display' => 'standalone'
- );
-
- } else {
-
- // remove domain name from the launch path
- $launch_path = home_url();
- $launch_path = str_replace('http://' . $_SERVER['HTTP_HOST'], '', $launch_path);
- $launch_path = str_replace('https://' . $_SERVER['HTTP_HOST'], '', $launch_path);
-
- $arr_manifest = array(
- 'name' => $blog_name,
- 'launch_path' => $launch_path,
- 'developer' => array(
- "name" => $blog_name
- )
- );
- }
-
- // load icon path
- $icon_path = false;
-
- if (isset($arr_config_premium['icon_path']) && $arr_config_premium['icon_path'] != '') {
-
- // Check if we have a secure https connection
- $is_secure = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443;
-
- $cdn_apps = $is_secure ? $arr_config_premium['cdn_apps_https'] : $arr_config_premium['cdn_apps'];
- $icon_path = $cdn_apps . "/" . $arr_config_premium['shorten_url'] . '/' . $arr_config_premium['icon_path'];
- }
-
- // set icon depending on the manifest file type
- if ($icon_path != false) {
-
- if ($_GET['content'] == 'androidmanifest') {
-
- $arr_manifest['icons'] = array(
- array(
- "src" => $icon_path,
- "sizes" => "192x192"
- )
- );
-
- } else {
- $arr_manifest['icons'] = array(
- '152' => $icon_path,
- );
- }
- }
-
- return json_encode($arr_manifest);
- }
- }
- }
- }
-
-
- /**
- *
- * Load app texts for the current locale.
- *
- * The JSON files with translations for each language are located in frontend/locales.
- *
- * @param $locale
- * @param $response_type = javascript | list
- * @return bool|mixed
- *
- */
- public function load_language($locale, $response_type = 'javascript')
- {
-
- if (!class_exists('WMobilePack_Application'))
- require_once(WMP_PLUGIN_PATH.'frontend/class-application.php');
-
- $language_file = WMobilePack_Application::check_language_file($locale);
-
- if ($language_file !== false) {
-
- $appTexts = file_get_contents($language_file);
- $appTextsJson = json_decode($appTexts, true);
-
- if ($appTextsJson && !empty($appTextsJson) && array_key_exists('APP_TEXTS', $appTextsJson)) {
-
- if ($response_type == 'javascript')
- return 'var APP_TEXTS = ' . json_encode($appTextsJson['APP_TEXTS']);
- else
- return $appTextsJson;
- }
- }
-
- return false;
- }
-
- /**
- *
- * The export_settings method is used for exporting the main settings, when connecting with a Premium API key.
- *
- * The method returns a JSON with the following format:
- *
- * - ex :
- * {
- * "logo": "",
- * "icon": "",
- * "cover": "",
- * "google_analytics_id": "UA-1234567-1"
- * "status": 0/1
- * }
- */
- public function export_settings() {
-
- if (isset($_POST["apiKey"]) && preg_match('/^[a-zA-Z0-9]+$/', $_POST['apiKey'])) {
-
- // check if logo exists
- $WMP_Uploads = $this->get_uploads_manager();
-
- $logo_path = WMobilePack_Options::get_setting('logo');
-
- if ($logo_path != ''){
- $logo_path = $WMP_Uploads->get_file_url($logo_path);
- }
-
- // check if icon exists
- $icon_path = WMobilePack_Options::get_setting('icon');
-
- if ($icon_path != ''){
- $icon_path = $WMP_Uploads->get_file_url($icon_path);
- }
-
- // check if cover exists
- $cover_path = WMobilePack_Options::get_setting('cover');
-
- if ($cover_path != ''){
- $cover_path = $WMP_Uploads->get_file_url($cover_path);
- }
-
- // check if google analytics id is set
- $google_analytics_id = WMobilePack_Options::get_setting('google_analytics_id');
-
- // set settings
- $arr_settings = array(
- 'logo' => $logo_path,
- 'icon' => $icon_path,
- 'cover' => $cover_path,
- 'google_analytics_id' => $google_analytics_id,
- 'status' => 1
- );
-
- // return json
- return json_encode($arr_settings);
-
- } else
- return '{"error":"Missing post data (API Key) or mismatch.","status":0}';
- }
}
}
diff --git a/plugins/wordpress-mobile-pack/export/content.php b/plugins/wordpress-mobile-pack/export/content.php
index 85aafa3c..6f0f336f 100755
--- a/plugins/wordpress-mobile-pack/export/content.php
+++ b/plugins/wordpress-mobile-pack/export/content.php
@@ -69,24 +69,35 @@ if ( isset( $_GET['content'] ) ) {
}
} 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->export_manifest_premium();
+ echo $export_settings->export_manifest_premium();
} else {
- echo $export->export_manifest();
+ echo $export_settings->export_manifest();
}
break;
case 'apptexts':
- $app_texts = $export->load_language( $_GET['locale'] );
+ $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/javascript' );
+ header( 'Content-Type: application/' . $format);
echo $app_texts;
}
@@ -94,7 +105,7 @@ if ( isset( $_GET['content'] ) ) {
case 'exportsettings':
- echo $export->export_settings();
+ echo $export_settings->export_settings();
break;
default: