diff --git a/issuu-panel.php b/issuu-panel.php index a89f2dd..41c2433 100644 --- a/issuu-panel.php +++ b/issuu-panel.php @@ -3,7 +3,7 @@ Plugin Name: Issuu Panel Plugin URI: https://github.com/issuu/issuu-panel Description: Admin panel for Issuu. You can upload your documents, create folders and embed documents in posts. -Version: 2.0.1 +Version: 2.1.0 Author: Pedro Marcelo and Issuu Author URI: https://issuu.com License: GPL3 @@ -11,7 +11,7 @@ if (defined('ISSUU_PANEL_VERSION')) { - switch (version_compare(ISSUU_PANEL_VERSION, '2.0.1')) { + switch (version_compare(ISSUU_PANEL_VERSION, '2.1.0')) { case -1: wp_die("A lower version of Issuu Panel plugin is already installed"); break; @@ -30,7 +30,7 @@ |-------------------------------------- */ -define('ISSUU_PANEL_VERSION', '2.0.1'); +define('ISSUU_PANEL_VERSION', '2.1.0'); define('ISSUU_PANEL_DIR', plugin_dir_path(__FILE__)); define('ISSUU_PANEL_URL', plugin_dir_url(__FILE__)); define('ISSUU_PANEL_PREFIX', 'issuu_painel_'); diff --git a/issuuservice-lib/lib/class.issuufolder.php b/issuuservice-lib/lib/class.issuufolder.php index 04f43e4..a3815b3 100644 --- a/issuuservice-lib/lib/class.issuufolder.php +++ b/issuuservice-lib/lib/class.issuufolder.php @@ -77,23 +77,50 @@ protected function returnSingleResult($params) $stackId = $params['folderId']; $this->setParams($params); - $response = $this->curlRequest( + $response_stack = $this->curlRequest( $this->getApiUrl('/stacks/'.$stackId), array(), $this->headers ); - $response = json_decode($response, true); + $response_stack = json_decode($response_stack, true); - if(isset($response['id'])) + if(isset($response_stack['id'])) { $result['stat'] = 'ok'; - $result['stack'] = $this->clearObjectJson($response); + $result['stack'] = $this->clearObjectJson($response_stack); + + // get stack items + $response_stack_items = $this->curlRequest( + $this->getApiUrl('/stacks/'.$stackId.'/items'), + array( + 'includeUnlisted' => 'true', + ), + $this->headers + ); + $response_stack_items = json_decode($response_stack_items, true); + + $stack_items = $this->clearObjectJson($response_stack_items)->results; + // get data from each document + foreach($stack_items as $item) + { + $result_document = $this->curlRequest( + $this->getApiUrl('/publications/'.$item), + array(), + $this->headers + ); + + $document = json_decode($result_document, true); + $document = $this->clearObjectJson($document); + $documents[] = $document; + } + + $result['documents'] = $documents; return $result; } else { - return $this->returnErrorJson($response); + return $this->returnErrorJson($response_stack); } } @@ -212,6 +239,16 @@ protected function clearObjectJson($folder) { $fold = (object) $folder; + if(isset($doc->cover['small'])) { + $fold->coverImage = $fold->cover['small']['url']; + } + if(isset($fold->cover['medium'])) { + $fold->coverImage = $fold->cover['medium']['url']; + } + if(isset($fold->cover['large'])) { + $fold->coverImage = $fold->cover['large']['url']; + } + return $fold; } diff --git a/menu/folder/config.php b/menu/folder/config.php index 52d01ba..4088051 100644 --- a/menu/folder/config.php +++ b/menu/folder/config.php @@ -45,7 +45,6 @@ private function addPage() private function updatePage() { $issuuFolder = $this->getConfig()->getIssuuServiceApi('IssuuFolder'); - $issuuBookmark = $this->getConfig()->getIssuuServiceApi('IssuuBookmark'); $folderId = filter_input(INPUT_GET, 'folder'); $folder = $issuuFolder->getUpdateData(array('folderId' => $folderId)); $params = $issuuFolder->getParams(); @@ -56,10 +55,10 @@ private function updatePage() if ($folder['stat'] == 'ok') { - $bookmarks = $issuuBookmark->issuuList(array('folderId' => $folderId)); + $folders_documents = $folder['documents']; $folder = $folder['stack']; $image = 'https://image.issuu.com/%s/jpg/page_1_thumb_large.jpg'; - include(ISSUU_PANEL_DIR . 'menu/folder/forms/update.php'); + include(ISSUU_PANEL_DIR . 'menu/folder/forms/update.php'); } else { diff --git a/menu/folder/forms/update.php b/menu/folder/forms/update.php index 688443e..09fa4cb 100644 --- a/menu/folder/forms/update.php +++ b/menu/folder/forms/update.php @@ -33,18 +33,18 @@ - +

Shortcode

+ value='[issuu-panel-folder-list id="id; ?>"]'>
- +

- +
- +

title ?>

diff --git a/readme.txt b/readme.txt index c99d0f3..7e31444 100644 --- a/readme.txt +++ b/readme.txt @@ -105,6 +105,9 @@ You can send the translation by e-mail. Send for indri@issuu.com == Changelog == += 2.1.0 = +* Updated: show documents information inside folders + = 2.0.1 = * Updated: allow customizing show detected links option while creating and editing documents