Kopa snippetou
Napísané: Ut Júl 03, 2007 2:59 pm
tak sem se rozhodl, ze publiknu vsecko co mam, pokud to pujde, uvedu i autora...
co snippet, to post
// EDIT: typos
co snippet, to post
// EDIT: typos
česko-slovenské fórum pre užívateľov s podporou zdarma
https://forum.etomite.sk/
Kód: Vybrať všetko
/*
name: [[AntiSpam]]
usage: [[AntiSpam?email=nekdo@nekde.net]] nebo [[AntiSpam?jabber=TRUE&email=nekdo@jabber.org]]
author: dutch (+ chucryard dodelal jabber)
*/
$output = '';
$email_mask = '^[a-zA-Z0-9_\-\+]+(\.[a-zA-z0-9_\-\+]+)*@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*\.[a-zA-Z]{2,4}$';
if($jabber) { // cesky JID
$lang["email"] = "Toto JID je chráněno proti spamu (není to e-mail!)";
$lang["neplatny"] = "Zadané JID není platné!";
$lang["nezadan"] = "Nebylo zadáno JID!";
$prefix = "xmpp:";
}
else { // cesky mail
$lang["email"] = "Tento e-mail je chráněn proti spamu";
$lang["neplatny"] = "Zadaný e-mail není platný!";
$lang["nezadan"] = "Nebyl zadán e-mail!";
$prefix = "mailto:";
}
/* ZAKOMENTOVANY SLOVENSKY LANG
if($jabber) { // slovenksy JID
$lang["email"] = "Toto JID je chránené proti spamu (nie je to e-mail!)";
$lang["neplatny"] = "Zadané JID nie je platné!";
$lang["nezadan"] = "Nebolo zadané JID!";
$prefix = "xmpp:";
}
else { // slovensky mail
$lang["email"] = "Tento e-mail je chránený proti spamu";
$lang["neplatny"] = "Zadaný e-mail nie je platný!";
$lang["nezadan"] = "Nebyl zadaný e-mail!";
$prefix = "mailto:";
} */
if (!$email) {
$output .= $lang["nezadan"];
} else {
if (eregi($email_mask ,$email)) {
$email_transform = strrev($email);
$output .= '<a href="' . $prefix . $email_transform . '" onclick="\'mailReverse(this)\'" rel="nofollow"><bdo title="' . $lang["email"] . '" dir="rtl">' . $email_transform . '</bdo></a>';
} else {
$output .= $lang["neplatny"];
}
}
return $output;
Kód: Vybrať všetko
/*
name: [[EasyPeasyGallery]]
author: Nick_NP
usage:
1. Vytvoříte složku s dvěma podsložkama: "thumbs" a "large"
2. Náhledy se stejnými názvy jako mají originály nahrajte do složky "thumbs" a originály do "large"
3. Pak jen zavoláte snippet [[EasyPeasyGallery?directory=/nejaka/slozka]]
*/
// LANGUAGE
$lang['prev'] = "předchozí";
$lang['next'] = "další";
$lang['omluva'] = "Omlouváme se, ale v této galerii ještě nejou žádné obrázky.";
$lang['back'] = "zpět do galerie";
/* ZAKOMENTOVANÁ SLOVENCINA
$lang['prev'] = "predchádzajúca";
$lang['next'] = "ďalšia";
$lang['omluva'] = "Ospravedlňujeme sa, ale v tejto galérií ešte nie sú žiadne obrázky.";
$lang['back'] = "späť do galérie";
*/
// Configuration variables ------------
$pics_per_row = 4; // Number of thumbnails per row
$rows_per_page = 4; // Number of rows per page (set to 0 for all thumbnails on a single page)
$nav_thumbs_top = true; // Set to true to display top nav bar on thumbnails pages
$nav_thumbs_bot = true; // Same for the bottom nav bar
$nav_detail_top = true; // Set to true to display top nav bar on details pages
$nav_detail_bot = true; // Same for the bottom nav bar
// ------------------------------------
if (empty($g_pic)) $g_pic = $GLOBALS["HTTP_GET_VARS"]["g_pic"];
if (empty($g_view)) $g_view = $GLOBALS["HTTP_GET_VARS"]["g_view"];
if (empty($g_page)) $g_page = $GLOBALS["HTTP_GET_VARS"]["g_page"];
$id = $GLOBALS["HTTP_GET_VARS"]["id"];
$path = empty($HTTP_SERVER_VARS["PATH_INFO"]) ? $HTTP_SERVER_VARS["PHP_SELF"] : $HTTP_SERVER_VARS["PATH_INFO"];
@$dirhandle = opendir( "$directory/thumbs" );
$pic_count = 0;
while( $file = readdir( $dirhandle ) )
{
if (eregi("(gif|jpg|jpeg)$",$file))
{
$pic_list[$pic_count++] = $file;
}
}
if ($pic_count==0) return "<p>" . $lang['omluva'] . "</p>";
$output = '';
$page_for_pic = 0;
$pics_per_page = $pics_per_row * $rows_per_page;
if ( ($g_pic >= $pic_count) || (empty($g_pic)) )
$g_pic = 0;
else
if ($pics_per_page!=0) $page_for_pic = (int)($g_pic / $pics_per_page);
if ($g_view=="detail")
{
// Display single picture block
$next = $g_pic + $pic_count + 1; $next %= $pic_count;
$prev = $g_pic + $pic_count - 1; $prev %= $pic_count;
$output .= '<div id="EPG_detail_container">';
if ($nav_detail_top)
{
$output .= '<div id="EPG_text_container1">';
$output .= '<div id="EPG_text_sub_container1">';
$output .= '<a id="EPG_prev1" href="'.$path.'?g_pic='.$prev.'&g_view=detail"><img src=./assets/images/EPG_prev.gif />' . $lang['prev'] . '</a>';
$output .= '<a id="EPG_next1" href="'.$path.'?g_pic='.$next.'&g_view=detail">' . $lang['next'] . '<img src=./assets/images/EPG_next.gif /></a>';
$output .= '<a id="EPG_back1" href="'.$path.'?g_view=thumbs&g_page='.$page_for_pic.'">[' . $lang['back'] . ']</a>';
$output .= '</div>';
$output .= '</div>';
}
$output .= '<div id="EPG_image_container">';
$output .= '<img id="EPG_image" src="'.$directory.'/large/'.$pic_list[$g_pic].'"><br />';
$output .= '</div>';
if ($nav_detail_bot)
{
$output .= '<div id="EPG_text_container2">';
$output .= '<div id="EPG_text_sub_container2">';
$output .= '<a id="EPG_prev2" href="'.$path.'?g_pic='.$prev.'&g_view=detail"><img src=./assets/images/EPG_prev.gif />' . $lang['prev'] . '</a>';
$output .= '<a id="EPG_next2" href="'.$path.'?g_pic='.$next.'&g_view=detail">' . $lang['next'] . '<img src=./assets/images/EPG_next.gif /></a>';
$output .= '<a id="EPG_back2" href="'.$path.'?g_view=thumbs&g_page='.$page_for_pic.'">[' . $lang['back'] . ']</a>';
$output .= '</div>';
$output .= '</div>';
}
$output .= '</div>';
}
else
{
// Display thumbnail block
if ($rows_per_page!=0)
$pages = ceil($pic_count/$pics_per_page);
else
$pages = 1;
$nextpage = $pages + $g_page + 1 ; $nextpage %= $pages;
$prevpage = $pages + $g_page - 1 ; $prevpage %= $pages;
$output .= '<div id="EPG_thumbs_container">';
if ( ($rows_per_page!=0) && ($pic_count>$pics_per_page) && ($nav_thumbs_top) )
{
$output .= '<div id="EPG_prev-next_1">';
$output .= '<a id="EPG_prev1" href="'.$path.'?g_page='.$prevpage.'&g_view=thumbs"><img src=./assets/images/EPG_prev.gif />' . $lang['prev'] . '</a>';
$output .= '<a id="EPG_next1" href="'.$path.'?g_page='.$nextpage.'&g_view=thumbs">' . $lang['next'] . '<img src=./assets/images/EPG_next.gif /></a>';
$output .= '<div id="EPG_pages_container1">';
$output .= '<div id="EPG_pages_sub_container1">';
for ($p=0;$p<$pages;$p++)
$output .= '<a class="'.($p!=$g_page?"EPG_pages":"EPG_pages_current").'" href="'.$path.'?g_page='.$p.'&g_view=thumbs">'.($p+1).'</a> ';
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
}
$pstart = $g_page*$pics_per_page;
$pend = $pstart + $pics_per_page;
if ($pend>$pic_count) $pend=$pic_count;
$output .= '<table cellpadding="0" cellspacing="0" id="EPG_thumbs_table"><tr>';
for ($i=$pstart;$i<$pend;$i++)
{
if ( ($i%$pics_per_row==0) && ($i!=0) ) $output .= '</tr><tr>';
$output .= '<td style="width:'.(100/$pics_per_row).'%;">';
$output .= '<a align="center" href="'.$path.'?g_pic='.$i.'&g_view=detail"><img src="./'.$directory.'/thumbs/'.$pic_list[$i].'"/></a>';
$output .= '</td>';
}
$output .= '</tr></table>';
if ( ($rows_per_page!=0) && ($pic_count>$pics_per_page) && ($nav_thumbs_bot) )
{
$output .= '<div id="EPG_prev-next_2">';
$output .= '<a id="EPG_prev2" href="'.$path.'?g_page='.$prevpage.'&g_view=thumbs"><img src=./assets/images/EPG_prev.gif />' . $lang['prev'] . '</a>';
$output .= '<a id="EPG_next2" href="'.$path.'?g_page='.$nextpage.'&g_view=thumbs">' . $lang['next'] . '<img src=./assets/images/EPG_next.gif /></a>';
$output .= '<div id="EPG_pages_container2">';
$output .= '<div id="EPG_pages_sub_container2">';
for ($p=0;$p<$pages;$p++)
$output .= '<a class="'.($p!=$g_page?"EPG_pages":"EPG_pages_current").'" href="'.$path.'?g_page='.$p.'&g_view=thumbs">'.($p+1).'</a> ';
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
}
$output .= '</div>';
}
return $output;
Kód: Vybrať všetko
// OTEVREME SOUBOR
$url = "http://gh.ffshrine.org/song/" . $url;
$handle = fopen($url, "rb");
$contents = '';
while (!feof($handle)) {
$contents .= fread($handle, 8192);
}
// ZAVREME SOUBOR
fclose($handle);
preg_match('/var data = "(.*?)";/si', $contents, $co);
$escape = preg_replace('/var data = "(.*?)";/si', "$1", $co["0"]);
$nove = decodeescape($escape);
$nove = str_replace('document.getElementById("linkcode").innerHTML = "<a href=\\"" + unescapesome(escape(Address)) + "\\">click here</a>";', "return unescapesome(escape(Address));", $nove);
$nove = str_replace("decode(addr);", 'document.write("<a href=\"" + decode(addr) + "\">download</a>");', $nove);
$jscript .= "<script type=\"text/javascript\">" . "\r";
$jscript .= "<!--" . "\r";
$jscript .= $nove . "\r";
$jscript .= "// -->" . "\r";
$jscript .= "</script>" . "\r";
$output = $jscript;
return $output;
Kód: Vybrať všetko
if(isset($transalias)){
$tenhle_alias = $transalias;
}
else {
$tenhle_alias = $this->aliases[$etomite->documentIdentifier];
}
if($tolang == "cze") {
$novy_alias = str_replace("svk_", "", $tenhle_alias);
}
elseif($tolang == "svk") {
$novy_alias = "svk_" . $tenhle_alias;
}
else {
$novy_alias = $tenhle_alias;
}
$url = $novy_alias . ".htm";
return $url;
Kód: Vybrať všetko
// OTEVREME SOUBOR
$handle = fopen("http://wiki.ubuntu.cz/The_Neverhood?action=raw", "rb");
$content = '';
while (!feof($handle)) {
$content .= fread($handle, 8192);
}
$wikisource = $content;
// ZAVREME SOUBOR
fclose($handle);
$wikisource = iconv("UTF-8", "iso-8859-2", $wikisource);
$wikisource = str_replace('[[ImageLink(neverhood-game.jpg,,height=300)]]','IMGneverhoodIMG',$wikisource);
$wikisource = preg_replace('/\n#([^(\n)]*)/si', '', $wikisource);
$wikisource = preg_replace('/^#([^(\n)]*)/si', '', $wikisource);
$wikisource = preg_replace('/\|\|([^(\n)]*)/si', '', $wikisource);
$wikisource = preg_replace('/`([^`]*)`/si', '<span class="code">$1</span>', $wikisource);
$wikisource = preg_replace('/\'\'\'([^\']*)\'\'\'/si', '<strong>$1</strong>', $wikisource);
$wikisource = preg_replace('/\'\'([^\']*)\'\'/si', '<em>$1</em>', $wikisource);
$wikisource = preg_replace('/\[(http|https|ftp):\/\/([^ ]*)([^\]]*)\]/si', '<a href="$1://$2">$3</a>', $wikisource);
$wikisource = preg_replace('/=== ([^=]*)===/si', '<h5>$1</h5>', $wikisource);
$wikisource = preg_replace('/== ([^=]*)==/si', '<h4>$1</h4>', $wikisource);
$wikisource = preg_replace('/= ([^=]*)=/si', '<h3>$1</h3>', $wikisource);
$wikisource = preg_replace('/\[:([^:]*):\]/si', '<a href="http://wiki.ubuntu.cz/$1">$1</a>', $wikisource);
$wikisource = preg_replace('/\["([^"]*)"\]/si', '<a href="http://wiki.ubuntu.cz/$1">$1</a>', $wikisource);
$wikisource = preg_replace('/\[:([^:]*):([^\]]*)\]/si', '<a href="http://wiki.ubuntu.cz/$1">$2</a>', $wikisource);
$wikisource = preg_replace('/attachment:IconsPage\/([^(\n)]*)/si', '<img src="http://wiki.ubuntu.cz/IconsPage?action=AttachFile&do=get&target=$1', $wikisource);
$wikisource = preg_replace('/attachment:([^(\n)]*)/si', '<img src="http://wiki.ubuntu.cz/The_Neverhood?action=AttachFile&do=get&target=$1', $wikisource);
$wikisource = str_replace(".png", ".png\" />", $wikisource);
$wikisource = str_replace(".jpg", ".jpg\" />", $wikisource);
$wikisource = str_replace(".gif", ".gif\" />", $wikisource);
$wikisource = preg_replace("/{{{(\n)?(\r)?(\n)?/si", '<div class="box"><span class="code">', $wikisource);
$wikisource = preg_replace("/(\n)?(\r)?(\n)?}}}/si", '</span></div>', $wikisource);
$wikisource = str_replace(" </h", "</h", $wikisource);
$wikisource = str_replace("\\\\", "\\\\\\\\", $wikisource);
$wikisource = preg_replace('/\n ?/si', "\n", $wikisource);
$wikisource = preg_replace('/\n(\r)?\n(\r)?/si', "</p>\n<p>", $wikisource);
$wikisource = preg_replace('/<p><h([3-5])>([^<]*)<\/h([3-5])>/si', '<h$1>$2</h$1><p>', $wikisource);
$wikisource = str_replace("</p>\n<p></p>\n<p>", "", $wikisource);
$wikisource = preg_replace("/<p>(\n)?(\r)?<\/p>/si", "\n\r", $wikisource);
$wikisource = preg_replace('/^(.*) Tento/si', '<h3>Úvod</h3><p><img src="http://wiki.ubuntu.cz/IconsPage?action=AttachFile&do=get&target=wine.png" /> Tento', $wikisource);
$wikisource = preg_replace('/<h3>Odkazy(.*)/si', '', $wikisource);
$wikisource = nl2br($wikisource);
$wikisource = preg_replace("/<br \/>(\n)?(\r)?<\/p>/si", "</p>", $wikisource);
$wikisource = preg_replace("/<br \/>(\n)?(\r)?<p>/si", "<p>", $wikisource);
$wikisource = preg_replace("/<\/p>(\n)?(\r)?<br \/>/si", "</p>", $wikisource);
$wikisource = preg_replace("/<p>(\n)?(\r)?<br \/>/si", "<p>", $wikisource);
$wikisource = preg_replace("/<\/h3>(\n)?(\r)?<br \/>/si", "</h3>", $wikisource);
$wikisource = preg_replace("/<\/h4>(\n)?(\r)?<br \/>/si", "</h4>", $wikisource);
$wikisource = preg_replace("/<\/h5>(\n)?(\r)?<br \/>/si", "</h5>", $wikisource);
$wikisource = preg_replace("/<br \/>(\n)?(\r)?<h3>/si", "<h3>", $wikisource);
$wikisource = preg_replace("/<br \/>(\n)?(\r)?<h4>/si", "<h4>", $wikisource);
$wikisource = preg_replace("/<br \/>(\n)?(\r)?<h5>/si", "<h5>", $wikisource);
$wikisource = str_replace('IMGneverhoodIMG','<a href="imgs/wineshot.jpg"><img alt="Screenshot" src="imgs/wineshot.png" /></a>',$wikisource);
$wikisource = str_replace('http://wiki.ubuntu.cz/Terminál','http://wiki.ubuntu.cz/Termin%C3%A1l',$wikisource);
return $wikisource;
Kód: Vybrať všetko
str_replace('http://wiki.ubuntu.cz/Terminál','http://wiki.ubuntu.cz/Termin%C3%A1l',$wikisource);
Kód: Vybrať všetko
// EVENTS
$den=array('Ne', 'Po', 'Út', 'St', 'Čt', 'Pá', 'So'); // by churchyard
/* you can use the snippet as follows:
[[Events?resourceparent=4&maxEventNumbers=6&maxPeriod=6]]
To set a default setting here you can change the last number after the variable name in the following three lines, e.g.
$resourceparent = isset($resourceparent) ? $resourceparent : 8; means $resourceparent=8 if not set in the snippet call.
*/
$resourceparent = isset($resourceparent) ? $resourceparent : 56;
$maxEventNumbers = isset($maxEventNumbers ) ? $maxEventNumbers : 1000;
$maxPeriod = isset($maxPeriod ) ? $maxPeriod :1000;
$showEventInformation = isset($showEventInformation ) ? $showEventInformation : true;
$fullEventDate = isset($fullEventDate ) ? $fullEventDate : 'd.m.Y';
$quickEventDate = isset($quickEventDate ) ? $quickEventDate : 'd.m.';
$monthNames = array('Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec');
/* output generation */
$output = '';
$resource = $etomite->getActiveChildren($resourceparent, 'alias', 'ASC', $fields='id, longtitle, alias, description, content');
$displayedEvents = 0;
$numberEvents = count($resource);
$lastMonth = -1;
$currentDate = mktime(0,0,0);
$endDate = $currentDate + $maxPeriod * 30 * 24 * 60 * 60;
for ($i = 0; $i < $numberEvents && $displayedEvents < $maxEventNumbers; ++$i) {
$alias = $resource[$i]['alias'];
$eventtitle = $resource[$i]['longtitle'];
if (strlen($alias) > 0 && strlen($eventtitle) > 0 && preg_match('/^\d{8,8}/',$alias, $dateText)) {
$dateYear = substr($dateText[0], 0, 4);
$dateMonth = substr($dateText[0], 4, 2);
$dateDay = substr($dateText[0], 6, 2);
$eventDate = mktime(0, 0, 0, $dateMonth, $dateDay, $dateYear);
if ($eventDate < $currentDate || $eventDate > $endDate) {
continue;
}
$dateArray = getdate($eventDate);
$curMonth = $dateArray['mon'];
if ($curMonth != $lastMonth) {
if ($lastMonth != -1) {
$output .= '</li></ul>';
}
$output .= '<li class="eventmonth"><strong>'.$monthNames[$curMonth-1].'</strong><ul>';
}
$pageid = $resource[$i]['id'];
$eventdescription = $resource[$i]['description'] == '' ? "$eventtitle - ".date($fullEventDate,$eventDate) : $resource[$i]['description'];
$eventInformation = $resource[$i]['content'];
$href = "<strong>".date($quickEventDate ,$eventDate)." ".$den[date("w",$eventDate)]."</strong> - ".$eventtitle;
$output .= "<li class=\"eventitem\">$href".($showEventInformation ? "<br/><span class=\"event-information\">$eventInformation</span>" : '')."</li>";
++$displayedEvents;
$lastMonth = $curMonth;
}
}
if (strlen($output) == 0) {
$output .= "Žádné akce nenalezeny.";
} else {
$output = '<ul>'.$output.'</ul></li></ul>';
}
return $output;
Kód: Vybrať všetko
// OLD EVENTS
$den=array('Ne', 'Po', 'Út', 'St', 'Čt', 'Pá', 'So'); // by churchyard
/* you can use the snippet as follows:
[[Events?resourceparent=4&maxEventNumbers=6&maxPeriod=6]]
To set a default setting here you can change the last number after the variable name in the following three lines, e.g.
$resourceparent = isset($resourceparent) ? $resourceparent : 8; means $resourceparent=8 if not set in the snippet call.
*/
$resourceparent = isset($resourceparent) ? $resourceparent : 56;
$maxEventNumbers = isset($maxEventNumbers ) ? $maxEventNumbers : 1000;
$maxPeriod = isset($maxPeriod ) ? $maxPeriod :1000;
$showEventInformation = isset($showEventInformation ) ? $showEventInformation : true;
$fullEventDate = isset($fullEventDate ) ? $fullEventDate : 'd.m.Y';
$quickEventDate = isset($quickEventDate ) ? $quickEventDate : 'd.m.';
$monthNames = array('Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec');
/* output generation */
$output = '';
$resource = $etomite->getActiveChildren($resourceparent, 'alias', 'DESC', $fields='id, longtitle, alias, description, content');
$displayedEvents = 0;
$numberEvents = count($resource);
$lastMonth = -1;
$currentDate = mktime(0,0,0);
$endDate = $currentDate + $maxPeriod * 30 * 24 * 60 * 60;
for ($i = 0; $i < $numberEvents && $displayedEvents < $maxEventNumbers; ++$i) {
$alias = $resource[$i]['alias'];
$eventtitle = $resource[$i]['longtitle'];
if (strlen($alias) > 0 && strlen($eventtitle) > 0 && preg_match('/^\d{8,8}/',$alias, $dateText)) {
$dateYear = substr($dateText[0], 0, 4);
$dateMonth = substr($dateText[0], 4, 2);
$dateDay = substr($dateText[0], 6, 2);
$eventDate = mktime(0, 0, 0, $dateMonth, $dateDay, $dateYear);
/* if ($eventDate < $currentDate || $eventDate > $endDate) { */
if ($eventDate > $currentDate || $eventDate > $endDate) {
continue;
}
$dateArray = getdate($eventDate);
$curMonth = $dateArray['mon'];
$year = date("Y",$eventDate);
if ($curMonth != $lastMonth) {
if ($lastMonth != -1) {
$output .= '</li></ul>';
}
$output .= '<li class="eventmonth"><strong>'.$monthNames[$curMonth-1].' '.$year .'</strong><ul>';
}
$pageid = $resource[$i]['id'];
$eventdescription = $resource[$i]['description'] == '' ? "$eventtitle - ".date($fullEventDate,$eventDate) : $resource[$i]['description'];
$eventInformation = $resource[$i]['content'];
$href = "<strong>".date($quickEventDate ,$eventDate)." ".$den[date("w",$eventDate)]."</strong> - ".$eventtitle;
$output .= "<li class=\"eventitem\">$href".($showEventInformation ? "<br/><span class=\"event-information\">$eventInformation</span>" : '')."</li>";
++$displayedEvents;
$lastMonth = $curMonth;
}
}
if (strlen($output) == 0) {
$output .= "Žádné akce nenalezeny.";
} else {
$output = '<ul>'.$output.'</ul></li></ul>';
}
return $output;
Kód: Vybrať všetko
// ONE EVENT
$den=array('Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'); // by churchyard
/* you can use the snippet as follows:
[[Events?resourceparent=4&maxEventNumbers=6&maxPeriod=6]]
To set a default setting here you can change the last number after the variable name in the following three lines, e.g.
$resourceparent = isset($resourceparent) ? $resourceparent : 8; means $resourceparent=8 if not set in the snippet call.
*/
$resourceparent = isset($resourceparent) ? $resourceparent : 56;
$maxEventNumbers = isset($maxEventNumbers ) ? $maxEventNumbers : 1;
$maxPeriod = isset($maxPeriod ) ? $maxPeriod :100;
$showEventInformation = isset($showEventInformation ) ? $showEventInformation : true;
$fullEventDate = isset($fullEventDate ) ? $fullEventDate : 'd.m.Y';
$quickEventDate = isset($quickEventDate ) ? $quickEventDate : 'd.m.';
$monthNames = array('Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec');
/* output generation */
$output = '';
$resource = $etomite->getActiveChildren($resourceparent, 'alias', 'ASC', $fields='id, longtitle, alias, description, content');
$displayedEvents = 0;
$numberEvents = count($resource);
$lastMonth = -1;
$currentDate = mktime(0,0,0);
$endDate = $currentDate + $maxPeriod * 30 * 24 * 60 * 60;
for ($i = 0; $i < $numberEvents && $displayedEvents < $maxEventNumbers; ++$i) {
$alias = $resource[$i]['alias'];
$eventtitle = $resource[$i]['longtitle'];
if (strlen($alias) > 0 && strlen($eventtitle) > 0 && preg_match('/^\d{8,8}/',$alias, $dateText)) {
$dateYear = substr($dateText[0], 0, 4);
$dateMonth = substr($dateText[0], 4, 2);
$dateDay = substr($dateText[0], 6, 2);
$eventDate = mktime(0, 0, 0, $dateMonth, $dateDay, $dateYear);
if ($eventDate < $currentDate || $eventDate > $endDate) {
continue;
}
$dateArray = getdate($eventDate);
$curMonth = $dateArray['mon'];
if ($curMonth != $lastMonth) {
if ($lastMonth != -1) {
$output .= '';
}
$output .= '<div class="featurebox">';
}
$pageid = $resource[$i]['id'];
$eventdescription = $resource[$i]['description'] == '' ? "$eventtitle - ".date($fullEventDate,$eventDate) : $resource[$i]['description'];
$eventInformation = $resource[$i]['content'];
$href = "";
$output .= "<h3>".$den[date("w",$eventDate)].", ".date($quickEventDate ,$eventDate)."</h3><p><strong>".$eventtitle."</strong> - ".$eventInformation."</p>";
++$displayedEvents;
$lastMonth = $curMonth;
}
}
if (strlen($output) == 0) {
$output .= " ";
} else {
$output .= "</div>";
}
return $output;
no tak na tohle staci neco z tohohle:churchyard napísal:...
Zároveň se obracím s prosbou na zkušenější php programátory: potřebuju funkci, která předělá v konkrétním URL íľžáéáťľťžň znaky na %C3%A1 <- takovéhle. Ale podle UTF8ky, když stránky mají jineé kódování. Viz předposlední řádek kódu.Kód: Vybrať všetko
str_replace('http://wiki.ubuntu.cz/Terminál','http://wiki.ubuntu.cz/Termin%C3%A1l',$wikisource);
Pošli link... jakou chybu?gabo napísal:nazdar potreboval by som helpnut ohladne easy galery, co mas na neverhodovi, ja som to urobil presne tak ako je v popise a vecne mi to vypisuje chybu