Example #1
0
 /**
  * 
  * @return array
  */
 private function _getShortcodes()
 {
     $jsonFile = ZtShortcodesPath::getInstance()->getPath('Shortcodes://assets/shortcodes.json');
     if ($jsonFile) {
         return json_decode(file_get_contents($jsonFile), true);
     }
     return array();
 }
Example #2
0
 /**
  * 
  * @param string $className
  */
 public static function autoloadZo2Psr2($className)
 {
     if (substr($className, 0, 1) != 'J') {
         $path = ZtShortcodesPath::getInstance();
         $filePath = $path->getPathByClassname($className);
         if ($filePath) {
             return require_once $filePath;
         }
     }
     return false;
 }
Example #3
0
 /**
  * 
  * @return string
  */
 private function _getLatestIcons()
 {
     $path = ZtShortcodesPath::getInstance();
     $jsonAwesome = $path->getUrl('Shortcodes://assets/font-awesome/awesome.json');
     $bufferAwesome = file_get_contents($jsonAwesome);
     $listAwesome = json_decode($bufferAwesome);
     $html = '';
     $html .= '<div class="list-awesome-font"><ul>';
     foreach ($listAwesome as $key => $fontName) {
         $html .= '<li><a href="#"><i class="fa ' . $key . '"></i></a></li>';
     }
     $html .= '</ul></div>';
     return $html;
 }
Example #4
0
<?php 
$dir = JPath::clean(JPATH_ROOT . '/images/' . $options->get('dir'));
// Allowed filetypes
$allowedExtensions = array('jpg', 'png', 'gif');
// Also allow filetypes in uppercase
$allowedExtensions = array_merge($allowedExtensions, array_map('strtoupper', $allowedExtensions));
// Build the filter. Will return something like: "jpg|png|JPG|PNG|gif|GIF"
$filter = implode('|', $allowedExtensions);
$filter = "^.*\\.(" . implode('|', $allowedExtensions) . ")\$";
$files = JFolder::files($dir, $filter, false, true);
if (is_array($files)) {
    foreach ($files as $key => $image) {
        $image = JPath::clean($image);
        $images[$key]['src'] = ZtShortcodesPath::getInstance()->toUrl(ZtShortcodesHelperImage::getThumbnail($image, $options->get('width', 600), $options->get('height', 600), 'resized_'));
        $images[$key]['thumbnail'] = ZtShortcodesPath::getInstance()->toUrl(ZtShortcodesHelperImage::getThumbnail($image, $options->get('thumb-width', 300), $options->get('thumb-height', 300), 'thumb_'));
    }
}
$style = '';
if ($options->get('thumb-width') != '') {
    $style .= 'width: ' . $options->get('thumb-width') . 'px';
} elseif ($options->get('thumb-height') != '') {
    $style .= 'height: ' . $options->get('thumb-height') . 'px';
}
?>

<div class="zt-gallery zt-gallery-default clearfix">
    <?php 
if (!empty($images)) {
    ?>
        <?php 
Example #5
0
 * Zt Shortcodes
 * A powerful Joomla plugin to help effortlessly customize your own content and style without HTML code knowledge
 * 
 * @name        Zt Shortcodes
 * @version     2.0.0
 * @package     Plugin
 * @subpackage  System
 * @author      ZooTemplate 
 * @email       support@zootemplate.com 
 * @link        http://www.zootemplate.com 
 * @copyright   Copyright (c) 2015 ZooTemplate
 * @license     GPL v2 
 */
defined('_JEXEC') or die('Restricted access');
$root = rtrim(JUri::root(), '/');
$path = ZtShortcodesPath::getInstance();
$plugin = JPluginHelper::getPlugin('editors-xtd', 'ztshortcodes');
$params = new JRegistry($plugin->params);
$useEditor = $params->get('use_editor', false);
?>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="<?php 
echo $root . '/media/jui/js/bootstrap.min.js';
?>
"></script>
<script src="<?php 
echo $path->getUrl('Shortcodes://assets/js/shortcode.js');
?>
"></script>
<script src="<?php 
Example #6
0
 */
defined('_JEXEC') or die('Restricted access');
$dir = JPath::clean(JPATH_ROOT . '/images/' . $attributes->get('dir'));
// Allowed filetypes
$allowedExtensions = array('jpg', 'png', 'gif');
// Also allow filetypes in uppercase
$allowedExtensions = array_merge($allowedExtensions, array_map('strtoupper', $allowedExtensions));
// Build the filter. Will return something like: "jpg|png|JPG|PNG|gif|GIF"
$filter = implode('|', $allowedExtensions);
$filter = "^.*\\.(" . implode('|', $allowedExtensions) . ")\$";
$files = JFolder::files($dir, $filter, false, true);
if (is_array($files)) {
    foreach ($files as $key => $image) {
        $image = JPath::clean($image);
        $images[$key]['src'] = ZtShortcodesPath::getInstance()->toUrl(ZtShortcodesHelperImage::getThumbnail($image, $attributes->get('width', 600), $attributes->get('height', 600), 'resized_'));
        $images[$key]['thumbnail'] = ZtShortcodesPath::getInstance()->toUrl(ZtShortcodesHelperImage::getThumbnail($image, $attributes->get('thumbWidth', 300), $attributes->get('thumbHeight', 300), 'thumb_'));
    }
}
?>

<div class="zt-gallery zt-gallery-default clearfix">
    <?php 
if (!empty($images)) {
    ?>
    <?php 
    foreach ($images as $image) {
        ?>
            <a href="<?php 
        echo $image['src'];
        ?>
" class="ztshortcodes-gallery group1">
Example #7
0
 /**
  * Search content for shortcodes and filter shortcodes through their hooks.
  *
  * If there are no shortcode tags defined, then the content will be returned
  * without any filtering. This might cause issues when plugins are disabled but
  * the shortcode will still show up in the post or content.
  *
  * @since 2.5.0
  *
  * @uses $shortcode_tags
  *
  * @param string $content Content to search for shortcodes
  * @return string Content with shortcodes filtered out.
  */
 public function do_shortcode($content)
 {
     // Make sure we have at least open tag
     if (false === strpos($content, '[')) {
         return $content;
     }
     if (empty($this->shortcode_tags) || !is_array($this->shortcode_tags)) {
         return $content;
     }
     // Generate depends
     $depends = array();
     foreach ($this->_shortcodes as $tag => $data) {
         // If content has this shortcode than we check for depends
         if ($this->has_shortcode($content, $tag)) {
             // CSS
             if (!empty($this->_shortcodes[$tag]['depends']['css'])) {
                 foreach ($this->_shortcodes[$tag]['depends']['css'] as $css) {
                     if (strpos($css, 'Shortcodes://') === false) {
                         // Internal
                         if (strpos($css, 'http') == false) {
                             $depends['_css'][$css] = rtrim(JUri::root(true), '/') . $css;
                         } else {
                             $depends['_css'][$css] = $css;
                         }
                     } else {
                         // If we'r using key than we need convert to URL
                         $depends['_css'][$css] = ZtShortcodesPath::getInstance()->getUrl($css);
                     }
                 }
             }
             // JS
             if (!empty($this->_shortcodes[$tag]['depends']['js'])) {
                 foreach ($this->_shortcodes[$tag]['depends']['js'] as $js) {
                     if (strpos($js, 'Shortcodes://') === false) {
                         // Internal
                         if (strpos($js, 'http') == false) {
                             $depends['_js'][$js] = rtrim(JUri::root(true), '/') . $js;
                         } else {
                             $depends['_js'][$js] = $js;
                         }
                     } else {
                         // If we'r using key than we need convert to URL
                         $depends['_js'][$js] = ZtShortcodesPath::getInstance()->getUrl($js);
                     }
                 }
             }
         }
     }
     // Generate css depends
     if (!empty($depends['_css'])) {
         foreach ($depends['_css'] as $key => $url) {
             $buffer[] = '<link rel="stylesheet" type="text/css" href="' . $url . '">';
         }
     }
     // Generate js depends
     if (!empty($depends['_js'])) {
         foreach ($depends['_js'] as $key => $url) {
             $buffer[] = '<script src="' . $url . '"></script>';
         }
     }
     // Replace BBCode
     $pattern = $this->get_shortcode_regex();
     $html = preg_replace_callback("/{$pattern}/s", array($this, 'do_shortcode_tag'), $content);
     // Include depends to head if needed
     if (!empty($buffer)) {
         $buffer = implode(PHP_EOL, $buffer);
         $html = str_replace('</head>', $buffer . '</head>', $html);
     }
     return $html;
 }
Example #8
0
<?php

/**
 * Zt Shortcodes
 * A powerful Joomla plugin to help effortlessly customize your own content and style without HTML code knowledge
 * 
 * @name        Zt Shortcodes
 * @version     2.0.0
 * @package     Plugin
 * @subpackage  System
 * @author      ZooTemplate 
 * @email       support@zootemplate.com 
 * @link        http://www.zootemplate.com 
 * @copyright   Copyright (c) 2015 ZooTemplate
 * @license     GPL v2 
 */
defined('_JEXEC') or die('Restricted access');
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
// Global defines
require_once __DIR__ . '/defines.php';
// Core libraries
require_once __DIR__ . '/path.php';
require_once __DIR__ . '/loader.php';
ZtShortcodesPath::getInstance()->registerNamespace('Shortcodes', ZTSHORTCODES_CORE);
ZtShortcodesPath::getInstance()->registerNamespace('Shortcodes', ZTSHORTCODES_LOCAL);
/* Register Zo2 autoloading by Psr2 */
spl_autoload_register(array('ZtShortcodesLoader', 'autoloadZo2Psr2'));
Example #9
0
 /**
  * Constructor
  * @param object|array $properties
  */
 public function __construct($properties = null)
 {
     parent::__construct($properties);
     /* Init local variables */
     $this->_path = ZtShortcodesPath::getInstance();
 }