Exemplo n.º 1
0
    /**
     * @param array $p_optArray
     */
    private function getNewTagContent($p_optArray, $p_oldTagContent = null)
    {
        if (!is_array($p_optArray) || sizeof($p_optArray) < 1) {
            return;
        }

        $newTag = '';
        $p_optArray[0] = strtolower($p_optArray[0]);

        if ($p_optArray[0] == 'list'|| $p_optArray[0] == 'foremptylist'
                || strpos($p_optArray[0], 'endlist') !== false) {
            $newTag = TemplateConverterListObject::GetNewTagContent($p_optArray);
        } elseif ($p_optArray[0] == 'if' || $p_optArray[0] == 'endif') {
            $newTag = TemplateConverterIfBlock::GetNewTagContent($p_optArray);
        } else {
            if (in_array($p_optArray[0], array('uri','uripath','url','urlparameters'))) {
                $newTag = TemplateConverterHelper::GetNewTagContent($p_optArray);
            } else {
                return TemplateConverterHelper::GetNewTagContent($p_optArray, $this->m_templateDirectory);
            }
        }

        if (strlen($newTag) > 0) {
            $pattern = '/<!\*\*\s*'.@preg_quote($p_oldTagContent).'\s*>/';
            $replacement = CS_OPEN_TAG.' '.$newTag.' '.CS_CLOSE_TAG;
            $this->m_templateOriginalContent = @preg_replace($pattern,
                                                             $replacement,
                                                             $this->m_templateOriginalContent,
                                                             1);
            return null;
        }

        return false;
    } // fn getNewTagContent
 /**
  * @param array $p_optArray
  *
  * @return string $newTag
  */
 public static function BuildUrxStatement($p_optArray)
 {
     $newTag = $p_optArray[0];
     $ifBlockStack = TemplateConverterIfBlock::GetIfBlockStack();
     $ifBlockStackSize = sizeof($ifBlockStack);
     if ($ifBlockStackSize > 0) {
         $option = '';
         $idx = $ifBlockStackSize - 1;
         switch ($ifBlockStack[$idx]->getIfBlock()) {
             case 'nextitems':
                 $option = 'next_items';
                 break;
             case 'previous_items':
                 $option = 'previous_items';
                 break;
             case 'nextsubtitles':
                 $withField = self::GetWithBodyField();
                 $option = 'next_subtitle';
                 $option .= strlen($withField) > 0 ? ' ' . $withField : '';
                 break;
             case 'prevsubtitles':
                 $withField = self::GetWithBodyField();
                 $option = 'previous_subtitle';
                 $option .= strlen($withField) > 0 ? ' ' . $withField : '';
                 break;
         }
         $newTag .= strlen($option) > 0 ? ' options="' . $option . '"' : '';
     }
     if (sizeof($p_optArray) > 1) {
         $newTag .= ' options="';
         for ($x = 1; $x < sizeof($p_optArray); $x++) {
             $newTag .= $x > 1 ? ' ' : '';
             $newTag .= strtolower($p_optArray[$x]);
         }
         $newTag .= '"';
     }
     return $newTag;
 }