Пример #1
0
 /**
  * get_derivate_file_name
  * Try and find a file in the images directory.
  *
  * Looks for the newest file and returns that based on the largest increment.
  * Pattern:  en_myfilename_2.jpg = ${domain}_filename_${increment}.${extension}
  * Will use natcase sort to find "newest file". If domain is foreign, the method will try and
  * find the same file with the $domain prefix. E.g fr_myfilename_2.jpg.
  * If it can't find the foreign file, return the english one E.g en_myfilename_2.jpg
  *
  * @param [string] $file_param uri of path of image
  * @return [string] $file the new found file name.
  */
 protected function get_derivate_file_name($file_param)
 {
     $file_param = pathinfo($file_param);
     $pattern = '/(?!\\/)[a-zA-Z_]*([0-9])+\\.[a-z]{3}/';
     // get the contents of the current directory
     $contents = Directorywatch::scan_dir($file_param['dirname']);
     if (is_array($contents)) {
         // newest files at the top, ie those with largest increment
         $contents = array_reverse($contents);
         $search_file = preg_replace('/(\\_[0-9]{1})$/', '', $file_param['filename']);
         $domain = strtolower(_e_get_domain());
         if ($domain !== 'en') {
             // switch the image prefix with the current language domain prefix
             $search_file = preg_replace('/^en_/', $domain . '_', $search_file);
         }
         $found = $this->find_in_dir($contents, $search_file);
         //could not find a file.
         // if it is foreign, does the english version exisit? If so, use that.
         if (!$found) {
             $found = $this->find_in_dir($contents, 'en_' . $search_file);
         }
         // could not find the file.
         // does the file exisit without a domain?
         if (!$found) {
             foreach ($this->languages as $lang) {
                 $search_string = '/^' . strtolower($lang) . '_/';
                 $search_file = preg_replace($search_string, '', $search_file);
                 $found = $this->find_in_dir($contents, $search_file);
                 if ($found) {
                     break;
                 }
             }
         }
         // still could not find the file. Could we use the standard en_ based image if
         // we are using an english based domain in the config?
         if (!$found) {
             if (in_array(strtoupper($domain), $this->config['en_based'])) {
                 $search_file = 'en_' . $search_file;
                 $found = $this->find_in_dir($contents, $search_file);
             }
         }
         if (!$found) {
             var_dump('NOT FOUND!:' . $search_file, $file_param);
             exit;
         }
         return $found;
     }
 }
Пример #2
0
function get_dollar_country()
{
    $domain = _e_get_domain();
    switch ($domain) {
        case 'uk':
            return '';
        case 'es':
            return 'USD';
        case 'us':
            return 'USD';
        case 'asia':
            return 'USD';
        case 'eu':
            return '';
        case 'sp':
            return '';
        case 'gr':
            return '';
        case 'fr':
            return '';
        case 'au':
            return 'AUD';
        default:
            return 'AUD';
    }
}
Пример #3
0
function _e_tracking($section = 'product', $extra_params = array())
{
    global $mc_edm_config;
    $lang = i18n::get_instance();
    $campaign = $mc_edm_config['campaign_name'];
    $database = 'database-' . strtolower(_e_get_domain());
    $section = $section == 'product' ? $lang->get_section() : $section;
    $year = substr($mc_edm_config['launch_date'], 0, 4);
    $extra = '';
    if ($extra_params) {
        $extra = '&' . http_build_query($extra_params, '', '&');
    }
    $content = "?utm_campaign={$campaign}_{$year}&utm_medium=email&utm_source={$database}&utm_content={$section}{$extra}";
    return $content;
}
Пример #4
0
?>
>
                      <span class="feature_1"><?php 
echo _e(array('text' => 'feature_1'));
?>
</span>
                      <span class="feature_2">&nbsp;&ndash; <?php 
echo _e(array('text' => 'feature_2'));
?>
</span>
                      <span class="feature_3">&nbsp;&ndash; <?php 
echo _e(array('text' => 'feature_3'));
?>
</span>
                      <?php 
if (_e_get_domain() != 'gr') {
    ?>
                      <span class="feature_4">&nbsp;&ndash; <?php 
    echo _e(array('text' => 'feature_4'));
    ?>
 </span>
                      <?php 
}
?>
                    </font>  
                    </td>
                  </tr>
          </table>
          </center>
        
<?php