function processPage($text) { if ($this->getParam('img') == 1) { $text = preg_replace('#<img [^>]+>#is', '', $text); } elseif ($this->getParam('img') >= 2) { $scaletype = $this->getParam('img') - 2; $addstyles = (bool) $this->getParam('img_addstyles'); $text = MobileJoomla::RescaleImages($text, $scaletype, $addstyles); } if ($this->getParam('removetags')) { $text = preg_replace('#<object\\s[^>]+?/>#is', '', $text); $text = preg_replace('#<object\\s.+?</object>#is', '', $text); $text = preg_replace('#<embed\\s[^>]+?/>#is', '', $text); $text = preg_replace('#<embed.+?</embed>#is', '', $text); $text = preg_replace('#<applet\\s[^>]+?/>#is', '', $text); $text = preg_replace('#<applet\\s.+?</applet>#is', '', $text); } //TODO: parse css-files return $text; }
public static function getIcons() { if (!self::isMJInstalled()) { return array(); } JHtml::_('behavior.modal', 'a.modal'); $document = JFactory::getDocument(); $document->addStyleSheet('components/com_mobilejoomla/css/mod_mj_adminicon.css'); require_once JPATH_ADMINISTRATOR . '/components/com_mobilejoomla/classes/mobilejoomla.php'; MobileJoomla::loadLanguageFile('com_mobilejoomla', JPATH_ADMINISTRATOR); include_once JPATH_ADMINISTRATOR . '/components/com_mobilejoomla/mobilejoomla.html.php'; HTML_MobileJoomla::CheckForUpdate(); if (version_compare(JVERSION, '3.0', '>=')) { $image_prefix = ''; $image_suffix = ''; } else { $image_prefix = JUri::base() . 'components/com_mobilejoomla/images/'; $image_suffix = '.png'; } return array(array('id' => 'mjnoupdate', 'link' => 'index.php?option=com_mobilejoomla', 'image' => $image_prefix . 'mj-cpanel' . $image_suffix, 'text' => JText::_('COM_MJ__MOBILEJOOMLA')), array('id' => 'mjupdate', 'link' => 'index.php?tmpl=component&option=com_mobilejoomla&task=update', 'target' => '_self" class="modal" rel="{handler: \'iframe\', size: {x: 480, y: 320}}', 'image' => $image_prefix . 'mj-update' . $image_suffix, 'text' => JText::_('COM_MJ__UPDATE_AVAILABLE'))); }
/** * Get a cache_id string from an id/group pair * * @access private * @param string $id The cache data id * @param string $group The cache data group * @return string The cache_id string * @since 1.5 */ function _getCacheId($id, $group) { static $cachekey; if (!isset($cachekey)) { $cachekey = MobileJoomla::getCacheKey(); } $name = md5($this->_application . '-' . $id . '-' . $this->_hash . '-' . $this->_language . '-' . $cachekey); return 'cache_' . $group . '-' . $name; }
<?php /** * ###DESC### * ###URL### * * @version ###VERSION### * @license ###LICENSE### * @copyright ###COPYRIGHT### * @date ###DATE### */ defined('_JEXEC') or die('Restricted access'); defined('_MJ') or die('Incorrect usage of Mobile Joomla.'); $MobileJoomla =& MobileJoomla::getInstance(); $MobileJoomla->showMessage(); $MobileJoomla->showComponent();
function processPage($text) { if ($this->getParam('img') == 1) { $text = preg_replace('#<img [^>]+>#is', '', $text); } elseif ($this->getParam('img') >= 2) { $scaletype = $this->getParam('img') - 2; $addstyles = (bool) $this->getParam('img_addstyles'); $text = MobileJoomla::RescaleImages($text, $scaletype, $addstyles); } if ($this->getParam('removetags')) { $text = preg_replace('#<iframe\\s[^>]+? />#is', '', $text); $text = preg_replace('#<iframe.+?</iframe>#is', '', $text); $text = preg_replace('#<object\\s[^>]+? />#is', '', $text); $text = preg_replace('#<object\\s.+?</object>#is', '', $text); $text = preg_replace('#<embed\\s[^>]+? />#is', '', $text); $text = preg_replace('#<embed.+</embed>#is', '', $text); $text = preg_replace('#<applet\\s[^>]+? />#is', '', $text); $text = preg_replace('#<applet\\s.+?</applet>#is', '', $text); /* $text = preg_replace('#(<.+?)align="center"(.+?>)#is', '\1class="center"\2', $text); // mosimage fix */ $text = str_replace('<br>', '<br />', $text); // xml-compatibility } if ($this->config['xhtml.removescripts']) { $text = preg_replace('#<script\\s[^>]+? />#is', '', $text); //$text = preg_replace('#<script\s.+?</script>#is', '', $text); $text = preg_replace('#<script([^\'"/>]|"[^"]*?"|\'[^\']*?\')*?>([^\'"/]|"([^"\\\\]|\\\\.)*?"|\'([^\'\\\\]|\\\\.)*?\'|/[^/*]|/\\*.*?\\*/|//.*?$)*?</script>#ism', '', $text); } if ($this->config['xhtml.entitydecode']) { $text = strtr($text, array('<' => '&lt;', '>' => '&gt;', '&' => '&amp;')); $text = html_entity_decode($text, ENT_NOQUOTES, 'UTF-8'); } //remove target="_blank" from links $text = preg_replace('#(<a [^>]*?)target="_blank"([^>]*?>)#is', '\\1\\2', $text); return $text; }
* ###DESC### * ###URL### * * @version ###VERSION### * @license ###LICENSE### * @copyright ###COPYRIGHT### * @date ###DATE### */ defined('_JEXEC') or die('Restricted access'); defined('_MJ') or die('Incorrect usage of Mobile Joomla.'); //load language file (to allow users to rename template) MobileJoomla::loadLanguageFile('tpl_mobile_iphone'); $MobileJoomla =& MobileJoomla::getInstance(); $base = $this->baseurl . '/templates/' . $this->template; $home = $this->baseurl . '/'; $MobileJoomla_Device =& MobileJoomla::getDevice(); if ($MobileJoomla_Device['markup'] != $MobileJoomla_Device['default_markup']) { $home .= '?device=' . $MobileJoomla_Device['markup']; } ?> <!doctype html> <html<?php echo $MobileJoomla->getXmlnsString(); ?> > <head> <meta http-equiv="Content-Type" content="<?php echo $MobileJoomla->getContentString(); ?> "/> <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
static function onAfterRenderLast() { if (!defined('_MJ')) { return; } $MobileJoomla_Settings =& MobileJoomla::getConfig(); if ($MobileJoomla_Settings['httpcaching']) { JResponse::allowCache(true); JResponse::setHeader('Vary', 'Cookie'); } JResponse::setHeader('Cache-Control', 'no-transform'); //remove Content-Type duplicates $headers = JResponse::getHeaders(); JResponse::clearHeaders(); $found = false; foreach ($headers as $header) { if (strtolower($header['name']) != 'content-type') { JResponse::setHeader($header['name'], $header['value']); } elseif (!$found) { JResponse::setHeader($header['name'], $header['value']); $found = true; } } }
static function _renderMenu($menu, &$params, $submenu = array()) { $MobileJoomla = MobileJoomla::getInstance(); $markup = $MobileJoomla->getMarkup(); switch ($markup) { case 'wml': case 'chtml': case 'xhtml': case 'iphone': break; default: $markup = 'xhtml'; } $app = JFactory::getApplication(); $sitemenu = $app->getMenu(); $active = $sitemenu->getActive(); $active_id = isset($active) ? $active->id : 0; $is_vertical = $params->get('layout') == 'v'; $is_submenu = $params->get('class_prefix') == 'submenu'; $layout_file = JModuleHelper::getLayoutPath('mod_mj_menu', $markup); if (!is_file($layout_file)) { $layout_file = JModuleHelper::getLayoutPath('mod_mj_menu', 'xhtml'); } require $layout_file; }
} } if ($params->get('iphone_show', 0)) { $chosen = MobileJoomla::isCurrentMarkup('iphone'); if ($show_chosen_markup || !$chosen) { $text = $params->get('iphone_text', 'iPhone Version'); $link = $chosen ? false : MobileJoomla::getDeviceViewURI('iphone'); $links[] = array('url' => $link, 'text' => $text); } } if ($params->get('wml_show', 0)) { $chosen = MobileJoomla::isCurrentMarkup('wml'); if ($show_chosen_markup || !$chosen) { $text = $params->get('wml_text', 'WAP Version'); $link = $chosen ? false : MobileJoomla::getDeviceViewURI('wml'); $links[] = array('url' => $link, 'text' => $text); } } if ($params->get('chtml_show', 0)) { $chosen = MobileJoomla::isCurrentMarkup('chtml'); if ($show_chosen_markup || !$chosen) { $text = $params->get('chtml_text', 'iMode Version'); $link = $chosen ? false : MobileJoomla::getDeviceViewURI('chtml'); $links[] = array('url' => $link, 'text' => $text); } } $layout_file = JModuleHelper::getLayoutPath('mod_mj_markupchooser', $markup ? $markup : 'default'); if (!is_file($layout_file)) { $layout_file = JModuleHelper::getLayoutPath('mod_mj_markupchooser', 'xhtml'); } require $layout_file;
function processPage($text) { $doctypes = array(1 => '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">', '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml_1.2.xml">'); $pretext = '<?xml version="1.0" encoding="utf-8" ?>' . "\n" . $doctypes[$this->config['wml.doctype']] . "\n"; $text = preg_replace('#<img src="[^"]*arrow(_rtl)?\\.png" alt=""\\s*/>#', '>', $text); //pathway fix $text = preg_replace('#<iframe\\s[^>]+? />#is', '', $text); $text = preg_replace('#<iframe.+</iframe>#is', '', $text); $text = preg_replace('#<object\\s[^>]+? />#is', '', $text); $text = preg_replace('#<object\\s.+?</object>#is', '', $text); $text = preg_replace('#<embed\\s[^>]+? />#is', '', $text); $text = preg_replace('#<embed.+</embed>#is', '', $text); $text = preg_replace('#<applet\\s[^>]+? />#is', '', $text); $text = preg_replace('#<applet\\s.+?</applet>#is', '', $text); $text = preg_replace('#<script\\s[^>]+? />#is', '', $text); //$text = preg_replace('#<script\s.+?</script>#is', '', $text); $text = preg_replace('#<script([^\'"/>]|"[^"]*?"|\'[^\']*?\')*?>([^\'"/]|"([^"\\\\]|\\\\.)*?"|\'([^\'\\\\]|\\\\.)*?\'|/[^/*]|/\\*.*?\\*/|//.*?$)*?</script>#ism', '', $text); $text = preg_replace('#<h\\d.*?>#is', '<big>', $text); $text = preg_replace('#</h\\d.*?>#is', '</big><br/>', $text); $text = preg_replace('#<(ol|ul|dl|div|table).*?>#i', '', $text); $text = preg_replace('#</(ol|ul|dl|table)>#i', '', $text); $text = preg_replace('#</div>#i', '<br/>', $text); $text = preg_replace('#<(td|tr|dd|li|span).*?>#is', '', $text); $text = preg_replace('#</(tr|dd|li)>#i', '<br/>', $text); $text = str_ireplace('</td>', ' | ', $text); $text = str_ireplace('</span>', '', $text); $text = str_replace(' | <br/>', '<br/>', $text); $text = preg_replace('#<dt.*?>#is', '<strong>', $text); $text = str_ireplace('</dt>', '</strong><br/>', $text); $text = preg_replace('# class=".*?"#is', '', $text); $text = preg_replace('# rel=".*?"#is', '', $text); $text = preg_replace('# id=".*?"#is', '', $text); $text = preg_replace('# style=".*?"#is', '', $text); $text = preg_replace('# title=".*?"#is', '', $text); $text = preg_replace('# target="_blank"#is', '', $text); $text = trim($text); $title = $this->getPageTitle(); $pos = strpos($text, '<card'); if ($pos === false) { $text = '<card id="main" title="' . $title . '">' . "\n" . $text . "\n</card>\n"; } else { $text = '<card id="main" title="' . $title . '">' . "\n" . substr($text, 0, $pos) . "\n</card>\n" . substr($text, $pos); } $text = "<wml>\n" . "<head>\n" . "<meta http-equiv=\"Cache-Control\" content=\"max-age=0\" forua=\"true\" />\n" . "</head>\n" . $text . "\n" . "</wml>"; if ($this->getParam('img') == 1) { $text = preg_replace('#<img [^>]+>#is', '', $text); } elseif ($this->getParam('img') >= 2) { $scaletype = $this->getParam('img') - 2; $text = MobileJoomla::RescaleImages($text, $scaletype); } $text = str_replace('<br/>', '<br>', $text); $text = strip_tags($text, '<a><access><anchor><b><big><br><card><do><em><fieldset><go><head><i><img><input><meta><noop><onevent><optgroup><option><p><postfield><prev><refresh><select><setvar><small><strong><table><td><tr><template><timer><u><wml>'); $text = str_replace('<br />', '<br/>', $text); $text = str_replace('<br>', '<br/>', $text); $text = preg_replace('#\\s\\s+#', ' ', $text); $text = preg_replace("#(\n|\r)+#", "\n", $text); if ($this->config['wml.entitydecode'] == 1) { $text = strtr($text, array('<' => '&lt;', '>' => '&gt;', '&' => '&amp;')); $text = html_entity_decode($text, ENT_NOQUOTES, 'UTF-8'); } return $pretext . $text; }
function processPage($text) { //replace '<.../>' on '<...>' $text = preg_replace('#<([^>]) ?/>#s', '<\\1>', $text); // TODO: remove table // TODO: remove colors // TODO: remove stylesheet if ($this->getParam('img') == 1) { $text = preg_replace('#<img [^>]+>#is', '', $text); } elseif ($this->getParam('img') >= 2) { $scaletype = $this->getParam('img') - 2; $text = MobileJoomla::RescaleImages($text, $scaletype); } // allowable tags: a base blockquote body br center dd dir div dl dt form head h... hr html img input(exept type=image&file) li menu meta(refresh only) ol option(selected, but not value) p plaintext pre select textarea title ul if ($this->getParam('removetags')) { $text = preg_replace('#<iframe\\s[^>]+ ?/>#is', '', $text); $text = preg_replace('#<iframe.+</iframe>#is', '', $text); $text = preg_replace('#<object\\s[^>]+ ?/>#is', '', $text); $text = preg_replace('#<object\\s.+</object>#is', '', $text); $text = preg_replace('#<embed\\s[^>]+ ?/>#is', '', $text); $text = preg_replace('#<embed.+</embed>#is', '', $text); $text = preg_replace('#<applet\\s[^>]+ ?/>#is', '', $text); $text = preg_replace('#<applet\\s.+</applet>#is', '', $text); $text = preg_replace('#<script\\s[^>]+ ?/>#is', '', $text); //$text = preg_replace('#<script\s.+</script>#is', '', $text); $text = preg_replace('#<script([^\'"/>]|"[^"]*?"|\'[^\']*?\')*?>([^\'"/]|"([^"\\\\]|\\\\.)*?"|\'([^\'\\\\]|\\\\.)*?\'|/[^/*]|/\\*.*?\\*/|//.*?$)*?</script>#ism', '', $text); } if ($this->config['chtml.entitydecode']) { $text = strtr($text, array('<' => '&lt;', '>' => '&gt;', '&' => '&amp;')); $text = html_entity_decode($text, ENT_NOQUOTES, 'UTF-8'); } return $text; }
/** * Get a cache file path from an id/group pair * * @access private * @param string $id The cache data id * @param string $group The cache data group * @return string The cache file path * @since 1.5 */ function _getFilePath($id, $group) { $folder = $group; static $cachekey; if (!isset($cachekey)) { $cachekey = MobileJoomla::getCacheKey(); } $name = md5($this->_application . '-' . $id . '-' . $this->_hash . '-' . $this->_language . '-' . $cachekey) . '.php'; $dir = $this->_root . DS . $folder; // If the folder doesn't exist try to create it if (!is_dir($dir)) { // Make sure the index file is there $indexFile = $dir . DS . 'index.html'; @mkdir($dir) && file_put_contents($indexFile, '<html><body bgcolor="#FFFFFF"></body></html>'); } // Make sure the folder exists if (!is_dir($dir)) { return false; } return $dir . DS . $name; }
static function getCacheKey() { $MobileJoomla_Device =& MobileJoomla::getDevice(); $cachekey = array(); $cachekey[] = $MobileJoomla_Device['markup']; $cachekey[] = $MobileJoomla_Device['default_markup']; $cachekey[] = $MobileJoomla_Device['screenwidth']; $cachekey[] = $MobileJoomla_Device['screenheight']; $cachekey[] = isset($MobileJoomla_Device['pixelratio']) ? $MobileJoomla_Device['pixelratio'] : '1'; $imageformats = $MobileJoomla_Device['imageformats']; if (is_array($imageformats)) { sort($imageformats); $cachekey[] = implode('', $imageformats); } return implode('_', $cachekey); }
* * @version ###VERSION### * @license ###LICENSE### * @copyright ###COPYRIGHT### * @date ###DATE### */ defined('_JEXEC') or die('Restricted access'); //ACL check if (version_compare(JVERSION, '1.6', '>=') && !JFactory::getUser()->authorise('core.manage', 'com_mobilejoomla')) { return JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR')); } jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); jimport('joomla.event.dispatcher'); require_once JPATH_COMPONENT . '/classes/mobilejoomla.php'; MobileJoomla::loadLanguageFile('com_mobilejoomla', JPATH_ADMINISTRATOR); require_once JPATH_COMPONENT . '/mobilejoomla.html.php'; $task = JRequest::getCmd('task'); $app = JFactory::getApplication(); JPluginHelper::importPlugin('mobile'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onMJBeforeDispatch', array($task)); $extmanager = JRequest::getCmd('extmanager'); if (!empty($extmanager)) { require_once dirname(__FILE__) . '/classes/mjextmanager.php'; if (!headers_sent()) { header('Content-Type: text/html'); } switch (JRequest::getCmd('extmanager')) { case 'view_modules': require dirname(__FILE__) . '/admin_tpl/modules.php';