public static function AttachmentIf($attr, $content) { $if = array(); $operator = isset($attr['operator']) ? dcTemplate::getOperator($attr['operator']) : '&&'; if (isset($attr['is_image'])) { $sign = (bool) $attr['is_image'] ? '' : '!'; $if[] = $sign . '$attach_f->media_image'; } if (isset($attr['has_thumb'])) { $sign = (bool) $attr['has_thumb'] ? '' : '!'; $if[] = $sign . 'isset($attach_f->media_thumb[\'sq\'])'; } if (isset($attr['is_mp3'])) { $sign = (bool) $attr['is_mp3'] ? '==' : '!='; $if[] = '$attach_f->type ' . $sign . ' "audio/mpeg3"'; } if (isset($attr['is_flv'])) { $sign = (bool) $attr['is_flv'] ? '' : '!'; $if[] = $sign . '($attach_f->type == "video/x-flv" || ' . '$attach_f->type == "video/mp4" || ' . '$attach_f->type == "video/x-m4v")'; } if (count($if) != 0) { return '<?php if(' . implode(' ' . $operator . ' ', (array) $if) . ') : ?>' . $content . '<?php endif; ?>'; } else { return $content; } }
public static function TagIf($attr, $content) { $if = array(); $operateur = isset($attr['operator']) ? dcTemplate::getOperator($attr['operator']) : '&&'; if (isset($attr['has_entries'])) { $sign = (bool) $attr['has_entries'] ? '' : '!'; $if[] = $sign . '$_ctx->meta->count'; } if (!empty($if)) { return '<?php if(' . implode(' ' . $operateur . ' ', $if) . ') : ?>' . $content . '<?php endif; ?>'; } else { return $content; } }