summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/wordpress-mobile-pack/export')
-rwxr-xr-xplugins/wordpress-mobile-pack/export/class-export-settings.php50
-rwxr-xr-xplugins/wordpress-mobile-pack/export/class-export.php43
2 files changed, 40 insertions, 53 deletions
diff --git a/plugins/wordpress-mobile-pack/export/class-export-settings.php b/plugins/wordpress-mobile-pack/export/class-export-settings.php
index f68e2a39..e0ba8d7c 100755
--- a/plugins/wordpress-mobile-pack/export/class-export-settings.php
+++ b/plugins/wordpress-mobile-pack/export/class-export-settings.php
@@ -94,7 +94,8 @@ if ( ! class_exists( 'WMobilePack_Export_Settings' ) ) {
if (isset($_GET['content']) && $_GET['content'] == 'androidmanifest') {
$arr_manifest = array(
- 'name' => $blog_name,
+ 'name' => $blog_name,
+ 'short_name' => $blog_name,
'start_url' => home_url(),
'display' => 'standalone',
'orientation' => 'any'
@@ -130,30 +131,39 @@ if ( ! class_exists( 'WMobilePack_Export_Settings' ) ) {
// load icon from the local settings and folder
$icon_path = WMobilePack_Options::get_setting('icon');
- if ($icon_path != '') {
+ if ($icon_path != '' && $_GET['content'] == 'androidmanifest') {
- $WMP_Uploads = $this->get_uploads_manager();
- $icon_path = $WMP_Uploads->get_file_url($icon_path);
- }
+ $base_path = $icon_path;
+ $arr_manifest['icons'] = array();
+ $WMP_Uploads = $this->get_uploads_manager();
- // set icon depending on the manifest file type
- if ($icon_path != '') {
+ foreach (WMobilePack_Uploads::$manifest_sizes as $manifest_size) {
- if ($_GET['content'] == 'androidmanifest') {
+ $icon_path = $WMP_Uploads->get_file_url($manifest_size . $base_path);
- $arr_manifest['icons'] = array(
- array(
- "src" => $icon_path,
- "sizes" => "192x192"
- )
- );
+ if ($icon_path != '') {
+
+ $arr_manifest['icons'][] = array(
+ "src" => $icon_path,
+ "sizes" => $manifest_size . 'x' . $manifest_size,
+ "type" => "image/png"
+ );
+ }
+
+ }
+ } elseif ($icon_path != '') {
+ $WMP_Uploads = $this->get_uploads_manager();
+
+ $icon_path = $WMP_Uploads->get_file_url($icon_path);
+
+ if ($icon_path != '') {
+
+ $arr_manifest['icons'] = array(
+ '152' => $icon_path,
+ );
+ }
+ }
- } else {
- $arr_manifest['icons'] = array(
- '152' => $icon_path,
- );
- }
- }
return json_encode($arr_manifest);
diff --git a/plugins/wordpress-mobile-pack/export/class-export.php b/plugins/wordpress-mobile-pack/export/class-export.php
index 98f91e14..9e2fb424 100755
--- a/plugins/wordpress-mobile-pack/export/class-export.php
+++ b/plugins/wordpress-mobile-pack/export/class-export.php
@@ -463,32 +463,6 @@ if ( ! class_exists( 'WMobilePack_Export' ) ) {
return $comment_status;
}
- /**
- * Filter for export_categories.
- * It only retrieves categories with published, not password protected posts.
- *
- * @param $terms
- * @param $taxonomies
- * @param $args
- */
- public function get_terms_filter($terms, $taxonomies, $args)
- {
- global $wpdb;
-
- $taxonomy = $taxonomies[0];
- if (!is_array($terms) && count($terms) < 1)
- return $terms;
-
- $filtered_terms = array();
- foreach ($terms as $term){
- $result = $wpdb->get_var("SELECT * FROM $wpdb->posts p JOIN $wpdb->term_relationships rl ON p.ID = rl.object_id WHERE rl.term_taxonomy_id = $term->term_id AND p.post_type = 'post' AND p.post_status = 'publish' AND p.post_password = '' LIMIT 1");
- if (intval($result) > 0)
- $filtered_terms[] = $term;
- }
-
- return $filtered_terms;
- }
-
/**
*
* The export_categories method is used for exporting every category with a fixed number of articles.
@@ -566,11 +540,9 @@ if ( ! class_exists( 'WMobilePack_Export' ) ) {
if (isset($_GET["withArticles"]) && is_numeric($_GET["withArticles"]))
$with_articles = $_GET["withArticles"];
- // add the filter for exporting only categories with published posts
- add_filter('get_terms', array($this, 'get_terms_filter'), 10, 3);
// get categories that have posts
- $categories = get_terms('category', 'hide_empty=1');
+ $categories = get_categories(array('hide_empty' => 1));
// build array with the active categories ids
$active_categories_ids = array();
@@ -606,9 +578,6 @@ if ( ! class_exists( 'WMobilePack_Export' ) ) {
}
}
- // remove the filter for exporting only categories with published posts
- remove_filter('get_terms', array($this, 'get_terms_filter'), 10);
-
// activate latest category only if we have at least 2 visible categories
if (count($arr_categories) > 1) {
@@ -697,6 +666,14 @@ if ( ! class_exists( 'WMobilePack_Export' ) ) {
}
}
}
+
+ foreach ($arr_categories as $key => $arr_category) {
+ if (!isset($arr_category['articles']) || empty($arr_category['articles'])) {
+ unset($arr_categories[$key]);
+ }
+ }
+
+ $arr_categories = array_values($arr_categories);
}
if ($page && $rows) {
@@ -1416,7 +1393,7 @@ if ( ! class_exists( 'WMobilePack_Export' ) ) {
if (isset($_GET["page"]) && is_numeric($_GET["page"])) {
$pagination = $_GET["page"];
}
-
+
$rows = false;
if (isset($_GET["rows"]) && is_numeric($_GET["rows"])){