max(array_keys($arr)): return false; break; default: return strlen(implode($search, array_slice($arr, 0, $offset))); } } function ampforwp_nl2p($string, $only_if_no_html = TRUE) { // Replace the input string by default unless we find a reason not to. $replace = TRUE; // If the only_if_no_html flag is set, then we only want to replace if no HTML is detected if ($only_if_no_html) { // Create a string of the input string with stripped tags $str2 = strip_tags($string); // If there is a difference, then HTML must have been in the input string. // Since HTML already exists, we do not want to replace new lines with HTML if ($str2 != $string) { $replace = FALSE; } } // Now return the replacement string if we are supposed to replace it. if ($replace) { return preg_replace('#\*(.*?)\n#', '
  • $1
  • ', $string); } // Otherwise, we just return the input string. return $string; } $readme_file = AMPFORWP_PLUGIN_DIR.'readme.txt'; $readme = file_get_contents($readme_file); $readme = preg_replace('/`(.*?)`/', '\\1', $readme); $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' \\1', $readme); $readme = preg_replace('/[\040]\*(.*?)\*/', ' \\1', $readme); $readme = preg_replace('/=== (.*?) ===/', '

    \\1

    ', $readme); $readme = preg_replace('/== (.*?) ==/', '

    \\1

    ', $readme); $readme = preg_replace('/= (.*?) =/', '

    \\1