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
}
[7500] Fix | Delete
return $data;
[7501] Fix | Delete
}
[7502] Fix | Delete
[7503] Fix | Delete
// Multiple Images #2259
[7504] Fix | Delete
// Moved to structured-data-functions.php
[7505] Fix | Delete
[7506] Fix | Delete
// schema.org/SiteNavigationElement missing from menus #1229 & #2952
[7507] Fix | Delete
// Moved to structured-data-functions.php
[7508] Fix | Delete
[7509] Fix | Delete
// WP Subtitle Support #2831
[7510] Fix | Delete
add_action('ampforwp_below_the_title','ampforwp_wpsubtitle_support');
[7511] Fix | Delete
if (! function_exists('ampforwp_wpsubtitle_support') ) {
[7512] Fix | Delete
function ampforwp_wpsubtitle_support(){
[7513] Fix | Delete
if(class_exists('WPSubtitle')){?>
[7514] Fix | Delete
<h2 class="amp-wp-content"><?php the_subtitle(); ?></h2>
[7515] Fix | Delete
<?php
[7516] Fix | Delete
}
[7517] Fix | Delete
}
[7518] Fix | Delete
}
[7519] Fix | Delete
[7520] Fix | Delete
// Fallbacks for Vendor AMP #2287
[7521] Fix | Delete
// Class AMP_Base_Sanitizer
[7522] Fix | Delete
if ( ! class_exists('AMP_Base_Sanitizer') && class_exists('AMPforWP\\AMPVendor\\AMP_Base_Sanitizer') ) {
[7523] Fix | Delete
abstract class AMP_Base_Sanitizer extends AMPforWP\AMPVendor\AMP_Base_Sanitizer
[7524] Fix | Delete
{
[7525] Fix | Delete
[7526] Fix | Delete
}
[7527] Fix | Delete
}
[7528] Fix | Delete
// Class AMP_Base_Embed_Handler
[7529] Fix | Delete
if ( ! class_exists('AMP_Base_Embed_Handler') && class_exists('AMPforWP\\AMPVendor\\AMP_Base_Embed_Handler') ) {
[7530] Fix | Delete
abstract class AMP_Base_Embed_Handler extends AMPforWP\AMPVendor\AMP_Base_Embed_Handler
[7531] Fix | Delete
{
[7532] Fix | Delete
}
[7533] Fix | Delete
}
[7534] Fix | Delete
// Class AMP_HTML_Utils
[7535] Fix | Delete
if ( ! class_exists('AMP_HTML_Utils') && class_exists('AMPforWP\\AMPVendor\\AMP_HTML_Utils') ) {
[7536] Fix | Delete
class AMP_HTML_Utils extends AMPforWP\AMPVendor\AMP_HTML_Utils{}
[7537] Fix | Delete
}
[7538] Fix | Delete
// Class AMP_DOM_Utils
[7539] Fix | Delete
if ( ! class_exists('AMP_DOM_Utils') && class_exists('AMPforWP\\AMPVendor\\AMP_DOM_Utils') ) {
[7540] Fix | Delete
class AMP_DOM_Utils extends AMPforWP\AMPVendor\AMP_DOM_Utils{}
[7541] Fix | Delete
}
[7542] Fix | Delete
// Function is_amp_endpoint
[7543] Fix | Delete
add_action('pre_amp_render_post', 'ampforwp_is_amp_endpoint_old');
[7544] Fix | Delete
if ( !function_exists('ampforwp_is_amp_endpoint_old') ) {
[7545] Fix | Delete
function ampforwp_is_amp_endpoint_old(){
[7546] Fix | Delete
if ( !function_exists('amp_activate') && ! function_exists('is_amp_endpoint') ){
[7547] Fix | Delete
function is_amp_endpoint(){
[7548] Fix | Delete
return ampforwp_is_amp_endpoint();
[7549] Fix | Delete
}
[7550] Fix | Delete
}
[7551] Fix | Delete
// Class AMP_Post_Template
[7552] Fix | Delete
if ( ! class_exists('AMP_Post_Template') && class_exists('AMPforWP\\AMPVendor\\AMP_Post_Template') ) {
[7553] Fix | Delete
class AMP_Post_Template extends AMPforWP\AMPVendor\AMP_Post_Template{}
[7554] Fix | Delete
}
[7555] Fix | Delete
}
[7556] Fix | Delete
}
[7557] Fix | Delete
// End Fallbacks for Vendor AMP
[7558] Fix | Delete
[7559] Fix | Delete
// ampforwp_post_template_data filter #2287
[7560] Fix | Delete
add_filter('amp_post_template_data', 'ampforwp_post_template_data');
[7561] Fix | Delete
function ampforwp_post_template_data( $data ) {
[7562] Fix | Delete
// Run through our filter
[7563] Fix | Delete
$data = apply_filters('ampforwp_post_template_data', $data );
[7564] Fix | Delete
return $data;
[7565] Fix | Delete
}
[7566] Fix | Delete
[7567] Fix | Delete
if(false==ampforwp_get_setting('hide-amp-version-from-source')){
[7568] Fix | Delete
add_action('amp_meta','ampforwp_generator');
[7569] Fix | Delete
if ( ! function_exists('ampforwp_generator') ) {
[7570] Fix | Delete
function ampforwp_generator(){
[7571] Fix | Delete
if(true == ampforwp_get_setting('ampforwp-amp-convert-to-wp')){
[7572] Fix | Delete
?>
[7573] Fix | Delete
<meta name="generator" content="AMP for WP <?php echo esc_attr(AMPFORWP_VERSION)?>" />
[7574] Fix | Delete
<?php }
[7575] Fix | Delete
}
[7576] Fix | Delete
}
[7577] Fix | Delete
}
[7578] Fix | Delete
[7579] Fix | Delete
// #2497 Ivory Search Compatibility Added
[7580] Fix | Delete
add_filter('ampforwp_menu_content','ampforwp_modify_ivory_search');
[7581] Fix | Delete
if( ! function_exists(' ampforwp_modify_ivory_search ') ){
[7582] Fix | Delete
function ampforwp_modify_ivory_search($menu){
[7583] Fix | Delete
[7584] Fix | Delete
if(!class_exists('Ivory_Search')){
[7585] Fix | Delete
return $menu;
[7586] Fix | Delete
}
[7587] Fix | Delete
[7588] Fix | Delete
$dom = '';
[7589] Fix | Delete
$nodes = '';
[7590] Fix | Delete
$num_nodes = '';
[7591] Fix | Delete
if( !empty( $menu ) ){
[7592] Fix | Delete
// Create a new document
[7593] Fix | Delete
$dom = new DOMDocument();
[7594] Fix | Delete
if( function_exists( 'mb_convert_encoding' ) ){
[7595] Fix | Delete
$menu = mb_convert_encoding($menu, 'HTML-ENTITIES', 'UTF-8');
[7596] Fix | Delete
}
[7597] Fix | Delete
else{
[7598] Fix | Delete
$menu = preg_replace( '/&.*?;/', 'x', $menu ); // multi-byte characters converted to X
[7599] Fix | Delete
}
[7600] Fix | Delete
// To Suppress Warnings
[7601] Fix | Delete
libxml_use_internal_errors(true);
[7602] Fix | Delete
$dom->loadHTML($menu);
[7603] Fix | Delete
libxml_use_internal_errors(false);
[7604] Fix | Delete
// get all the forms
[7605] Fix | Delete
$nodes = $dom->getElementsByTagName( 'form' );
[7606] Fix | Delete
$num_nodes = $nodes->length;
[7607] Fix | Delete
for ( $i = $num_nodes - 1; $i >= 0; $i-- ) {
[7608] Fix | Delete
$node = $nodes->item( $i );
[7609] Fix | Delete
// Set The Width and Height if there in none
[7610] Fix | Delete
if ( '' === $node->getAttribute( 'target' ) ) {
[7611] Fix | Delete
$node->setAttribute('target', '_top');
[7612] Fix | Delete
}
[7613] Fix | Delete
if ( $node->getAttribute('action')){
[7614] Fix | Delete
$action_url = '';
[7615] Fix | Delete
$action_url = $node->getAttribute('action');
[7616] Fix | Delete
$action_url = preg_replace('#^http?:#', '', $action_url);
[7617] Fix | Delete
$node->setAttribute('action', $action_url);
[7618] Fix | Delete
}
[7619] Fix | Delete
}
[7620] Fix | Delete
$menu = $dom->saveHTML();
[7621] Fix | Delete
}
[7622] Fix | Delete
return $menu;
[7623] Fix | Delete
}
[7624] Fix | Delete
}
[7625] Fix | Delete
add_action('amp_post_template_css','ampforwp_ivory_search_css');
[7626] Fix | Delete
function ampforwp_ivory_search_css(){
[7627] Fix | Delete
if(class_exists('Ivory_Search')){?>
[7628] Fix | Delete
svg.icon.icon-search {
[7629] Fix | Delete
display: none;
[7630] Fix | Delete
}
[7631] Fix | Delete
input.search-field {
[7632] Fix | Delete
display: inline-block;
[7633] Fix | Delete
}
[7634] Fix | Delete
svg.search-icon {
[7635] Fix | Delete
display: none;
[7636] Fix | Delete
}
[7637] Fix | Delete
<?php } }
[7638] Fix | Delete
// Font Awesome Icons added for Swift
[7639] Fix | Delete
add_action('amp_post_template_head', 'ampforwp_fontawesome_canonical_link');
[7640] Fix | Delete
function ampforwp_fontawesome_canonical_link(){
[7641] Fix | Delete
if ( ampforwp_get_setting('ampforwp_font_icon') == 'fontawesome-icons' ){ ?>
[7642] Fix | Delete
<link rel="preconnect dns-prefetch" href="//use.fontawesome.com" crossorigin>
[7643] Fix | Delete
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
[7644] Fix | Delete
<?php }
[7645] Fix | Delete
}
[7646] Fix | Delete
add_action('amp_post_template_head', 'ampforwp_set_dns_preload_urls');
[7647] Fix | Delete
function ampforwp_set_dns_preload_urls(){
[7648] Fix | Delete
// Open graph tag is not loading from the SEO framework #4399
[7649] Fix | Delete
if (function_exists('the_seo_framework') && 'seo_framework' == ampforwp_get_setting('ampforwp-seo-selection')) {
[7650] Fix | Delete
$og_tsf = \the_seo_framework();
[7651] Fix | Delete
if($og_tsf){
[7652] Fix | Delete
echo $og_tsf->og_image();
[7653] Fix | Delete
echo $og_tsf->og_locale();
[7654] Fix | Delete
echo $og_tsf->og_type();
[7655] Fix | Delete
echo $og_tsf->og_title();
[7656] Fix | Delete
echo $og_tsf->og_image();
[7657] Fix | Delete
echo $og_tsf->og_description();
[7658] Fix | Delete
echo $og_tsf->og_sitename();
[7659] Fix | Delete
}
[7660] Fix | Delete
}
[7661] Fix | Delete
[7662] Fix | Delete
$prefetch = ampforwp_get_setting('amp-prefetch-options');
[7663] Fix | Delete
$data_arr = array();
[7664] Fix | Delete
if(is_array($prefetch)){
[7665] Fix | Delete
foreach ( $prefetch as $k => $value ) {
[7666] Fix | Delete
if(is_array($value)){
[7667] Fix | Delete
foreach ($value as $tk => $tval) {
[7668] Fix | Delete
$temp_arr = array();
[7669] Fix | Delete
$temp_arr['name'][] = $k;
[7670] Fix | Delete
$temp_arr['type'][] = $tk;
[7671] Fix | Delete
foreach ($tval as $ck => $cval) {
[7672] Fix | Delete
$temp_arr['value'][] = $cval;
[7673] Fix | Delete
}
[7674] Fix | Delete
$data_arr[] = $temp_arr;
[7675] Fix | Delete
}
[7676] Fix | Delete
}
[7677] Fix | Delete
}
[7678] Fix | Delete
if(isset($data_arr[0]) && !empty($data_arr)){
[7679] Fix | Delete
$val_count = count($data_arr[0]['value']);
[7680] Fix | Delete
for($i=0;$i<$val_count;$i++){
[7681] Fix | Delete
for($j=0;$j<count($data_arr);$j++){
[7682] Fix | Delete
if(isset($data_arr[$j]['value'][$i])){
[7683] Fix | Delete
$key = $data_arr[$j]['value'][$i];
[7684] Fix | Delete
}
[7685] Fix | Delete
if(isset($data_arr[$j+1])){
[7686] Fix | Delete
$key = $data_arr[$j]['value'][$i];
[7687] Fix | Delete
if(isset($data_arr[$j]['value'][$i])){
[7688] Fix | Delete
$value = $data_arr[$j+1]['value'][$i];
[7689] Fix | Delete
}
[7690] Fix | Delete
$type = '';
[7691] Fix | Delete
if (preg_match('/(\.jpg|\.png|\.webp)$/', $value)) {
[7692] Fix | Delete
$type = 'as="image"';
[7693] Fix | Delete
}
[7694] Fix | Delete
if($value!=""){
[7695] Fix | Delete
?>
[7696] Fix | Delete
<link rel="<?php echo esc_attr($key)?>" <?php echo $type; // XXS ok, escaped above ?> href="<?php echo esc_url($value);?>" crossorigin>
[7697] Fix | Delete
<?php
[7698] Fix | Delete
}
[7699] Fix | Delete
}
[7700] Fix | Delete
}
[7701] Fix | Delete
}
[7702] Fix | Delete
}
[7703] Fix | Delete
}
[7704] Fix | Delete
}
[7705] Fix | Delete
// Yoast BreadCrumbs #1473
[7706] Fix | Delete
add_action('pre_amp_render_post', 'ampforwp_yoast_breadcrumbs');
[7707] Fix | Delete
if ( ! function_exists('ampforwp_yoast_breadcrumbs') ) {
[7708] Fix | Delete
function ampforwp_yoast_breadcrumbs(){
[7709] Fix | Delete
if ( ampforwp_get_setting('ampforwp-yoast-bread-crumb') ) {
[7710] Fix | Delete
// Remove the separator of Yoast
[7711] Fix | Delete
add_filter('wpseo_breadcrumb_separator','ampforwp_yoast_breadcrumbs_sep');
[7712] Fix | Delete
function ampforwp_yoast_breadcrumbs_sep($sep) {
[7713] Fix | Delete
$sep = '';
[7714] Fix | Delete
return $sep;
[7715] Fix | Delete
}
[7716] Fix | Delete
// Remove xmlns:v to avoid validation error
[7717] Fix | Delete
add_filter('wpseo_breadcrumb_output','ampforwp_yoast_breadcrumbs_modified_output');
[7718] Fix | Delete
function ampforwp_yoast_breadcrumbs_modified_output($output){
[7719] Fix | Delete
$output = str_replace('xmlns:v="http://rdf.data-vocabulary.org/#"', '', $output);
[7720] Fix | Delete
return $output;
[7721] Fix | Delete
}
[7722] Fix | Delete
// Change the wrapper to div
[7723] Fix | Delete
add_filter('wpseo_breadcrumb_output_wrapper', 'ampforwp_yoast_breadcrumbs_wrapper');
[7724] Fix | Delete
function ampforwp_yoast_breadcrumbs_wrapper($wrap) {
[7725] Fix | Delete
$wrap = 'div';
[7726] Fix | Delete
return $wrap;
[7727] Fix | Delete
}
[7728] Fix | Delete
// Add the Breadcrumbs class to wrapper
[7729] Fix | Delete
add_filter('wpseo_breadcrumb_output_class','ampforwp_yoast_breadcrumbs_wrapper_class');
[7730] Fix | Delete
function ampforwp_yoast_breadcrumbs_wrapper_class($class) {
[7731] Fix | Delete
$class = 'breadcrumbs';
[7732] Fix | Delete
return $class;
[7733] Fix | Delete
}
[7734] Fix | Delete
}
[7735] Fix | Delete
}
[7736] Fix | Delete
}
[7737] Fix | Delete
function ampforwp_yoast_breadcrumbs_output(){
[7738] Fix | Delete
if ( class_exists('WPSEO_Options') && method_exists('WPSEO_Options', 'get') ){
[7739] Fix | Delete
$breadcrumb = '';
[7740] Fix | Delete
if ( true == ampforwp_get_setting('ampforwp-yoast-bread-crumb') && true === WPSEO_Options::get( 'breadcrumbs-enable' ) && function_exists('yoast_breadcrumb')) {
[7741] Fix | Delete
$breadcrumb = yoast_breadcrumb('','', false);
[7742] Fix | Delete
if( true == ampforwp_get_setting('convert-internal-nonamplinks-to-amp') && preg_match('/<a\s+href="(.*?)">(.*?)<\/a>/', $breadcrumb)){
[7743] Fix | Delete
$breadcrumb = preg_replace('/<a\s+href="(.*?)\/">(.*?)<\/a>/', '<a href="$1/'.user_trailingslashit(AMPFORWP_AMP_QUERY_VAR).'">$2</a>', $breadcrumb);
[7744] Fix | Delete
}
[7745] Fix | Delete
return $breadcrumb;
[7746] Fix | Delete
}
[7747] Fix | Delete
}
[7748] Fix | Delete
}
[7749] Fix | Delete
[7750] Fix | Delete
// Slide Anything compatibility #2891
[7751] Fix | Delete
add_filter('amp_content_embed_handlers','ampforwp_slide_anything_embed');
[7752] Fix | Delete
function ampforwp_slide_anything_embed($data) {
[7753] Fix | Delete
if ( function_exists('cpt_slider_plugin_activation') ) {
[7754] Fix | Delete
require_once( AMPFORWP_PLUGIN_DIR. 'classes/class-ampforwp-slide-anything-embed.php' );
[7755] Fix | Delete
$data['AMPFORWP_Slide_Anything_Embed_Handler'] = array();
[7756] Fix | Delete
}
[7757] Fix | Delete
return $data;
[7758] Fix | Delete
}
[7759] Fix | Delete
[7760] Fix | Delete
// Revolution Slider compatibility #1464
[7761] Fix | Delete
add_action('pre_amp_render_post', 'ampforwp_initialise_rev_slider');
[7762] Fix | Delete
if ( ! function_exists('ampforwp_initialise_rev_slider') ) {
[7763] Fix | Delete
function ampforwp_initialise_rev_slider(){
[7764] Fix | Delete
if ( class_exists('RevSliderOutput') ){
[7765] Fix | Delete
require AMPFORWP_PLUGIN_DIR .'/classes/class-ampforwp-rev-slider.php';
[7766] Fix | Delete
}
[7767] Fix | Delete
}
[7768] Fix | Delete
}
[7769] Fix | Delete
add_filter('amp_content_embed_handlers','ampforwp_rev_slider_embed');
[7770] Fix | Delete
function ampforwp_rev_slider_embed($data) {
[7771] Fix | Delete
if ( class_exists('RevSliderOutput') ){
[7772] Fix | Delete
$data['AMP_Rev_Slider_Embed_Handler'] = array();
[7773] Fix | Delete
}
[7774] Fix | Delete
return $data;
[7775] Fix | Delete
}
[7776] Fix | Delete
// Photo Gallery by 10Web Compatibility #1811
[7777] Fix | Delete
add_action('pre_amp_render_post', 'ampforwp_initialise_photo_gallery');
[7778] Fix | Delete
if ( ! function_exists('ampforwp_initialise_photo_gallery') ) {
[7779] Fix | Delete
function ampforwp_initialise_photo_gallery(){
[7780] Fix | Delete
if ( class_exists('BWG') ) {
[7781] Fix | Delete
require AMPFORWP_PLUGIN_DIR .'/classes/class-ampforwp-photo-gallery-embed.php';
[7782] Fix | Delete
}
[7783] Fix | Delete
}
[7784] Fix | Delete
}
[7785] Fix | Delete
add_filter('amp_content_embed_handlers','ampforwp_photo_gallery_embed');
[7786] Fix | Delete
function ampforwp_photo_gallery_embed($data) {
[7787] Fix | Delete
if ( class_exists('BWG') ) {
[7788] Fix | Delete
$data['AMPforWP_Photo_Gallery_Embed_Handler'] = array();
[7789] Fix | Delete
}
[7790] Fix | Delete
return $data;
[7791] Fix | Delete
}
[7792] Fix | Delete
function ampforwp_rel_attributes_social_links(){
[7793] Fix | Delete
$rel_attributes = array();
[7794] Fix | Delete
if (true == ampforwp_get_setting('ampforwp-social-no-follow')) {
[7795] Fix | Delete
$rel_attributes[] = 'nofollow';
[7796] Fix | Delete
}
[7797] Fix | Delete
if (true == ampforwp_get_setting('ampforwp-social-no-referrer')) {
[7798] Fix | Delete
$rel_attributes[] = 'noreferrer';
[7799] Fix | Delete
}
[7800] Fix | Delete
if (true == ampforwp_get_setting('ampforwp-social-no-opener')) {
[7801] Fix | Delete
$rel_attributes[] = 'noopener';
[7802] Fix | Delete
}
[7803] Fix | Delete
$rel_attributes = apply_filters('ampforwp_rel_attributes_social_links', $rel_attributes);
[7804] Fix | Delete
$rel_attributes = array_map('esc_attr', $rel_attributes);
[7805] Fix | Delete
if ( $rel_attributes ) {
[7806] Fix | Delete
echo 'rel="' . implode(" ",$rel_attributes).'"';
[7807] Fix | Delete
}
[7808] Fix | Delete
return;
[7809] Fix | Delete
}
[7810] Fix | Delete
// Fallback added
[7811] Fix | Delete
function ampforwp_nofollow_social_links(){
[7812] Fix | Delete
ampforwp_rel_attributes_social_links();
[7813] Fix | Delete
return ;
[7814] Fix | Delete
}
[7815] Fix | Delete
[7816] Fix | Delete
function ampforwp_nofollow_notification(){
[7817] Fix | Delete
if(true == ampforwp_get_setting('ampforwp-notifications-nofollow')){
[7818] Fix | Delete
echo 'rel=nofollow';
[7819] Fix | Delete
return;
[7820] Fix | Delete
}
[7821] Fix | Delete
return false;
[7822] Fix | Delete
}
[7823] Fix | Delete
// Featured Video SmartMag theme Compatibility CSS #2559
[7824] Fix | Delete
add_action('amp_post_template_css', 'ampforwp_featured_video_plus_css');
[7825] Fix | Delete
function ampforwp_featured_video_plus_css(){
[7826] Fix | Delete
if( function_exists('get_the_post_video') ) {?>
[7827] Fix | Delete
.fvp-onload{display:none}
[7828] Fix | Delete
<?php }
[7829] Fix | Delete
if(class_exists('Bunyad')){ ?>
[7830] Fix | Delete
.amp-featured-image amp-iframe, .amp-wp-article-featured-image amp-iframe { margin:auto; height:100%; }
[7831] Fix | Delete
.f_vid { background: #000; }
[7832] Fix | Delete
<?php }
[7833] Fix | Delete
}
[7834] Fix | Delete
function ampforwp_webp_featured_image() {
[7835] Fix | Delete
$post_id = ampforwp_get_the_ID();
[7836] Fix | Delete
[7837] Fix | Delete
if ( ! has_post_thumbnail( $post_id )) {
[7838] Fix | Delete
return false;
[7839] Fix | Delete
}
[7840] Fix | Delete
[7841] Fix | Delete
$thumb_id = get_post_thumbnail_id($post_id);
[7842] Fix | Delete
$image_size = apply_filters( 'ampforwp_featured_image', 'full' );
[7843] Fix | Delete
$image = wp_get_attachment_image_src( $thumb_id, $image_size );
[7844] Fix | Delete
if( $image ) {
[7845] Fix | Delete
if(empty($image[1])){
[7846] Fix | Delete
$image[1] = 750;
[7847] Fix | Delete
}
[7848] Fix | Delete
if(empty($image[2])){
[7849] Fix | Delete
$image[2] = 500;
[7850] Fix | Delete
}
[7851] Fix | Delete
$thumb_alt = get_post_meta( $thumb_id, '_wp_attachment_image_alt', true);
[7852] Fix | Delete
if($thumb_alt){
[7853] Fix | Delete
$alt = $thumb_alt;
[7854] Fix | Delete
}
[7855] Fix | Delete
else{
[7856] Fix | Delete
$alt = get_the_title( $post_id );
[7857] Fix | Delete
}
[7858] Fix | Delete
$alt = convert_chars( stripslashes( $alt ) );
[7859] Fix | Delete
$image_output = "<amp-img src='".esc_url($image[0])."' width='".esc_attr($image[1])."' height='".esc_attr($image[2])."' layout='responsive' alt='".esc_attr($alt)."' ></amp-img>";?>
[7860] Fix | Delete
<?php
[7861] Fix | Delete
if(1 == ampforwp_get_setting('amp-design-selector') || 2 == ampforwp_get_setting('amp-design-selector') || 3 == ampforwp_get_setting('amp-design-selector')){?>
[7862] Fix | Delete
<figure class="amp-wp-article-featured-image">
[7863] Fix | Delete
<?php echo $image_output; // escaped above
[7864] Fix | Delete
?>
[7865] Fix | Delete
</figure>
[7866] Fix | Delete
<?php }
[7867] Fix | Delete
}
[7868] Fix | Delete
}
[7869] Fix | Delete
[7870] Fix | Delete
// Keep the default WordPress form for AMP #3000
[7871] Fix | Delete
add_filter('get_search_form', 'ampforwp_search_form');
[7872] Fix | Delete
if ( ! function_exists('ampforwp_search_form') ) {
[7873] Fix | Delete
function ampforwp_search_form($form){
[7874] Fix | Delete
if ( ampforwp_is_amp_endpoint() ) {
[7875] Fix | Delete
$placeholder = ampforwp_translation(ampforwp_get_setting('ampforwp-search-placeholder'), 'Type Here' );
[7876] Fix | Delete
if (function_exists('pll__')) {
[7877] Fix | Delete
$placeholder = pll__(esc_html__( ampforwp_get_setting('ampforwp-search-placeholder'), 'accelerated-mobile-pages'));
[7878] Fix | Delete
}
[7879] Fix | Delete
$widgetlabel = ampforwp_translation(ampforwp_get_setting('ampforwp-search-widget-label'), 'Search for:' );
[7880] Fix | Delete
$form = '<form role="search" method="get" id="searchform" class="search-form" action="' . esc_url( home_url( '/' ) ) . '" target="_top">
[7881] Fix | Delete
<label>
[7882] Fix | Delete
<span class="screen-reader-text">' . esc_html__( $widgetlabel, 'accelerated-mobile-pages' ) . '</span>
[7883] Fix | Delete
<input type="text" value="" placeholder="' . esc_html__( $placeholder, 'accelerated-mobile-pages' ) . '" name="s" class="search-field">
[7884] Fix | Delete
</label>
[7885] Fix | Delete
<input type="text" placeholder="' . esc_html__( $placeholder, 'accelerated-mobile-pages' ) . '" value="1" name="amp" class="hide" id="ampforwp_search_query_item">
[7886] Fix | Delete
</form>';
[7887] Fix | Delete
}
[7888] Fix | Delete
return $form;
[7889] Fix | Delete
}
[7890] Fix | Delete
}
[7891] Fix | Delete
[7892] Fix | Delete
//Saving all taxonomies in Transient
[7893] Fix | Delete
add_action('init','ampforwp_generate_taxonomies_transient');
[7894] Fix | Delete
function ampforwp_generate_taxonomies_transient(){
[7895] Fix | Delete
$taxonomies = get_transient('ampforwp_get_taxonomies');
[7896] Fix | Delete
$tax_arr = array();
[7897] Fix | Delete
$args = array(
[7898] Fix | Delete
'public' => true,
[7899] Fix | Delete
'_builtin' => false,
[7900] Fix | Delete
);
[7901] Fix | Delete
$output = 'objects'; // or objects
[7902] Fix | Delete
$operator = 'and'; // 'and' or 'or'
[7903] Fix | Delete
$alltaxonomies = get_taxonomies( $args, $output, $operator );
[7904] Fix | Delete
if ($alltaxonomies) {
[7905] Fix | Delete
foreach ($alltaxonomies as $taxKey => $taxVal) {
[7906] Fix | Delete
$tax_arr[$taxVal->name] = $taxVal->labels->singular_name;
[7907] Fix | Delete
}
[7908] Fix | Delete
}
[7909] Fix | Delete
if ( false == $taxonomies ) {
[7910] Fix | Delete
set_transient('ampforwp_get_taxonomies',$tax_arr);
[7911] Fix | Delete
}else{
[7912] Fix | Delete
if(count($tax_arr) > count($taxonomies)){
[7913] Fix | Delete
$result = array_diff_assoc($tax_arr,$taxonomies);
[7914] Fix | Delete
}elseif( count($taxonomies) > count($tax_arr)){
[7915] Fix | Delete
$result = array_diff_assoc($taxonomies,$tax_arr);
[7916] Fix | Delete
}
[7917] Fix | Delete
if( !empty($result)){
[7918] Fix | Delete
delete_transient('ampforwp_get_taxonomies');
[7919] Fix | Delete
}
[7920] Fix | Delete
}
[7921] Fix | Delete
return $taxonomies;
[7922] Fix | Delete
}
[7923] Fix | Delete
[7924] Fix | Delete
// Include Opengraph.php #3261
[7925] Fix | Delete
add_action('pre_amp_render_post', 'ampforwp_include_opengraph');
[7926] Fix | Delete
if ( ! function_exists('ampforwp_include_opengraph') ) {
[7927] Fix | Delete
function ampforwp_include_opengraph(){
[7928] Fix | Delete
if ( true == ampforwp_get_setting('ampforwp-seo-og-meta-tags') && '' == ampforwp_get_setting('ampforwp-seo-selection') ) {
[7929] Fix | Delete
require_once AMPFORWP_PLUGIN_DIR."includes/features/opengraph.php";
[7930] Fix | Delete
}
[7931] Fix | Delete
}
[7932] Fix | Delete
}
[7933] Fix | Delete
[7934] Fix | Delete
add_action('wp_ajax_ampforwp_import_file_from_file','ampforwp_import_settings_from_file');
[7935] Fix | Delete
function ampforwp_import_settings_from_file(){
[7936] Fix | Delete
$security = $_POST['security'];
[7937] Fix | Delete
if ( wp_verify_nonce( $security, 'ampforwp_import_file' ) && current_user_can( 'manage_options' ) ) {
[7938] Fix | Delete
if(isset($_FILES["file"]["tmp_name"])){
[7939] Fix | Delete
$content = file_get_contents($_FILES["file"]["tmp_name"]);
[7940] Fix | Delete
if ( ! empty ( $content ) ) {
[7941] Fix | Delete
$imported_options = json_decode( $content, true );
[7942] Fix | Delete
}
[7943] Fix | Delete
$plugin_options = get_option('redux_builder_amp');
[7944] Fix | Delete
if ( ! empty ( $imported_options ) && is_array( $imported_options ) && isset ( $imported_options['redux-backup'] ) && $imported_options['redux-backup'] == '1' ) {
[7945] Fix | Delete
echo $content;
[7946] Fix | Delete
}
[7947] Fix | Delete
}
[7948] Fix | Delete
}
[7949] Fix | Delete
}
[7950] Fix | Delete
[7951] Fix | Delete
add_filter('ampforwp_loop_image_update','ampforwp_recentpost_link_to_nonamp');
[7952] Fix | Delete
function ampforwp_recentpost_link_to_nonamp($image_link_data){
[7953] Fix | Delete
if( true == ampforwp_get_setting('ampforwp-recentpost-posts-link') ){
[7954] Fix | Delete
$image_link_data['image_link'] = get_permalink();
[7955] Fix | Delete
}else{
[7956] Fix | Delete
$image_link_data['image_link'] = ampforwp_url_controller( get_permalink() ) ;
[7957] Fix | Delete
}
[7958] Fix | Delete
return $image_link_data;
[7959] Fix | Delete
}
[7960] Fix | Delete
#3596 link to nonamp option on title for recent posts
[7961] Fix | Delete
add_filter('ampforwp_loop_permalink_update','ampforwp_recentpost_title_link_to_nonamp');
[7962] Fix | Delete
function ampforwp_recentpost_title_link_to_nonamp($title_link){
[7963] Fix | Delete
if( true == ampforwp_get_setting('ampforwp-recentpost-posts-link') ){
[7964] Fix | Delete
$title_link = get_permalink();
[7965] Fix | Delete
}else{
[7966] Fix | Delete
$title_link = ampforwp_url_controller( get_permalink() ) ;
[7967] Fix | Delete
}
[7968] Fix | Delete
return $title_link;
[7969] Fix | Delete
}
[7970] Fix | Delete
[7971] Fix | Delete
// Post Meta Revisions #3548 -- start here --
[7972] Fix | Delete
add_filter( '_wp_post_revision_field_amp_page_builder', 'ampforwp_meta_revi_pb_field', 22, 2 );
[7973] Fix | Delete
add_action( 'save_post', 'ampforwp_meta_revi_save_post', 10, 2 );
[7974] Fix | Delete
add_action( 'wp_restore_post_revision', 'ampforwp_meta_restore_revision', 10, 2 );
[7975] Fix | Delete
add_filter( '_wp_post_revision_fields', 'ampforwp_meta_revi_fields' );
[7976] Fix | Delete
// Displaying the meta field on the revisions screen
[7977] Fix | Delete
function ampforwp_meta_revi_fields( $fields ) {
[7978] Fix | Delete
$fields['post_title'] = 'Title';
[7979] Fix | Delete
$fields['post_content'] = 'Content';
[7980] Fix | Delete
$fields['post_excerpt'] = 'Excerpt';
[7981] Fix | Delete
$fields['amp-page-builder'] = 'AMP Page Builder';
[7982] Fix | Delete
return $fields;
[7983] Fix | Delete
}
[7984] Fix | Delete
// Displaying the meta field on the revisions screen
[7985] Fix | Delete
function ampforwp_meta_revi_pb_field( $value, $field ) {
[7986] Fix | Delete
global $revision;
[7987] Fix | Delete
return get_metadata( 'post', $revision->ID, $field, true );
[7988] Fix | Delete
}
[7989] Fix | Delete
// Reverting to the correct revision of the meta field when a post is reverted
[7990] Fix | Delete
function ampforwp_meta_restore_revision( $post_id, $revision_id ) {
[7991] Fix | Delete
if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {
[7992] Fix | Delete
return;
[7993] Fix | Delete
}
[7994] Fix | Delete
$post = get_post( $post_id );
[7995] Fix | Delete
$revision = get_post( $revision_id );
[7996] Fix | Delete
$meta = get_metadata( 'post', $revision->ID, 'amp-page-builder', true );
[7997] Fix | Delete
if ( false === $meta ) {
[7998] Fix | Delete
delete_post_meta( $post_id, 'amp-page-builder' );
[7999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function