<?php /** * Morfy Feed Plugin * * (c) Romanenko Sergey / Awilum <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ if (Url::getUriSegment(0) == 'rss') { Morfy::factory()->addAction('before_render', function () { $fenom = Fenom::factory(PLUGINS_PATH . '/feed/templates/', CACHE_PATH . '/fenom/', Morfy::$fenom); $fenom->setOptions(array("strip" => false)); Response::status(200); Request::setHeaders('Content-Type: text/xml; charset=utf-8'); $fenom->display('rss.tpl', array('page' => Morfy::factory()->getPage(Morfy::$plugins['feed']['page']), 'pages' => Morfy::factory()->getPages(Morfy::$plugins['feed']['page'], 'date', 'DESC', array('404')))); Request::shutdown(); }); }
* * @package Morfy * @subpackage Plugins * @author Pavel Belousov / pafnuty * @copyright 2014 - 2015 Romanenko Sergey / Awilum * @version 1.0.0 * */ /** * Add to config.php * 'parsedown' => array( * 'extra' => true, // Enable parsedownExtra * 'autoLink' => true, // Enable automatic convertation url to link * ), */ require_once PLUGINS_PATH . '/parsedown/Parsedown/Parsedown.php'; if (Morfy::$config['parsedown']['extra']) { require_once PLUGINS_PATH . '/parsedown/Parsedown-extra/ParsedownExtra.php'; } Morfy::factory()->addFilter('content', 'parseMdText', 1); function parseMdText($content) { $parseDownConfig = Morfy::$config['parsedown']; if ($parseDownConfig['extra']) { $Parsedown = new ParsedownExtra(); } else { $Parsedown = new Parsedown(); } $Parsedown->setUrlsLinked($parseDownConfig['autoLink']); return $Parsedown->text($content); }
<?php /** * Morfy Sitemap Plugin * * (c) Romanenko Sergey / Awilum <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ if (Url::getUriSegment(0) == 'sitemap.xml') { Morfy::factory()->addAction('before_render', function () { $fenom = Fenom::factory(PLUGINS_PATH . '/sitemap/templates/', CACHE_PATH . '/fenom/', Morfy::$fenom); $fenom->setOptions(array("strip" => false)); $pages = Morfy::factory()->getPages('', 'date', 'DESC', array('404')); Response::status(200); Request::setHeaders('Content-Type: text/xml; charset=utf-8'); $fenom->display('sitemap.tpl', array('pages' => $pages)); Request::shutdown(); }); }
/** * Sitemap plugin * * @package Morfy * @subpackage Plugins * @author Romanenko Sergey / Awilum * @copyright 2014 - 2015 Romanenko Sergey / Awilum * @version 1.0.0 * */ if (Morfy::factory()->getUrl() == 'sitemap.xml') { Morfy::factory()->addAction('before_render', function () { header($_SERVER['SERVER_PROTOCOL'] . ' 200 OK'); header("Content-Type: text/xml; charset=utf-8"); echo '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $pages = Morfy::factory()->getPages(CONTENT_PATH, 'date', 'DESC', array('404')); foreach ($pages as $page) { echo '<url> <loc>' . $page['url'] . '</loc> <lastmod>' . $page['date'] . '</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url>'; } echo ' </urlset> '; exit; }); }
/** * Check that the given token matches the currently stored security token. * * <code> * if (Morfy::factory()->checkToken($token)) { * // Pass * } * </code> * * @param string $token token to check * @return boolean */ public function checkToken($token) { return Morfy::factory()->generateToken() === $token; }
define('PLUGINS_PATH', ROOT_DIR . '/plugins'); /** * Define the path to the cache directory (without trailing slash). */ define('CACHE_PATH', ROOT_DIR . '/cache'); /** * Define the path to the config directory (without trailing slash). */ define('CONFIG_PATH', ROOT_DIR . '/config'); /** * Load Morfy */ require LIBRARIES_PATH . '/Morfy/Morfy.php'; /** * First check for installer then go */ if (file_exists('install.php')) { if (isset($_GET['install']) && $_GET['install'] == 'done') { // Try to delete install file if not DELETE MANUALLY !!! @unlink('install.php'); // Redirect to main page header('location: index.php'); } else { include 'install.php'; } } else { /** * Run Morfy Application */ Morfy::factory()->run(); }
define('LIBRARIES_PATH', ROOT_DIR . '/libraries'); /** * Define the path to the themes directory (without trailing slash). */ define('THEMES_PATH', ROOT_DIR . '/themes'); /** * Define the path to the plugins directory (without trailing slash). */ define('PLUGINS_PATH', ROOT_DIR . '/plugins'); /** * Load Morfy */ require LIBRARIES_PATH . '/Morfy/Morfy.php'; /** * First check for installer then go */ if (file_exists('install.php')) { if (isset($_GET['install']) && $_GET['install'] == 'done') { // Try to delete install file if not DELETE MANUALLY !!! @unlink('install.php'); // Redirect to main page header('location: index.php'); } else { include 'install.php'; } } else { /** * Run Morfy Application */ Morfy::factory()->run('config.php'); }
<?php /** * Markdown plugin * * @package Morfy * @subpackage Plugins * @author Romanenko Sergey / Awilum * @copyright 2014 - 2015 Romanenko Sergey / Awilum * @version 1.0.0 * */ use Michelf\MarkdownExtra; include PLUGINS_PATH . '/markdown/php-markdown/Michelf/Markdown.php'; include PLUGINS_PATH . '/markdown/php-markdown/Michelf/MarkdownExtra.php'; Morfy::factory()->addFilter('content', 'markdown', 1); function markdown($content) { return MarkdownExtra::defaultTransform($content); }