Skip to content

Commit

Permalink
Updates for Flextype 0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Awilum committed May 21, 2018
1 parent c3e08a8 commit 4ae6b70
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,6 @@
# v1.2.0, 2018-05-21
* Updates for Flextype 0.4.1

# v1.1.0, 2018-05-07
* Updates for Flextype 0.3.0

Expand Down
2 changes: 1 addition & 1 deletion README.md
@@ -1,5 +1,5 @@
# Summary Plugin for [Flextype](http://flextype.org/)
![version](https://img.shields.io/badge/version-1.1.0-brightgreen.svg?style=flat-square "Version")
![version](https://img.shields.io/badge/version-1.2.0-brightgreen.svg?style=flat-square "Version")
![Flextype](https://img.shields.io/badge/Flextype-0.x-green.svg?style=flat-square "Flextype Version")
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/flextype-plugins/summary/blob/master/LICENSE.txt)

Expand Down
14 changes: 9 additions & 5 deletions summary.php
@@ -1,4 +1,4 @@
<?php namespace Flextype;
<?php

/**
*
Expand All @@ -11,17 +11,21 @@
* file that was distributed with this source code.
*/

namespace Flextype;

use Flextype\Component\Event\Event;

//
// Add listner for onPageContentAfter event
//
Event::addListener('onPageContentAfter', function () {
if (($pos = strpos(Pages::$page['content'], "<!--more-->")) === false) {
$page = Content::getCurrentPage();

if (($pos = strpos($page['content'], "<!--more-->")) === false) {

} else {
$page_content = explode("<!--more-->", Pages::$page['content']);
Pages::$page['summary'] = Event::dispatch('content', ['content' => Pages::parseContent($page_content[0])], true);
Pages::$page['content'] = Event::dispatch('content', ['content' => Pages::parseContent($page_content[0].$page_content[1])], true);
$page_content = explode("<!--more-->", $page['content']);
Content::updateCurrentPage('summary', Content::processContent($page_content[0]));
Content::updateCurrentPage('content', Content::processContent($page_content[0].$page_content[1]));
}
});
2 changes: 1 addition & 1 deletion summary.yaml
@@ -1,5 +1,5 @@
name: Summary
version: 1.1.0
version: 1.2.0
description: "Summary plugin will search tag: <!--more--> in the page content and will create summary text."
author:
name: Sergey Romanenko
Expand Down

0 comments on commit 4ae6b70

Please sign in to comment.