static function deleteOldImage($controller, $name, $sizes, $dir) { if (isset($controller->files)) { $root = $controller->files->file_root; foreach ($sizes as $size) { $controller->files->deleteFile("{$root}/{$dir}/" . Helper_File::addSuffix(Helper_File::getFileName($name), $size['suffix'])); } } }
function _getImageName($item) { $suffix = '_tn'; if (isset($this->thumbnailSuffix)) { $suffix = $this->thumbnailSuffix; } $imageName = ''; if ($item['image']) { $imageName = Helper_File::addSuffix($item['image'], $suffix); } if (!empty($item['options']['_image_url'])) { $imageName = $item['options']['_image_url']; } return $imageName; }
function smarty_modifier_cc_file_add_suffix($string, $suff = '') { return Helper_File::addSuffix($string, $suff); }
static function renderFormRow($options, $lang = "en") { $_name = ""; $_sanitized_name = ""; $_label = ""; $_type = "text"; $_attribute = ""; $_value = ""; $_value_empty = ""; $_html_input = ""; $_html = ""; $_options = array(); $_selected = ""; if (!empty($options['name'])) { $_name = $options['name']; } if (!empty($options['name'])) { $_sanitized_name = preg_replace("/[^a-zA-Z0-9\\-_]+/", "", $options['name']); } if (!empty($options['label'])) { $_label = $options['label']; } if (!empty($options['type'])) { $_type = $options['type']; } if (!empty($options['attribute'])) { $_attribute = $options['attribute']; } if (!empty($options['value'])) { $_value = $options['value']; } if (!empty($options['value_empty'])) { $_value_empty = $options['value_empty']; } if (!empty($options['options'])) { $_options = $options['options']; } if (!empty($options['selected'])) { $_selected = $options['selected']; } $_required = ""; if (strpos($_attribute, 'required') !== false) { $_required .= "<span class='required'>*</span>"; } if ($_type == "text" || $_type == "email" || $_type == "tel" || $_type == "password") { $_html_input .= "<input id='input_{$_name}' type='{$_type}' name='{$_name}' {$_attribute} value='{$_value}'>"; $_html .= "\n <div id='form-row-{$_sanitized_name}' class='sirclo-form-row'>\n <div class='sirclo-form-label'>\n <label for='{$_name}'>\n {$_label}\n {$_required}\n </label>\n </div>\n <div class='sirclo-form-input'>\n {$_html_input}\n </div>\n </div>"; } else { if ($_type == "textarea") { $_html_input .= "<textarea name='{$_name}' {$_attribute}></textarea>"; $_html .= "\n <div id='form-row-{$_sanitized_name}' class='sirclo-form-row'>\n <div class='sirclo-form-label'>\n <label for='{$_name}'>\n {$_label}\n {$_required}\n </label>\n </div>\n <div class='sirclo-form-input'>\n {$_html_input}\n </div>\n </div>"; } else { if ($_type == "file") { $_html_input .= "<input id='input_{$_name}' type='file' name='{$_name}' {$_attribute}>"; $_html .= "\n <div id='form-row-{$_sanitized_name}' class='sirclo-form-row'>\n <div class='sirclo-form-label'>\n <label for='{$_name}'>\n {$_label}\n {$_required}\n </label>\n </div>\n <div class='sirclo-form-input'>\n {$_html_input}\n </div>\n </div>"; } else { if ($_type == "country") { $_countries = Helper_Paypal::getPaypalCountriesAssoc(); $_html_input_option = "<option value=\"\">-- Select Country --</option>"; foreach ($_countries as $_country_key => $_country_value) { if (!empty($_value) && $_value == $_country_key) { $_html_input_option .= "<option value='{$_country_key}' selected='selected'>{$_country_value}</option>"; } else { $_html_input_option .= "<option value='{$_country_key}'>{$_country_value}</option>"; } } $_html_input .= "<select name='{$_name}' {$_attribute}>{$_html_input_option}</select>"; $_html .= "\n <div id='form-row-{$_sanitized_name}' class='sirclo-form-row'>\n <div class='sirclo-form-label'>\n <label for='{$_name}'>\n {$_label}\n {$_required}\n </label>\n </div>\n <div class='sirclo-form-input'>\n {$_html_input}\n </div>\n </div>"; } else { if ($_type == "salutation") { if ($lang == "id") { $_salutations = array('' => '-- Harap Dipilih --', 'Mr' => 'Tuan', 'Mrs' => 'Nyonya', 'Miss' => 'Nona', 'Dr' => 'Dr'); } else { $_salutations = array('' => '-- Please Select --', 'Mr' => 'Mr', 'Mrs' => 'Mrs', 'Miss' => 'Miss', 'Ms' => 'Ms', 'Dr' => 'Dr'); } $_html_input_option = ""; foreach ($_salutations as $_salutation_key => $_salutation_value) { if (!empty($_value) && $_value == $_salutation_value) { $_html_input_option .= "<option value='{$_salutation_key}' selected='selected'>{$_salutation_value}</option>"; } else { $_html_input_option .= "<option value='{$_salutation_key}'>{$_salutation_value}</option>"; } } $_html_input .= "<select name='{$_name}' {$_attribute}>{$_html_input_option}</select>"; $_html .= "\n <div id='form-row-{$_sanitized_name}' class='sirclo-form-row'>\n <div class='sirclo-form-label'>\n <label for='{$_name}'>\n {$_label}\n {$_required}\n </label>\n </div>\n <div class='sirclo-form-input'>\n {$_html_input}\n </div>\n </div>"; } else { if ($_type == "checkbox") { $_html_input .= "<input name='{$_name}' {$_attribute} type='checkbox'>"; $_html .= "\n <div id='form-row-{$_sanitized_name}' class='sirclo-form-row'>\n <div class='sirclo-form-input checkbox'>\n {$_html_input}\n <label for='{$_name}'>\n {$_label}\n {$_required}\n </label>\n </div>\n </div>"; } else { if ($_type == "radio") { $_html_input = ""; if (!empty($_value)) { foreach ($_value as $_v) { $_html_image = ''; if (!empty($_v['image'])) { $_html_image = '<br/><img src="' . Helper_File::addSuffix($_v['image'], '_ori') . '"/>'; } if (isset($_selected) && $_v['value'] == $_selected) { $_html_input .= "<div class='radio'><input value='" . $_v['value'] . "' name='" . $_name . "' type='radio' " . $_attribute . " checked='checked'>" . $_v['title'] . $_html_image . "</div>\n"; } else { $_html_input .= "<div class='radio'><input value='" . $_v['value'] . "' name='" . $_name . "' type='radio' " . $_attribute . ">" . $_v['title'] . $_html_image . "</div>\n"; } } } else { if (!empty($_value_empty)) { $_html_input .= "<span class='value-empty'>{$_value_empty}</span>"; } } $_html .= <<<EOD <div id='form-row-{$_sanitized_name}' class='sirclo-form-row'> <div class='sirclo-form-input radio'> {$_html_input}</div> </div> EOD; } else { if ($_type == "checkbox_multiple") { $_html_input = ""; if (!empty($_value)) { foreach ($_value as $_v) { if (!empty($_selected) && in_array($_v['value'], $_selected)) { $_html_input .= "<div class='checkbox-multiple'><input value='" . $_v['value'] . "' name='" . $_name . "' type='checkbox' " . $_attribute . " checked='checked'>" . $_v['title'] . "</div>"; } else { $_html_input .= "<div class='checkbox-multiple'><input value='" . $_v['value'] . "' name='" . $_name . "' type='checkbox' " . $_attribute . ">" . $_v['title'] . "</div>"; } } } else { if (!empty($_value_empty)) { $_html_input .= "<span class='value-empty'>{$_value_empty}</span>"; } } $_html .= "\n <div id='form-row-{$_sanitized_name}' class='sirclo-form-row'>\n <div class='sirclo-form-input checkbox-multiple'>\n {$_html_input}\n </div>\n </div>"; } else { if ($_type == "subheader") { $_html .= "<h3 class='{$_sanitized_name}'>" . $_value . "</h3>"; } else { if ($_type == "hidden") { $_html .= "<input id='input_{$_sanitized_name}' type='{$_type}' name='{$_name}' {$_attribute} value='{$_value}'>"; } else { if ($_type == "div") { $_html .= "<div {$_attribute}>"; } else { if ($_type == "div_close") { $_html .= "</div>"; } else { if ($_type == "submit") { if ($lang == "id") { $_html_input .= "<div class='sirclo-form-row notice'><span class='required'>*</span> wajib diisi.</div>"; } else { $_html_input .= "<div class='sirclo-form-row notice'>Fields marked with <span class='required'>*</span> are required.</div>"; } $_html_input .= "<input type='submit' value='{$_value}' {$_attribute}>"; $_html .= "\n <div id='form-row-{$_sanitized_name}' class='sirclo-form-row'>\n {$_html_input}\n </div>"; } else { if ($_type == 'dropdown') { $_attrs = array(); if ($_required) { $_attrs['required'] = 'required'; } $_html_input .= Helper_Xml::xmlSelect($_name, $_options, $_value, $_attrs); $_html .= "\n <div id='form-row-{$_sanitized_name}' class='sirclo-form-row'>\n <div class='sirclo-form-label'>\n <label for='{$_name}'>\n {$_label}\n {$_required}\n </label>\n </div>\n <div class='sirclo-form-input'>\n {$_html_input}\n </div>\n </div>"; } else { if ($_type == "plain_text") { $_html_input .= "<p>{$_value}</p>"; $_html .= "\n <div id='form-row-{$_sanitized_name}' class='sirclo-form-row'>\n {$_html_input}\n </div>"; } } } } } } } } } } } } } } } return $_html; }
static function bannerToArr($controller, $obj) { $prefix = '_med'; if ($controller->getKrcoConfigVersion() >= 1) { $prefix = ''; } $image = Helper_File::addSuffix($obj->getImage(), $prefix); $youtubeId = Helper_String::extractYoutubeId($obj->getYoutubeLink()); $arr = array('title' => $obj->getTitle($controller->lang), 'description' => self::markdownMark($obj->getDescription($controller->lang)), 'image' => $controller->composeResource("/content/banners/" . rawurlencode($image)), 'link' => $obj->getLink(), 'youtube_id' => $youtubeId, 'cta_text' => $obj->getButtonText()); return $arr; }