コード例 #1
0
ファイル: htmlTools.class.php プロジェクト: noikiy/owaspbwa
 /**
  * Returns a link tag
  *
  * @param string $href
  * @param string $type
  * @param string $rel
  * @return string
  */
 function linkTag($href, $type = 'text/css', $rel = 'stylesheet', $media = "screen, projection")
 {
     global $mosConfig_gzip, $mosConfig_live_site;
     if (isset($_REQUEST['usefetchscript'])) {
         $use_fetchscript = vmRequest::getBool('usefetchscript', 1);
         vmRequest::setVar('usefetchscript', $use_fetchscript, 'session');
     } else {
         $use_fetchscript = vmRequest::getBool('usefetchscript', 1, 'session');
     }
     if (stristr($href, 'com_virtuemart') && $use_fetchscript) {
         $base_href = str_replace(URL, '', $href);
         $base_href = str_replace(SECUREURL, '', $base_href);
         $base_href = str_replace('components/com_virtuemart/', '', $base_href);
         $href = $mosConfig_live_site . '/components/com_virtuemart/fetchscript.php?gzip=' . $mosConfig_gzip . '&subdir[0]=' . dirname($base_href) . '&file[0]=' . basename($href);
     }
     return '<link type="' . $type . '" href="' . $href . '" rel="' . $rel . '"' . (empty($media) ? '' : ' media="' . $media . '"') . ' />' . "\n";
 }
コード例 #2
0
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
global $mosConfig_absolute_path, $product_id, $vmInputFilter, $vmLogger;
/* Load the virtuemart main parse code */
require_once dirname(__FILE__) . '/virtuemart_parser.php';
$my_page = explode('.', $page);
$modulename = $my_page[0];
$pagename = $my_page[1];
$is_popup = vmRequest::getBool('pop');
// Page Navigation Parameters
$limit = intval($vm_mainframe->getUserStateFromRequest("viewlistlimit{$page}", 'limit', $mosConfig_list_limit));
$limitstart = intval($vm_mainframe->getUserStateFromRequest("view{$keyword}{$category_id}{$pagename}limitstart", 'limitstart', 0));
/* Get all the other paramters */
$search_category = vmRequest::getVar('search_category');
// Display just the naked page without toolbar, menu and footer?
$only_page = vmRequest::getInt('only_page', 0);
if (PSHOP_IS_OFFLINE == '1' && !$perm->hasHigherPerms('storeadmin')) {
    echo PSHOP_OFFLINE_MESSAGE;
} else {
    if (PSHOP_IS_OFFLINE == '1') {
        echo '<h2>' . $VM_LANG->_('OFFLINE_MODE') . '</h2>';
    }
    if ($is_popup) {
        echo "<style type='text/css' media='print'>.vmNoPrint { display: none }</style>";
コード例 #3
0
ファイル: mainframe.class.php プロジェクト: noikiy/owaspbwa
 function render($print = false)
 {
     global $mainframe, $mosConfig_gzip, $mosConfig_live_site;
     foreach ($this->_style as $style) {
         $tag = '<style type="' . key($style) . '">' . current($style) . '</style>';
         if ($print) {
             echo $tag;
         } else {
             $mainframe->addCustomHeadTag($tag);
         }
     }
     if (isset($_REQUEST['usefetchscript'])) {
         $use_fetchscript = vmRequest::getBool('usefetchscript', true);
         vmRequest::setVar('usefetchscript', $use_fetchscript, 'session');
     } else {
         $use_fetchscript = vmRequest::getBool('usefetchscript', true, 'session');
     }
     // Gather all the linked Scripts into ONE link
     $i = 0;
     $appendix = '';
     $loadorder = array();
     foreach ($this->_scripts as $script) {
         $src = $script['url'];
         $type = $script['type'];
         $content = $script['content'];
         $position = $script['position'];
         $urlpos = strpos($src, '?');
         $url_params = '';
         $js_file = false;
         $js_statement = false;
         if ($urlpos && (stristr($src, VM_COMPONENT_NAME) && !stristr($src, '.php') && $use_fetchscript)) {
             $url_params = '&amp;' . substr($src, $urlpos);
             $src = substr($src, 0, $urlpos);
         }
         /* Group the JS files together */
         if (stristr($src, VM_COMPONENT_NAME) && !stristr($src, '.php') && $use_fetchscript) {
             $base_source = str_replace($GLOBALS['real_mosConfig_live_site'], '', $src);
             $base_source = str_replace($GLOBALS['mosConfig_live_site'], '', $base_source);
             $base_source = str_replace('/components/' . VM_COMPONENT_NAME, '', $base_source);
             $base_source = str_replace('components/' . VM_COMPONENT_NAME, '', $base_source);
             $js_file = '&amp;subdir[' . $i . ']=' . dirname($base_source) . '&amp;file[' . $i . ']=' . basename($src);
             $i++;
         } else {
             $js_statement = array('type' => $type, 'src' => $src, 'content' => $content);
         }
         /* Group the statements according to their position */
         /* JS files */
         if ($js_file) {
             if (!isset($loadorder[$position]['js_file']['appendix'])) {
                 $loadorder[$position]['js_file']['appendix'] = '';
             }
             $loadorder[$position]['js_file']['appendix'] .= $js_file;
         }
         $js_file = false;
         /* JS statements */
         if ($js_statement) {
             $loadorder[$position]['js_statement'][] = $js_statement;
         }
         $js_statement = false;
     }
     /* Add the JS to the output */
     $processorder = array('top', 'middle', 'bottom');
     foreach ($processorder as $key => $pos) {
         if (isset($loadorder[$pos])) {
             if (isset($loadorder[$pos]['js_file'])) {
                 /* JS files */
                 $src = $mosConfig_live_site . '/components/' . VM_COMPONENT_NAME . '/fetchscript.php?gzip=' . $mosConfig_gzip;
                 $src .= $loadorder[$pos]['js_file']['appendix'];
                 $tag = '<script src="' . $src . @$url_params . '" type="text/javascript"></script>';
                 if ($print) {
                     echo $tag;
                 } else {
                     $mainframe->addCustomHeadTag($tag);
                 }
             }
             if (isset($loadorder[$pos]['js_statement'])) {
                 /* JS statements */
                 foreach ($loadorder[$pos]['js_statement'] as $statement_key => $otherscript) {
                     if (!empty($otherscript['src'])) {
                         $tag = '<script type="' . $otherscript['type'] . '" src="' . $otherscript['src'] . '"></script>';
                     } else {
                         $tag = '<script type="' . $otherscript['type'] . '">' . $otherscript['content'] . '</script>';
                     }
                     if ($print) {
                         echo $tag;
                     } else {
                         $mainframe->addCustomHeadTag($tag);
                     }
                 }
             }
         }
     }
     // Gather all the linked Stylesheets into ONE link
     $i = 0;
     $appendix = '';
     $url_params = '';
     foreach ($this->_styleSheets as $stylesheet) {
         $urlpos = strpos($stylesheet['url'], '?');
         if ($urlpos) {
             $url_params .= '&amp;' . substr($stylesheet['url'], $urlpos);
             $stylesheet['url'] = substr($stylesheet['url'], 0, $urlpos);
         }
         if (stristr($stylesheet['url'], VM_COMPONENT_NAME) && !stristr($stylesheet['url'], '.php') && $stylesheet['media'] == null && $use_fetchscript) {
             $base_source = str_replace($GLOBALS['real_mosConfig_live_site'], '', $stylesheet['url']);
             $base_source = str_replace($GLOBALS['mosConfig_live_site'], '', $base_source);
             $base_source = str_replace('/components/' . VM_COMPONENT_NAME, '', $base_source);
             $base_source = str_replace('components/' . VM_COMPONENT_NAME, '', $base_source);
             $appendix .= '&amp;subdir[' . $i . ']=' . dirname($base_source) . '&amp;file[' . $i . ']=' . basename($stylesheet['url']);
             $i++;
         } else {
             $tag = '<link type="' . $stylesheet['mime'] . '" href="' . $stylesheet['url'] . '" rel="stylesheet"' . (!empty($stylesheet['media']) ? ' media="' . $stylesheet['media'] . '"' : '') . ' />';
             if ($print) {
                 echo $tag;
             } else {
                 $mainframe->addCustomHeadTag($tag);
             }
         }
     }
     if ($i > 0) {
         $src = $mosConfig_live_site . '/components/com_virtuemart/fetchscript.php?gzip=' . $mosConfig_gzip;
         $src .= $appendix;
         $tag = '<link href="' . $src . @$url_params . '" type="text/css" rel="stylesheet" />';
         if ($print) {
             echo $tag;
         } else {
             $mainframe->addCustomHeadTag($tag);
         }
     }
 }