TemplateConverterHelper::BuildPrintStatement PHP Метод

BuildPrintStatement() публичный статический Метод

public static BuildPrintStatement ( array $p_optArray ) : string
$p_optArray array
Результат string $newTag
    public static function BuildPrintStatement($p_optArray)
    {
        $newTag = CS_OBJECT;
        $object = strtolower($p_optArray[1]);
        if (array_key_exists($object, self::$m_exceptions) && array_key_exists(strtolower($p_optArray[2]), self::$m_exceptions[$object])) {
            $e = self::$m_exceptions[$object][strtolower($p_optArray[2])];
            $newTag .= isset($e['new_object']) ? '->' . $e['new_object'] : '->' . strtolower($p_optArray[1]);
            $newTag .= isset($e['attribute']) ? '->' . $e['attribute'] : '';
            if ($e['attribute'] == 'date' || $e['attribute'] == 'creation_date' || $e['attribute'] == 'publish_date') {
                $newTag .= isset($p_optArray[3]) ? '|camp_date_format:"' . $p_optArray[3] . '"' : '';
            }
        } elseif ($object == 'captcha') {
            $newTag = 'captcha_image_link';
        } else {
            for ($i = 1; $i < sizeof($p_optArray); $i++) {
                if (array_key_exists(strtolower($p_optArray[$i]), self::$m_printEx)) {
                    $p_optArray[$i] = self::$m_printEx[strtolower($p_optArray[$i])];
                }
                if ($object == 'article' && $i > 2 && $i == sizeof($p_optArray) - 1 && strstr($p_optArray[$i], '%') !== false) {
                    // date/time format string
                    $newTag .= '|camp_date_format:"' . $p_optArray[$i] . '"';
                } elseif ($p_optArray[$i] == 'image' && is_numeric($p_optArray[$i + 1])) {
                    $newTag .= '->article->' . strtolower($p_optArray[$i]) . $p_optArray[$i + 1];
                    $i += 1;
                } elseif ($object == 'article' && strtolower($p_optArray[$i]) == 'firstparagraph') {
                    $newTag .= '->first_paragraph';
                } else {
                    $newTag .= '->' . strtolower($p_optArray[$i]);
                }
            }
        }
        return $newTag;
    }