Ejemplo n.º 1
0
 /**
  * Generates element sub-options for selectbox, checkbox and radio buttons.
  *
  * @since 1.0.0
  * @access private
  */
 private function builder_sub_options($options = array(), $name = "multiple_selectbox_options", $counter = NULL, $default_value = NULL)
 {
     $o = array();
     $upload = "";
     $uploadp = "";
     $class = "";
     $additional_currencies = TM_EPO_HELPER()->wc_aelia_cs_enabled_currencies();
     if ($name == "multiple_radiobuttons_options" || $name == "multiple_checkboxes_options") {
         if ($name == "multiple_radiobuttons_options") {
             $upload = '&nbsp;<span data-tm-tooltip-html="' . esc_attr(__("Choose the image to use in place of the radio button.", TM_EPO_TRANSLATION)) . '" class="tm_upload_button cp_button tm-tooltip"><i class="tcfa tcfa-upload"></i></span>';
         } elseif ($name == "multiple_checkboxes_options") {
             $upload = '&nbsp;<span data-tm-tooltip-html="' . esc_attr(__("Choose the image to use in place of the checkbox.", TM_EPO_TRANSLATION)) . '" class="tm_upload_button cp_button tm-tooltip"><i class="tcfa tcfa-upload"></i></span>';
         }
         $uploadp = '&nbsp;<span data-tm-tooltip-html="' . esc_attr(__("Choose the image to replace the product image with.", TM_EPO_TRANSLATION)) . '" class="tm_upload_button tm_upload_buttonp cp_button tm-tooltip"><i class="tcfa tcfa-upload"></i></span>';
         $class = " withupload";
     }
     if ($name == "multiple_selectbox_options") {
         $uploadp = '&nbsp;<span data-tm-tooltip-html="' . esc_attr(__("Choose the image to replace the product image with.", TM_EPO_TRANSLATION)) . '" class="tm_upload_button tm_upload_buttonp cp_button tm-tooltip"><i class="tcfa tcfa-upload"></i></span>';
         $class = " withupload";
     }
     $o["title"] = array("id" => $name . "_title", "default" => "", "type" => "text", "nodiv" => 1, "tags" => array("class" => "t tm_option_title", "id" => $name . "_title", "name" => $name . "_title", "value" => ""));
     $o["value"] = array("id" => $name . "_value", "default" => "", "type" => "text", "nodiv" => 1, "tags" => array("class" => "t tm_option_value", "id" => $name . "_value", "name" => $name . "_value"));
     $o["price"] = array("id" => $name . "_price", "default" => "", "type" => "number", "nodiv" => 1, "tags" => array("class" => "n tm_option_price", "id" => $name . "_price", "name" => $name . "_price"));
     $o["sale_price"] = array("id" => $name . "_sale_price", "default" => "", "type" => "number", "nodiv" => 1, "tags" => array("class" => "n tm_option_sale_price", "id" => $name . "_price", "name" => $name . "_price"));
     $o["image"] = array("id" => $name . "_image", "default" => "", "type" => "hidden", "nodiv" => 1, "tags" => array("class" => "n tm_option_image" . $class, "id" => $name . "_image", "name" => $name . "_image"), "extra" => $upload);
     $o["imagep"] = array("id" => $name . "_imagep", "default" => "", "type" => "hidden", "nodiv" => 1, "tags" => array("class" => "n tm_option_image tm_option_imagep" . $class, "id" => $name . "_imagep", "name" => $name . "_imagep"));
     $o["price_type"] = array("id" => $name . "_price_type", "default" => "", "type" => "select", "options" => array(array("text" => __("Fixed amount", TM_EPO_TRANSLATION), "value" => ""), array("text" => __("Percent of the original price", TM_EPO_TRANSLATION), "value" => "percent"), array("text" => __("Percent of the original price + options", TM_EPO_TRANSLATION), "value" => "percentcurrenttotal")), "nodiv" => 1, "tags" => array("class" => "n tm_option_price_type " . $name, "id" => $name . "_price_type", "name" => $name . "_price_type"));
     $o["url"] = array("id" => $name . "_url", "default" => "", "type" => "text", "nodiv" => 1, "tags" => array("class" => "t tm_option_url", "id" => $name . "_url", "name" => $name . "_url", "value" => ""));
     $o["description"] = array("id" => $name . "_description", "default" => "", "type" => "text", "nodiv" => 1, "tags" => array("class" => "t tm_option_description", "id" => $name . "_description", "name" => $name . "_description", "value" => ""));
     if ($this->woo_subscriptions_check && $name != "multiple_selectbox_options") {
         $o["price_type"]['options'][] = array("text" => __("Subscription fee", TM_EPO_TRANSLATION), "value" => "subscriptionfee");
     }
     if ($name != "multiple_selectbox_options") {
         $o["price_type"]['options'][] = array("text" => __("Fee", TM_EPO_TRANSLATION), "value" => "fee");
     }
     if (!$options) {
         $options = array("title" => array(""), "value" => array(""), "price" => array(""), "sale_price" => array(""), "image" => array(""), "imagep" => array(""), "price_type" => array(""), "url" => array(""), "description" => array(""));
     }
     $del = TM_EPO_HTML()->tm_make_button(array("text" => "<i class='tcfa tcfa-times'></i>", "tags" => array("href" => "#delete", "class" => "button button-secondary button-small builder_panel_delete")), 0);
     $drag = TM_EPO_HTML()->tm_make_button(array("text" => "<i class='tcfa tcfa-sort'></i>", "tags" => array("href" => "#move", "class" => "builder_panel_move")), 0);
     $out = "<div class='tm-row nopadding multiple_options tc-clearfix'>" . "<div class='tm-cell col-auto tm_cell_move'>&nbsp;</div>" . "<div class='tm-cell col-auto tm_cell_default'>" . ($name == "multiple_checkboxes_options" ? __("Checked", TM_EPO_TRANSLATION) : __("Default", TM_EPO_TRANSLATION)) . "</div>" . "<div class='tm-cell col-3 tm_cell_title'>" . __("Label", TM_EPO_TRANSLATION) . "</div>" . "<div class='tm-cell col-2 tm_cell_images'>" . __("Images", TM_EPO_TRANSLATION) . "</div>" . "<div class='tm-cell col-0 tm_cell_value'>" . __("Value", TM_EPO_TRANSLATION) . "</div>" . "<div class='tm-cell col-auto tm_cell_price'>" . __("Price", TM_EPO_TRANSLATION) . "</div>" . "<div class='tm-cell col-auto tm_cell_delete'><span class='tm-button button button-primary button-large builder_panel_delete_all'>" . __("Delete all options", TM_EPO_TRANSLATION) . "</span></div>" . "</div>" . "<div class='panels_wrap nof_wrapper'>";
     $d_counter = 0;
     foreach ($options["title"] as $ar => $el) {
         $out .= "<div class='options_wrap'>" . "<div class='tm-row nopadding tc-clearfix'>";
         $o["title"]["default"] = $options["title"][$ar];
         //label
         $o["title"]["tags"]["name"] = "tm_meta[tmfbuilder][" . $name . "_title][" . (is_null($counter) ? 0 : $counter) . "][]";
         $o["title"]["tags"]["id"] = str_replace(array("[", "]"), "", $o["title"]["tags"]["name"]) . "_" . $ar;
         $o["value"]["default"] = $options["value"][$ar];
         //value
         $o["value"]["tags"]["name"] = "tm_meta[tmfbuilder][" . $name . "_value][" . (is_null($counter) ? 0 : $counter) . "][]";
         $o["value"]["tags"]["id"] = str_replace(array("[", "]"), "", $o["value"]["tags"]["name"]) . "_" . $ar;
         $o["price"]["default"] = $options["price"][$ar];
         //price
         $o["price"]["tags"]["name"] = "tm_meta[tmfbuilder][" . $name . "_price][" . (is_null($counter) ? 0 : $counter) . "][]";
         $o["price"]["tags"]["id"] = str_replace(array("[", "]"), "", $o["price"]["tags"]["name"]) . "_" . $ar;
         $o["sale_price"]["default"] = $options["sale_price"][$ar];
         //sale_price
         $o["sale_price"]["tags"]["name"] = "tm_meta[tmfbuilder][" . $name . "_sale_price][" . (is_null($counter) ? 0 : $counter) . "][]";
         $o["sale_price"]["tags"]["id"] = str_replace(array("[", "]"), "", $o["sale_price"]["tags"]["name"]) . "_" . $ar;
         $o["image"]["default"] = $options["image"][$ar];
         //image
         $o["image"]["tags"]["name"] = "tm_meta[tmfbuilder][" . $name . "_image][" . (is_null($counter) ? 0 : $counter) . "][]";
         $o["image"]["tags"]["id"] = str_replace(array("[", "]"), "", $o["image"]["tags"]["name"]) . "_" . $ar;
         $o["image"]["extra"] = $upload . '<span class="tm_upload_image"><img class="tm_upload_image_img" alt="" src="' . $options["image"][$ar] . '" /></span>';
         $o["imagep"]["default"] = $options["imagep"][$ar];
         //imagep
         $o["imagep"]["tags"]["name"] = "tm_meta[tmfbuilder][" . $name . "_imagep][" . (is_null($counter) ? 0 : $counter) . "][]";
         $o["imagep"]["tags"]["id"] = str_replace(array("[", "]"), "", $o["imagep"]["tags"]["name"]) . "_" . $ar;
         $o["imagep"]["extra"] = $uploadp . '<span class="tm_upload_image tm_upload_imagep"><img class="tm_upload_image_img" alt="" src="' . $options["imagep"][$ar] . '" /></span>';
         $o["price_type"]["default"] = $options["price_type"][$ar];
         //price type
         $o["price_type"]["tags"]["name"] = "tm_meta[tmfbuilder][" . $name . "_price_type][" . (is_null($counter) ? 0 : $counter) . "][]";
         $o["price_type"]["tags"]["id"] = str_replace(array("[", "]"), "", $o["price_type"]["tags"]["name"]) . "_" . $ar;
         $o["url"]["default"] = $options["url"][$ar];
         //url
         $o["url"]["tags"]["name"] = "tm_meta[tmfbuilder][" . $name . "_url][" . (is_null($counter) ? 0 : $counter) . "][]";
         $o["url"]["tags"]["id"] = str_replace(array("[", "]"), "", $o["url"]["tags"]["name"]) . "_" . $ar;
         $o["description"]["default"] = $options["description"][$ar];
         //description
         $o["description"]["tags"]["name"] = "tm_meta[tmfbuilder][" . $name . "_description][" . (is_null($counter) ? 0 : $counter) . "][]";
         $o["description"]["tags"]["id"] = str_replace(array("[", "]"), "", $o["description"]["tags"]["name"]) . "_" . $ar;
         if ($name == "multiple_checkboxes_options") {
             $default_select = '<input type="checkbox" value="' . $d_counter . '" name="tm_meta[tmfbuilder][' . $name . '_default_value][' . (is_null($counter) ? 0 : $counter) . '][]" class="tm-default-checkbox" ' . checked(is_null($counter) ? "" : isset($default_value[$counter]) ? in_array($d_counter, $default_value[$counter]) : "", true, 0) . '>';
         } else {
             $default_select = '<input type="radio" value="' . $d_counter . '" name="tm_meta[tmfbuilder][' . $name . '_default_value][' . (is_null($counter) ? 0 : $counter) . ']" class="tm-default-radio" ' . checked(is_null($counter) ? "" : isset($default_value[$counter]) && !is_array($default_value[$counter]) ? (string) $default_value[$counter] : "", $d_counter, 0) . '>';
         }
         $default_select = '<span class="tm-hidden-inline">' . ($name == "multiple_checkboxes_options" ? __("Checked", TM_EPO_TRANSLATION) : __("Default", TM_EPO_TRANSLATION)) . '</span>' . $default_select;
         $out .= "<div class='tm-cell col-auto tm_cell_move'>" . $drag . "</div>";
         $out .= "<div class='tm-cell col-auto tm_cell_default'>" . $default_select . "</div>";
         $out .= "<div class='tm-cell col-3 tm_cell_title'>" . TM_EPO_HTML()->tm_make_field($o["title"], 0) . "</div>";
         $out .= "<div class='tm-cell col-2 tm_cell_images'>" . TM_EPO_HTML()->tm_make_field($o["image"], 0) . TM_EPO_HTML()->tm_make_field($o["imagep"], 0) . "</div>";
         $out .= "<div class='tm-cell col-0 tm_cell_value'>" . TM_EPO_HTML()->tm_make_field($o["value"], 0) . "</div>";
         $out .= "<div class='tm-cell col-auto tm_cell_price'>";
         if (!empty($additional_currencies) && is_array($additional_currencies)) {
             $_copy_value = $o["price"];
             $_sale_copy_value = $o["sale_price"];
             $o["price"]["html_before_field"] = '<span class="tm-choice-currency">' . TM_EPO_HELPER()->wc_base_currency() . '</span>';
             $o["sale_price"]["html_before_field"] = '<span class="tm-choice-currency">' . TM_EPO_HELPER()->wc_base_currency() . '</span>' . '<span class="tm-choice-sale">' . __("Sale", TM_EPO_TRANSLATION) . '</span>';
             $out .= TM_EPO_HTML()->tm_make_field($o["price"], 0);
             $out .= TM_EPO_HTML()->tm_make_field($o["sale_price"], 0);
             foreach ($additional_currencies as $ckey => $currency) {
                 $mt_prefix = TM_EPO_HELPER()->get_currency_price_prefix($currency);
                 $copy_value = $_copy_value;
                 $copy_value["default"] = isset($options["price_" . $currency][$ar]) ? $options["price" . $mt_prefix][$ar] : "";
                 $copy_value["id"] .= $mt_prefix;
                 $copy_value["html_before_field"] = '<span class="tm-choice-currency">' . $currency . '</span>';
                 $copy_value["tags"]["name"] = "tm_meta[tmfbuilder][" . $name . "_price" . $mt_prefix . "][" . (is_null($counter) ? 0 : $counter) . "][]";
                 $copy_value["tags"]["id"] = str_replace(array("[", "]"), "", $copy_value["tags"]["name"]) . "_" . $ar;
                 $out .= TM_EPO_HTML()->tm_make_field($copy_value, 0);
                 $copy_value = $_sale_copy_value;
                 $copy_value["default"] = isset($options["sale_price_" . $currency][$ar]) ? $options["sale_price" . $mt_prefix][$ar] : "";
                 $copy_value["id"] .= $mt_prefix;
                 $copy_value["html_before_field"] = '<span class="tm-choice-currency">' . $currency . '</span>' . '<span class="tm-choice-sale">' . __("Sale", TM_EPO_TRANSLATION) . '</span>';
                 $copy_value["tags"]["name"] = "tm_meta[tmfbuilder][" . $name . "_sale_price" . $mt_prefix . "][" . (is_null($counter) ? 0 : $counter) . "][]";
                 $copy_value["tags"]["id"] = str_replace(array("[", "]"), "", $copy_value["tags"]["name"]) . "_" . $ar;
                 $out .= TM_EPO_HTML()->tm_make_field($copy_value, 0);
             }
         } else {
             $out .= TM_EPO_HTML()->tm_make_field($o["price"], 0);
             $o["sale_price"]["html_before_field"] = '<span class="tm-choice-sale">' . __("Sale", TM_EPO_TRANSLATION) . '</span>';
             $out .= TM_EPO_HTML()->tm_make_field($o["sale_price"], 0);
         }
         $out .= TM_EPO_HTML()->tm_make_field($o["price_type"], 0) . "</div>";
         $out .= "<div class='tm-cell col-auto tm_cell_delete'>" . $del . "</div>";
         $out .= "<div class='tm-cell col-12 tm_cell_description'><span class='tm-inline-label bsbb'>" . __("Description", TM_EPO_TRANSLATION) . "</span>" . TM_EPO_HTML()->tm_make_field($o["description"], 0) . "</div>";
         $out .= "<div class='tm-cell col-12 tm_cell_url'><span class='tm-inline-label bsbb'>" . __("URL", TM_EPO_TRANSLATION) . "</span>" . TM_EPO_HTML()->tm_make_field($o["url"], 0) . "</div>";
         $out .= "</div></div>";
         $d_counter++;
     }
     $out .= "</div>";
     $out .= ' <a class="tm-button button button-primary button-large builder-panel-add" href="#">' . __("Add item", TM_EPO_TRANSLATION) . '</a>';
     $out .= ' <a class="tm-button button button-primary button-large builder-panel-mass-add" href="#">' . __("Mass add", TM_EPO_TRANSLATION) . '</a>';
     return $out;
 }
Ejemplo n.º 2
0
 public function meta_box($post)
 {
     if ($this->is_wpml) {
         global $wp_post_types;
         $post_type_label = $wp_post_types[TM_EPO_GLOBAL_POST_TYPE]->labels->singular_name != "" ? $wp_post_types[TM_EPO_GLOBAL_POST_TYPE]->labels->singular_name : $wp_post_types[TM_EPO_GLOBAL_POST_TYPE]->labels->name;
         $tmparentpostid = 0;
         $tmaddlang = '';
         $tm_meta_lang = get_post_meta($post->ID, TM_EPO_WPML_LANG_META, true);
         $tm_meta_parent_post_id = get_post_meta($post->ID, TM_EPO_WPML_PARENT_POSTID, true);
         $is_original = false;
         $is_added_translation = false;
         $is_original_lang = '';
         $active_languages = $this->get_active_languages();
         $is_new = false;
         $is_add = false;
         // existing global epo before WPML || new global epo after WPML
         if (!empty($post->ID) && empty($tm_meta_lang) && empty($tm_meta_parent_post_id) || !empty($post->ID) && $tm_meta_parent_post_id === 0 && !empty($tm_meta_lang) || !empty($post->ID) && $tm_meta_parent_post_id == $post->ID) {
             $is_original = true;
         }
         if (!empty($_GET['tmparentpostid']) && !empty($_GET['tmaddlang']) && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'add')) {
             $tmparentpostid = (int) $_GET['tmparentpostid'];
             $tmaddlang = $_GET['tmaddlang'];
             $is_added_translation = true;
             $is_original_lang = get_post_meta($tmparentpostid, TM_EPO_WPML_LANG_META, true);
             if (empty($is_original_lang)) {
                 $is_original_lang = $this->get_default_lang();
             }
             if ($is_original_lang != $tmaddlang) {
                 $is_original = false;
             }
             $is_add = true;
         } else {
             if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'add') {
                 if (empty($_GET['tmparentpostid']) || empty($_GET['tmaddlang'])) {
                     $is_original = true;
                     $is_original_lang = $tm_meta_lang = $tmaddlang = $this->get_lang();
                     $is_new = true;
                 }
             } else {
             }
         }
         if ($is_original && empty($tm_meta_lang)) {
             $is_original_lang = $tm_meta_lang = $tmaddlang = $this->get_default_lang();
         }
         if ($is_original && empty($tmparentpostid)) {
             $tmparentpostid = $post->ID;
         }
         if (!$is_original && empty($is_original_lang) && !empty($tm_meta_parent_post_id)) {
             $is_original_lang = get_post_meta($tm_meta_parent_post_id, TM_EPO_WPML_LANG_META, true);
             if (empty($is_original_lang)) {
                 $is_original_lang = $this->get_default_lang();
             }
             if (empty($tmparentpostid)) {
                 $tmparentpostid = $tm_meta_parent_post_id;
             }
         }
         if (!$is_original && empty($tmaddlang)) {
             $tmaddlang = $tm_meta_lang;
         }
         TM_EPO_HTML()->tm_make_field(array("nodiv" => 1, "id" => "tmparentpostid", "default" => $tmparentpostid, "type" => "hidden", "tags" => array("id" => TM_EPO_WPML_PARENT_POSTID, "name" => TM_EPO_WPML_PARENT_POSTID)), 1);
         TM_EPO_HTML()->tm_make_field(array("nodiv" => 1, "id" => "tmaddlang", "default" => $tmaddlang, "type" => "hidden", "tags" => array("id" => TM_EPO_WPML_LANG_META, "name" => TM_EPO_WPML_LANG_META)), 1);
         echo '<div class="tm-meta-wpml-lang">';
         echo '<strong>' . sprintf(__('Language of this %s', 'sitepress'), $post_type_label) . '</strong>: ';
         if (!empty($_GET['tmparentpostid']) && !empty($_GET['tmaddlang']) && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'add')) {
             echo $this->get_flag($_GET['tmaddlang']);
         } else {
             echo $this->get_flag($tm_meta_lang);
         }
         echo '</div>';
         if (!$is_original) {
             echo '<div class="tm-meta-wpml-translation">';
             echo __('This is a translation of', 'sitepress');
             echo ': <div class="tm-title added">' . $this->get_flag($is_original_lang) . ' ' . get_the_title($tmparentpostid) . $this->edit_lang_link($tmparentpostid, $is_original_lang, $active_languages[$is_original_lang], $tmparentpostid, true) . '</div>';
             echo '</div>';
             $args = array('post_type' => TM_EPO_GLOBAL_POST_TYPE, 'post_status' => array('publish'), 'numberposts' => -1, 'orderby' => 'date', 'order' => 'asc');
             if (!$is_add) {
                 foreach ($active_languages as $key => $value) {
                     if ($key != $tm_meta_lang && $key != $is_original_lang) {
                         $class = "tm-title";
                         $args['meta_query'] = TM_EPO_HELPER()->build_meta_query('AND', TM_EPO_WPML_LANG_META, $key, '=', 'EXISTS');
                         $other_translations = get_posts($args);
                         if (!empty($other_translations) && isset($other_translations[0]) && is_object($other_translations[0]) && property_exists($other_translations[0], 'ID')) {
                             //has $key code translation
                             $link = $this->edit_lang_link($other_translations[0]->ID, $key, $active_languages[$key], $tmparentpostid, true);
                             $class = "tm-title added";
                         } else {
                             // no translation
                             $link = $this->add_lang_link($tmparentpostid, $key, $active_languages[$key]);
                         }
                         echo '<div class="' . $class . '">' . $this->get_flag($key) . ' ' . $value['display_name'];
                         echo $link . '</div>';
                     }
                 }
             }
         } elseif ($is_original && !$is_new) {
             echo '<div class="tm-meta-wpml-translation">';
             echo __('Translations', 'sitepress');
             $args = array('post_type' => TM_EPO_GLOBAL_POST_TYPE, 'post_status' => array('publish'), 'numberposts' => -1, 'orderby' => 'date', 'order' => 'asc');
             foreach ($active_languages as $key => $value) {
                 if ($key != $tm_meta_lang) {
                     $class = "tm-title";
                     $args['meta_query'] = TM_EPO_HELPER()->build_meta_query('AND', TM_EPO_WPML_LANG_META, $key, '=', 'EXISTS');
                     $args['meta_query'][] = array('key' => TM_EPO_WPML_PARENT_POSTID, 'value' => $tmparentpostid, 'compare' => '=');
                     $other_translations = get_posts($args);
                     if (!empty($other_translations) && isset($other_translations[0]) && is_object($other_translations[0]) && property_exists($other_translations[0], 'ID')) {
                         //has $key code translation
                         $link = $this->edit_lang_link($other_translations[0]->ID, $key, $active_languages[$key], $tmparentpostid, true);
                         $class = "tm-title added";
                     } else {
                         // no translation
                         $link = $this->add_lang_link($tmparentpostid, $key, $active_languages[$key]);
                     }
                     echo '<div class="' . $class . '">' . $this->get_flag($key) . ' ' . $value['display_name'];
                     echo $link . '</div>';
                 }
             }
             echo '</div>';
         }
     }
 }
Ejemplo n.º 3
0
 $selectArray = array("class" => "tmcp-date-select tmcp-date-month", "id" => $id . "_month", "name" => $name . "_month", "extra" => "data-tm-date='" . $id . "'");
 $select_options = array();
 $tranlation_month = !empty($tranlation_month) ? $tranlation_month : __('Month', TM_EPO_TRANSLATION);
 $select_options[] = array("text" => $tranlation_month, "value" => "");
 for ($i = 1; $i != 12 + 1; $i += 1) {
     $select_options[] = array("text" => $i, "value" => $i);
 }
 $month_html = TM_EPO_HTML()->tm_make_select($selectArray, $select_options, $selectedvalue = isset($_POST[$name . "_month"]) ? $_POST[$name . "_month"] : "", 1, 0);
 $selectArray = array("class" => "tmcp-date-select tmcp-date-year", "id" => $id . "_year", "name" => $name . "_year", "extra" => "data-tm-date='" . $id . "'");
 $select_options = array();
 $tranlation_year = !empty($tranlation_year) ? $tranlation_year : __('Year', TM_EPO_TRANSLATION);
 $select_options[] = array("text" => $tranlation_year, "value" => "");
 for ($i = intval($end_year); $i != intval($start_year) - 1; $i -= 1) {
     $select_options[] = array("text" => $i, "value" => $i);
 }
 $year_html = TM_EPO_HTML()->tm_make_select($selectArray, $select_options, $selectedvalue = isset($_POST[$name . "_year"]) ? $_POST[$name . "_year"] : "", 1, 0);
 switch ($format) {
     case "0":
     case "2":
     case "4":
         if (is_rtl()) {
             echo $year_html . $month_html . $day_html;
         } else {
             echo $day_html . $month_html . $year_html;
         }
         break;
     case "1":
     case "3":
     case "5":
         if (is_rtl()) {
             echo $year_html . $day_html . $month_html;