diff --git a/README.md b/README.md index 20fe263..6cca212 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Evernote Cloud SDK 2.0 for PHP (beta) +Evernote Cloud SDK PHP v2.0.2 ===================================== A newly-redesigned, simple, workflow-oriented library built on the Evernote Cloud API. It's designed to drop into your web app easily and make most common Evernote integrations very simple to accomplish. (And even the more complex integrations easier than they used to be.) @@ -12,7 +12,7 @@ Just run these two commands to install it: ``` bash $ curl -sS https://getcomposer.org/installer | php -$ php composer.phar require evernote/evernote-cloud-sdk-php dev-master +$ php composer.phar require evernote/evernote-cloud-sdk-php ``` Now you can add the autoloader, and you will have access to the library: diff --git a/composer.json b/composer.json index 3e388fc..c22704a 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "sdk" ], "homepage": "https://github.com/evernote/evernote-cloud-sdk-php", - "version": "2.0", + "version": "2.0.2", "license": "Apache", "authors": [ { @@ -23,8 +23,8 @@ }, "require": { "php": ">=5.3", - "ezyang/htmlpurifier": "~4.6.0", - "tijsverkoyen/css-to-inline-styles": "~1.5", + "ezyang/htmlpurifier": "^4.6.0", + "tijsverkoyen/css-to-inline-styles": "~2.2", "psr/log": "~1.0" }, "autoload": { diff --git a/src/Evernote/Auth/OauthHandler.php b/src/Evernote/Auth/OauthHandler.php index b276b65..4c64df5 100644 --- a/src/Evernote/Auth/OauthHandler.php +++ b/src/Evernote/Auth/OauthHandler.php @@ -44,9 +44,12 @@ public function authorize($consumer_key, $consumer_secret, $callback) $this->consumer_secret = $consumer_secret; + if (session_status() == PHP_SESSION_NONE) { + session_start(); + } + // first call if (!array_key_exists('oauth_verifier', $_GET) && !array_key_exists('oauth_token', $_GET)) { - session_start(); unset($this->params['oauth_token']); unset($this->params['oauth_verifier']); @@ -68,7 +71,6 @@ public function authorize($consumer_key, $consumer_secret, $callback) throw new AuthorizationDeniedException('Authorization declined.'); //the user authorized the app } else { - session_start(); $this->token_secret = $_SESSION['oauth_token_secret']; $this->params['oauth_token'] = $_GET['oauth_token']; diff --git a/src/Evernote/Enml/Converter/HtmlToEnmlConverter.php b/src/Evernote/Enml/Converter/HtmlToEnmlConverter.php index d450728..1a6da37 100644 --- a/src/Evernote/Enml/Converter/HtmlToEnmlConverter.php +++ b/src/Evernote/Enml/Converter/HtmlToEnmlConverter.php @@ -44,7 +44,7 @@ public function convertToEnml($content, $base_url = null) $content = $this->cleanHtml($content); //Transform to ENML via XSLT - $enml_body = $this->xslTransform($content, 'html2enml.xslt'); + $enml_body = $this->xslTransform($content, __DIR__ . '/html2enml.xslt'); $enml = << diff --git a/src/Evernote/Model/EnmlNoteContent.php b/src/Evernote/Model/EnmlNoteContent.php index b387bee..fbbfa94 100644 --- a/src/Evernote/Model/EnmlNoteContent.php +++ b/src/Evernote/Model/EnmlNoteContent.php @@ -11,8 +11,12 @@ class EnmlNoteContent extends NoteContent implements NoteContentInterface public function __construct($content, HtmlConverterInterface $htmlConverter = null) { + if (!$this->hasDoctypeDeclaration($content)) { + $content = $this->addDoctypeDeclaration($content); + } + if (!$this->hasXmlDeclaration($content)) { - $content = $this->decorate($content); + $content = $this->addXmlDeclaration($content); } $this->content = $content; @@ -57,14 +61,27 @@ protected function hasXmlDeclaration($content) { return substr(trim($content), 0, 5) == ' +$content +ENML; + + } + + protected function addDoctypeDeclaration($content) + { + return << $content ENML; } -} \ No newline at end of file +}