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
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/accelera.../componen...
File: components-core.php
<?php
[0] Fix | Delete
use AMPforWP\AMPVendor\AMP_Post_Template;
[1] Fix | Delete
use AMPforWP\AMPVendor\AMP_HTML_Utils;
[2] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[3] Fix | Delete
exit;
[4] Fix | Delete
}
[5] Fix | Delete
global $redux_builder_amp;
[6] Fix | Delete
$ampforwpTemplate = '';
[7] Fix | Delete
$loadComponent = array();
[8] Fix | Delete
$scriptComponent = array();
[9] Fix | Delete
$search_found = false;
[10] Fix | Delete
$supportComponent = array('AMP-search','AMP-menu','AMP-alter-menu','AMP-logo','AMP-social-icons','AMP-sidebar','AMP-featured-image','AMP-author-box','AMP-loop','AMP-categories-tags','AMP-comments','AMP-post-navigation','AMP-related-posts','AMP-post-pagination','AMP-call-now', 'AMP-breadcrumb','AMP-gdpr', 'AMP-google-font', 'AMP-google-font');
[11] Fix | Delete
[12] Fix | Delete
add_filter( 'amp_post_template_data', 'ampforwp_framework_add_and_form_scripts',20);
[13] Fix | Delete
function ampforwp_framework_add_and_form_scripts($data) {
[14] Fix | Delete
global $scriptComponent, $loadComponent;
[15] Fix | Delete
[16] Fix | Delete
if(count($scriptComponent)>0){
[17] Fix | Delete
foreach ($scriptComponent as $key => $value) {
[18] Fix | Delete
if ( empty( $data['amp_component_scripts'][$key] ) ) {
[19] Fix | Delete
$data['amp_component_scripts'][$key] = $value;
[20] Fix | Delete
}
[21] Fix | Delete
}
[22] Fix | Delete
}
[23] Fix | Delete
return $data;
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
//Component Loader
[27] Fix | Delete
function add_amp_theme_support($componentName){
[28] Fix | Delete
global $wpdb;
[29] Fix | Delete
global $loadComponent,$supportComponent;
[30] Fix | Delete
if($supportComponent){
[31] Fix | Delete
if(in_array($componentName, $supportComponent)){
[32] Fix | Delete
$loadComponent[$componentName] = true;
[33] Fix | Delete
ampforwp_loadComponents($componentName);
[34] Fix | Delete
return true;
[35] Fix | Delete
}
[36] Fix | Delete
}
[37] Fix | Delete
return false;
[38] Fix | Delete
}
[39] Fix | Delete
//Include the Component file
[40] Fix | Delete
function ampforwp_loadComponents($componentName){
[41] Fix | Delete
global $wpdb;
[42] Fix | Delete
if(empty($componentName)) return '';
[43] Fix | Delete
$componentName = str_replace("AMP-", "", $componentName);
[44] Fix | Delete
[45] Fix | Delete
$file = AMP_FRAMEWORK_COMOPNENT_DIR_PATH.'/'.esc_attr($componentName).'/'.esc_attr($componentName).".php";
[46] Fix | Delete
if(!file_exists($file)){
[47] Fix | Delete
return '';
[48] Fix | Delete
}
[49] Fix | Delete
include_once( esc_attr($file));
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
// Icons
[53] Fix | Delete
$amp_icons_css = array();
[54] Fix | Delete
function add_amp_icon($args=array()){
[55] Fix | Delete
global $amp_icons_css, $redux_builder_amp;
[56] Fix | Delete
$amp_icons_css_array = include AMPFORWP_PLUGIN_DIR .'includes/icons/amp-icons.php';
[57] Fix | Delete
foreach ($args as $key ) {
[58] Fix | Delete
if(isset($amp_icons_css_array[$key]))
[59] Fix | Delete
$amp_icons_css[$key] = $amp_icons_css_array[$key];
[60] Fix | Delete
}
[61] Fix | Delete
// Design-1,2,3
[62] Fix | Delete
if ( 1 == $redux_builder_amp['amp-design-selector'] || 2 == $redux_builder_amp['amp-design-selector'] || 3 == $redux_builder_amp['amp-design-selector'] ) {
[63] Fix | Delete
add_action('amp_post_template_css', 'amp_icon_css',999);
[64] Fix | Delete
[65] Fix | Delete
}
[66] Fix | Delete
else
[67] Fix | Delete
add_action('amp_css', 'amp_icon_css');
[68] Fix | Delete
[69] Fix | Delete
}
[70] Fix | Delete
function amp_icon_css(){
[71] Fix | Delete
global $amp_icons_css, $redux_builder_amp;
[72] Fix | Delete
foreach ($amp_icons_css as $key => $value) {
[73] Fix | Delete
// TODO: https://github.com/ahmedkaludi/accelerated-mobile-pages/issues/2651
[74] Fix | Delete
echo $value;
[75] Fix | Delete
}
[76] Fix | Delete
$icon_url = plugin_dir_url(__FILE__);
[77] Fix | Delete
$icon_url = ampforwp_font_url($icon_url);
[78] Fix | Delete
// Add @font-face for Design-1,2,3
[79] Fix | Delete
if ( 1 == $redux_builder_amp['amp-design-selector'] || 2 == $redux_builder_amp['amp-design-selector'] || 3 == $redux_builder_amp['amp-design-selector'] ) { ?>
[80] Fix | Delete
@font-face {font-family: 'icomoon';font-style: normal;font-weight: normal;font-display: swap;src: local('icomoon'), local('icomoon'), url('<?php echo esc_url($icon_url) ?>icomoon/icomoon.ttf');}
[81] Fix | Delete
[class^="icon-"], [class*=" icon-"] {font-family: 'icomoon';speak: none;font-style: normal;font-weight: normal;font-variant: normal;text-transform: none;line-height: 1;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}
[82] Fix | Delete
<?php }
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
/**
[86] Fix | Delete
* Component Functions
[87] Fix | Delete
**/
[88] Fix | Delete
[89] Fix | Delete
//Search Component Utilities
[90] Fix | Delete
function amp_search(){
[91] Fix | Delete
global $loadComponent;
[92] Fix | Delete
if(isset($loadComponent['AMP-search']) && $loadComponent['AMP-search']==true){
[93] Fix | Delete
ampforwp_framework_get_search_form();
[94] Fix | Delete
}
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
// Logo Component Utilitis
[98] Fix | Delete
function amp_logo(){
[99] Fix | Delete
global $loadComponent;
[100] Fix | Delete
if(isset($loadComponent['AMP-logo']) && $loadComponent['AMP-logo']==true){
[101] Fix | Delete
ampforwp_framework_get_logo();
[102] Fix | Delete
}
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
// Title
[106] Fix | Delete
function amp_title(){
[107] Fix | Delete
global $post;
[108] Fix | Delete
$ID = ampforwp_get_the_ID();
[109] Fix | Delete
if ( ampforwp_polylang_front_page() ) {
[110] Fix | Delete
$ID = pll_get_post(get_option('page_on_front'));
[111] Fix | Delete
}
[112] Fix | Delete
elseif( ampforwp_is_front_page() && ampforwp_get_setting('ampforwp-title-on-front-page') == false) {
[113] Fix | Delete
$ID = null;
[114] Fix | Delete
}
[115] Fix | Delete
if( $ID!=null ){
[116] Fix | Delete
do_action('ampforwp_above_the_title');
[117] Fix | Delete
$ampforwp_title = get_the_title($ID);
[118] Fix | Delete
$ampforwp_title = apply_filters('ampforwp_filter_single_title', $ampforwp_title);
[119] Fix | Delete
if(!empty($ampforwp_title)){
[120] Fix | Delete
$title_tag = '<h1 class="amp-post-title">' . wp_kses_data( $ampforwp_title ) . '</h1>';
[121] Fix | Delete
}
[122] Fix | Delete
$title_tag = apply_filters('ampforwp_modify_title_tag',$title_tag,$ampforwp_title);
[123] Fix | Delete
echo $title_tag; // Escaped above
[124] Fix | Delete
do_action('ampforwp_below_the_title');
[125] Fix | Delete
}
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
// Excerpt
[129] Fix | Delete
function amp_excerpt( $no_of_words=260 ) {
[130] Fix | Delete
global $post;
[131] Fix | Delete
$post_id = $content = '';
[132] Fix | Delete
$no_of_words = (int) $no_of_words;
[133] Fix | Delete
$post_id = ampforwp_get_the_ID();
[134] Fix | Delete
if ( $post_id != null && true == ampforwp_get_setting('enable-excerpt-single') ) { ?>
[135] Fix | Delete
<p><?php
[136] Fix | Delete
if ( has_excerpt() ) {
[137] Fix | Delete
$content = get_the_excerpt();
[138] Fix | Delete
}
[139] Fix | Delete
/*
[140] Fix | Delete
Encoding $content as HTML entities, then trimming it to a certain number of words, decoding it back from HTML entities, and finally ensuring that all HTML tags are properly balanced.
[141] Fix | Delete
We are doing this since the excerpt may contain HTML tags and wp_trim_words strips all HTML tags.
[142] Fix | Delete
*/
[143] Fix | Delete
echo force_balance_tags( html_entity_decode( wp_trim_words( htmlentities( $content ), $no_of_words) ) );
[144] Fix | Delete
?></p><?php
[145] Fix | Delete
}
[146] Fix | Delete
}
[147] Fix | Delete
[148] Fix | Delete
[149] Fix | Delete
//Menus
[150] Fix | Delete
function amp_menu($echo=true, $menu_args=array(), $type='header'){
[151] Fix | Delete
if ( ($type == 'header' && ! has_nav_menu( 'amp-menu' )) || ( 'footer' == $type && ! has_nav_menu( 'amp-footer-menu' ) ) ) {
[152] Fix | Delete
return false;
[153] Fix | Delete
}
[154] Fix | Delete
global $loadComponent;
[155] Fix | Delete
if(isset($loadComponent['AMP-menu']) && $loadComponent['AMP-menu']==true){
[156] Fix | Delete
$amp_menu = "";
[157] Fix | Delete
$header_menu = get_transient('ampforwp_header_menu');
[158] Fix | Delete
$footer_menu = get_transient('ampforwp_footer_menu');
[159] Fix | Delete
if ( 'header' == $type && false != $header_menu ){
[160] Fix | Delete
$amp_menu = $header_menu;
[161] Fix | Delete
}
[162] Fix | Delete
elseif ('footer' == $type && false != $footer_menu) {
[163] Fix | Delete
$amp_menu = $footer_menu;
[164] Fix | Delete
}
[165] Fix | Delete
else{
[166] Fix | Delete
$amp_menu = amp_menu_html($echo, $menu_args, $type);
[167] Fix | Delete
}
[168] Fix | Delete
if ( false == $echo ) {
[169] Fix | Delete
return $amp_menu;
[170] Fix | Delete
}
[171] Fix | Delete
else
[172] Fix | Delete
echo $amp_menu; // escaped above
[173] Fix | Delete
}
[174] Fix | Delete
}
[175] Fix | Delete
// Alternative Menus
[176] Fix | Delete
function amp_alter_menu($echo=true){
[177] Fix | Delete
global $loadComponent;
[178] Fix | Delete
if ( ! has_nav_menu('amp-alternative-menu') ) {
[179] Fix | Delete
return false;
[180] Fix | Delete
}
[181] Fix | Delete
if(isset($loadComponent['AMP-alter-menu']) && $loadComponent['AMP-alter-menu']==true){
[182] Fix | Delete
if ( false == $echo ) {
[183] Fix | Delete
return amp_menu_html($echo, array(),'amp-alternative-menu');
[184] Fix | Delete
}
[185] Fix | Delete
else
[186] Fix | Delete
echo amp_menu_html($echo, array(), 'amp-alternative-menu');
[187] Fix | Delete
}
[188] Fix | Delete
}
[189] Fix | Delete
[190] Fix | Delete
// Social Icons component
[191] Fix | Delete
function amp_social( $social_icons="" ) {
[192] Fix | Delete
global $loadComponent;
[193] Fix | Delete
$amp_social = array();
[194] Fix | Delete
//Supported social icons
[195] Fix | Delete
$amp_social = array( 'twitter', 'facebook', 'pinterest', 'google-plus', 'linkedin', 'youtube', 'instagram', 'reddit', 'VKontakte', 'Odnoklassniki', 'snapchat', 'tumblr' );
[196] Fix | Delete
if ( isset($loadComponent['AMP-social-icons']) && true == $loadComponent['AMP-social-icons'] ) {
[197] Fix | Delete
if ( null != $social_icons ) {
[198] Fix | Delete
ampforwp_framework_get_social_icons($social_icons);
[199] Fix | Delete
}
[200] Fix | Delete
else
[201] Fix | Delete
ampforwp_framework_get_social_icons($amp_social);
[202] Fix | Delete
}
[203] Fix | Delete
}
[204] Fix | Delete
[205] Fix | Delete
//Sidebar
[206] Fix | Delete
function amp_sidebar($tag='start',$data=array()){
[207] Fix | Delete
global $loadComponent;
[208] Fix | Delete
if(isset($loadComponent['AMP-sidebar']) && $loadComponent['AMP-sidebar']==true){
[209] Fix | Delete
ampforwp_framework_get_sideabr($tag,$data);
[210] Fix | Delete
}
[211] Fix | Delete
}
[212] Fix | Delete
[213] Fix | Delete
//Featured Image
[214] Fix | Delete
function amp_featured_image( ){
[215] Fix | Delete
global $loadComponent;
[216] Fix | Delete
if(isset($loadComponent['AMP-featured-image']) && $loadComponent['AMP-featured-image']==true){
[217] Fix | Delete
ampforwp_framework_get_featured_image( );
[218] Fix | Delete
}
[219] Fix | Delete
}
[220] Fix | Delete
[221] Fix | Delete
// Author Box
[222] Fix | Delete
function amp_author_box($args=array() ){
[223] Fix | Delete
global $loadComponent;
[224] Fix | Delete
if(isset($loadComponent['AMP-author-box']) && $loadComponent['AMP-author-box']==true){
[225] Fix | Delete
ampforwp_framework_get_author_box($args);
[226] Fix | Delete
}
[227] Fix | Delete
}
[228] Fix | Delete
[229] Fix | Delete
// Categories List
[230] Fix | Delete
function amp_categories_list( $separator = '' ){
[231] Fix | Delete
global $loadComponent;
[232] Fix | Delete
if(isset($loadComponent['AMP-categories-tags']) && $loadComponent['AMP-categories-tags']==true){
[233] Fix | Delete
ampforwp_framework_get_categories_list( $separator );
[234] Fix | Delete
}
[235] Fix | Delete
}
[236] Fix | Delete
// Tags List
[237] Fix | Delete
function amp_tags_list( $separator = '' ){
[238] Fix | Delete
global $loadComponent;
[239] Fix | Delete
if(isset($loadComponent['AMP-categories-tags']) && $loadComponent['AMP-categories-tags']==true){
[240] Fix | Delete
ampforwp_framework_get_tags_list( $separator );
[241] Fix | Delete
}
[242] Fix | Delete
}
[243] Fix | Delete
[244] Fix | Delete
// Comments
[245] Fix | Delete
function amp_comments( ){
[246] Fix | Delete
global $loadComponent;
[247] Fix | Delete
if(isset($loadComponent['AMP-comments']) && $loadComponent['AMP-comments']==true){
[248] Fix | Delete
ampforwp_framework_get_comments( );
[249] Fix | Delete
}
[250] Fix | Delete
}
[251] Fix | Delete
[252] Fix | Delete
// Post Navigation
[253] Fix | Delete
function amp_post_navigation( ){
[254] Fix | Delete
global $loadComponent;
[255] Fix | Delete
if(isset($loadComponent['AMP-post-navigation']) && $loadComponent['AMP-post-navigation']==true){
[256] Fix | Delete
echo ampforwp_framework_get_post_navigation();
[257] Fix | Delete
}
[258] Fix | Delete
}
[259] Fix | Delete
[260] Fix | Delete
// Related Posts
[261] Fix | Delete
function amp_related_posts($argsdata = array()){
[262] Fix | Delete
global $loadComponent;
[263] Fix | Delete
if(isset($loadComponent['AMP-related-posts']) && $loadComponent['AMP-related-posts']==true){
[264] Fix | Delete
echo ampforwp_framework_get_related_posts( $argsdata);
[265] Fix | Delete
}
[266] Fix | Delete
}
[267] Fix | Delete
[268] Fix | Delete
// Post Pagination
[269] Fix | Delete
function amp_post_pagination($args='' ){
[270] Fix | Delete
global $loadComponent;
[271] Fix | Delete
if(isset($loadComponent['AMP-post-pagination']) && $loadComponent['AMP-post-pagination']==true){
[272] Fix | Delete
ampforwp_framework_get_post_pagination($args);
[273] Fix | Delete
}
[274] Fix | Delete
}
[275] Fix | Delete
[276] Fix | Delete
// Breadcrumb
[277] Fix | Delete
function amp_breadcrumb(){
[278] Fix | Delete
global $loadComponent;
[279] Fix | Delete
if ( isset($loadComponent['AMP-breadcrumb']) && true == $loadComponent['AMP-breadcrumb'] ) {
[280] Fix | Delete
echo amp_breadcrumb_output();
[281] Fix | Delete
}
[282] Fix | Delete
}
[283] Fix | Delete
[284] Fix | Delete
// GDPR component
[285] Fix | Delete
function amp_gdpr(){
[286] Fix | Delete
global $loadComponent;
[287] Fix | Delete
$gdpr = apply_filters('ampforwp_on_off_gdpr', true);
[288] Fix | Delete
if ( isset($loadComponent['AMP-gdpr']) && true == $loadComponent['AMP-gdpr'] && $gdpr) {
[289] Fix | Delete
echo amp_gdpr_output();
[290] Fix | Delete
}
[291] Fix | Delete
}
[292] Fix | Delete
[293] Fix | Delete
//Get Core of AMP HTML
[294] Fix | Delete
function amp_header_core(){
[295] Fix | Delete
global $ampforwpTemplate;
[296] Fix | Delete
$post_id = ampforwp_get_the_ID();
[297] Fix | Delete
if ( ampforwp_polylang_front_page() ) {
[298] Fix | Delete
$post_id = pll_get_post(get_option('page_on_front'));
[299] Fix | Delete
}
[300] Fix | Delete
$thisTemplate = $ampforwpTemplate;
[301] Fix | Delete
$html_tag_attributes = AMP_HTML_Utils::build_attributes_string( $thisTemplate->get( 'html_tag_attributes' ) );
[302] Fix | Delete
[303] Fix | Delete
$bodyClass = '';
[304] Fix | Delete
if ( is_single() || is_page() ) {
[305] Fix | Delete
$bodyClass = 'single-post';
[306] Fix | Delete
$bodyClass .= ( is_page()? ' amp-single-page ' : ' amp-single ');
[307] Fix | Delete
[308] Fix | Delete
}
[309] Fix | Delete
// Archive
[310] Fix | Delete
if ( is_archive() ) {
[311] Fix | Delete
$bodyClass = 'amp-archive';
[312] Fix | Delete
}
[313] Fix | Delete
$ampforwp_custom_post_page = ampforwp_custom_post_page();
[314] Fix | Delete
[315] Fix | Delete
add_action('amp_post_template_head','ampforwp_sanitize_archive_desc');
[316] Fix | Delete
if ( !function_exists('ampforwp_sanitize_archive_desc') ) {
[317] Fix | Delete
function ampforwp_sanitize_archive_desc(){
[318] Fix | Delete
$description = get_the_archive_description();
[319] Fix | Delete
if ($description) {
[320] Fix | Delete
$sanitizer = new AMPFORWP_Content( $description, array(),
[321] Fix | Delete
apply_filters( 'ampforwp_content_sanitizers',
[322] Fix | Delete
array(
[323] Fix | Delete
'AMP_Style_Sanitizer' => array(),
[324] Fix | Delete
'AMP_Blacklist_Sanitizer' => array(),
[325] Fix | Delete
'AMP_Img_Sanitizer' => array(),
[326] Fix | Delete
'AMP_Video_Sanitizer' => array(),
[327] Fix | Delete
'AMP_Audio_Sanitizer' => array(),
[328] Fix | Delete
'AMP_Iframe_Sanitizer' => array(
[329] Fix | Delete
'add_placeholder' => true,
[330] Fix | Delete
)
[331] Fix | Delete
) ) );
[332] Fix | Delete
[333] Fix | Delete
$amp_component_scripts = $sanitizer->amp_scripts;
[334] Fix | Delete
[335] Fix | Delete
if ( $sanitizer && $amp_component_scripts) {
[336] Fix | Delete
foreach ($amp_component_scripts as $ampforwp_service => $ampforwp_js_file) { ?>
[337] Fix | Delete
<script custom-element="<?php echo esc_attr($ampforwp_service); ?>" src="<?php echo esc_url($ampforwp_js_file); ?>" async></script> <?php
[338] Fix | Delete
}
[339] Fix | Delete
}
[340] Fix | Delete
}
[341] Fix | Delete
}
[342] Fix | Delete
}
[343] Fix | Delete
// Homepage
[344] Fix | Delete
if ( is_home() ) {
[345] Fix | Delete
[346] Fix | Delete
$bodyClass = 'amp-index amp-home'.esc_attr( $thisTemplate->get( 'body_class' ) );
[347] Fix | Delete
if (ampforwp_get_setting('amp-frontpage-select-option') == 1) {
[348] Fix | Delete
$bodyClass = 'single-post design_3_wrapper';
[349] Fix | Delete
}
[350] Fix | Delete
if ( $ampforwp_custom_post_page == "page" && ampforwp_name_blog_page() ) {
[351] Fix | Delete
$current_url = home_url( $GLOBALS['wp']->request );
[352] Fix | Delete
$current_url_in_pieces = explode( '/', $current_url );
[353] Fix | Delete
[354] Fix | Delete
if( in_array( ampforwp_name_blog_page() , $current_url_in_pieces ) ) {
[355] Fix | Delete
$bodyClass = 'amp-index' .esc_attr( $thisTemplate->get( 'body_class' ) );
[356] Fix | Delete
}
[357] Fix | Delete
}
[358] Fix | Delete
[359] Fix | Delete
}
[360] Fix | Delete
// is_search
[361] Fix | Delete
if ( is_search() ) {
[362] Fix | Delete
$bodyClass = 'amp_home_body archives_body design_3_wrapper';
[363] Fix | Delete
}
[364] Fix | Delete
if( true == ampforwp_get_setting('amp-rtl-select-option') ){
[365] Fix | Delete
$bodyClass .= ' rtl ';
[366] Fix | Delete
}
[367] Fix | Delete
$lightbox = '';
[368] Fix | Delete
if( false == ampforwp_get_setting('ampforwp-amp-img-lightbox') ){
[369] Fix | Delete
$lightbox = 'data-amp-auto-lightbox-disable';
[370] Fix | Delete
}
[371] Fix | Delete
?><!doctype html>
[372] Fix | Delete
<html <?php echo esc_attr(ampforwp_amp_nonamp_convert('amp ')); ?><?php echo AMP_HTML_Utils::build_attributes_string( $thisTemplate->get( 'html_tag_attributes' ) ); ?>>
[373] Fix | Delete
<head>
[374] Fix | Delete
<meta charset="utf-8">
[375] Fix | Delete
<?php do_action('amp_experiment_meta', $thisTemplate); ?>
[376] Fix | Delete
<link rel="preconnect" href="//cdn.ampproject.org">
[377] Fix | Delete
<?php do_action( 'amp_meta', $thisTemplate ); ?>
[378] Fix | Delete
<?php
[379] Fix | Delete
if(ampforwp_amp_nonamp_convert("", "check")){
[380] Fix | Delete
echo '<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=2,user-scalable=yes">';
[381] Fix | Delete
wp_head();
[382] Fix | Delete
[383] Fix | Delete
}else{
[384] Fix | Delete
if(is_search() && false == ampforwp_get_setting('amp-inspection-tool') && false == ampforwp_get_setting('ampforwp-robots-search-pages')){?>
[385] Fix | Delete
<meta name="robots" content="noindex,nofollow"/>
[386] Fix | Delete
<?php }
[387] Fix | Delete
do_action( 'amp_post_template_head', $thisTemplate );
[388] Fix | Delete
} ?>
[389] Fix | Delete
<style amp-custom>
[390] Fix | Delete
<?php $thisTemplate->load_parts( array( 'style' ) ); ?>
[391] Fix | Delete
<?php do_action( 'amp_post_template_css', $thisTemplate ); ?>
[392] Fix | Delete
<?php do_action( 'amp_css', $thisTemplate ); ?>
[393] Fix | Delete
<?php $custom_css = ampforwp_get_setting('css_editor');
[394] Fix | Delete
if (function_exists('heateor_sss_run') && ampforwp_get_setting('ampforwp_css_tree_shaking') ) {
[395] Fix | Delete
global $wp_filesystem;
[396] Fix | Delete
if(!is_object($wp_filesystem)){
[397] Fix | Delete
require_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php';
[398] Fix | Delete
require_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php';
[399] Fix | Delete
$wp_filesystem = new WP_Filesystem_Direct( array() );
[400] Fix | Delete
}
[401] Fix | Delete
$custom_css .= $wp_filesystem->get_contents(AMPFORWP_PLUGIN_DIR."/includes/sassy-style-optimized.css");
[402] Fix | Delete
}
[403] Fix | Delete
$custom_css = apply_filters('ampforwp_custom_css_output', $custom_css);
[404] Fix | Delete
$custom_css = str_replace(array('.accordion-mod'), array('.apac'), $custom_css);
[405] Fix | Delete
$sanitized_css = ampforwp_sanitize_i_amphtml($custom_css);
[406] Fix | Delete
echo $sanitized_css; // sanitized above ?>
[407] Fix | Delete
</style>
[408] Fix | Delete
<?php do_action('ampforwp_before_head', $thisTemplate); ?>
[409] Fix | Delete
</head>
[410] Fix | Delete
<body <?php echo esc_attr($lightbox); ?> <?php ampforwp_body_class($bodyClass); ?>>
[411] Fix | Delete
<?php do_action('amp_start', $thisTemplate); ?>
[412] Fix | Delete
<?php do_action('ampforwp_admin_menu_bar_front'); ?>
[413] Fix | Delete
<?php do_action('ampforwp_body_beginning', $thisTemplate);
[414] Fix | Delete
}
[415] Fix | Delete
[416] Fix | Delete
function amp_header(){
[417] Fix | Delete
global $ampforwpTemplate;
[418] Fix | Delete
$post_id = ampforwp_get_the_ID();
[419] Fix | Delete
if ( ampforwp_polylang_front_page() ) {
[420] Fix | Delete
$post_id = pll_get_post(get_option('page_on_front'));
[421] Fix | Delete
}
[422] Fix | Delete
$thisTemplate = $ampforwpTemplate;
[423] Fix | Delete
$thisTemplate->load_parts( array( 'header' ) );
[424] Fix | Delete
do_action( 'amp_after_header', $thisTemplate );
[425] Fix | Delete
do_action( 'ampforwp_after_header', $thisTemplate );
[426] Fix | Delete
do_action('ampforwp_post_before_design_elements') ?>
[427] Fix | Delete
<?php }
[428] Fix | Delete
[429] Fix | Delete
function amp_footer(){
[430] Fix | Delete
global $ampforwpTemplate;
[431] Fix | Delete
$post_id = ampforwp_get_the_ID();
[432] Fix | Delete
if ( ampforwp_polylang_front_page() ) {
[433] Fix | Delete
$post_id = pll_get_post(get_option('page_on_front'));
[434] Fix | Delete
}
[435] Fix | Delete
$thisTemplate = $ampforwpTemplate;
[436] Fix | Delete
do_action( 'amp_before_footer', $thisTemplate );
[437] Fix | Delete
do_action( 'amp_post_template_above_footer', $thisTemplate );
[438] Fix | Delete
[439] Fix | Delete
$thisTemplate->load_parts( array( 'footer' ) );
[440] Fix | Delete
[441] Fix | Delete
}
[442] Fix | Delete
[443] Fix | Delete
function amp_footer_core(){
[444] Fix | Delete
global $ampforwpTemplate;
[445] Fix | Delete
$post_id = ampforwp_get_the_ID();
[446] Fix | Delete
if ( ampforwp_polylang_front_page() ) {
[447] Fix | Delete
$post_id = pll_get_post(get_option('page_on_front'));
[448] Fix | Delete
}
[449] Fix | Delete
$thisTemplate = $ampforwpTemplate;
[450] Fix | Delete
if(ampforwp_amp_nonamp_convert("", "check")){
[451] Fix | Delete
wp_footer();
[452] Fix | Delete
}
[453] Fix | Delete
else {
[454] Fix | Delete
do_action( 'amp_post_template_footer', $thisTemplate );
[455] Fix | Delete
do_action('ampforwp_global_after_footer');
[456] Fix | Delete
do_action('amp_end',$thisTemplate);
[457] Fix | Delete
}
[458] Fix | Delete
// Close the body and Html tags ?>
[459] Fix | Delete
</body>
[460] Fix | Delete
</html><?php
[461] Fix | Delete
}
[462] Fix | Delete
[463] Fix | Delete
function amp_non_amp_link(){
[464] Fix | Delete
$allowed_tags = '<p><a><b><strong><i><u><ul><ol><li><h1><h2><h3><h4><h5><h6><table><tr><th><td><em><span>';
[465] Fix | Delete
if (function_exists('pll__')) {
[466] Fix | Delete
echo '<span>' . strip_tags(pll__(ampforwp_get_setting('amp-translator-footer-text'),'All Rights Reserved'),$allowed_tags) . '</span>';
[467] Fix | Delete
}else {
[468] Fix | Delete
echo '<span>' . strip_tags(ampforwp_translation(do_shortcode(ampforwp_get_setting('amp-translator-footer-text')),'All Rights Reserved'),$allowed_tags) . '</span>';
[469] Fix | Delete
}
[470] Fix | Delete
if(ampforwp_get_setting('amp-footer-link-non-amp-page')=='1') { ampforwp_view_nonamp(); }
[471] Fix | Delete
}
[472] Fix | Delete
[473] Fix | Delete
// Back to Top
[474] Fix | Delete
function amp_back_to_top_link(){
[475] Fix | Delete
if(true == ampforwp_get_setting('ampforwp-footer-top')){?>
[476] Fix | Delete
<a id="scrollToTopButton" title="back to top" on="tap:backtotop.scrollTo(duration=500)" class="btt" href="#" ></a>
[477] Fix | Delete
<?php
[478] Fix | Delete
if(ampforwp_get_setting('ampforwp-amp-convert-to-wp') == true){?>
[479] Fix | Delete
<script>
[480] Fix | Delete
var elem = document.getElementById('scrollToTopButton');
[481] Fix | Delete
elem.addEventListener("click", function(){
[482] Fix | Delete
window.scrollTo({
[483] Fix | Delete
top: 0,
[484] Fix | Delete
behavior: 'smooth'
[485] Fix | Delete
});
[486] Fix | Delete
});
[487] Fix | Delete
</script>
[488] Fix | Delete
<?php
[489] Fix | Delete
}
[490] Fix | Delete
}
[491] Fix | Delete
}
[492] Fix | Delete
[493] Fix | Delete
function amp_loop_template(){
[494] Fix | Delete
global $ampforwpTemplate;
[495] Fix | Delete
$post_id = get_queried_object_id();
[496] Fix | Delete
$thisTemplate = $ampforwpTemplate;
[497] Fix | Delete
do_action('amp_before_loop',$thisTemplate);
[498] Fix | Delete
$thisTemplate->load_parts( array( 'loop' ) );
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function