Exemple #1
0
 public static function _($string, $jsSafe = false, $interpretBackSlashes = true, $script = false)
 {
     $text = JText::_($string, $jsSafe, $interpretBackSlashes, $script);
     switch ($string) {
         case 'COM_VIRTUEMART_CART_PRICE':
             return str_replace(':', '', JText::_('COM_VIRTUEMART_CART_PRICE'));
             /*
             case 'COM_VIRTUEMART_COMMENT_CART': 
             	return JText::_('COM_VIRTUEMART_COMMENT'); 
             */
         /*
         case 'COM_VIRTUEMART_COMMENT_CART': 
         	return JText::_('COM_VIRTUEMART_COMMENT'); 
         */
         default:
             break;
     }
     switch ($text) {
         case 'COM_VIRTUEMART_USER_FORM_MISSING_REQUIRED_JS':
             return JText::_('COM_VIRTUEMART_USER_FORM_MISSING_REQUIRED_JS');
         case 'COM_VIRTUEMART_CART_TOS':
             return JText::_('COM_VIRTUEMART_CART_TOS');
         case 'COM_VIRTUEMART_REGISTER_UNAME':
             return JText::_('COM_VIRTUEMART_USERNAME');
         case 'COM_VIRTUEMART_USER_FORM_MISSING_REQUIRED':
             return JText::_('COM_VIRTUEMART_USER_FORM_MISSING_REQUIRED_JS');
         case 'COM_ONEPAGE_OTHER_DISCOUNT':
             if (JText::_('COM_ONEPAGE_OTHER_DISCOUNT') == 'COM_ONEPAGE_OTHER_DISCOUNT') {
                 return JText::_('COM_VIRTUEMART_COUPON_DISCOUNT');
             } else {
                 return JText_('COM_ONEPAGE_OTHER_DISCOUNT');
             }
         case 'COM_ONEPAGE_EMAIL_ALREADY_EXISTS':
             return JText::_('COM_VIRTUEMART_STRING_ERROR_NOT_UNIQUE_NAME');
         case 'COM_VIRTUEMART_FIELDS_NEWSLETTER':
             return JText::_('COM_ONEPAGE_NEWSLETTER_SUBSCRIPTION');
         default:
             return $text;
     }
     return $text;
 }
 /**
  * Retrieves the real url of a media resource.
  * First, the content of a given url is fetched, then
  * this content is matched against a given regex in order
  * to retrieve a fragment which contains the actual media
  * url.
  *
  * @param robj A ripper parameter object.
  *
  * @return An array, containing the extracted media URL at index 0,
  *         followed by an arbitrary number of additional backreferences.
  * @access private
  */
 function &_ripper(&$robj)
 {
     $url = str_replace(' ', '%20', $robj->url);
     $ret = array('');
     $resp = '';
     if (function_exists('curl_init')) {
         // We preferably use cURL, because that supports
         // a proxy out of the box. In your apache config,
         // simply set the environment variable http_proxy
         // to host:port in order to use it.
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_HEADER, 0);
         curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_TIMEOUT, 30);
         curl_setopt($ch, CURLOPT_USERAGENT, 'AllVideos Reloaded');
         if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(plgContentAvreloaded::_curl_version(), '7.15.2', '>=')) {
             curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
             curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
         }
         $proxy = getenv('http_proxy');
         if ($proxy !== false) {
             curl_setopt($ch, CURLOPT_PROXY, $proxy);
         }
         if (!($resp = curl_exec($ch))) {
             $resp = '';
         }
         curl_close($ch);
     } else {
         if (ini_get('allow_url_fopen') == '1') {
             // try fallback to file_get_contents
             $resp = @file_get_contents($url);
         }
     }
     if (strlen($resp)) {
         if ($robj->flags & 1) {
             $resp = urldecode($resp);
         }
         $resp = plgContentAvreloaded::_htsdecode($resp);
         $regex = plgContentAvreloaded::_quoteRegex($robj->regex);
         if (empty($regex)) {
             plgContentAvreloaded::_err(JText::sprintf('ERR_MATCH_URL', htmlspecialchars($url), htmlspecialchars($resp), htmlspecialchars($robj->regex)));
             return $ret;
         }
         if (preg_match($regex, $resp, $matches)) {
             array_shift($matches);
             if (count($matches) < 1) {
                 plgContentAvreloaded::_err(JText::sprintf('ERR_MATCH_URL', htmlspecialchars($url), htmlspecialchars($resp), htmlspecialchars($robj->regex)));
                 return $ret;
             }
             if ($robj->cindex > 0) {
                 $i = $robj->cindex;
                 if ($i >= count($matches)) {
                     plgContentAvreloaded::_err(JText_('ERR_MATCH_INDEX'));
                     return $ret;
                 }
                 $code = $matches[$i];
                 $a1 = array_slice($matches, 0, $i);
                 $a2 = array_slice($matches, $i + 1);
                 $matches = array($code);
                 $matches = array_merge($matches, $a1, $a2);
             }
             return $matches;
         }
         plgContentAvreloaded::_err(JText::sprintf('ERR_MATCH_URL', htmlspecialchars($url), htmlspecialchars($resp), htmlspecialchars($robj->regex)));
     } else {
         plgContentAvreloaded::_err(JText::sprintf('ERR_FETCH_URL', htmlspecialchars($url)));
     }
     return $ret;
 }