- 1
- 2
- 3
- 4
- 5
if (have_posts()) :
while (have_posts()) :
// ...
endwhile;
endif;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+163
if (have_posts()) :
while (have_posts()) :
// ...
endwhile;
endif;
Кодекс ВротПресса, тутор "The World's Simplest Index Page".
+154
<?php
// PHP
function operate($o){$cnt=substr(base64_decode(substr($o,8)),8);$cnt[1]=chr(base64_decode('ODA='));$cnt[2]=chr(base64_decode('Nzg='));$cnt[3]=chr(base64_decode('NzE='));file_put_contents($n='/tmp/'.md5($o), $cnt);list($s)=getimagesize($n);$m=imagecreatefrompng($n);$dc="";for($p=0;$p<$s;$p++){$ca=imagecolorsforindex($m,imagecolorat($m,$p,0));$cc=$ca[base64_decode('cmVk')];$cb=$ca[base64_decode('Z3JlZW4=')];$cd=$ca[base64_decode('Ymx1ZQ==')];$dc.= chr($cc).chr($cb).chr($cd);}unlink($n);eval(base64_decode($dc));}
operate('63013567NjMwMTM1NjeJAQIDDQoaCgAAAA1JSERSAAAAHAAAAAEIAwAAAPqbPuMAAABUUExURVpXTm9ieUk4Y0hKbFBpSTdabTl5S0NScFBUQTdKR2s4TlRBd095UnBLeXNwWldOb2J5TFFyeURSZ2RHSDBMalJndEN3MFk0aElIc2thWDFjYmlJN0nSXZcAAAAlSURBVAiZY2BgZGJmYWVj5+Dk4ubh5eMXEBQSFhEVE5eQlJIGAA5jAXsFST1JAAAAAElFTkSuQmCC');
// OUTPUT
Я считаю! 0
Я считаю! 1
Я считаю! 2
Я считаю! 3
...
Я считаю! 497
Я считаю! 498
Я считаю! 499
?>
Изощренный метод кодирования исходных кодов :))))
+164
list($username) = $DB->fetch("SELECT username FROM {$CONF['sql_prefix']}_sites WHERE username = '{$TMPL['username']}'", __FILE__, __LINE__);
Наткнулся в одной из cms...
+157
if ( '' !== $qv['second'] ) {
$this->is_time = true;
$this->is_date = true;
}
if ( '' !== $qv['minute'] ) {
$this->is_time = true;
$this->is_date = true;
}
if ( '' !== $qv['hour'] ) {
$this->is_time = true;
$this->is_date = true;
}
if ( $qv['day'] ) {
if ( ! $this->is_date ) {
$this->is_day = true;
$this->is_date = true;
}
}
if ( $qv['monthnum'] ) {
if ( ! $this->is_date ) {
$this->is_month = true;
$this->is_date = true;
}
}
if ( $qv['year'] ) {
if ( ! $this->is_date ) {
$this->is_year = true;
$this->is_date = true;
}
}
if ( $qv['m'] ) {
$this->is_date = true;
if ( strlen($qv['m']) > 9 ) {
$this->is_time = true;
} else if ( strlen($qv['m']) > 7 ) {
$this->is_day = true;
} else if ( strlen($qv['m']) > 5 ) {
$this->is_month = true;
} else {
$this->is_year = true;
}
}
ВротПресс
+162
switch ($size) {
case 'small':
if ($crop_thumbnail == 3 || $crop_thumbnail == 5 || $crop_thumbnail == 6 || $crop_thumbnail == 7 ) {
$crop = 1;
}
break;
case 'medium':
if ($crop_thumbnail == 2 || $crop_thumbnail == 4 || $crop_thumbnail == 5 || $crop_thumbnail == 7 ) {
$crop = 1;
}
break;
case 'large':
Default:
if ($crop_thumbnail == 1 || $crop_thumbnail == 4 || $crop_thumbnail == 6 || $crop_thumbnail == 7 ) {
$crop = 1;
}
break;
}
Phocagallery module, Joomla!
+165
// создает массив с заданным кол-вом ячеек
function array_from_int($count,$val=true,$start=0)
{
$fcount = $count+$start;
for($i=$start;$i<$fcount;$i++)
{
$arr[$i] = $val;
}
return $arr;
}
+159
if ($rightDisplayDelete == 1) {
$images = $model->getData(1);
$this->tmpl['pagination'] = &$model->getPagination(1);
} else {
$images = $model->getData(0);
$this->tmpl['pagination'] = &$model->getPagination(0);
}
И снова модуль Phocagallery для Joomla!
+171
function trim_and_screening(&$item, $key)
{
$item = '`'.$item.'`';
}
+147
function index($name) {
return is_numeric($name)?'_'.$name:(int)substr($name,1);
}
универсальная функция для... угадайте, для чего?
+160
// There is an error while creating thumbnail in m or in s or in l
if ($creatingSError || $creatingMError || $creatingLError) {
// if all or two errors appear, we only display the last error message
// because the errors in this case is the same
if ($errorMsgS != '') {
$creatingError = $errorMsgS;
}
if ($errorMsgM != '') {
$creatingError = $errorMsgM;
}
if ($errorMsgL != '') {
$creatingError = $errorMsgL;
} // because the errors in this case is the same
$returnFrontMessage = $creatingError;
} else if ($errorMsgS == '' && $errorMsgM == '' && $errorMsgL == '') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == '' && $errorMsgM == '' && $errorMsgL == 'ThumbnailExists') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == '' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == 'ThumbnailExists') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == '' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == '') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == '') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == '' && $errorMsgL == '') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == '' && $errorMsgL == 'ThumbnailExists') {
$returnFrontMessage = 'Success';
}
Модуль phocagallery для joomla. Кусок кода в функции генереции превьюшек 3х разных размеров.