function xtc_draw_pull_down_menuNote($data, $values, $default = '', $parameters = '', $required = false)
{
    $field = '<select name="' . xtc_parse_input_field_data($data['name'], array('"' => '&quot;')) . '"';
    if (USE_BOOTSTRAP == "true") {
        $field .= ' class="form-control"';
    }
    if (xtc_not_null($parameters)) {
        $field .= ' ' . $parameters;
    }
    $field .= '>';
    if (empty($default) && isset($GLOBALS[$data['name']])) {
        $default = $GLOBALS[$data['name']];
    }
    for ($i = 0, $n = sizeof($values); $i < $n; $i++) {
        $field .= '<option value="' . xtc_parse_input_field_data($values[$i]['id'], array('"' => '&quot;')) . '"';
        # New $values parameter disabled
        if (isset($values[$i]['disabled'])) {
            if ($values[$i]['disabled'] == "disabled") {
                $field .= ' disabled="disabled"';
            }
        }
        if ($default == $values[$i]['id']) {
            $field .= ' selected="selected"';
        }
        $field .= '>' . xtc_parse_input_field_data($values[$i]['text'], array('"' => '&quot;', '\'' => '&#039;', '<' => '&lt;', '>' => '&gt;')) . '</option>';
    }
    $field .= '</select>' . $data['text'];
    if ($required == true) {
        $field .= TEXT_FIELD_REQUIRED;
    }
    return $field;
}
function xtc_draw_form($name, $action, $method = 'post', $parameters = '')
{
    $form = '<form id="' . xtc_parse_input_field_data($name, array('"' => '&quot;')) . '" action="' . xtc_parse_input_field_data($action, array('"' => '&quot;')) . '" method="' . xtc_parse_input_field_data($method, array('"' => '&quot;')) . '"';
    if (xtc_not_null($parameters)) {
        $form .= ' ' . $parameters;
    }
    $form .= '>';
    return $form;
}
Esempio n. 3
0
/**
 * xtc_output_string()
 *
 * @param mixed $string
 * @param bool $translate
 * @param bool $protected
 * @return
 */
function xtc_output_string($string, $translate = false, $protected = false)
{
    if ($protected == true) {
        return encode_htmlspecialchars($string);
    } else {
        if ($translate == false) {
            return xtc_parse_input_field_data($string, array('"' => '&quot;'));
        } else {
            return xtc_parse_input_field_data($string, $translate);
        }
    }
}
function xtc_draw_hidden_field($name, $value = '', $parameters = '')
{
    $field = '<input type="hidden" name="' . xtc_parse_input_field_data($name, array('"' => '&quot;')) . '" value="';
    if (xtc_not_null($value)) {
        $field .= xtc_parse_input_field_data($value, array('"' => '&quot;'));
    } else {
        $field .= xtc_parse_input_field_data(array_key_exists($name, $GLOBALS) ? $GLOBALS[$name] : NULL, array('"' => '&quot;'));
    }
    $field .= xtc_not_null($parameters) ? '" ' . $parameters : '"';
    $field .= ' />';
    return $field;
}
function xtc_draw_input_fieldNote($data, $value = '', $parameters = '', $type = 'text', $reinsert_value = true)
{
    $field = '<input type="' . xtc_parse_input_field_data($type, array('"' => '&quot;')) . '" name="' . xtc_parse_input_field_data($data['name'], array('"' => '&quot;')) . '"';
    if (isset($GLOBALS[$data['name']]) && $reinsert_value == true) {
        $field .= ' value="' . xtc_parse_input_field_data($GLOBALS[$data['name']], array('"' => '&quot;')) . '"';
    } elseif (xtc_not_null($value)) {
        $field .= ' value="' . xtc_parse_input_field_data($value, array('"' => '&quot;')) . '"';
    }
    if (xtc_not_null($parameters)) {
        $field .= ' ' . $parameters;
    }
    $field .= ' />' . $data['text'];
    return $field;
}
function xtc_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true)
{
    $field = '<textarea name="' . xtc_parse_input_field_data($name, array('"' => '&quot;')) . '" id="' . xtc_parse_input_field_data($name, array('"' => '&quot;')) . '" cols="' . xtc_parse_input_field_data($width, array('"' => '&quot;')) . '" rows="' . xtc_parse_input_field_data($height, array('"' => '&quot;')) . '"';
    if (xtc_not_null($parameters)) {
        $field .= ' ' . $parameters;
    }
    $field .= '>';
    if (isset($GLOBALS[$name]) && $reinsert_value == true) {
        $field .= $GLOBALS[$name];
    } elseif (xtc_not_null($text)) {
        $field .= $text;
    }
    $field .= '</textarea>';
    return $field;
}
function xtc_image_submit($image, $alt = '', $parameters = '')
{
    if (USE_BOOTSTRAP == "true") {
        return xtc_image_button($image, $alt, $parameters, true);
    } else {
        $image_submit = '<input type="image" src="' . xtc_parse_input_field_data('templates/' . CURRENT_TEMPLATE . '/buttons/' . $_SESSION['language'] . '/' . $image, array('"' => '&quot;')) . '" alt="' . xtc_parse_input_field_data($alt, array('"' => '&quot;')) . '"';
        if (xtc_not_null($alt)) {
            $image_submit .= ' title=" ' . xtc_parse_input_field_data($alt, array('"' => '&quot;')) . ' "';
        }
        if (xtc_not_null($parameters)) {
            $image_submit .= ' ' . $parameters;
        }
        $image_submit .= ' />';
        return $image_submit;
    }
}
function xtc_image($src, $alt = '', $width = '', $height = '', $parameters = '')
{
    if (empty($src) || $src == DIR_WS_IMAGES || $src == DIR_WS_THUMBNAIL_IMAGES) {
        return false;
    }
    // alt is added to the img tag even if it is null to prevent browsers from outputting
    // the image filename as default
    $image = '<img src="' . xtc_parse_input_field_data($src, array('"' => '&quot;')) . '" alt="' . xtc_parse_input_field_data($alt, array('"' => '&quot;')) . '"';
    //BOF - Dokuman - 2009-10-14 - Remove title-attribute from images to avoid "keyword stuffing" (SEO), as it is identical to the alt-attribute
    /*
    if (xtc_not_null($alt)) {
      $image .= ' title=" ' . xtc_parse_input_field_data($alt, array('"' => '&quot;')) . ' "';
    }
    */
    //EOF - Dokuman - 2009-10-14 - Remove title-attribute from images to avoid "keyword stuffing" (SEO), as it is identical to the alt-attribute
    if (CONFIG_CALCULATE_IMAGE_SIZE == 'true' && (empty($width) || empty($height))) {
        if ($image_size = @getimagesize($src)) {
            if (empty($width) && xtc_not_null($height)) {
                $ratio = $height / $image_size[1];
                $width = $image_size[0] * $ratio;
            } elseif (xtc_not_null($width) && empty($height)) {
                $ratio = $width / $image_size[0];
                $height = $image_size[1] * $ratio;
            } elseif (empty($width) && empty($height)) {
                $width = $image_size[0];
                $height = $image_size[1];
            }
        } elseif (defined('IMAGE_REQUIRED') && IMAGE_REQUIRED == 'false') {
            //DokuMan - 2010-02-26 - set undefined constant
            return false;
        }
    }
    if (xtc_not_null($width) && xtc_not_null($height)) {
        $image .= ' width="' . xtc_parse_input_field_data($width, array('"' => '&quot;')) . '" height="' . xtc_parse_input_field_data($height, array('"' => '&quot;')) . '"';
    }
    if (xtc_not_null($parameters)) {
        $image .= ' ' . $parameters;
    }
    $image .= ' />';
    return $image;
}
function xtc_draw_selection_fieldNote($data, $type, $value = '', $checked = false, $parameters = '')
{
    $selection = $data['suffix'] . '<input type="' . xtc_parse_input_field_data($type, array('"' => '&quot;')) . '" name="' . xtc_parse_input_field_data($data['name'], array('"' => '&quot;')) . '"';
    if (xtc_not_null($value)) {
        $selection .= ' value="' . xtc_parse_input_field_data($value, array('"' => '&quot;')) . '"';
    }
    //BOF - DokuMan - 2010-09-17 - set undefined index
    //if ( ($checked == true) || ($GLOBALS[$data['name']] == 'on') || ( (isset($value)) && ($GLOBALS[$data['name']] == $value) ) ) {
    if ($checked == true || isset($GLOBALS[$data['name']]) && $GLOBALS[$data['name']] == 'on' || isset($value) && (isset($GLOBALS[$data['name']]) && $GLOBALS[$data['name']] == $value)) {
        //EOF - DokuMan - 2010-09-17 - set undefined index
        $selection .= ' checked="checked"';
    }
    if (xtc_not_null($parameters)) {
        $selection .= ' ' . $parameters;
    }
    //BOF - DokuMan - 2010-09-17 - set undefined index: text
    //$selection .= ' />'.$data['text'];
    $selection .= ' />';
    if (isset($data['text'])) {
        $selection .= $data['text'];
    }
    //EOF - DokuMan - 2010-09-17 - set undefined index: text
    return $selection;
}
 /**
  * Used for error encodings.
  *
  * @param string        $string    string to encode
  * @param boolean|array $translate to translate or not
  * @param boolean       $protected protected or not
  *
  * @return string
  */
 public function klarnaOutputString($string, $translate = false, $protected = false)
 {
     if ($protected == true) {
         return htmlspecialchars($string);
     }
     if ($translate == false) {
         return xtc_parse_input_field_data($string, array('"' => '&quot;'));
     }
     return xtc_parse_input_field_data($string, $translate);
 }
function xtc_image_button($image, $alt = '', $parameters = '', $submit = false)
{
    if (USE_BOOTSTRAP == "true") {
        $name = $image;
        $html = '';
        $title = xtc_parse_input_field_data($alt, array('"' => '&quot;'));
        // Erklärung: es wird geprüft, welches Buttonbild von Modified aufgerufen wird. Dementsprechend werden neue Attribute zugewiesen.
        // z.B. dem Buttonbild 'button_buy_now.gif' wird zugewiesen:
        //      'Image' => '' (kein Bild - vergleiche cart_del.gif, dort wird das Bild cart_del.gif zugewiesen, damit bleibt der Button ein Bildbutton).
        //      'Text' => IMAGE_BUTTON_IN_CART (der Text der auf dem neuen Button angezeigt wird, in der Regel der Text der Modifiedvariablen '$alt', in unserem Beispiel der Text der in der Languagedatei 'IMAGE_BUTTON_IN_CART' zugewiesen wurde).
        //      'icon' => 'glyphicon glyphicon-shopping-cart' (das Icon das im Button angezeigt wird - in der Bootstrapdokumentation unter 'Icons by Glyphicons' kann man diese aussuchen).
        //      'iconposition' => 'iconleft' (die Position des Icons im Button - 'iconleft' = links vom Text, 'iconright' = rechts vom Text).
        //      'Class' => '' (hier kann dem Button noch eine zusätzliche CSS-Klasse zugewiesen werden).
        /* Buttons array */
        $buttons = array('default' => array('Image' => '', 'Text' => $alt, 'icon' => '', 'iconposition' => '', 'Class' => 'btn-default'), 'button_add_address.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-edit', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_add_quick.gif' => array('Image' => '', 'Text' => IMAGE_BUTTON_IN_CART, 'icon' => 'glyphicon glyphicon-shopping-cart', 'iconposition' => 'iconleft', 'Class' => 'btn-primary'), 'button_admin.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-wrench', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_back.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-arrow-left', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_buy_now.gif' => array('Image' => '', 'Text' => IMAGE_BUTTON_IN_CART, 'icon' => 'glyphicon glyphicon-shopping-cart', 'iconposition' => 'iconleft', 'Class' => 'btn-primary'), 'button_change_address.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-edit', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_checkout.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-ok', 'iconposition' => 'iconright', 'Class' => 'btn-primary'), 'button_confirm.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-ok', 'iconposition' => 'iconright', 'Class' => 'btn-default'), 'button_confirm_order.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-ok', 'iconposition' => 'iconright', 'Class' => 'btn-success'), 'button_continue.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-arrow-right', 'iconposition' => 'iconright', 'Class' => 'btn-primary'), 'button_continue_shopping.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-arrow-left', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_delete.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-remove', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_download.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-download', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_login.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon glyphicon-user', 'iconposition' => 'iconleft', 'Class' => 'btn-primary'), 'button_logoff.gif' => array('Image' => '', 'Text' => $alt, 'icon' => '', 'iconposition' => '', 'Class' => 'btn-default'), 'button_in_cart.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-shopping-cart', 'iconposition' => 'iconleft', 'Class' => 'btn-primary'), 'button_login_newsletter.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-ok', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_print.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-print', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_product_more.gif' => array('Image' => '', 'Text' => IMAGE_BUTTON_PRODUCT_MORE, 'icon' => 'glyphicon glyphicon-info-sign', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_quick_find.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-search', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_redeem.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-asterisk', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_search.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-search', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_send.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-ok', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_login_small.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-user', 'iconposition' => 'iconleft', 'Class' => 'btn-primary'), 'button_update.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-refresh', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_update_cart.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-refresh', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_view.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-eye-open', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_write_review.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-edit', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'small_edit.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-edit', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'small_delete.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-remove', 'iconposition' => 'iconright', 'Class' => 'btn-default'), 'small_view.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-eye-open', 'iconposition' => 'iconright', 'Class' => 'btn-default'), 'cart_del.gif' => array('Image' => 'cart_del.gif', 'Text' => $alt, 'icon' => '', 'iconposition' => '', 'Class' => 'btn-default'), 'edit_product.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-edit', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'print.gif' => array('Image' => '', 'Text' => TEXT_PRINT, 'icon' => 'glyphicon glyphicon-print', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_goto_cart_gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-shopping-cart', 'iconposition' => 'iconleft', 'Class' => 'btn-default'), 'button_manufactors_info.gif' => array('Image' => '', 'Text' => $alt, 'icon' => 'glyphicon glyphicon-list-alt', 'iconposition' => 'iconleft', 'Class' => 'btn-default'));
        if (!array_key_exists($name, $buttons)) {
            $name = 'default';
        }
        // kein Submitbutton
        if (!$submit) {
            if ($buttons[$name]['Image']) {
                $html .= xtc_image('templates/' . CURRENT_TEMPLATE . '/buttons/' . $_SESSION['language'] . '/' . $buttons[$name]['Image'], $buttons[$name]['Text'], '', '', $parameters);
            } else {
                $html .= '<span class="btn';
                if ($buttons[$name]['Class']) {
                    $html .= ' ' . $buttons[$name]['Class'];
                }
                if (xtc_not_null($parameters)) {
                    $html .= '" ' . $parameters . '>';
                } else {
                    $html .= '">';
                }
                if ($buttons[$name]['iconposition'] == 'iconleft') {
                    $html .= '<i class="' . $buttons[$name]['icon'] . '"></i>&nbsp;' . $buttons[$name]['Text'];
                } elseif ($buttons[$name]['iconposition'] == 'iconright') {
                    $html .= $buttons[$name]['Text'] . '&nbsp;<i class="' . $buttons[$name]['icon'] . '"></i>';
                } else {
                    $html .= $buttons[$name]['Text'];
                }
                $html .= '</span>';
            }
        }
        // wenn Submitbutton
        if ($submit) {
            $html .= '<button class="btn';
            if ($buttons[$name]['Class']) {
                $html .= ' ' . $buttons[$name]['Class'] . '"';
            } else {
                $html .= '"';
            }
            if ($submit != true) {
                $html .= ' name="' . $submit . '"';
            }
            if ($submit == true || $submit == "submit") {
                $html .= ' type="submit"';
            }
            $html .= ' title="' . $title . '"' . $parameters . '>';
            if ($buttons[$name]['iconposition'] == 'iconleft') {
                $html .= '<i class="' . $buttons[$name]['icon'] . '"></i>&nbsp;' . $buttons[$name]['Text'];
            } elseif ($buttons[$name]['iconposition'] == 'iconright') {
                $html .= $buttons[$name]['Text'] . '&nbsp;<i class="' . $buttons[$name]['icon'] . '"></i>';
            } else {
                $html .= $buttons[$name]['Text'];
            }
            $html .= '</button>';
        }
        return $html;
    } else {
        return xtc_image('templates/' . CURRENT_TEMPLATE . '/buttons/' . $_SESSION['language'] . '/' . $image, $alt, '', '', $parameters);
    }
}