Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/accelera.../template...
File: features.php
if(isset($redux_builder_amp['ampforwp-display-avatar']) && $redux_builder_amp['ampforwp-display-avatar']==0){
[5500] Fix | Delete
return '';
[5501] Fix | Delete
}
[5502] Fix | Delete
if (class_exists('FV_Gravatar_Cache')) {
[5503] Fix | Delete
$options = get_option('fv_gravatar_cache');
[5504] Fix | Delete
$size = $options['size'];
[5505] Fix | Delete
if (empty($size)) {
[5506] Fix | Delete
$size = '96';
[5507] Fix | Delete
}
[5508] Fix | Delete
$avatar_url = get_avatar_url($comment);
[5509] Fix | Delete
$upload_dir = wp_upload_dir();
[5510] Fix | Delete
$upload_dir = $upload_dir['baseurl'] . '/fv-gravatar-cache/';
[5511] Fix | Delete
$avatar_url = preg_replace('/(.*?)avatar\/(.*?)\?s=(.*?)&(.*?)g/', ''.$upload_dir.'$2x$3.png', $avatar_url);
[5512] Fix | Delete
preg_match_all('/(.*?)wp-content\/uploads\/fv-gravatar-cache\/(.*?)/U', $avatar_url, $match);
[5513] Fix | Delete
$url = $match[0][0];
[5514] Fix | Delete
$headers = get_headers($url, 1);
[5515] Fix | Delete
if(isset($headers[0]) && !stripos($headers[0], "200 OK")){
[5516] Fix | Delete
$avatar_url = $upload_dir.'mystery'. esc_html($size) .'.png';
[5517] Fix | Delete
}
[5518] Fix | Delete
return $avatar_url;
[5519] Fix | Delete
}
[5520] Fix | Delete
$gravatar_exists = '';
[5521] Fix | Delete
$gravatar_exists = ampforwp_gravatar_checker($comment->comment_author_email);
[5522] Fix | Delete
if ( null !== ampforwp_get_wp_user_avatar($comment, 'comment') ) {
[5523] Fix | Delete
return ampforwp_get_wp_user_avatar($comment, 'comment');
[5524] Fix | Delete
}
[5525] Fix | Delete
elseif($gravatar_exists == true){
[5526] Fix | Delete
return get_avatar_url( $comment, apply_filters( 'ampforwp_get_comments_gravatar', '60' ), '' );
[5527] Fix | Delete
}
[5528] Fix | Delete
else
[5529] Fix | Delete
return apply_filters( 'ampforwp_get_comments_gravatar', '' );
[5530] Fix | Delete
}
[5531] Fix | Delete
}
[5532] Fix | Delete
// Gravatar Checker
[5533] Fix | Delete
if ( ! function_exists('ampforwp_gravatar_checker') ) {
[5534] Fix | Delete
function ampforwp_gravatar_checker( $email ) {
[5535] Fix | Delete
$uri = "";
[5536] Fix | Delete
// Craft a potential url and test its headers
[5537] Fix | Delete
$hash = md5(strtolower(trim($email)));
[5538] Fix | Delete
$gravatar_server = 0;
[5539] Fix | Delete
if ( $hash ) {
[5540] Fix | Delete
$gravatar_server = hexdec( $hash[0] ) % 3;
[5541] Fix | Delete
} else {
[5542] Fix | Delete
$gravatar_server = rand( 0, 2 );
[5543] Fix | Delete
}
[5544] Fix | Delete
if ( is_ssl() ) {
[5545] Fix | Delete
$uri = 'https://secure.gravatar.com/avatar/' . $hash;
[5546] Fix | Delete
} else {
[5547] Fix | Delete
$uri = sprintf( 'http://%d.gravatar.com/avatar/%s', $gravatar_server, $hash );
[5548] Fix | Delete
}
[5549] Fix | Delete
if($uri){
[5550] Fix | Delete
$response = wp_remote_get(esc_url_raw($uri));
[5551] Fix | Delete
$response_code = wp_remote_retrieve_response_code($response);
[5552] Fix | Delete
}
[5553] Fix | Delete
//If its 404
[5554] Fix | Delete
if ($response_code!=200) {
[5555] Fix | Delete
$has_valid_avatar = FALSE;
[5556] Fix | Delete
}else {
[5557] Fix | Delete
$has_valid_avatar = TRUE;
[5558] Fix | Delete
}
[5559] Fix | Delete
return $has_valid_avatar;
[5560] Fix | Delete
}
[5561] Fix | Delete
}
[5562] Fix | Delete
function ampfowp_add_extra_css(){
[5563] Fix | Delete
echo '<style>
[5564] Fix | Delete
#wp-admin-bar-ampforwp-view-amp a{
[5565] Fix | Delete
background:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjMxNHB4IiBoZWlnaHQ9IjMxNXB4IiB2aWV3Qm94PSIwIDAgMzE0IDMxNSIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggNDEgKDM1MzI2KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5TaGFwZTwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSIjODI4NzhjIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSIyNjA3MSIgZmlsbD0iIzgyODc4YyI+CiAgICAgICAgICAgIDxnIGlkPSJDYXBhXzEiPgogICAgICAgICAgICAgICAgPGcgaWQ9Il94MzJfNDAuX1Bvd2VyIj4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTU3LjAwNywwIEM3MC4yOTIsMCAwLDcwLjI5MiAwLDE1Ny4wMDcgQzAsMjQzLjcxNSA3MC4yOTIsMzE0LjAxNCAxNTcuMDA3LDMxNC4wMTQgQzI0My43MTYsMzE0LjAxNCAzMTQuMDE0LDI0My43MTUgMzE0LjAxNCwxNTcuMDA3IEMzMTQuMDE0LDcwLjI5MiAyNDMuNzE2LDAgMTU3LjAwNywwIFogTTE1Ny4wMDcsMjgyLjYxMiBDODcuNjM0LDI4Mi42MTIgMzEuNDAyLDIyNi4zNzIgMzEuNDAyLDE1Ny4wMDcgQzMxLjQwMiw4Ny42MzQgODcuNjM0LDMxLjQwMiAxNTcuMDA3LDMxLjQwMiBDMjI2LjM3MSwzMS40MDIgMjgyLjYxMSw4Ny42MzQgMjgyLjYxMSwxNTcuMDA3IEMyODIuNjEyLDIyNi4zNzIgMjI2LjM3MiwyODIuNjEyIDE1Ny4wMDcsMjgyLjYxMiBaIE0yMDQuMTExLDE0MS4zNjggTDE2My40NzksMTQxLjUzMyBDMTU5LjEzOSwxNDEuNTUzIDE1Ny41NDQsMTM4LjYyMyAxNTkuOTA1LDEzNC45NzkgTDIwMy4zOTcsNjguMTA5IEMyMDguMTI2LDYwLjg0MSAyMDYuOTg0LDU5LjkyMiAyMDAuODYxLDY2LjA1MyBMMTA1LjMwNSwxNjEuNiBDOTkuMTcyLDE2Ny43MzIgMTAxLjIzMiwxNzIuNjc2IDEwOS45MDYsMTcyLjY0MSBMMTQyLjY3OSwxNzIuNTA4IEMxNTEuMzQ3LDE3Mi40NzIgMTU0LjU1MiwxNzguMzM1IDE0OS44MjQsMTg1LjYwNSBMMTA2LjMzNCwyNTIuNDc3IEMxMDMuOTcyLDI1Ni4xMTIgMTA0LjU0MiwyNTYuNTgxIDEwNy42MiwyNTMuNTI3IEwxNzUuOTE1LDE4NS43MTcgQzE3OC45ODgsMTgyLjY1OSAxODMuOTUsMTc3LjY4NiAxODYuOTgzLDE3NC41OTYgTDIwOC43ODgsMTUyLjQ4NSBDMjE0Ljg3NSwxNDYuMzE3IDIxMi43NzUsMTQxLjMzIDIwNC4xMTEsMTQxLjM2OCBaIiBpZD0iU2hhcGUiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+) !important;
[5566] Fix | Delete
background-size: 18px !important;
[5567] Fix | Delete
background-repeat: no-repeat !important;
[5568] Fix | Delete
background-position: 4px 7px !important;
[5569] Fix | Delete
text-indent: -99999px;
[5570] Fix | Delete
width: 12px;
[5571] Fix | Delete
}</style>';
[5572] Fix | Delete
}
[5573] Fix | Delete
if ( is_user_logged_in() ) {
[5574] Fix | Delete
add_action('wp_head', 'ampfowp_add_extra_css');
[5575] Fix | Delete
}
[5576] Fix | Delete
// 92. View AMP in Admin Bar
[5577] Fix | Delete
add_action( 'wp_before_admin_bar_render', 'ampforwp_view_amp_admin_bar' );
[5578] Fix | Delete
if( ! function_exists( 'ampforwp_view_amp_admin_bar' ) ) {
[5579] Fix | Delete
function ampforwp_view_amp_admin_bar( ) {
[5580] Fix | Delete
global $wp_admin_bar, $post, $wp_post_types, $redux_builder_amp;
[5581] Fix | Delete
$post_type_title = $current_url = '';
[5582] Fix | Delete
$supported_amp_post_types = array();
[5583] Fix | Delete
[5584] Fix | Delete
// Get all post types supported by AMP
[5585] Fix | Delete
$supported_amp_post_types = ampforwp_get_all_post_types();
[5586] Fix | Delete
$current_access = false;
[5587] Fix | Delete
// Check for Admin
[5588] Fix | Delete
if ( is_admin() ) {
[5589] Fix | Delete
$current_screen = get_current_screen();
[5590] Fix | Delete
$current_access = ('post' == $current_screen->base && 'add' != $current_screen->action);
[5591] Fix | Delete
}elseif(is_user_logged_in()){
[5592] Fix | Delete
$current_user = wp_get_current_user();
[5593] Fix | Delete
$current_access = current_user_can('edit_posts',$current_user );
[5594] Fix | Delete
}
[5595] Fix | Delete
// Check for Screen base, user ability to read and visibility
[5596] Fix | Delete
if ($current_access && (isset($post->ID) && $post->ID && current_user_can('read_post', $post->ID ))
[5597] Fix | Delete
&& ( isset ( $wp_post_types[ $post->post_type ]->public ) && $wp_post_types[$post->post_type]->public )
[5598] Fix | Delete
&& ( isset ( $wp_post_types[ $post->post_type ]->show_in_admin_bar ) && $wp_post_types[$post->post_type]->show_in_admin_bar ) ) {
[5599] Fix | Delete
// Check if current post type is AMPed or not
[5600] Fix | Delete
if( $supported_amp_post_types && in_array($post->post_type, $supported_amp_post_types) ){
[5601] Fix | Delete
// If AMP on Posts or Pages is off then do nothing
[5602] Fix | Delete
if($post->post_type == 'post' && !ampforwp_get_setting('amp-on-off-for-all-posts') || $post->post_type == 'page' && !ampforwp_get_setting('amp-on-off-for-all-pages')) {
[5603] Fix | Delete
return;
[5604] Fix | Delete
}
[5605] Fix | Delete
if( is_archive() && is_category() ){
[5606] Fix | Delete
if(!ampforwp_get_setting('ampforwp-archive-support') || !ampforwp_get_setting('ampforwp-archive-support-cat') ){
[5607] Fix | Delete
return ;
[5608] Fix | Delete
}
[5609] Fix | Delete
}elseif( is_archive() && is_tag() ){
[5610] Fix | Delete
if(!ampforwp_get_setting('ampforwp-archive-support') || !ampforwp_get_setting('ampforwp-archive-support-tag') ){
[5611] Fix | Delete
return ;
[5612] Fix | Delete
}
[5613] Fix | Delete
}elseif( is_archive() && is_tax()){
[5614] Fix | Delete
$taxonomies = ampforwp_get_setting('ampforwp-custom-taxonomies');
[5615] Fix | Delete
if(empty($taxonomies)){
[5616] Fix | Delete
return ;
[5617] Fix | Delete
}else{
[5618] Fix | Delete
$term_id = get_queried_object()->term_id;
[5619] Fix | Delete
$termObj = get_term( $term_id);
[5620] Fix | Delete
if( in_array($termObj->taxonomy, $taxonomies)){
[5621] Fix | Delete
}else{
[5622] Fix | Delete
return ;
[5623] Fix | Delete
}
[5624] Fix | Delete
}
[5625] Fix | Delete
}
[5626] Fix | Delete
[5627] Fix | Delete
if( is_archive() && is_category()){
[5628] Fix | Delete
$term_id = get_queried_object()->term_id;
[5629] Fix | Delete
$termObj = get_term( $term_id);
[5630] Fix | Delete
$taxonomy_objects = get_object_taxonomies( 'post', 'objects' );
[5631] Fix | Delete
$post_type_title = $taxonomy_objects[$termObj->taxonomy]->labels->singular_name;
[5632] Fix | Delete
if(ampforwp_get_setting('ampforwp-archive-support') == true && ampforwp_get_setting('ampforwp-archive-support-cat') == true){
[5633] Fix | Delete
$current_url = get_term_link($term_id);
[5634] Fix | Delete
}
[5635] Fix | Delete
}elseif( is_archive() && is_tag()){
[5636] Fix | Delete
$term_id = get_queried_object()->term_id;
[5637] Fix | Delete
$termObj = get_term( $term_id);
[5638] Fix | Delete
$taxonomy_objects = get_object_taxonomies( 'post', 'objects' );
[5639] Fix | Delete
$post_type_title = $taxonomy_objects[$termObj->taxonomy]->labels->singular_name;
[5640] Fix | Delete
if(ampforwp_get_setting('ampforwp-archive-support') == true && ampforwp_get_setting('ampforwp-archive-support-tag') == true){
[5641] Fix | Delete
$current_url = get_term_link($term_id);
[5642] Fix | Delete
}
[5643] Fix | Delete
}elseif(is_archive() && is_tax()){
[5644] Fix | Delete
$term_id = get_queried_object()->term_id;
[5645] Fix | Delete
$termObj = get_term( $term_id);
[5646] Fix | Delete
$taxonomy_objects = get_taxonomy( $termObj->taxonomy );
[5647] Fix | Delete
$post_type_title = $taxonomy_objects->labels->singular_name;
[5648] Fix | Delete
$current_url = get_term_link($term_id);
[5649] Fix | Delete
}else{
[5650] Fix | Delete
$post_type_title = ucfirst($post->post_type);
[5651] Fix | Delete
$current_url = get_permalink( $post->ID );
[5652] Fix | Delete
if(is_home()){
[5653] Fix | Delete
$current_url = home_url();
[5654] Fix | Delete
}
[5655] Fix | Delete
}
[5656] Fix | Delete
if (is_preview()) {
[5657] Fix | Delete
$current_url = $current_url .'&amp=1&preview=true';
[5658] Fix | Delete
$wp_admin_bar->add_node(array(
[5659] Fix | Delete
'id' => 'ampforwp-view-amp',
[5660] Fix | Delete
'title' => 'View ' . esc_html($post_type_title) . ' (AMP)' ,
[5661] Fix | Delete
'href' => esc_url($current_url)
[5662] Fix | Delete
));
[5663] Fix | Delete
}else{
[5664] Fix | Delete
$wp_admin_bar->add_node(array(
[5665] Fix | Delete
'id' => 'ampforwp-view-amp',
[5666] Fix | Delete
'title' => 'View ' . esc_html($post_type_title) . ' (AMP)' ,
[5667] Fix | Delete
'href' => ampforwp_url_controller($current_url)
[5668] Fix | Delete
));
[5669] Fix | Delete
}
[5670] Fix | Delete
}
[5671] Fix | Delete
}
[5672] Fix | Delete
}
[5673] Fix | Delete
}
[5674] Fix | Delete
[5675] Fix | Delete
// 94. OneSignal Push Notifications
[5676] Fix | Delete
// Moved to push-notification-functions.php
[5677] Fix | Delete
[5678] Fix | Delete
// 95. Modify menu link attributes for SiteNavigationElement Schema Markup #1229 #1345
[5679] Fix | Delete
add_filter( 'nav_menu_link_attributes', 'ampforwp_nav_menu_link_attributes', 10, 3 );
[5680] Fix | Delete
if( ! function_exists( 'ampforwp_nav_menu_link_attributes' ) ) {
[5681] Fix | Delete
function ampforwp_nav_menu_link_attributes( $atts, $item, $args ) {
[5682] Fix | Delete
if ( function_exists('ampforwp_is_amp_endpoint') && ampforwp_is_amp_endpoint() ) {
[5683] Fix | Delete
// Manipulate link attributes
[5684] Fix | Delete
$atts['itemprop'] = "url";
[5685] Fix | Delete
}
[5686] Fix | Delete
return $atts;
[5687] Fix | Delete
}
[5688] Fix | Delete
}
[5689] Fix | Delete
[5690] Fix | Delete
// 96. ampforwp_is_front_page() ampforwp_is_home() and ampforwp_is_blog is created
[5691] Fix | Delete
// Moved to functions.php
[5692] Fix | Delete
[5693] Fix | Delete
// 97. Change the format of the post date on Loops #1384
[5694] Fix | Delete
add_filter('ampforwp_modify_post_date', 'ampforwp_full_post_date_loops');
[5695] Fix | Delete
if( ! function_exists( 'ampforwp_full_post_date_loops' ) ){
[5696] Fix | Delete
function ampforwp_full_post_date_loops($full_date){
[5697] Fix | Delete
global $redux_builder_amp;
[5698] Fix | Delete
if( is_home() || is_archive() ){
[5699] Fix | Delete
if( 2 == $redux_builder_amp['ampforwp-post-date-format'] ){
[5700] Fix | Delete
$full_date = get_the_date();
[5701] Fix | Delete
if( 2 == $redux_builder_amp['ampforwp-post-date-global'] ){
[5702] Fix | Delete
$full_date = get_the_modified_date();
[5703] Fix | Delete
}
[5704] Fix | Delete
}
[5705] Fix | Delete
if( 1 == $redux_builder_amp['ampforwp-post-date-format'] ){
[5706] Fix | Delete
$time = ampforwp_get_the_time();
[5707] Fix | Delete
$date = human_time_diff( $time, current_time('timestamp') );
[5708] Fix | Delete
if( $redux_builder_amp['ampforwp-post-date-format-text'] ){
[5709] Fix | Delete
$full_date = $redux_builder_amp['ampforwp-post-date-format-text'];
[5710] Fix | Delete
// Change the % days into the actual number of days
[5711] Fix | Delete
$full_date = str_replace('% days', $date, $full_date);
[5712] Fix | Delete
$full_date = str_replace('ago', ampforwp_translation( $redux_builder_amp['amp-translator-ago-date-text'],'ago'), $full_date);
[5713] Fix | Delete
}
[5714] Fix | Delete
}
[5715] Fix | Delete
}
[5716] Fix | Delete
if(is_single() && 1 == $redux_builder_amp['ampforwp-post-date-format']){
[5717] Fix | Delete
$time = ampforwp_get_the_time();
[5718] Fix | Delete
$date = human_time_diff( $time, current_time('timestamp') );
[5719] Fix | Delete
$full_date = human_time_diff( $time, current_time('timestamp') ) .' '. ampforwp_translation( $redux_builder_amp['amp-translator-ago-date-text'],'ago');
[5720] Fix | Delete
if( $redux_builder_amp['ampforwp-post-date-format-text'] ){
[5721] Fix | Delete
$full_date = $redux_builder_amp['ampforwp-post-date-format-text'];
[5722] Fix | Delete
// Change the % days into the actual number of days
[5723] Fix | Delete
$full_date = str_replace('% days', $date, $full_date);
[5724] Fix | Delete
$full_date = str_replace('ago', ampforwp_translation( $redux_builder_amp['amp-translator-ago-date-text'],'ago'), $full_date);
[5725] Fix | Delete
}
[5726] Fix | Delete
}
[5727] Fix | Delete
return $full_date;
[5728] Fix | Delete
}
[5729] Fix | Delete
}
[5730] Fix | Delete
if(!function_exists('ampforwp_get_the_time')){
[5731] Fix | Delete
function ampforwp_get_the_time(){
[5732] Fix | Delete
$time = get_the_time('U', get_the_ID());
[5733] Fix | Delete
if( 2 == ampforwp_get_setting('ampforwp-post-date-global') ){
[5734] Fix | Delete
$time = get_the_modified_time('U', get_the_ID() );
[5735] Fix | Delete
}
[5736] Fix | Delete
if(defined('ECWD_VERSION')){
[5737] Fix | Delete
global $ecwd_options;
[5738] Fix | Delete
$tz = $ecwd_options['time_zone'];
[5739] Fix | Delete
$ewwetz = new DateTime( get_the_time('c', get_the_ID()) );
[5740] Fix | Delete
if( 2 == ampforwp_get_setting('ampforwp-post-date-global') ){
[5741] Fix | Delete
$ewwetz = new DateTime( get_the_modified_time('c', get_the_ID()) );
[5742] Fix | Delete
}
[5743] Fix | Delete
$ewwetz->setTimezone(new DateTimeZone($tz));
[5744] Fix | Delete
$time = $ewwetz->format('U');
[5745] Fix | Delete
}
[5746] Fix | Delete
return $time;
[5747] Fix | Delete
}
[5748] Fix | Delete
}
[5749] Fix | Delete
// 99. Merriweather Font Management
[5750] Fix | Delete
add_filter( 'amp_post_template_data', 'ampforwp_merriweather_font_management' );
[5751] Fix | Delete
function ampforwp_merriweather_font_management( $data ) {
[5752] Fix | Delete
if ( 1 != ampforwp_get_setting('amp-design-selector') || ( false == ampforwp_get_setting('ampforwp-d1-font') && 1 == ampforwp_get_setting('amp-design-selector') ) ) {
[5753] Fix | Delete
unset($data['font_urls']['merriweather']);
[5754] Fix | Delete
}
[5755] Fix | Delete
return $data;
[5756] Fix | Delete
}
[5757] Fix | Delete
[5758] Fix | Delete
// 100. Flags compatibility in Menu
[5759] Fix | Delete
add_filter('ampforwp_menu_content','ampforwp_modify_menu_content');
[5760] Fix | Delete
if( ! function_exists(' ampforwp_modify_menu_content ') ){
[5761] Fix | Delete
function ampforwp_modify_menu_content($menu){
[5762] Fix | Delete
[5763] Fix | Delete
// Return $menu If tagDiv Composer plugin is active
[5764] Fix | Delete
if(function_exists('tdc_error_handler')){
[5765] Fix | Delete
return $menu;
[5766] Fix | Delete
}
[5767] Fix | Delete
[5768] Fix | Delete
$dom = '';
[5769] Fix | Delete
$nodes = '';
[5770] Fix | Delete
$num_nodes = '';
[5771] Fix | Delete
if( !empty( $menu ) ){
[5772] Fix | Delete
// Create a new document
[5773] Fix | Delete
$dom = new DOMDocument();
[5774] Fix | Delete
if( function_exists( 'mb_convert_encoding' ) ){
[5775] Fix | Delete
if (version_compare(PHP_VERSION, '8.2.0', '>=')) {
[5776] Fix | Delete
$menu = htmlentities($menu);
[5777] Fix | Delete
$menu = html_entity_decode($menu, ENT_QUOTES | ENT_HTML401, 'UTF-8');
[5778] Fix | Delete
$menu = mb_convert_encoding($menu, 'UTF-8', 'UTF-8');
[5779] Fix | Delete
} else {
[5780] Fix | Delete
$menu = mb_convert_encoding($menu, 'HTML-ENTITIES', 'UTF-8');
[5781] Fix | Delete
}
[5782] Fix | Delete
}
[5783] Fix | Delete
else{
[5784] Fix | Delete
$menu = preg_replace( '/&[^amp|#038].*?;/', 'x', $menu ); // multi-byte characters converted to X
[5785] Fix | Delete
}
[5786] Fix | Delete
[5787] Fix | Delete
// To Suppress Warnings
[5788] Fix | Delete
libxml_use_internal_errors(true);
[5789] Fix | Delete
[5790] Fix | Delete
$dom->loadHTML($menu);
[5791] Fix | Delete
[5792] Fix | Delete
libxml_use_internal_errors(false);
[5793] Fix | Delete
[5794] Fix | Delete
// get all the img's
[5795] Fix | Delete
$nodes = $dom->getElementsByTagName( 'img' );
[5796] Fix | Delete
$num_nodes = $nodes->length;
[5797] Fix | Delete
for ( $i = $num_nodes - 1; $i >= 0; $i-- ) {
[5798] Fix | Delete
$node = $nodes->item( $i );
[5799] Fix | Delete
// Set The Width and Height if there in none
[5800] Fix | Delete
if ( '' === $node->getAttribute( 'width' ) ) {
[5801] Fix | Delete
$node->setAttribute('width', 15);
[5802] Fix | Delete
}
[5803] Fix | Delete
if( '' === $node->getAttribute( 'height' ) ){
[5804] Fix | Delete
$node->setAttribute('height', 15);
[5805] Fix | Delete
}
[5806] Fix | Delete
}
[5807] Fix | Delete
$menu = $dom->saveHTML();
[5808] Fix | Delete
}
[5809] Fix | Delete
return $menu;
[5810] Fix | Delete
}
[5811] Fix | Delete
}
[5812] Fix | Delete
/*
[5813] Fix | Delete
* Fetches the logo data
[5814] Fix | Delete
* More details about the fix https://github.com/ahmedkaludi/accelerated-mobile-pages/pull/2317
[5815] Fix | Delete
* Props to: https://github.com/saucal for suggesting the fix.
[5816] Fix | Delete
*/
[5817] Fix | Delete
[5818] Fix | Delete
function ampforwp_default_logo_data() {
[5819] Fix | Delete
global $redux_builder_amp, $ampwforwp_default_logo_data;
[5820] Fix | Delete
[5821] Fix | Delete
if( $ampwforwp_default_logo_data ) {
[5822] Fix | Delete
return $ampwforwp_default_logo_data;
[5823] Fix | Delete
}
[5824] Fix | Delete
[5825] Fix | Delete
$logo_id = '';
[5826] Fix | Delete
$image = array();
[5827] Fix | Delete
$value = '';
[5828] Fix | Delete
$logo_alt = '';
[5829] Fix | Delete
[5830] Fix | Delete
$logo_id = get_theme_mod( 'custom_logo' );
[5831] Fix | Delete
if(isset($redux_builder_amp['opt-media']['id']) && empty( $logo_id ) ) {
[5832] Fix | Delete
$logo_id = (integer) $redux_builder_amp['opt-media']['id'];
[5833] Fix | Delete
}
[5834] Fix | Delete
[5835] Fix | Delete
if( empty( $logo_id ) ) {
[5836] Fix | Delete
return false;
[5837] Fix | Delete
}
[5838] Fix | Delete
[5839] Fix | Delete
if( ! wp_attachment_is( 'image', $logo_id ) || ampforwp_get_setting('opt-media','url') ) {
[5840] Fix | Delete
$logo_url = ampforwp_get_setting('opt-media','url');
[5841] Fix | Delete
$image[0] = ampforwp_get_setting('opt-media','width');
[5842] Fix | Delete
$image[1] = ampforwp_get_setting('opt-media','height');
[5843] Fix | Delete
if(empty($image)){
[5844] Fix | Delete
$image = @getimagesize( $logo_url );
[5845] Fix | Delete
}
[5846] Fix | Delete
if ( empty($image[0]) || empty($image[1]) ) {
[5847] Fix | Delete
$image[0] = '190';
[5848] Fix | Delete
$image[1] = '36';
[5849] Fix | Delete
}
[5850] Fix | Delete
} else {
[5851] Fix | Delete
$imageDetail = wp_get_attachment_image_src( $logo_id , 'full');
[5852] Fix | Delete
$logo_url = $imageDetail[0];
[5853] Fix | Delete
$image[0] = $imageDetail[1];
[5854] Fix | Delete
$image[1] = $imageDetail[2];
[5855] Fix | Delete
if ( 0 === $image[1] ) {
[5856] Fix | Delete
$image[0] = '190';
[5857] Fix | Delete
$image[1] = '36';
[5858] Fix | Delete
}
[5859] Fix | Delete
}
[5860] Fix | Delete
[5861] Fix | Delete
$logo_alt = get_post_meta( $logo_id, '_wp_attachment_image_alt', true);
[5862] Fix | Delete
[5863] Fix | Delete
$ampwforwp_default_logo_data = array(
[5864] Fix | Delete
'logo_id' => $logo_id,
[5865] Fix | Delete
'logo_url' => $logo_url,
[5866] Fix | Delete
'logo_alt' => $logo_alt,
[5867] Fix | Delete
'logo_size' => $image
[5868] Fix | Delete
);
[5869] Fix | Delete
return $ampwforwp_default_logo_data;
[5870] Fix | Delete
}
[5871] Fix | Delete
[5872] Fix | Delete
// 101. Function for Logo attributes
[5873] Fix | Delete
function ampforwp_default_logo($param=""){
[5874] Fix | Delete
global $redux_builder_amp;
[5875] Fix | Delete
$value = '';
[5876] Fix | Delete
$data = ampforwp_default_logo_data();
[5877] Fix | Delete
if( ! $data ) {
[5878] Fix | Delete
if($param!="width" && $param!="height"){
[5879] Fix | Delete
return $value;
[5880] Fix | Delete
}
[5881] Fix | Delete
}
[5882] Fix | Delete
[5883] Fix | Delete
switch ($param) {
[5884] Fix | Delete
case 'url':
[5885] Fix | Delete
$value = $data['logo_url'];
[5886] Fix | Delete
break;
[5887] Fix | Delete
case 'width':
[5888] Fix | Delete
if (true == ampforwp_get_setting('ampforwp-custom-logo-dimensions') && 'prescribed' ==ampforwp_get_setting('ampforwp-custom-logo-dimensions-options')) {
[5889] Fix | Delete
$value = trim(ampforwp_get_setting('opt-media-width'));
[5890] Fix | Delete
if($value==""){
[5891] Fix | Delete
$value = 190;
[5892] Fix | Delete
}
[5893] Fix | Delete
}
[5894] Fix | Delete
else
[5895] Fix | Delete
$value = '';
[5896] Fix | Delete
if(isset($data['logo_size'][0])){
[5897] Fix | Delete
$value = $data['logo_size'][0];
[5898] Fix | Delete
}
[5899] Fix | Delete
if($value==""){
[5900] Fix | Delete
$value = 190;
[5901] Fix | Delete
}
[5902] Fix | Delete
break;
[5903] Fix | Delete
case 'height':
[5904] Fix | Delete
if (true == ampforwp_get_setting('ampforwp-custom-logo-dimensions') && 'prescribed' == ampforwp_get_setting('ampforwp-custom-logo-dimensions-options')) {
[5905] Fix | Delete
$value = trim(ampforwp_get_setting('opt-media-height'));
[5906] Fix | Delete
if($value==""){
[5907] Fix | Delete
$value = 36;
[5908] Fix | Delete
}
[5909] Fix | Delete
}
[5910] Fix | Delete
else
[5911] Fix | Delete
$value = '';
[5912] Fix | Delete
if(isset($data['logo_size'][1])){
[5913] Fix | Delete
$value = $data['logo_size'][1];
[5914] Fix | Delete
}
[5915] Fix | Delete
if($value==""){
[5916] Fix | Delete
$value = 36;
[5917] Fix | Delete
}
[5918] Fix | Delete
break;
[5919] Fix | Delete
case 'alt':
[5920] Fix | Delete
if(isset($data['logo_alt'][0])){
[5921] Fix | Delete
$value = $data['logo_alt'];
[5922] Fix | Delete
}
[5923] Fix | Delete
else
[5924] Fix | Delete
$value = get_bloginfo('name');
[5925] Fix | Delete
break;
[5926] Fix | Delete
default:
[5927] Fix | Delete
$value = $data['logo_url'];
[5928] Fix | Delete
break;
[5929] Fix | Delete
}
[5930] Fix | Delete
[5931] Fix | Delete
return $value;
[5932] Fix | Delete
}
[5933] Fix | Delete
// Envira Lazy Load compatibility
[5934] Fix | Delete
add_filter('envira_gallery_pre_data', 'ampforwp_envira_lazy_load');
[5935] Fix | Delete
if( ! function_exists(' ampforwp_envira_lazy_load ') ){
[5936] Fix | Delete
function ampforwp_envira_lazy_load($data){
[5937] Fix | Delete
if( function_exists('ampforwp_is_amp_endpoint') && ampforwp_is_amp_endpoint() ){
[5938] Fix | Delete
if(function_exists('envira_get_config')){
[5939] Fix | Delete
$checker = envira_get_config( 'lazy_loading', $data);
[5940] Fix | Delete
if( 1 === $checker){
[5941] Fix | Delete
$data['config']['lazy_loading'] = 0;
[5942] Fix | Delete
}
[5943] Fix | Delete
}
[5944] Fix | Delete
}
[5945] Fix | Delete
return $data;
[5946] Fix | Delete
}
[5947] Fix | Delete
}
[5948] Fix | Delete
[5949] Fix | Delete
#1581 Instagram Sanitizer
[5950] Fix | Delete
[5951] Fix | Delete
add_filter( 'amp_content_sanitizers', 'ampforwp_instagram_sanitizer', 10, 1 );
[5952] Fix | Delete
[5953] Fix | Delete
function ampforwp_instagram_sanitizer( $sanitizer_classes ) {
[5954] Fix | Delete
require_once( AMPFORWP_PLUGIN_DIR. 'classes/class-ampforwp-instagram-sanitizer.php' );
[5955] Fix | Delete
$sanitizer_classes[ 'AMPFORWP_Instagram_Embed_Sanitizer' ] = array();
[5956] Fix | Delete
return $sanitizer_classes;
[5957] Fix | Delete
}
[5958] Fix | Delete
[5959] Fix | Delete
// Allowed Tags
[5960] Fix | Delete
if ( ! function_exists('ampforwp_allowed_tags') ) {
[5961] Fix | Delete
function ampforwp_allowed_tags() {
[5962] Fix | Delete
$allowed_tags = '';
[5963] Fix | Delete
$allowed_tags = wp_kses_allowed_html('post');
[5964] Fix | Delete
$allowed_tags['a']['itemprop'] = true;
[5965] Fix | Delete
$allowed_tags['span']['itemprop'] = true;
[5966] Fix | Delete
[5967] Fix | Delete
return $allowed_tags;
[5968] Fix | Delete
}
[5969] Fix | Delete
}
[5970] Fix | Delete
[5971] Fix | Delete
// List of Subpages/Childpages on Pages
[5972] Fix | Delete
add_action('ampforwp_after_post_content', 'ampforwp_list_subpages');
[5973] Fix | Delete
if ( ! function_exists('ampforwp_list_subpages') ) {
[5974] Fix | Delete
function ampforwp_list_subpages() {
[5975] Fix | Delete
if (class_exists('AddWidgetAfterContent')) {
[5976] Fix | Delete
$sanitized_output = '';
[5977] Fix | Delete
$sanitized_output = ampforwp_sidebar_content_sanitizer('add-widget-after-content');
[5978] Fix | Delete
if ( $sanitized_output) {
[5979] Fix | Delete
$sanitized_output = $sanitized_output->get_amp_content();?>
[5980] Fix | Delete
<div class="amp-add-widget-after-content">
[5981] Fix | Delete
<?php echo do_shortcode($sanitized_output); ?>
[5982] Fix | Delete
</div>
[5983] Fix | Delete
<?php }
[5984] Fix | Delete
}
[5985] Fix | Delete
global $post, $redux_builder_amp;
[5986] Fix | Delete
if ( is_page() && true == $redux_builder_amp['ampforwp_subpages_list'] ) {
[5987] Fix | Delete
$pages = '';
[5988] Fix | Delete
$pages = wp_list_pages( array(
[5989] Fix | Delete
'echo' => 0,
[5990] Fix | Delete
'child_of' => $post->ID,
[5991] Fix | Delete
'title_li' => '',
[5992] Fix | Delete
) );
[5993] Fix | Delete
$pages = preg_replace('/href="(.*?)"/', 'href="$1/amp/"', $pages);
[5994] Fix | Delete
echo wp_kses($pages, ampforwp_allowed_tags());
[5995] Fix | Delete
}
[5996] Fix | Delete
}
[5997] Fix | Delete
}
[5998] Fix | Delete
[5999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function