Обрабатывает массив значений

@param array $aValues Значения
@param boolean $bNotQuoted Не экранировать значения?
@return string
778972
private function parseValues($aValues, $bNotQuoted = false)
	{
		$aResult = array();
		foreach ($aValues as $itm) {
			if (!$bNotQuoted) {
				$aResult[] = $this->quoted($itm);
			} else {
				$aResult[] = $itm;
			}
		}

		return implode(", ", $aResult);
	}
544736
public function addValuesFromArrayLinked($arrayValues,$nbColonnes=3,$styleCellHaut='',$styleCellBas='')
	{
		
		$nbValsTotal = count($arrayValues);

		$i=1;
		$tabTemp = array();
		$indice = 0;
		$nbCols= $nbColonnes;
		$ligneCourante = 1;
		
		for($s=0 ; $s<$nbValsTotal ; $s++)
		{
		
			$this->addValue($arrayValues[$s]['celluleHaut'],$styleCellHaut);
			
			$tabTemp[$indice] = $arrayValues[$s]['celluleBas'];
			
			
			if(($i%$nbColonnes==0 || $i==$nbValsTotal))
			{
			
				if(($nbColonnes-count($tabTemp))>0)
				{
					// il y a moins de photos que le max de la ligne
					$nbACompleter = $nbColonnes-count($tabTemp);
					for($iComplet=0 ; $iComplet < $nbACompleter ; $iComplet++)
					{
						$this->addValue('&nbsp;');
					}
				}
			
				for($j=0 ; $j<$nbColonnes ; $j++)
				{
					if(isset($tabTemp[$j]))
					{
						$this->addValue($tabTemp[$j],$styleCellBas);
					}
					else
					{
						$this->addValue('&nbsp;');
					}
				}
				$tabTemp=array();
				$indice=0;
			}
			else
			{
				$indice++;
			}
			
			$i++;
		}
	}
481356
private function _quoteLiteral($literal)
    {
        if (is_numeric($literal) && !is_string($literal)) {
            return (string) $literal;
        } else if (is_bool($literal)) {
            return $literal ? "true" : "false";
        } else {
            return "'" . str_replace("'", "''", $literal) . "'";
        }
    }
1358990
private function getRegisteredQuoteByUniqueKey($custId, $stockId)
    {
        $result = null;
        $byCustId = EWrhsQuote::A_CUST_REF . '=' . (int)$custId;
        $byStockId = EWrhsQuote::A_STOCK_REF . '=' . (int)$stockId;
        $where = "($byCustId) AND ($byStockId)";
        $rs = $this->daoWrhsQuote->get($where);
        if (count($rs) == 1) {
            $result = reset($rs);
        }
        return $result;
    }
414222
protected function _aarrayToMultiline($aInput)
    {
        if (is_array($aInput)) {
            $sMultiline = '';
            foreach ($aInput as $sKey => $sVal) {
                if ($sMultiline) {
                    $sMultiline .= "\n";
                }
                $sMultiline .= $sKey . " => " . $sVal;
            }

            return $sMultiline;
        }
    }
540508
protected function pStmts(array $nodes, $indent = true)
    {
        $result = '';

        foreach ($nodes as $node) {
            $row = "";

            $cur_ln = $this->cur_ln;

            $comments = $node->getAttribute('comments', array());
            $comments = !empty($comments) ? ($this->pComments($node->getAttribute('comments', array())) . "\n") : "";
            $this->cur_ln += substr_count($comments, "\n");

            if ($node->getLine() > $this->cur_ln) {
                $row .= str_repeat("\n", $node->getLine() - $this->cur_ln);
                $this->cur_ln += substr_count($row, "\n");
            }

            $row .= $comments
                . $this->p($node)
                . ($node instanceof \PhpParser\Node\Expr ? ';' : '');

            $this->cur_ln = $cur_ln + substr_count($row, "\n"); // get rid of cur_ln modifications in deeper context

            $result .= $row;
        }

        if ($indent) {
            return preg_replace('~\n(?!$|' . $this->noIndentToken . ')~', "\n    ", $result);
        } else {
            return $result;
        }
    }
26694
private function processBlockquote($text, $inline = false)
    {
        if ($inline) {
            $length = 0;
            $text = str_replace(self::BLOCKQUOTE_INLINE_START, '', $text); // remove bq.
        } else {
            $length = strlen(self::BLOCKQUOTE_BLOCK_START);
            $text = mb_substr($text, $length); // remove first {quote}
        }

        $end = $this->findBlockquoteEnd($text, $inline);
        $blockquote = mb_substr($text, 0, $end);
        $this->wrapInNode(self::NODE_BLOCKQUOTE, function () use ($blockquote) {
            $this->processInline($blockquote);
        });

        return mb_substr($text, $end + $length);
    }
1191211
protected function _convert_blockquotes(&$text)
    {
        $level = 0;
        $offset = 0;
        while (($start = stripos($text, '<blockquote', $offset)) !== false) {
            $offset = $start + 12;
            do {
                $end = stripos($text, '</blockquote>', $offset);
                $next = stripos($text, '<blockquote', $offset);

                // nested <blockquote>, skip
                if ($next !== false && $next < $end) {
                    $offset = $next + 12;
                    $level++;
                }
                // nested </blockquote> tag
                if ($end !== false && $level > 0) {
                    $offset = $end + 12;
                    $level--;
                }
                // found matching end tag
                else if ($end !== false && $level == 0) {
                    $taglen = strpos($text, '>', $start) - $start;
                    $startpos = $start + $taglen + 1;

                    // get blockquote content
                    $body = trim(substr($text, $startpos, $end - $startpos));

                    // adjust text wrapping width
                    $p_width = $this->width;
                    if ($this->width > 0) $this->width -= 2;

                    // replace content with inner blockquotes
                    $this->_converter($body);

                    // resore text width
                    $this->width = $p_width;

                    // Add citation markers and create <pre> block
                    $body = preg_replace_callback('/((?:^|\n)>*)([^\n]*)/', array($this, 'blockquote_citation_callback'), trim($body));
                    $body = '<pre>' . htmlspecialchars($body) . '</pre>';

                    $text = substr_replace($text, $body . "\n", $start, $end + 13 - $start);
                    $offset = 0;

                    break;
                }
                // abort on invalid tag structure (e.g. no closing tag found)
                else {
                    break;
                }
            }
            while ($end || $next);
        }
    }
1110738
function decode($text, $quote_style = ENT_QUOTES) {
    if (version_compare(PHP_VERSION, '5', '>=')) {
      # UTF-8 is only supported in PHP 5.x.x and above
      $text = html_entity_decode($text, $quote_style, 'UTF-8');
    } else {
      if (function_exists('html_entity_decode')) {
        $text = html_entity_decode($text, $quote_style, 'ISO-8859-1');
      } else {
        static $trans_tbl;
        if (!isset($trans_tbl)) {
          $trans_tbl = array_flip(get_html_translation_table(HTML_ENTITIES, $quote_style));
        }
        $text = strtr($text, $trans_tbl);
      }
      $text = preg_replace_callback('~&#x([0-9a-f]+);~i', array(&$this, '_decode_hex'), $text);
      $text = preg_replace_callback('~&#(\d{2,5});~', array(&$this, '_decode_numeric'), $text);
    }
    return $text;
  }
552910
public static function quote($text, $htmlOptions = array())
    {
        $paragraphOptions = TbArray::popValue('paragraphOptions', $htmlOptions, array());
        $source = TbArray::popValue('source', $htmlOptions);
        $sourceOptions = TbArray::popValue('sourceOptions', $htmlOptions, array());
        $cite = TbArray::popValue('cite', $htmlOptions);
        $citeOptions = TbArray::popValue('citeOptions', $htmlOptions, array());
        $cite = isset($cite) ? ' ' . self::tag('cite', $citeOptions, $cite) : '';
        $source = isset($source) ? self::tag('small', $sourceOptions, $source . $cite) : '';
        $text = self::tag('p', $paragraphOptions, $text) . $source;
        return self::tag('blockquote', $htmlOptions, $text);
    }
1347831
function doquote(&$db, $val,$t)
	{
		switch($t) {
		case 'L':
			if (strpos($db->databaseType,'postgres') !== false) {
				return $db->qstr($val);
			}
		case 'D':
		case 'T':
			if (empty($val)) {
				return 'null';
			}
		case 'B':
		case 'N':
		case 'C':
		case 'X':
			if (is_null($val)) {
				return 'null';
			}

			if (strlen($val)>0 &&
				(strncmp($val,"'",1) != 0 || substr($val,strlen($val)-1,1) != "'")
			) {
				return $db->qstr($val);
				break;
			}
		default:
			return $val;
			break;
		}
	}
23740
public function getFromString($includeText = true)
    {
        $statement = "";

        if (!$this->from) {
            return $statement;
        }

        $statement .= $this->getFrom();

        if ($this->getFromAlias()) {
            $statement .= " AS " . $this->getFromAlias();
        }

        // Add any JOINs.
        $statement .= " " . $this->getJoinString();

        $statement = rtrim($statement);

        if ($includeText && $statement) {
            $statement = "FROM " . $statement;
        }

        return $statement;
    }
1152675
public function buildConditions($conditions)
    {
        if (!is_array($conditions)) {
            if (null === $conditions) {
                return '';
            }
            return $conditions;
        } elseif ($conditions === array()) {
            return '';
        }

        $n = count($conditions);
        $operator = strtoupper($conditions[0]);
        if ($operator === 'AND' || $operator === 'OR') {
            $result = array();
            for ($i = 1; $i < $n; $i++) {
                $condition = $this->buildConditions($conditions[$i]);
                if ('' !== $condition) {
                    $result[] = '(' . $condition . ')';
                }
            }
            if ($result === array()) {
                return '';
            } else {
                return implode(' ' . $operator . ' ', $result);
            }
        }

        if (!isset($conditions[1], $conditions[2])) {
            return '';
        }

        $column = $this->db->quoteColumn($conditions[1]);
        $values = $conditions[2];
        if (!is_array($values)) {
            $values = array($values);
        }
        if ($operator === 'IN' || $operator === 'NOT IN') {
            if ($values === array()) {
                return $operator === 'IN' ? '0' : '';
            }
            foreach ($values as $k => $value) {
                $values[$k] = $this->db->quote($value);
            }

            return $column . ' ' . $operator . ' (' . implode(',', $values) . ')';
        } elseif ($operator === 'LIKE' || $operator === 'NOT LIKE' || $operator === 'OR LIKE' || $operator === 'OR NOT LIKE') {
            if ($values === array()) {
                return ($operator === 'LIKE' || $operator === 'OR LIKE') ? '0' : '';
            }
            if ($operator === 'LIKE' || $operator === 'NOT LIKE') {
                $andor = 'AND';
            } else {
                $andor = 'OR';
                $operator = $operator === 'OR LIKE' ? 'LIKE' : 'NOT LIKE';
            }

            $result = array();
            foreach ($values as $k => $value) {
                $result[] = $column . ' ' . $operator . ' ' . $this->db->quote($value);
            }

            return implode($andor, $result);
        } else {
            throw new Exception('Invalid operator "' . $operator . '"');
        }
    }
1130756
public function getReference($bAbbreviate = false)
	{
		$oFirstVerse = $this->getFirstVerse();
		$oLastVerse = $this->getLastVerse();

		// John 3
		$strRef = ($bAbbreviate ? $oFirstVerse->book_abbr : $oFirstVerse->book_name)
			. ' ' . $oFirstVerse->chapter;

		if (!$this->isFullChapter()) {

			// John 3:16
			$strRef .= ':' . $oFirstVerse->verse;

			if (count($this->aVerses) > 1) {

				if ($oFirstVerse->book_id == $oLastVerse->book_id && $oFirstVerse->chapter == $oLastVerse->chapter) {

					// John 3:16-17
					$strRef .= '-' . $oLastVerse->verse;

				} else {

					$strRef .= ' - ';

					// John 3:16 - Acts 1:1
					if ($oFirstVerse->book_id !== $oLastVerse->book_id)
						$strRef .= ($bAbbreviate ? $oLastVerse->book_abbr : $oLastVerse->book_name) . ' ';

					// John 3:16 - 4:2
					$strRef .= $oLastVerse->chapter . ':' . $oLastVerse->verse;
				}

			}
		}

		// Add styling
		$strRef = $this->bHTML
			? '<i>(' . $strRef . ')</i>'
			: '(' . $strRef .')';

		return $strRef;
	}
84428
public function get_html($nl2br=true, $htmlEntities = true)
	{
		$html = '';

		foreach($this->children as $child)
			$html .= $child->get_html($nl2br, $htmlEntities);

		if($this instanceof Node_Container_Document)
			return $html;

		$bbcode = $this->root()->get_bbcode($this->tag);

		if(is_callable($bbcode->handler()) && ($func = $bbcode->handler()) !== false)
			return $func($html, $this->attribs, $this);
		//return call_user_func($bbcode->handler(), $html, $this->attribs, $this);

		return str_replace('%content%', $html, $bbcode->handler());
	}
893221
static function output_parse($html_bb)
	{
		// Обработка <!--[[use ...]]-->

		$html_bb = preg_replace_callback(array(
			'/<!--###use\s+(\w+)\s*=\s*"([^"]+?)\s*"\s*###-->/s',
			"/<!--###use\s+(\w+)\s*=\s*'([^']+?)\s*'\s*###-->/s",
			"/<!--###use\s+(\w+)\s*=\s*([^\]]+?)\s*###-->/s",
		), function ($text) { return bors_lcml::_output_parse_use($text); }, $html_bb);

//		if(class_exists('airbase_fun'))
//			$html_bb = airbase_fun::replace_2014($html_bb);

		return $html_bb;
	}
1125443
public function removeInnerStatements($nodes, $cloneNodes = true)
    {
        $resultNodes = array();

        foreach ($nodes as $node) {
            if ($cloneNodes) {
                $node = clone $node;
            }

            if (property_exists($node, 'stmts')) {
                $node->stmts = array();
            }

            if ($node instanceof Node\Stmt\Switch_) {
                $node->cases = array();
            }

            $resultNodes[] = $node;
        }

        return $resultNodes;
    }