/** * Create excerpt from the supplied text. Default is the description. * * Filters: * cn_cat_excerpt_length => change the default excerpt length of 55 words. * cn_cat_excerpt_more => change the default more string of … * cn_trim_cat_excerpt => change returned string * * @access public * @since 0.7.8 * * @param array $atts [optional] * @param string $text [optional] * * @return string */ public function getExcerpt($atts = array(), $text = '') { $defaults = array('length' => apply_filters('cn_cat_excerpt_length', 55), 'more' => apply_filters('cn_cat_excerpt_more', '…')); $atts = $this->validate->attributesArray($defaults, $atts); $text = cnString::excerpt(empty($text) ? $this->getDescription() : $text, $atts); return apply_filters('cn_trim_cat_excerpt', $text); }
/** * Create excerpt from the supplied text. Default is the bio. * * @access public * @since unknown * @param array $atts [optional] * @param string $text [optional] * * @return string */ public function getExcerpt($atts = array(), $text = '') { return cnString::excerpt($text = empty($text) ? $this->getBio() : $text, $atts); }
/** * Create excerpt from the supplied string. * * @access public * @since 8.1.5 * @static * * @deprecated 8.2.9 Use {@see cnString::excerpt()} instead. * @see cnString::excerpt() * * @param string $string String to create the excerpt from. * @param array $atts { * Optional. An array of arguments. * * @type int $length The length, number of words, of the excerpt to create. * If set to `p` the excerpt will be the first paragraph, no word limit. * Default: 55. * @type string $more The string appended to the end of the excerpt when $length is exceeded. * Default: &hellip * @type array $allowed_tags An array containing the permitted tags. * } * * @return string */ public static function excerpt($string, $atts = array()) { return cnString::excerpt($string, $atts); }
/** * Renders an excerpt of the bio or supplied string. * * @access public * @since 8.5.19 * * @param array $atts * @param string $text * * @return string */ public function excerpt($atts = array(), $text = '') { $defaults = array('before' => '', 'after' => '', 'length' => apply_filters('cn_excerpt_length', 55), 'more' => apply_filters('cn_excerpt_more', __('…', 'connections')), 'return' => FALSE); /** * All extensions to filter the method default and supplied args. * * @since 8.5.19 */ $atts = cnSanitize::args(apply_filters('cn_output_atts_excerpt', $atts), apply_filters('cn_output_default_atts_excerpt', $defaults)); $text = 0 < strlen($text) ? $text : $this->getBio(); /** * Apply the default filters. * * @since 8.5.19 */ $text = apply_filters('cn_output_excerpt', $text); $html = cnString::excerpt($text, $atts); return $this->echoOrReturn($atts['return'], $html); }