Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
andrelopez committed Mar 15, 2018
2 parents dbb1f94 + e27d6ff commit 8a08c6b
Show file tree
Hide file tree
Showing 22 changed files with 828 additions and 945 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Enupal Snapshot Changelog

## 1.0.0 - 2018-01-24
## 1.0.1 - 2018.03.15
### Fixed
- Fixed deprecation errors

## 1.0.0 - 2018.01.24
### Added
- Initial release
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://enupal.com/en/craft-plugins/enupal-snapshot/docs/" target="_blank">
<img width="312" height="312" src="https://enupal.com/assets/docs/snapshot-icon.svg" alt="Enupal Snapshot"></a>
<img width="212" height="212" src="https://enupal.com/assets/docs/snapshot-icon.svg" alt="Enupal Snapshot"></a>
</p>

# Enupal Snapshot Plugin for Craft CMS 3.x
Expand Down Expand Up @@ -41,19 +41,24 @@ PDF or Image generation from a URL or HTML page easily. It uses the excellent we
}
%}
{{ craft.enupalsnapshot.displayHtml("<h1>Hello world!</h1>", settings) }}
{% set url = craft.enupalsnapshot.displayHtml("<h1>Hello world!</h1>", settings) %}
<a target="_blank" href="{{url}}"> Download Pdf</a>
```

### Download url as an Image

```twig
{% set settings = {
filename: 'my-first-image.png',
asImage: true,
asImage: true
}
%}
{{ craft.enupalsnapshot.displayHtml("<h1>Hello world!</h1>", settings) }}
{% set url = craft.enupalsnapshot.displayHtml("<h1>Hello world!</h1>", settings) %}
<a target="_blank" href="{{url}}"> Download Image</a>
```

### Display the Pdf in browser from Urls
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "enupal/snapshot",
"description": "PDF or Image generation from a Url or HTML page",
"type": "craft-plugin",
"version": "1.0.0",
"version": "1.0.1",
"keywords": [
"craft",
"cms",
Expand Down
158 changes: 79 additions & 79 deletions src/Snapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,83 +32,83 @@
*/
class Snapshot extends Plugin
{
// Static Properties
// =========================================================================

/**
* @var Snapshot
*/
public static $app;

// Public Methods
// =========================================================================

/**
* @inheritdoc
*/
public function init()
{
parent::init();
self::$app = $this->get('app');

Event::on(
CraftVariable::class,
CraftVariable::EVENT_INIT,
function (Event $event) {
/** @var CraftVariable $variable */
$variable = $event->sender;
$variable->set('enupalsnapshot', SnapshotVariable::class);
}
);
}

// Protected Methods
// =========================================================================

/**
* @inheritdoc
*/
protected function createSettingsModel()
{
return new Settings();
}

/**
* @inheritdoc
*/
protected function settingsHtml(): string
{
return Craft::$app->view->renderTemplate(
'enupal-snapshot/settings',
[
'settings' => $this->getSettings()
]
);
}

/**
* @param string $message
* @param array $params
*
* @return string
*/
public static function t($message, array $params = [])
{
return Craft::t('enupal-snapshot', $message, $params);
}

public static function log($message, $type = 'info')
{
Craft::$type(self::t($message), __METHOD__);
}

public static function info($message)
{
Craft::info(self::t($message), __METHOD__);
}

public static function error($message)
{
Craft::error(self::t($message), __METHOD__);
}
// Static Properties
// =========================================================================

/**
* @var Snapshot
*/
public static $app;

// Public Methods
// =========================================================================

/**
* @inheritdoc
*/
public function init()
{
parent::init();
self::$app = $this->get('app');

Event::on(
CraftVariable::class,
CraftVariable::EVENT_INIT,
function(Event $event) {
/** @var CraftVariable $variable */
$variable = $event->sender;
$variable->set('enupalsnapshot', SnapshotVariable::class);
}
);
}

// Protected Methods
// =========================================================================

/**
* @inheritdoc
*/
protected function createSettingsModel()
{
return new Settings();
}

/**
* @inheritdoc
*/
protected function settingsHtml(): string
{
return Craft::$app->view->renderTemplate(
'enupal-snapshot/settings',
[
'settings' => $this->getSettings()
]
);
}

/**
* @param string $message
* @param array $params
*
* @return string
*/
public static function t($message, array $params = [])
{
return Craft::t('enupal-snapshot', $message, $params);
}

public static function log($message, $type = 'info')
{
Craft::$type(self::t($message), __METHOD__);
}

public static function info($message)
{
Craft::info(self::t($message), __METHOD__);
}

public static function error($message)
{
Craft::error(self::t($message), __METHOD__);
}
}
48 changes: 0 additions & 48 deletions src/assetbundles/snapshot/SnapshotAsset.php

This file was deleted.

11 changes: 0 additions & 11 deletions src/assetbundles/snapshot/dist/css/Pdf.css

This file was deleted.

52 changes: 0 additions & 52 deletions src/assetbundles/snapshot/dist/img/Pdf-icon.svg

This file was deleted.

11 changes: 0 additions & 11 deletions src/assetbundles/snapshot/dist/js/Pdf.js

This file was deleted.

Loading

0 comments on commit 8a08c6b

Please sign in to comment.