/**
 * execute droplets
 * @param string $content
 * @return string 
 */
function doFilterDroplets($content)
{
    if (file_exists(WB_PATH . '/modules/droplets/droplets.php')) {
        include_once WB_PATH . '/modules/droplets/droplets.php';
        if (function_exists('evalDroplets')) {
            $content = evalDroplets($content);
        }
    }
    return $content;
}
/**
 * execute droplets
 * @copyright       Manuela v.d.Decken <*****@*****.**>
 * @author          Manuela v.d.Decken <*****@*****.**>
 * @param string $content
 * @return string
 */
function doFilterDroplets($content)
{
    $aFilterSettings = getOutputFilterSettings();
    $key = preg_replace('=^.*?filter([^\\.\\/\\\\]+)(\\.[^\\.]+)?$=is', '\\1', __FILE__);
    if ($aFilterSettings[$key]) {
        if (file_exists(WB_PATH . '/modules/droplets/droplets.php')) {
            include_once WB_PATH . '/modules/droplets/droplets.php';
            if (function_exists('evalDroplets')) {
                $content = evalDroplets($content);
            }
        }
    }
    return $content;
}
/**
 * execute droplets
 * @param string $content
 * @return string 
 */
function doFilterDroplets($content)
{
    // check file and include
    if (file_exists(WB_PATH . '/modules/droplets/droplets.php')) {
        include_once WB_PATH . '/modules/droplets/droplets.php';
        // remove <p> tags that are added by CKE editor every time you
        // have a droplet in an empty line
        if (strpos($content, '<p>[[') !== false) {
            $content = str_replace('<p>[[', '[[', $content);
            $content = str_replace(']]</p>', ']]', $content);
        }
        // load filter function
        if (function_exists('evalDroplets')) {
            $content = evalDroplets($content, 'frontend');
        }
    }
    return $content;
}
Ejemplo n.º 4
0
 /**
  *	Print the admin backend footer
  *
  */
 public function print_footer()
 {
     $footer_vars = array('BACKEND_BODY_MODULE_JS' => get_page_footers('backend'), 'LEPTON_URL' => LEPTON_URL, 'LEPTON_PATH' => LEPTON_PATH, 'ADMIN_URL' => ADMIN_URL, 'THEME_URL' => THEME_URL);
     echo $this->parser->render("@theme/footer.lte", $footer_vars);
     /**
      *	Droplet support
      *
      */
     $this->html_output_storage = ob_get_clean();
     if (true === $this->droplets_ok) {
         $this->html_output_storage = evalDroplets($this->html_output_storage);
     }
     // CSRF protection - add tokens to internal links
     if ($this->is_authenticated()) {
         if (file_exists(LEPTON_PATH . '/framework/functions/function.addTokens.php')) {
             include_once LEPTON_PATH . '/framework/functions/function.addTokens.php';
             if (function_exists('addTokens')) {
                 addTokens($this->html_output_storage, $this);
             }
         }
     }
     echo $this->html_output_storage;
 }
Ejemplo n.º 5
0
 public function get_news()
 {
     if (false === $this->got_news_module) {
         return NULL;
     }
     if (true === $this->evalDroplets) {
         include_once LEPTON_PATH . '/modules/droplets/droplets.php';
     }
     $fields = array('post_id', 'title', 'link', 'content_short', 'published_when');
     $all_news = array();
     $this->db->execute_query("SELECT * FROM `" . TABLE_PREFIX . "mod_news_posts` WHERE " . ($this->group > -1 ? "group_id = " . $this->group . " and " : "") . "active = 1 ORDER BY position DESC LIMIT 0," . $this->limit, true, $all_news);
     $base_path = LEPTON_PATH . MEDIA_DIRECTORY . "/newspics/";
     $base_url = LEPTON_URL . MEDIA_DIRECTORY . "/newspics/";
     foreach ($all_news as &$ref) {
         if (file_exists($base_path . "image" . $ref['post_id'] . ".jpg")) {
             $ref['img'] = $base_url . "image" . $ref['post_id'] . ".jpg";
         }
         $ref['link'] = LEPTON_URL . PAGES_DIRECTORY . $ref['link'] . PAGE_EXTENSION;
         if (true === $this->evalDroplets) {
             evalDroplets($ref['content_short']);
         }
         $this->clean_up_content($ref['content_short']);
         if ($this->max_chars > 0) {
             $match = array();
             if (strlen($ref['content_short']) > $this->max_chars) {
                 if (preg_match('/.{0,' . $this->max_chars . '}/su', $ref['content_short'], $match)) {
                     $ref['content_short'] = $match[0];
                 }
             }
         }
     }
     $vars = array('LEPTON_URL' => LEPTON_URL, 'PAGES_DIRECTORY' => PAGES_DIRECTORY, 'PAGE_EXTENSION' => PAGE_EXTENSION, 'readmore' => "read more ...", 'news_header' => "News", 'all_news' => $all_news);
     return $this->parser->render('@zenlike_news/zenlike_news.lte', $vars);
 }
Ejemplo n.º 6
0
// loop through the topics
while (false !== ($topic = $query->fetchRow())) {
    $topic_link = WB_URL . $topics_virtual_directory . $topic['link'] . PAGE_EXTENSION;
    $rfcdate = date('D, d M Y H:i:s O', (int) $topic["published_when"]);
    if ($last_publishing_date < (int) $topic['published_when']) {
        $last_publishing_date = (int) $topic['published_when'];
    }
    $title = stripslashes($topic["title"]);
    $content = stripslashes($topic["content_short"]);
    // we don't want any dbGlossary entries here...
    $content = str_replace('||', '', $content);
    if (file_exists(WB_PATH . '/modules/droplets/droplets.php')) {
        // we must process the droplets to get the real output content
        include_once WB_PATH . '/modules/droplets/droplets.php';
        if (function_exists('evalDroplets')) {
            $content = evalDroplets($content);
        }
    }
    if (!empty($topic['picture'])) {
        // add a image to the content
        $img_url = $picture_url . $topic['picture'];
        $content = <<<EOD
<div>
  <img style="float:left;width:{$image_width_px};height:auto;margin:0;padding:0 20px 20px 0;" src="{$img_url}" width="{$image_width}" alt="{$title}" />
  {$content}
</div>
EOD;
    }
    // image
    // add the topic to the $topics placeholder
    $topics .= <<<EOD
Ejemplo n.º 7
0
</guid>
			<link><?php 
    echo LEPTON_URL . PAGES_DIRECTORY . $item["link"] . PAGE_EXTENSION;
    ?>
</link>
			<pubDate><?php 
    echo date('D, d M Y H:i:s O', $item["published_when"]);
    ?>
</pubDate>
		</item>
<?php 
}
?>
	</channel>
</rss>

<?php 
$output = ob_get_contents();
if (ob_get_length() > 0) {
    ob_end_clean();
}
// wb->preprocess() -- replace all [wblink123] with real, internal links
$wb->preprocess($output);
// Load Droplet engine and process
if (file_exists(LEPTON_PATH . '/modules/droplets/droplets.php')) {
    include_once LEPTON_PATH . '/modules/droplets/droplets.php';
    if (function_exists('evalDroplets')) {
        evalDroplets($output);
    }
}
echo $output;
Ejemplo n.º 8
0
 /**
  * Returns the URL of the first image found in a WYSIWYG section
  *
  * @param INT $page_id
  * @return STR URL oder BOOL FALSE
  */
 public static function getFirstImageFromContent($page_id, $exec_droplets = true)
 {
     $self = self::getInstance();
     $img = array();
     $__CAT_Helper_Droplets_content = '';
     $section = CAT_Sections::getSectionsByType($page_id);
     if (count($section)) {
         $SQL = "SELECT `content` FROM `:prefix:mod_wysiwyg` WHERE `section_id`=:id";
         $params = array('id' => $section[0]['section_id']);
         $result = $self->db()->query($SQL, $params)->fetchColumn();
         if ($self->db()->isError()) {
             return false;
         }
         if (is_string($result)) {
             $__CAT_Helper_Droplets_content = self::unsanitizeText($result);
         }
     }
     if (!empty($__CAT_Helper_Droplets_content)) {
         // scan content for images
         if ($exec_droplets && file_exists(CAT_Helper_Directory::sanitizePath(CAT_PATH . '/modules/droplets/droplets.php'))) {
             // we must process the droplets to get the real output content
             $_SESSION['DROPLET_EXECUTED_BY_DROPLETS_EXTENSION'] = true;
             ob_start();
             include_once CAT_Helper_Directory::sanitizePath(CAT_PATH . '/modules/droplets/droplets.php');
             if (function_exists('evalDroplets')) {
                 try {
                     $__CAT_Helper_Droplets_content = evalDroplets($__CAT_Helper_Droplets_content);
                 } catch (Exception $e) {
                     trigger_error(sprintf('[%s - %s] %s', __FUNCTION__, __LINE__, $e->getMessage()), E_USER_ERROR);
                 }
             }
             ob_end_clean();
             unset($_SESSION['DROPLET_EXECUTED_BY_DROPLETS_EXTENSION']);
         }
         if (preg_match('/<img[^>]*>/', $__CAT_Helper_Droplets_content, $matches)) {
             preg_match_all('/([a-zA-Z]*[a-zA-Z])\\s{0,3}[=]\\s{0,3}("[^"\\r\\n]*)"/', $matches[0], $attr);
             foreach ($attr as $attributes) {
                 foreach ($attributes as $attribut) {
                     if (strpos($attribut, "=") !== false) {
                         list($key, $value) = explode("=", $attribut);
                         $value = trim($value);
                         $value = substr($value, 1, strlen($value) - 2);
                         $img[strtolower(trim($key))] = trim($value);
                     }
                 }
             }
         }
     }
     if (isset($img['src'])) {
         $image = $img['src'];
         if (strpos($image, '..') !== false) {
             $image = substr($image, strpos($image, MEDIA_DIRECTORY . '/'));
             $image = CAT_URL . $image;
         }
         return $image;
     } else {
         return false;
     }
 }
Ejemplo n.º 9
0
 /**
  *	Print the admin backend footer
  *
  */
 public function print_footer()
 {
     $footer_template = new Template(THEME_PATH . '/templates');
     $footer_template->set_file('page', 'footer.htt');
     $footer_template->set_block('page', 'footer_block', 'header');
     $footer_template->set_var(array('BACKEND_BODY_MODULE_JS' => get_page_footers('backend'), 'LEPTON_URL' => LEPTON_URL, 'LEPTON_PATH' => LEPTON_PATH, 'ADMIN_URL' => ADMIN_URL, 'THEME_URL' => THEME_URL));
     $footer_template->parse('header', 'footer_block', false);
     $footer_template->pparse('output', 'page');
     /**
      *	Droplet support
      *
      */
     $this->html_output_storage = ob_get_clean();
     if (true === $this->droplets_ok) {
         $this->html_output_storage = evalDroplets($this->html_output_storage);
     }
     // CSRF protection - add tokens to internal links
     if ($this->is_authenticated()) {
         if (file_exists(LEPTON_PATH . '/framework/functions/function.addTokens.php')) {
             include_once LEPTON_PATH . '/framework/functions/function.addTokens.php';
             if (function_exists('addTokens')) {
                 addTokens($this->html_output_storage, $this);
             }
         }
     }
     echo $this->html_output_storage;
 }