| Server IP : 93.184.69.11 / Your IP : 216.73.217.131 Web Server : Apache System : Linux wa01 5.10.0-45-amd64 #1 SMP Debian 5.10.259-1 (2026-07-02) x86_64 User : web673 ( 1054) PHP Version : 7.0.33-84+0~20251218.106+debian11~1.gbpe01fd8 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/clients/client310/web673/web/wp-content/plugins/advanced-excerpt/functions/ |
Upload File : |
<?php
// Do not use outside the Loop!
function the_advanced_excerpt( $args = '', $get = false ) {
global $advanced_excerpt;
if ( !empty( $args ) && !is_array( $args ) ) {
$args = wp_parse_args( $args );
// Parse query style parameters
if ( isset( $args['ellipsis'] ) ) {
$args['ellipsis'] = urldecode( $args['ellipsis'] );
}
if ( isset( $args['allowed_tags'] ) ) {
$args['allowed_tags'] = preg_split( '/[\s,]+/', $args['allowed_tags'] );
}
if ( isset( $args['exclude_tags'] ) ) {
$args['exclude_tags'] = preg_split( '/[\s,]+/', $args['exclude_tags'] );
}
}
// convert legacy arg use_words to it's udpated equivalent
if ( isset( $args['use_words'] ) ) {
$args['length_type'] = ( 1 == $args['use_words'] ) ? 'words' : 'characters';
unset( $args['use_words'] );
}
// convert legacy args finish_word & finish_sentence to their udpated equivalents
if ( isset( $args['finish_word'] ) || isset( $args['finish_sentence'] ) ) {
$defaults = array(
'finish_word' => 0,
'finish_sentence' => 0
);
$args = wp_parse_args( $args, $defaults );
if ( 0 == $args['finish_word'] && 0 == $args['finish_sentence'] ) {
$args['finish'] = 'exact';
} else if ( 1 == $args['finish_word'] && 1 == $args['finish_sentence'] ) {
$args['finish'] = 'sentence';
} else if ( 0 == $args['finish_word'] && 1 == $args['finish_sentence'] ) {
$args['finish'] = 'sentence';
} else {
$args['finish'] = 'word';
}
unset( $args['finish_word'] );
unset( $args['finish_sentence'] );
}
if ( ! empty( $args['allowed_tags'] ) || ! empty( $args['exclude_tags'] ) ) {
if ( isset( $args['allowed_tags'] ) && ! in_array( '_all', (array) $args['allowed_tags'] ) ) {
$args['allowed_tags_option'] = 'remove_all_tags_except';
} else if ( ! isset( $args['allowed_tags'] ) ) {
$args['allowed_tags_option'] = 'remove_all_tags_except';
}
}
// Set temporary options
$advanced_excerpt->options = wp_parse_args( $args, $advanced_excerpt->options );
// Ensure our filter is hooked, regardless of the page type
if ( ! has_filter( 'get_the_excerpt', array( $advanced_excerpt, 'filter_excerpt' ) ) ) {
remove_all_filters( 'get_the_excerpt' );
remove_all_filters( 'the_excerpt' );
add_filter( 'get_the_excerpt', array( $advanced_excerpt, 'filter_excerpt' ) );
}
if ( $get ) {
return get_the_excerpt();
} else {
the_excerpt();
}
// Reset the options back to their original state
$advanced_excerpt->load_options();
}
function the_advanced_excerpt_lang( $atts, $content = '' ) {
$settings = shortcode_atts( array(
'lang' => 'en_us',
), $atts );
$settings['lang'] = strtolower( $settings['lang'] );
$locale = strtolower( get_locale() );
if ( $locale == $settings['lang'] ) {
return $content;
}
return;
} add_shortcode( 'advanced_excerpt_text', 'the_advanced_excerpt_lang' );