\n\t//\n\n"; } // UTF-8 HTML ENTITTIES function htmlentities_utf8($str) { return htmlentities($str, ENT_QUOTES, 'utf-8'); } /* Create SEO friendly URL's */ function urlRewrite($string) { $string = str_replace('&', '-', $string); $string = preg_replace("`\[.*\]`U","",$string); $string = preg_replace('`&(amp;)?#?[a-z0-9]+;`i','-',$string); $string = htmlentities($string, ENT_COMPAT, 'utf-8'); $string = preg_replace( "`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig|quot|rsquo);`i","\\1", $string ); $string = preg_replace( array("`[^a-z0-9]`i","`[-]+`") , "-", $string); return strtolower(trim($string, '-')); } function getPagina($Pagina_id){ $qryPagina = mysql_query("SELECT * FROM wp_posts WHERE ID = '$Pagina_id' AND post_type = 'page' AND post_status != 'private'"); $rowPagina = mysql_fetch_assoc($qryPagina); if (mysql_num_rows($qryPagina)){ return $rowPagina; } else { return false; } } function hasSubitems($PaginaID){ $query = "SELECT ID FROM wp_posts WHERE post_parent ='$PaginaID' AND post_type = 'page'"; $res = mysql_query($query); if (mysql_num_rows($res)) { return true; } return false; } function isHoofdItem($paginaID){ $query = "SELECT post_parent FROM wp_posts WHERE ID='$paginaID' AND post_type = 'page'"; $res = mysql_query($query); if (mysql_num_rows($res)){ list($paginaHoofd) = mysql_fetch_row($res); if ($paginaHoofd == 0) { return true; } else { return $paginaHoofd; } } } function isSubItem($paginaID){ $query = "SELECT post_parent FROM wp_posts WHERE ID='$paginaID' AND post_type = 'page'"; $res = mysql_query($query); if (mysql_num_rows($res)){ list($paginaSub) = mysql_fetch_row($res); if ($paginaSub > 0) { return true; } else { return false; } } } function getHoofdID($paginaID){ $query = "SELECT ID, post_parent FROM wp_posts WHERE ID='$paginaID' AND post_type = 'page'"; $res = mysql_query($query); if (mysql_num_rows($res)){ list($paginaID, $paginaHoofd) = mysql_fetch_row($res); if ($paginaHoofd == 0) { return $paginaID; } else { return getHoofdID($paginaHoofd); } } } function getParent($paginaID){ $query = "SELECT ID, post_parent FROM wp_posts WHERE ID='$paginaID' AND post_type = 'page'"; $res = mysql_query($query); if (mysql_num_rows($res)){ list($paginaID, $paginaHoofd) = mysql_fetch_row($res); if ($paginaHoofd == 0) { return $paginaID; } else { return $paginaHoofd; } } } function isActive($paginaID) { if ($_GET["Pagina_id"] == $paginaID) { return ' class="active"'; } else if (hasSubitems($paginaID) && getHoofdID($_GET["Pagina_id"]) == $paginaID) { return ' class="active"'; } } /** * Replaces double line-breaks with paragraph elements. * * A group of regex replaces used to identify text formatted with newlines and * replace double line-breaks with HTML paragraph tags. The remaining * line-breaks after conversion become <
> tags, unless $br is set to '0' * or 'false'. * * @since 0.71 * * @param string $pee The text which has to be formatted. * @param int|bool $br Optional. If set, this will convert all remaining line-breaks after paragraphing. Default true. * @return string Text which has been converted into correct paragraph tags. */ function autop($pee, $br = 1) { if ( trim($pee) === '' ) return ''; $pee = $pee . "\n"; // just to make things a little easier, pad the end $pee = preg_replace('|
\s*
|', "\n\n", $pee); // Space things out a little $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr)'; $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee); $pee = preg_replace('!()!', "$1\n\n", $pee); $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines if ( strpos($pee, ']*)>\s*|', "", $pee); // no pee inside object/embed $pee = preg_replace('|\s*\s*|', '', $pee); } $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates // make paragraphs, including one at the end $pees = preg_split('/\n\s*\n/', $pee, -1, PREG_SPLIT_NO_EMPTY); $pee = ''; foreach ( $pees as $tinkle ) $pee .= '

' . trim($tinkle, "\n") . "

\n"; $pee = preg_replace('|

\s*

|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace $pee = preg_replace('!

([^<]+)!', "

$1

", $pee); $pee = preg_replace('!

\s*(]*>)\s*

!', "$1", $pee); // don't pee all over a tag $pee = preg_replace("|

(|", "$1", $pee); // problem with nested lists $pee = preg_replace('|

]*)>|i', "

", $pee); $pee = str_replace('

', '

', $pee); $pee = preg_replace('!

\s*(]*>)!', "$1", $pee); $pee = preg_replace('!(]*>)\s*

!', "$1", $pee); if ($br) { $pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', create_function('$matches', 'return str_replace("\n", "", $matches[0]);'), $pee); $pee = preg_replace('|(?)\s*\n|', "
\n", $pee); // optionally make line breaks $pee = str_replace('', "\n", $pee); } $pee = preg_replace('!(]*>)\s*
!', "$1", $pee); $pee = preg_replace('!
(\s*]*>)!', '$1', $pee); if (strpos($pee, ']*>)(.*?)!is', 'clean_pre', $pee ); $pee = preg_replace( "|\n

$|", '

', $pee ); $pee = preg_replace('/

\s*?(' . get_shortcode_regex() . ')\s*<\/p>/s', '$1', $pee); // don't auto-p wrap shortcodes that stand alone return $pee; } /** * Retrieve the shortcode regular expression for searching. * * The regular expression combines the shortcode tags in the regular expression * in a regex class. * * The regular expresion contains 6 different sub matches to help with parsing. * * 1/6 - An extra [ or ] to allow for escaping shortcodes with double [[]] * 2 - The shortcode name * 3 - The shortcode argument list * 4 - The self closing / * 5 - The content of a shortcode when it wraps some content. * * @since 2.5 * @uses $shortcode_tags * * @return string The shortcode search regular expression */ function get_shortcode_regex() { $tagnames = array_keys(array()); $tagregexp = join( '|', array_map('preg_quote', $tagnames) ); return '(.?)\[('.$tagregexp.')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)'; } ?>