'.API_VERSION.''; return $XML; } /** * trims text to a space then adds ellipses if desired * @param string $input text to trim * @param int $length in characters to trim to * @param bool $ellipses if ellipses (...) are to be added * @param bool $strip_html if html tags are to be stripped * @return string */ function trim_text($input, $length, $ellipses = true, $strip_html = true) { //strip tags, if desired if ($strip_html) { $input = strip_tags($input); } //no need to trim, already shorter than trim length if (strlen($input) <= $length) { return $input; } //find last space within length $last_space = strrpos(substr($input, 0, $length), ' '); $trimmed_text = substr($input, 0, $last_space); //add ellipses (...) if ($ellipses) { $trimmed_text .= '...'; } return $trimmed_text; } function stripHtmlTags($str) { $description = strip_tags($str); $description = preg_replace("/(\[[^\]]*\])/s", "", $description); // remove 3rd party plugin strnage code e.g. [caption id="attachment_5986" align="alignleft" width="300"] $description = str_replace(" ", " ", $description); $description = preg_replace('/\s+/', ' ',$description); //no need to trim, already shorter than trim length if (strlen($description) <= SYNOPSIS_LENGTH) { return $description; } //find last space within length $last_space = strrpos(substr($description, 0, SYNOPSIS_LENGTH), ' '); $description = substr($description, 0, $last_space); //$description = substr($description, 0, SYNOPSIS_LENGTH); return $description; } function strip($value) { if(get_magic_quotes_gpc() == 0) return $value; else return stripslashes($value); } function categoryListXML ($alc_api_options) { $args = array( //'orderby' => 'name', //'order' => 'ASC', 'hierarchical' => 1, 'hide_empty' => 0, 'include' => $alc_api_options['cat'] ); $categories = get_categories($args); /* all categories */ $XML .= ""; if (!empty($categories)) { //echo '
';
        //print_r($category);
        //print_r($alc_api_options);
        //echo '
'; foreach ($categories as $category) { $XML .= ""; $XML .= "" . $category->term_id . ""; $XML .= "" . $category->name . ""; $XML .= ""; if (!empty($category->description)) { $XML .="description . "]]>"; } $XML .= ""; if ($category->category_parent > 0) { $XML .= "" . $category->category_parent . ""; } $XML .= ""; } } $XML .= "
"; return $XML; } ?>