tag : BARCODE
mode : OPEN

@param  array $param
@return boolean
174999
protected function _tag_open_BARCODE($param)
    {
        if (!isset($param['type'])) {
            $param['type'] = 'C39';
        }
        if (!isset($param['value'])) {
            $param['value']    = 0;
        }
        if (!isset($param['label'])) {
            $param['label']    = 'label';
        }
        if (!isset($param['style']['color'])) {
            $param['style']['color'] = '#000000';
        }

        $param['type'] = strtoupper($param['type']);
        if (!isset($param['dimension'])) {
            $param['dimension'] = '1D';
        }

        $this->parsingCss->save();
        $this->parsingCss->analyse('barcode', $param);
        $this->parsingCss->setPosition();
        $this->parsingCss->fontSet();

        $x = $this->pdf->GetX();
        $y = $this->pdf->GetY();
        $w = $this->parsingCss->value['width'];
        if (!$w) {
            $w = $this->cssConverter->convertToMM('50mm');
        }
        $h = $this->parsingCss->value['height'];
        if (!$h) {
            $h = $this->cssConverter->convertToMM('10mm');
        }
        $txt = ($param['label'] !== 'none' ? $this->parsingCss->value['font-size'] : false);
        $c = $this->parsingCss->value['color'];
        $infos = $this->pdf->myBarcode($param['value'], $param['type'], $x, $y, $w, $h, $txt, $c, $param['dimension']);

        $this->_maxX = max($this->_maxX, $x+$infos[0]);
        $this->_maxY = max($this->_maxY, $y+$infos[1]);
        $this->_maxH = max($this->_maxH, $infos[1]);
        $this->_maxE++;

        $this->pdf->SetXY($x+$infos[0], $y);

        $this->parsingCss->load();
        $this->parsingCss->fontSet();

        return true;
    }
1127537
protected function _tag_open_HR($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }
        $oldAlign = $this->parsingCss->value['text-align'];
        $this->parsingCss->value['text-align'] = 'left';

        if ($this->_maxH) {
            $this->_tag_open_BR($param);
        }

        $fontSize = $this->parsingCss->value['font-size'];
        $this->parsingCss->value['font-size']=$fontSize*0.5;
        $this->_tag_open_BR($param);
        $this->parsingCss->value['font-size']=$fontSize;

        $param['style']['width'] = '100%';

        $this->parsingCss->save();
        $this->parsingCss->value['height']=$this->cssConverter->convertToMM('1mm');

        $this->parsingCss->analyse('hr', $param);
        $this->parsingCss->setPosition();
        $this->parsingCss->fontSet();

        $h = $this->parsingCss->value['height'];
        if ($h) {
            $h-= $this->parsingCss->value['border']['t']['width']+$this->parsingCss->value['border']['b']['width'];
        }
        if ($h<=0) {
            $h = $this->parsingCss->value['border']['t']['width']+$this->parsingCss->value['border']['b']['width'];
        }

        $this->_drawRectangle($this->pdf->GetX(), $this->pdf->GetY(), $this->parsingCss->value['width'], $h, $this->parsingCss->value['border'], 0, 0, $this->parsingCss->value['background']);
        $this->_maxH = $h;

        $this->parsingCss->load();
        $this->parsingCss->fontSet();

        $this->parsingCss->value['font-size'] = 0;
        $this->_tag_open_BR($param);

        $this->parsingCss->value['font-size']=$fontSize*0.5;
        $this->_tag_open_BR($param);
        $this->parsingCss->value['font-size']=$fontSize;

        $this->parsingCss->value['text-align'] = $oldAlign;
        $this->_setNewPositionForNewLine();

        return true;
    }
1130499
public function url($uri,$param=[])
    {
        $list=Lists::get();
        if($this->get_index($uri,$list)===false){
            $url=$uri;
        }else{
            $url=$this->return_rule($list,$param);
        }
        return urldecode($url);
    }
699807
public function init($param)
    {

        if (empty($param)) return false;

        $this->header = '';

        $param_list = new ParamList();
        foreach ($param as $key => $value) {
            if (property_exists($this, $key)) $this->$key = $value;
            elseif (property_exists($param_list, strtolower(str_replace('-', '_', $key)))) {
                if (is_string($value)) {
                    $this->header[] = new SingleParam($key, $value);
                } elseif (is_array($value)) {
                    $this->header[] = new MultiParam($key, $value);
                }
            }

        }


        return true;
    }
652022
public function call($param = null)
    {
        // get the class within the correct namespace
        // initiate object
        $object = $this->prepareObject(new $this->class());

        $return    = new \SplFixedArray(2);
        $return[1] = $object;

        if (!empty($this->method)) {
            if (!empty($param) && !empty($this->param)) {
                $return[0] = $object->{$this->method}(array_merge((array)$this->param, (array)$param));

                return $return;
            }
            $return[0] = $object->{$this->method}();

            return $return;
        }

        return $return;
    }
1153981
protected function _tag_open_PAGE_HEADER($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }

        $amountHtmlCodes = count($this->parsingHtml->code);

        $this->_subHEADER = array();
        for ($this->_parsePos; $this->_parsePos<$amountHtmlCodes; $this->_parsePos++) {
            $action = $this->parsingHtml->code[$this->_parsePos];
            if ($action->getName() === 'page_header') {
                $action->setName('page_header_sub');
            }
            $this->_subHEADER[] = $action;
            if (strtolower($action->getName()) === 'page_header_sub' && $action->isClose()) {
                break;
            }
        }

        $this->_setPageHeader();

        return true;
    }
781177
public function hasParam($param)
	{
		$param = (string)$this->params[$param];
		
		return strlen($param) > 0 ? true : false;
	}
509173
protected function _tag_open_TABLE($param, $other = 'table')
    {
        if ($this->_maxH) {
            if ($this->_isForOneLine) {
                return false;
            }
            $this->_tag_open_BR(array());
        }

        if ($this->_isForOneLine) {
            $this->_maxX = $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin();
            return false;
        }

        $this->_maxH = 0;

        $alignObject = isset($param['align']) ? strtolower($param['align']) : 'left';
        if (isset($param['align'])) {
            unset($param['align']);
        }
        if (!in_array($alignObject, array('left', 'center', 'right'))) {
            $alignObject = 'left';
        }

        $this->parsingCss->save();
        $this->parsingCss->analyse($other, $param);
        $this->parsingCss->setPosition();
        $this->parsingCss->fontSet();

        if ($this->parsingCss->value['margin-auto']) {
            $alignObject = 'center';
        }

        // collapse table ?
        $collapse = false;
        if ($other === 'table') {
            $collapse = isset($this->parsingCss->value['border']['collapse']) ? $this->parsingCss->value['border']['collapse'] : false;
        }

        // if collapse => no borders for the table, only for TD
        if ($collapse) {
            $param['style']['border'] = 'none';
            $param['cellspacing'] = 0;
            $none = $this->parsingCss->readBorder('none');
            $this->parsingCss->value['border']['t'] = $none;
            $this->parsingCss->value['border']['r'] = $none;
            $this->parsingCss->value['border']['b'] = $none;
            $this->parsingCss->value['border']['l'] = $none;
        }

        // if we are in a SUB html => prepare the properties of the table
        if ($this->_subPart) {
            if (!is_null($this->debug)) {
                $this->debug->addStep('Table '.$param['num'], true);
            }
            self::$_tables[$param['num']] = array();
            self::$_tables[$param['num']]['border']          = isset($param['border']) ? $this->parsingCss->readBorder($param['border']) : null;
            self::$_tables[$param['num']]['cellpadding']     = $this->cssConverter->convertToMM(isset($param['cellpadding']) ? $param['cellpadding'] : '1px');
            self::$_tables[$param['num']]['cellspacing']     = $this->cssConverter->convertToMM(isset($param['cellspacing']) ? $param['cellspacing'] : '2px');
            self::$_tables[$param['num']]['cases']           = array();          // properties of each TR/TD
            self::$_tables[$param['num']]['corr']            = array();          // link between TR/TD and colspan/rowspan
            self::$_tables[$param['num']]['corr_x']          = 0;                // position in 'cases'
            self::$_tables[$param['num']]['corr_y']          = 0;                // position in 'cases'
            self::$_tables[$param['num']]['td_curr']         = 0;                // current column
            self::$_tables[$param['num']]['tr_curr']         = 0;                // current row
            self::$_tables[$param['num']]['curr_x']          = $this->pdf->GetX();
            self::$_tables[$param['num']]['curr_y']          = $this->pdf->GetY();
            self::$_tables[$param['num']]['width']           = 0;                // global width
            self::$_tables[$param['num']]['height']          = 0;                // global height
            self::$_tables[$param['num']]['align']           = $alignObject;
            self::$_tables[$param['num']]['marge']           = array();
            self::$_tables[$param['num']]['marge']['t']      = $this->parsingCss->value['padding']['t']+$this->parsingCss->value['border']['t']['width']+self::$_tables[$param['num']]['cellspacing']*0.5;
            self::$_tables[$param['num']]['marge']['r']      = $this->parsingCss->value['padding']['r']+$this->parsingCss->value['border']['r']['width']+self::$_tables[$param['num']]['cellspacing']*0.5;
            self::$_tables[$param['num']]['marge']['b']      = $this->parsingCss->value['padding']['b']+$this->parsingCss->value['border']['b']['width']+self::$_tables[$param['num']]['cellspacing']*0.5;
            self::$_tables[$param['num']]['marge']['l']      = $this->parsingCss->value['padding']['l']+$this->parsingCss->value['border']['l']['width']+self::$_tables[$param['num']]['cellspacing']*0.5;
            self::$_tables[$param['num']]['page']            = 0;                // number of pages
            self::$_tables[$param['num']]['new_page']        = true;             // flag : new page for the current TR
            self::$_tables[$param['num']]['style_value']     = null;             // CSS style of the table
            self::$_tables[$param['num']]['thead']           = array();          // properties on the thead
            self::$_tables[$param['num']]['tfoot']           = array();          // properties on the tfoot
            self::$_tables[$param['num']]['thead']['tr']     = array();          // list of the TRs in the thead
            self::$_tables[$param['num']]['tfoot']['tr']     = array();          // list of the TRs in the tfoot
            self::$_tables[$param['num']]['thead']['height']    = 0;             // thead height
            self::$_tables[$param['num']]['tfoot']['height']    = 0;             // tfoot height
            self::$_tables[$param['num']]['thead']['code'] = array();            // HTML content of the thead
            self::$_tables[$param['num']]['tfoot']['code'] = array();            // HTML content of the tfoot
            self::$_tables[$param['num']]['cols']        = array();              // properties of the COLs

            $this->_saveMargin($this->pdf->getlMargin(), $this->pdf->gettMargin(), $this->pdf->getrMargin());

            $this->parsingCss->value['width']-= self::$_tables[$param['num']]['marge']['l'] + self::$_tables[$param['num']]['marge']['r'];
        } else {
            // we start from the first page and the first page of the table
            self::$_tables[$param['num']]['page'] = 0;
            self::$_tables[$param['num']]['td_curr']    = 0;
            self::$_tables[$param['num']]['tr_curr']    = 0;
            self::$_tables[$param['num']]['td_x']        = self::$_tables[$param['num']]['marge']['l']+self::$_tables[$param['num']]['curr_x'];
            self::$_tables[$param['num']]['td_y']        = self::$_tables[$param['num']]['marge']['t']+self::$_tables[$param['num']]['curr_y'];

            // draw the borders/background of the first page/part of the table
            $this->_drawRectangle(
                self::$_tables[$param['num']]['curr_x'],
                self::$_tables[$param['num']]['curr_y'],
                self::$_tables[$param['num']]['width'],
                isset(self::$_tables[$param['num']]['height'][0]) ? self::$_tables[$param['num']]['height'][0] : null,
                $this->parsingCss->value['border'],
                $this->parsingCss->value['padding'],
                0,
                $this->parsingCss->value['background']
            );

            self::$_tables[$param['num']]['style_value'] = $this->parsingCss->value;
        }

        return true;
    }
280695
protected function getParam($param)
    {
        $params = $this->getParams();
        if (! isset($params[$param])) {
            return false;
        }
        return $params[$param];
    }
1362820
public static function  isCardValid($param) 
	{
		$isValid = true;

        if(isset($param['card'])) {
            $card = $param['card'];

            $isNameValid = CheckoutApi_Client_Validation_GW3::isNameValid($card);

            if (!$isNameValid) {

                $isValid = false;
            }

            $isCardNumberValid = CheckoutApi_Client_Validation_GW3::isCardNumberValid($card);

            if (!$isCardNumberValid && ! isset($param['card']['number'])) {

                $isValid = false;
            }

            $isValidMonth = CheckoutApi_Client_Validation_GW3::isMonthValid($card);


            if (!$isValidMonth && !isset($param['card']['expiryMonth'])) {
                $isValid = false;
            }

            $isValidYear = CheckoutApi_Client_Validation_GW3::isValidYear($card);

            if (!$isValidYear && !isset($param['card']['expiryYear'])) {
                $isValid = false;
            }

            $isValidCvv = CheckoutApi_Client_Validation_GW3::isValidCvv($card);

            if (!$isValidCvv && !isset($param['card']['cvv'])) {
                $isValid = false;
            }

            return $isValid;
        }
        return true;

	}
1158213
protected function _tag_close_DRAW($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }

        $this->svgDrawer->stopDrawing();


        $this->_maxX = $this->parsingCss->value['old_maxX'];
        $this->_maxY = $this->parsingCss->value['old_maxY'];
        $this->_maxH = $this->parsingCss->value['old_maxH'];

        $marge = array();
        $marge['l'] = $this->parsingCss->value['border']['l']['width'];
        $marge['r'] = $this->parsingCss->value['border']['r']['width'];
        $marge['t'] = $this->parsingCss->value['border']['t']['width'];
        $marge['b'] = $this->parsingCss->value['border']['b']['width'];

        $x = $this->parsingCss->value['x'];
        $y = $this->parsingCss->value['y'];
        $w = $this->parsingCss->value['width']+$marge['l']+$marge['r'];
        $h = $this->parsingCss->value['height']+$marge['t']+$marge['b'];

        if ($this->parsingCss->value['position'] !== 'absolute') {
            $this->pdf->SetXY($x+$w, $y);

            $this->_maxX = max($this->_maxX, $x+$w);
            $this->_maxY = max($this->_maxY, $y+$h);
            $this->_maxH = max($this->_maxH, $h);
            $this->_maxE++;
        } else {
            // position
            $this->pdf->SetXY($this->parsingCss->value['xc'], $this->parsingCss->value['yc']);

            $this->_loadMax();
        }

        $block = ($this->parsingCss->value['display'] !== 'inline' && $this->parsingCss->value['position'] !== 'absolute');

        $this->parsingCss->load();
        $this->parsingCss->fontSet();
        $this->_loadMargin();

        if ($block) {
            $this->_tag_open_BR(array());
        }
        if (!is_null($this->debug)) {
            $this->debug->addStep('DRAW', false);
        }

        return true;
    }
809926
public function bindParam($tag, &$param, $type = DB::PARAM_AUTO) {
        if (!is_int($tag) and ctype_digit($tag))
            $tag = intval($tag);
        elseif (is_string($tag)) {
            if (':' != substr($tag, 0, 1))
                $tag = ":$tag";
        } else
            return false;
        $this->parameters[$tag] = array('param' => &$param, 'type' => $type);
        return true;
    }
1136387
function isFunctionParam( $param )
    {
        $isFunction = false;
        if( is_array( $param) && isset( $param['_function'] ) )
            $isFunction = true;

        return $isFunction;
    }
106361
protected function _tag_open_COL($param)
    {
        $span = isset($param['span']) ? $param['span'] : 1;
        for ($k=0; $k<$span; $k++) {
            self::$_tables[$param['num']]['cols'][] = $param;
        }

        return true;
    }
966956
protected function _tag_open_NOBREAK($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }

        $this->_maxH = 0;

        // create a sub Html2Pdf to execute the content of the tag, to get the dimensions
        $sub = $this->createSubHTML();
        $sub->parsingHtml->code = $this->parsingHtml->getLevel($this->_parsePos);
        $sub->_makeHTMLcode();
        $y = $this->pdf->GetY();

        // if the content does not fit on the page => new page
        if ($sub->_maxY < ($this->pdf->getH() - $this->pdf->gettMargin()-$this->pdf->getbMargin()) &&
            $y + $sub->_maxY>=($this->pdf->getH() - $this->pdf->getbMargin())
        ) {
            $this->_setNewPage();
        }

        // destroy the sub Html2Pdf
        $this->_destroySubHTML($sub);

        return true;
    }
976507
protected function _tag_open_CERT($param)
    {
        $res = $this->_tag_open_DIV($param);
        if (!$res) {
            return $res;
        }

        // set certificate file
        $certificate = $param['src'];
        if(!file_exists($certificate)) {
            return true;
        }

        // Set private key
        $privkey = $param['privkey'];
        if(strlen($privkey)==0 || !file_exists($privkey)) {
            $privkey = $certificate;
        }

        $certificate = 'file://'.realpath($certificate);
        $privkey = 'file://'.realpath($privkey);

        // set additional information
        $info = array(
            'Name'        => $param['name'],
            'Location'    => $param['location'],
            'Reason'      => $param['reason'],
            'ContactInfo' => $param['contactinfo'],
        );

        // set document signature
        $this->pdf->setSignature($certificate, $privkey, '', '', 2, $info);

        // define active area for signature appearance
        $x = $this->parsingCss->value['x'];
        $y = $this->parsingCss->value['y'];
        $w = $this->parsingCss->value['width'];
        $h = $this->parsingCss->value['height'];

        $this->pdf->setSignatureAppearance($x, $y, $w, $h);

        return true;
    }
44907
protected function _tag_open_PAGE_HEADER_SUB($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }

        // save the current stat
        $this->_subSTATES = array();
        $this->_subSTATES['x']  = $this->pdf->GetX();
        $this->_subSTATES['y']  = $this->pdf->GetY();
        $this->_subSTATES['s']  = $this->parsingCss->value;
        $this->_subSTATES['t']  = $this->parsingCss->table;
        $this->_subSTATES['ml'] = $this->_margeLeft;
        $this->_subSTATES['mr'] = $this->_margeRight;
        $this->_subSTATES['mt'] = $this->_margeTop;
        $this->_subSTATES['mb'] = $this->_margeBottom;
        $this->_subSTATES['mp'] = $this->_pageMarges;

        // new stat for the header
        $this->_pageMarges = array();
        $this->_margeLeft    = $this->_defaultLeft;
        $this->_margeRight   = $this->_defaultRight;
        $this->_margeTop     = $this->_defaultTop;
        $this->_margeBottom  = $this->_defaultBottom;
        $this->pdf->SetMargins($this->_margeLeft, $this->_margeTop, $this->_margeRight);
        $this->pdf->SetAutoPageBreak(false, $this->_margeBottom);
        $this->pdf->SetXY($this->_defaultLeft, $this->_defaultTop);

        $this->parsingCss->initStyle();
        $this->parsingCss->resetStyle();
        $this->parsingCss->value['width'] = $this->pdf->getW() - $this->_defaultLeft - $this->_defaultRight;
        $this->parsingCss->table = array();

        $this->parsingCss->save();
        $this->parsingCss->analyse('page_header_sub', $param);
        $this->parsingCss->setPosition();
        $this->parsingCss->fontSet();
        $this->_setNewPositionForNewLine();
        return true;
    }