| Server IP : 89.39.208.18 / Your IP : 216.73.217.74 Web Server : LiteSpeed System : User : ( ) PHP Version : 7.4.33 Disable Function : eval,./,ln,passthru,dl,system,exec,popen,shell_exec,posix_getpwuid,posix_uname,ftp_exec,posix_uname,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,get_current_user,getmyuid,getmygid,listen,chgrp,apache_note,apache_setenv,apache_child_terminate,closelog,debugger_off,debugge_on,ini_restore,netscript,escapeshellarg,cmd,backtick,virtual,show_sourc,show_source,pclose,pcntl_exec,datasec,old_offset,ctrl_dir,ini_alter,leak,listen,chgrp,apache_setenv,define_syslog_variables,root,diskfreespace,disk_free_space,disk_total_space,posix_kill,getmyuid,getmygid,apache_child_terminate,php_ini_scanned_files,ls,ps_aux,chown,getrusage,posixc,posame,chgrp,posix_setuid,posix_setsid,posix_setgid,apache_note,apache_setenv,x_getuid,e_ini_file,nfo,SQL,mysql_li,t_dbs,filegroup,highlight_file,ilegetcontents,get_dir,popen,popens,pfsockopen,dos_conv,apache_get_modules,crack_check,crack_closedict,rar_open,bzopen,bzread,bzwrite,shellcode,posix_isatty,posix_getservbyname,escapeshellarg,hypot,pg_host,pos,posix_access,inurl,posix_times,posix_mknod,pclose,ps_fill,symlink,id,escapeshellcmd,php_uname,phpinfo MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home3/mahyarcake/./www/wp-content/plugins/polylang/integrations/jetpack/ |
Upload File : |
<?php
/**
* @package Polylang
*/
/**
* Manages the compatibility with the Jetpack Twenty Fourteenn Featured content
*
* @since 2.4
*/
class PLL_Featured_Content {
/**
* Constructor
*
* @since 2.6
*/
public function init() {
add_filter( 'transient_featured_content_ids', array( $this, 'featured_content_ids' ) );
add_filter( 'option_featured-content', array( $this, 'option_featured_content' ) );
}
/**
* Tell whether the theme supports the featured content
*
* @since 2.4
*
* @return bool
*/
protected function is_active() {
return 'twentyfourteen' === get_template() || ( defined( 'JETPACK__VERSION' ) && get_theme_support( 'featured-content' ) );
}
/**
* Get the theme featured posts filter name
*
* @since 2.4
*
* @return string
*/
protected function get_featured_posts_filter() {
$theme_support = get_theme_support( 'featured-content' );
if ( isset( $theme_support[0]['featured_content_filter'] ) ) {
$theme_support[0]['filter'] = $theme_support[0]['featured_content_filter'];
unset( $theme_support[0]['featured_content_filter'] );
}
return $theme_support[0]['filter'];
}
/**
* Rewrites the function Featured_Content::get_featured_post_ids()
*
* @since 1.4
*
* @param array $featured_ids Featured posts ids
* @return array modified featured posts ids ( include all languages )
*/
public function featured_content_ids( $featured_ids ) {
if ( ! $this->is_active() || false !== $featured_ids ) {
return $featured_ids;
}
$settings = Featured_Content::get_setting();
if ( ! $term = get_term_by( 'name', $settings['tag-name'], 'post_tag' ) ) {
return $featured_ids;
}
// Get featured tag translations
$tags = PLL()->model->term->get_translations( $term->term_id );
$ids = array();
// Query for featured posts in all languages
// One query per language to get the correct number of posts per language
foreach ( $tags as $tag ) {
$args = array(
'lang' => 0, // Avoid language filters.
'fields' => 'ids',
'numberposts' => Featured_Content::$max_posts,
'tax_query' => array(
array(
'taxonomy' => 'post_tag',
'terms' => (int) $tag,
),
),
);
// Available in Jetpack, but not in Twenty Fourteen.
if ( isset( Featured_Content::$post_types ) ) {
$args['post_type'] = Featured_Content::$post_types;
}
$_ids = get_posts( $args );
$ids = array_merge( $ids, $_ids );
}
$ids = array_map( 'absint', $ids );
set_transient( 'featured_content_ids', $ids );
return $ids;
}
/**
* Translates the featured tag id in featured content settings
* Mainly to allow hiding it when requested in featured content options
* Acts only on frontend
*
* @since 1.4
*
* @param array $settings featured content settings
* @return array modified $settings
*/
public function option_featured_content( $settings ) {
if ( $this->is_active() && PLL() instanceof PLL_Frontend && $settings['tag-id'] && $tr = pll_get_term( $settings['tag-id'] ) ) {
$settings['tag-id'] = $tr;
}
return $settings;
}
}