Esempio n. 1
0
function _eventorganiser_remove_duplicates($array)
{
    //Do we need to worry about the myTimes of the date-myTime objects?
    if (myEmpty($array)) {
        return $array;
    }
    $unique = array();
    foreach ($array as $key => $object) {
        if (!myInArray($object, $unique)) {
            $unique[$key] = $object;
        }
    }
    return $unique;
}
Esempio n. 2
0
function convert_smilies($text, $wp_smiliessearch)
{
    $output = '';
    if (get_option('use_smilies') && !myEmpty($wp_smiliessearch)) {
        // HTML loop taken from texturize function, could possible be consolidated
        $textarr = myPregSplit('/(<.*>)/U', $text, -1, 1);
        // capture the tags as well as in between
        $stop = myCount($textarr);
        // loop stuff
        // Ignore proessing of specific tags
        $tags_to_ignore = 'code|pre|style|script|textarea';
        $ignore_block_element = '';
        for ($i = 0; $i < $stop; $i++) {
            $content = $textarr[$i];
            $matches = [];
            // If we're in an ignore block, wait until we find its closing tag
            if ('' == $ignore_block_element && myPregMatch('/^<(' . $tags_to_ignore . ')>/', $content, $matches)) {
                $ignore_block_element = $matches[1];
            }
            // If it's not a tag and not in ignore block
            if ('' == $ignore_block_element && myStrLen($content) > 0 && '<' != $content[0]) {
                // $content = preg_replace_callback( $wp_smiliessearch, 'translate_smiley', $content );
            }
            // did we exit ignore block
            if ('' != $ignore_block_element && '</' . $ignore_block_element . '>' == $content) {
                $ignore_block_element = '';
            }
            $output .= $content;
        }
    } else {
        // return default text.
        $output = $text;
    }
    return $output;
}