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.../includes/features
File: functions.php
cursor: pointer;
[1000] Fix | Delete
position: absolute;
[1001] Fix | Delete
top: 50%;
[1002] Fix | Delete
width: auto;
[1003] Fix | Delete
padding: 10px 15px 10px 15px;
[1004] Fix | Delete
margin-top: 0;
[1005] Fix | Delete
color: white;
[1006] Fix | Delete
font-weight: bold;
[1007] Fix | Delete
font-size: 16px;
[1008] Fix | Delete
transition: 0.6s ease;
[1009] Fix | Delete
border-radius: 0 3px 3px 0;
[1010] Fix | Delete
user-select: none;
[1011] Fix | Delete
background-color: rgba(0,0,0,0.5);
[1012] Fix | Delete
}
[1013] Fix | Delete
/* Position the "next button" to the right */
[1014] Fix | Delete
.nonamp-next {
[1015] Fix | Delete
right: 0;
[1016] Fix | Delete
border-radius: 3px 0 0 3px;
[1017] Fix | Delete
}
[1018] Fix | Delete
.nonamp-prev{
[1019] Fix | Delete
left:0;
[1020] Fix | Delete
border-radius: 3px 0 0 3px;
[1021] Fix | Delete
}
[1022] Fix | Delete
/* On hover, add a black background color with a little bit see-through */
[1023] Fix | Delete
.nonamp-prev:hover, .nonamp-next:hover {
[1024] Fix | Delete
color:#fff;
[1025] Fix | Delete
}
[1026] Fix | Delete
/* Caption text */
[1027] Fix | Delete
.text {
[1028] Fix | Delete
color: #f2f2f2;
[1029] Fix | Delete
font-size: 15px;
[1030] Fix | Delete
padding: 8px 12px;
[1031] Fix | Delete
position: absolute;
[1032] Fix | Delete
bottom: 8px;
[1033] Fix | Delete
width: 100%;
[1034] Fix | Delete
text-align: center;
[1035] Fix | Delete
}
[1036] Fix | Delete
/* Number text (1/3 etc) */
[1037] Fix | Delete
.numbertext {
[1038] Fix | Delete
color: #f2f2f2;
[1039] Fix | Delete
font-size: 12px;
[1040] Fix | Delete
padding: 8px 12px;
[1041] Fix | Delete
position: absolute;
[1042] Fix | Delete
top: 0;
[1043] Fix | Delete
}
[1044] Fix | Delete
/* The dots/bullets/indicators */
[1045] Fix | Delete
.dot {
[1046] Fix | Delete
cursor: pointer;
[1047] Fix | Delete
height: 15px;
[1048] Fix | Delete
width: 15px;
[1049] Fix | Delete
margin: 0 2px;
[1050] Fix | Delete
background-color: #bbb;
[1051] Fix | Delete
border-radius: 50%;
[1052] Fix | Delete
display: inline-block;
[1053] Fix | Delete
transition: background-color 0.6s ease;
[1054] Fix | Delete
}
[1055] Fix | Delete
.active, .dot:hover {
[1056] Fix | Delete
background-color: #717171;
[1057] Fix | Delete
}
[1058] Fix | Delete
/* Fading animation */
[1059] Fix | Delete
.fade {
[1060] Fix | Delete
-webkit-animation-name: fade;
[1061] Fix | Delete
-webkit-animation-duration: 1.5s;
[1062] Fix | Delete
animation-name: fade;
[1063] Fix | Delete
animation-duration: 1.5s;
[1064] Fix | Delete
}
[1065] Fix | Delete
@-webkit-keyframes fade {
[1066] Fix | Delete
from {opacity: .4}
[1067] Fix | Delete
to {opacity: 1}
[1068] Fix | Delete
}
[1069] Fix | Delete
@keyframes fade {
[1070] Fix | Delete
from {opacity: .4}
[1071] Fix | Delete
to {opacity: 1}
[1072] Fix | Delete
}
[1073] Fix | Delete
/* On smaller screens, decrease text size */
[1074] Fix | Delete
@media only screen and (max-width: 300px) {
[1075] Fix | Delete
.nonamp-prev, .nonamp-next,.text {font-size: 11px}
[1076] Fix | Delete
}';
[1077] Fix | Delete
$galleryJs = '<script>
[1078] Fix | Delete
var slideIndex = 0;
[1079] Fix | Delete
showSlides(slideIndex);
[1080] Fix | Delete
function plusSlides(n) {
[1081] Fix | Delete
showSlides(slideIndex += n);
[1082] Fix | Delete
}
[1083] Fix | Delete
function currentSlide(n) {
[1084] Fix | Delete
showSlides(slideIndex = n);
[1085] Fix | Delete
}
[1086] Fix | Delete
function showSlides(n) {
[1087] Fix | Delete
var i;
[1088] Fix | Delete
var slides = document.getElementsByClassName("mySlides");
[1089] Fix | Delete
var dots = document.getElementsByClassName("dot");
[1090] Fix | Delete
var heads = document.getElementsByClassName("heads");
[1091] Fix | Delete
if (n >= slides.length) {slideIndex = 0}
[1092] Fix | Delete
if (n < 0) {slideIndex = slides.length-1}
[1093] Fix | Delete
for (i = 0; i < slides.length; i++) {
[1094] Fix | Delete
slides[i].style.display = "none";
[1095] Fix | Delete
}
[1096] Fix | Delete
for (i = 0; i < dots.length; i++) {
[1097] Fix | Delete
dots[i].className = dots[i].className.replace(" how-current", "");
[1098] Fix | Delete
}
[1099] Fix | Delete
for (i = 0; i < heads.length; i++) {
[1100] Fix | Delete
heads[i].className = heads[i].className.replace(" how-current", "");
[1101] Fix | Delete
}
[1102] Fix | Delete
slides[slideIndex].style.display = "block";
[1103] Fix | Delete
dots[slideIndex].className += " how-current";
[1104] Fix | Delete
heads[slideIndex].className += " how-current";
[1105] Fix | Delete
}
[1106] Fix | Delete
function currentDiv(n) {
[1107] Fix | Delete
showDivs(slideIndex = n);
[1108] Fix | Delete
}
[1109] Fix | Delete
function showDivs(n) {
[1110] Fix | Delete
var i;
[1111] Fix | Delete
var x = document.getElementsByClassName("mySlides");
[1112] Fix | Delete
if (n > x.length) {slideIndex = 1}
[1113] Fix | Delete
if (n < 0) {slideIndex = x.length}
[1114] Fix | Delete
for (i = 0; i < x.length; i++) {
[1115] Fix | Delete
x[i].style.display = "none";
[1116] Fix | Delete
}
[1117] Fix | Delete
x[slideIndex].style.display = "block";
[1118] Fix | Delete
}
[1119] Fix | Delete
</script>';
[1120] Fix | Delete
}
[1121] Fix | Delete
[1122] Fix | Delete
$nonampCss = '
[1123] Fix | Delete
.cntr img{width:100%;height:auto !important;}
[1124] Fix | Delete
img{height:auto;}
[1125] Fix | Delete
.slid-prv{width:100%;text-align: center;margin-top: 10px;display: inline-block;}
[1126] Fix | Delete
.amp-featured-image img{width:100%;height:auto;}
[1127] Fix | Delete
.content-wrapper, .header, .header-2, .header-3{width:100% !important;}
[1128] Fix | Delete
.image-mod img{width:100%;}
[1129] Fix | Delete
[1130] Fix | Delete
';
[1131] Fix | Delete
$re = '/<style\s*type="text\/css">(.*?)<\/style>/si';
[1132] Fix | Delete
$subst = "<style type=\"text/css\">$1 ".$nonampCss.$galleryCss."</style>";
[1133] Fix | Delete
$returnData = preg_replace($re, $subst, $returnData);
[1134] Fix | Delete
$returnData = preg_replace(
[1135] Fix | Delete
'/<amp-youtube\sdata-videoid="(.*?)"(.*?)><\/amp-youtube>/',
[1136] Fix | Delete
'<iframe src="'. esc_url("https://www.youtube.com/embed/$1").'" style="width:100%;height:360px;" ></iframe>', $returnData);
[1137] Fix | Delete
$returnData = preg_replace_callback(
[1138] Fix | Delete
'/<amp-iframe(.*?)src="(.*?)"(.*?)><\/amp-iframe>/',
[1139] Fix | Delete
function($matches){
[1140] Fix | Delete
return '<iframe src="'.esc_url($matches[2]).'" style="width:100%;height:400px;" ></iframe>';
[1141] Fix | Delete
}, $returnData);
[1142] Fix | Delete
$returnData = preg_replace_callback('/<amp-carousel\s(.*?)>(.*?)<\/amp-carousel>/s', 'ampforwp_non_amp_gallery', $returnData );
[1143] Fix | Delete
$returnData = preg_replace('/on="tap(.*?).goToSlide(.*?)"/', 'onclick="currentDiv$2"', $returnData);
[1144] Fix | Delete
$returnData = preg_replace('/<span on="tap:AMP\.setState\((.*?)\s:\showSectionSelected\.howSlide - 1(.*?)\)(.*?)/', '<span onclick="plusSlides(-1)$3"', $returnData);
[1145] Fix | Delete
$returnData = preg_replace('/<span on="tap:AMP\.setState\((.*?)\s:\showSectionSelected\.howSlide \+ 1(.*?)\)(.*?)>/', '<span onclick="plusSlides(+1)$3">', $returnData);
[1146] Fix | Delete
$returnData = str_replace('</footer>', '</footer>'.$galleryJs, $returnData);
[1147] Fix | Delete
break;
[1148] Fix | Delete
}
[1149] Fix | Delete
return $returnData;
[1150] Fix | Delete
}
[1151] Fix | Delete
}
[1152] Fix | Delete
[1153] Fix | Delete
// wp_update_nav_menu #3052
[1154] Fix | Delete
add_action('wp_update_nav_menu', 'ampforwp_wp_update_nav_menu', 10 , 1 );
[1155] Fix | Delete
if ( ! function_exists('ampforwp_wp_update_nav_menu') ) {
[1156] Fix | Delete
function ampforwp_wp_update_nav_menu( $menu_id ) {
[1157] Fix | Delete
if ( false != get_transient('ampforwp_header_menu') ) {
[1158] Fix | Delete
delete_transient('ampforwp_header_menu');
[1159] Fix | Delete
}
[1160] Fix | Delete
if ( false != get_transient('ampforwp_footer_menu') ) {
[1161] Fix | Delete
delete_transient('ampforwp_footer_menu');
[1162] Fix | Delete
}
[1163] Fix | Delete
}
[1164] Fix | Delete
}
[1165] Fix | Delete
// Delete Menu Transients on Saving AMP Settings #3052
[1166] Fix | Delete
if ( ! function_exists('ampforwp_menu_transient_on_save') ){
[1167] Fix | Delete
function ampforwp_menu_transient_on_save($redux_builder_amp, $this_transients_changed_values) {
[1168] Fix | Delete
if ( isset($this_transients_changed_values['amp-design-selector']) ) {
[1169] Fix | Delete
if ( false != get_transient('ampforwp_header_menu') ) {
[1170] Fix | Delete
delete_transient('ampforwp_header_menu');
[1171] Fix | Delete
}
[1172] Fix | Delete
if ( false != get_transient('ampforwp_footer_menu') ) {
[1173] Fix | Delete
delete_transient('ampforwp_footer_menu');
[1174] Fix | Delete
}
[1175] Fix | Delete
}
[1176] Fix | Delete
}
[1177] Fix | Delete
}
[1178] Fix | Delete
add_action("redux/options/redux_builder_amp/saved",'ampforwp_menu_transient_on_save', 10, 2);
[1179] Fix | Delete
[1180] Fix | Delete
// Protocol Remover
[1181] Fix | Delete
if ( ! function_exists('ampforwp_remove_protocol') ) {
[1182] Fix | Delete
function ampforwp_remove_protocol($url){
[1183] Fix | Delete
$url = preg_replace('#^https?://#', '//', $url);
[1184] Fix | Delete
return $url;
[1185] Fix | Delete
}
[1186] Fix | Delete
}
[1187] Fix | Delete
// #3009
[1188] Fix | Delete
if ( ! function_exists('ampforwp_sanitize_i_amphtml') ) {
[1189] Fix | Delete
function ampforwp_sanitize_i_amphtml($data){
[1190] Fix | Delete
if(empty($data)){
[1191] Fix | Delete
return $data;
[1192] Fix | Delete
}
[1193] Fix | Delete
$data = preg_replace_callback('/.i-amphtml-(.*?){(.*?)}/s',function($matches){ if(!empty($matched)){ return ''; } }, $data);
[1194] Fix | Delete
return $data;
[1195] Fix | Delete
}
[1196] Fix | Delete
}
[1197] Fix | Delete
[1198] Fix | Delete
function checkAMPforPageBuilderStatus($postId){
[1199] Fix | Delete
global $post;
[1200] Fix | Delete
$postId = (is_object($post)? $post->ID: '');
[1201] Fix | Delete
$response =false;
[1202] Fix | Delete
if( ampforwp_is_front_page() ){
[1203] Fix | Delete
$postId = ampforwp_get_frontpage_id();
[1204] Fix | Delete
}
[1205] Fix | Delete
if ( empty( $postId ) ) {
[1206] Fix | Delete
$response = false;
[1207] Fix | Delete
}else{
[1208] Fix | Delete
$amp_builder = get_post_field('amp-page-builder',$postId);
[1209] Fix | Delete
$amp_pd_data = json_decode($amp_builder);
[1210] Fix | Delete
$ampforwp_pagebuilder_enable = get_post_meta($postId,'ampforwp_page_builder_enable', true);
[1211] Fix | Delete
if( $ampforwp_pagebuilder_enable=='yes' && true == ampforwp_get_setting('ampforwp-pagebuilder') && ( function_exists('amppb_post_content') && !empty($amp_pd_data->rows))){
[1212] Fix | Delete
$response = true;
[1213] Fix | Delete
}else{
[1214] Fix | Delete
$response = false;
[1215] Fix | Delete
}
[1216] Fix | Delete
}
[1217] Fix | Delete
$response = apply_filters( 'ampforwp_pagebuilder_status_modify', $response, $postId );
[1218] Fix | Delete
return $response;
[1219] Fix | Delete
}
[1220] Fix | Delete
[1221] Fix | Delete
// Gallery Code #3296
[1222] Fix | Delete
function ampforwp_new_gallery_images($images_markup, $image, $markup_arr){
[1223] Fix | Delete
add_action('amp_post_template_css', 'ampforwp_additional_gallery_style');
[1224] Fix | Delete
add_filter('amp_post_template_data','ampforwp_carousel_bind_script');
[1225] Fix | Delete
add_action('amp_post_template_css', 'ampforwp_additional_style_carousel_caption');
[1226] Fix | Delete
return $images_markup;
[1227] Fix | Delete
}
[1228] Fix | Delete
if( ! function_exists( 'ampforwp_additional_gallery_style' ) ){
[1229] Fix | Delete
function ampforwp_additional_gallery_style(){
[1230] Fix | Delete
global $carousel_markup_all;
[1231] Fix | Delete
$design_type = '';
[1232] Fix | Delete
$design_type = ampforwp_get_setting('ampforwp-gallery-design-type');
[1233] Fix | Delete
[1234] Fix | Delete
if(isset($design_type) && $design_type!==''){
[1235] Fix | Delete
echo $carousel_markup_all[$design_type]['gallery_css'];
[1236] Fix | Delete
}
[1237] Fix | Delete
}
[1238] Fix | Delete
}
[1239] Fix | Delete
// amp-bind for carousel with captions
[1240] Fix | Delete
function ampforwp_carousel_bind_script($data){
[1241] Fix | Delete
if( 1 == ampforwp_get_setting('ampforwp-gallery-design-type') || 2 == ampforwp_get_setting('ampforwp-gallery-design-type') ){
[1242] Fix | Delete
if ( empty( $data['amp_component_scripts']['amp-bind'] ) ) {
[1243] Fix | Delete
$data['amp_component_scripts']['amp-bind'] = 'https://cdn.ampproject.org/v0/amp-bind-0.1.js';
[1244] Fix | Delete
}
[1245] Fix | Delete
}
[1246] Fix | Delete
if( 3 == ampforwp_get_setting('ampforwp-gallery-design-type') || true == ampforwp_get_setting('ampforwp-gallery-lightbox') ){
[1247] Fix | Delete
if ( empty( $data['amp_component_scripts']['amp-image-lightbox'] ) ) {
[1248] Fix | Delete
$data['amp_component_scripts']['amp-image-lightbox'] = 'https://cdn.ampproject.org/v0/amp-image-lightbox-0.1.js';
[1249] Fix | Delete
}
[1250] Fix | Delete
}
[1251] Fix | Delete
return $data;
[1252] Fix | Delete
}
[1253] Fix | Delete
function ampforwp_new_thumbnail_images($amp_images, $uniqueid, $markup_arr){
[1254] Fix | Delete
if(!isset($markup_arr['carousel_with_thumbnail_html'])){return '';}
[1255] Fix | Delete
$amp_thumb_image_buttons = array();
[1256] Fix | Delete
foreach ($amp_images as $key => $value) {
[1257] Fix | Delete
$returnHtml = $markup_arr['carousel_with_thumbnail_html'];
[1258] Fix | Delete
$returnHtml = str_replace('{{thumbnail}}', $value , $returnHtml);
[1259] Fix | Delete
$returnHtml = str_replace('{{unique_id}}', $uniqueid , $returnHtml);
[1260] Fix | Delete
$returnHtml = str_replace('{{unique_index}}', $key , $returnHtml);
[1261] Fix | Delete
$amp_thumb_image_buttons[$key] = $returnHtml;
[1262] Fix | Delete
}
[1263] Fix | Delete
return $amp_thumb_image_buttons;
[1264] Fix | Delete
}
[1265] Fix | Delete
// Gallery Styling
[1266] Fix | Delete
if( ! function_exists( 'ampforwp_additional_style_carousel_caption' ) ){
[1267] Fix | Delete
function ampforwp_additional_style_carousel_caption(){ ?>
[1268] Fix | Delete
.collapsible-captions {--caption-height: 32px; --image-height: 100%; --caption-padding:1rem; --button-size: 28px; --caption-color: #f5f5f5;; --caption-bg-color: #111;}
[1269] Fix | Delete
.collapsible-captions * {
[1270] Fix | Delete
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
[1271] Fix | Delete
box-sizing: border-box;
[1272] Fix | Delete
}
[1273] Fix | Delete
.collapsible-captions .amp-carousel-container {position: relative; width: 100%;}
[1274] Fix | Delete
.collapsible-captions amp-img img {object-fit: contain; }
[1275] Fix | Delete
.collapsible-captions figure { margin: 0; padding: 0; }
[1276] Fix | Delete
.collapsible-captions figcaption { position: absolute; bottom: 0;width: 100%;
[1277] Fix | Delete
max-height: var(--caption-height);margin-bottom:0;
[1278] Fix | Delete
line-height: var(--caption-height);
[1279] Fix | Delete
padding: 0 var(--button-size) 0 5px;
[1280] Fix | Delete
white-space: nowrap;
[1281] Fix | Delete
overflow: hidden;
[1282] Fix | Delete
text-overflow: ellipsis;
[1283] Fix | Delete
transition: max-height 200ms cubic-bezier(0.4, 0, 0.2, 1);
[1284] Fix | Delete
z-index: 1000;
[1285] Fix | Delete
color: var(--caption-color);
[1286] Fix | Delete
background: rgba(0, 0, 0, 0.6);
[1287] Fix | Delete
}
[1288] Fix | Delete
.collapsible-captions figcaption.expanded {
[1289] Fix | Delete
line-height: inherit;
[1290] Fix | Delete
white-space: normal;
[1291] Fix | Delete
text-overflow: auto;
[1292] Fix | Delete
max-height: 100px;
[1293] Fix | Delete
overflow: auto;
[1294] Fix | Delete
}
[1295] Fix | Delete
.collapsible-captions figcaption:focus { outline: none; border: none; }
[1296] Fix | Delete
.collapsible-captions figcaption span { display: block; position: absolute;
[1297] Fix | Delete
top: calc((var(--caption-height) - var(--button-size)) / 2);
[1298] Fix | Delete
right: 2px; width: var(--button-size); height: var(--button-size);
[1299] Fix | Delete
line-height: var(--button-size); text-align: center; font-size: 12px; color: inherit;
[1300] Fix | Delete
cursor: pointer; }
[1301] Fix | Delete
figcaption{ margin-bottom: 20px; }
[1302] Fix | Delete
<?php }
[1303] Fix | Delete
}
[1304] Fix | Delete
[1305] Fix | Delete
function ampforwp_role_based_access_options(){
[1306] Fix | Delete
$user_role = '';
[1307] Fix | Delete
$user_role = true;
[1308] Fix | Delete
$currentUser = wp_get_current_user();
[1309] Fix | Delete
$amp_roles = ampforwp_get_setting('ampforwp-role-based-access');
[1310] Fix | Delete
$currentuserrole = (array) $currentUser->roles;
[1311] Fix | Delete
$hasrole = array_intersect( $currentuserrole, $amp_roles );
[1312] Fix | Delete
if( empty($hasrole)){
[1313] Fix | Delete
$user_role = false;
[1314] Fix | Delete
}
[1315] Fix | Delete
$user_role = apply_filters('ampforwp_modify_user_access_role', $user_role, $currentUser, $amp_roles, $hasrole );
[1316] Fix | Delete
return $user_role;
[1317] Fix | Delete
}
[1318] Fix | Delete
if(!function_exists('ampforwp_sassy_share_icons')){
[1319] Fix | Delete
function ampforwp_sassy_share_icons($ampforwp_the_content) {
[1320] Fix | Delete
if(function_exists('heateor_sss_run')){
[1321] Fix | Delete
global $heateor_sss;global $post;
[1322] Fix | Delete
$share_counts = false;
[1323] Fix | Delete
$sassy_options = $heateor_sss->options;
[1324] Fix | Delete
$post_url = get_the_permalink($post);
[1325] Fix | Delete
if(isset($sassy_options['horizontal_counts'])){
[1326] Fix | Delete
$post_id = ampforwp_get_the_ID();
[1327] Fix | Delete
if ( $post_id == 'custom' ) {
[1328] Fix | Delete
$share_counts = get_option( 'heateor_sss_custom_url_shares' ) ;
[1329] Fix | Delete
} elseif ( $post_url == home_url() ) {
[1330] Fix | Delete
$share_counts = get_option( 'heateor_sss_homepage_shares' );
[1331] Fix | Delete
} elseif ( $post_id > 0 ) {
[1332] Fix | Delete
$share_counts = get_post_meta( $post_id, '_heateor_sss_shares_meta', true );
[1333] Fix | Delete
}
[1334] Fix | Delete
$total_share = 0;
[1335] Fix | Delete
if(isset($sassy_options['horizontal_re_providers'])){
[1336] Fix | Delete
$share_icons = $sassy_options['horizontal_re_providers'];
[1337] Fix | Delete
foreach($share_icons as $i){
[1338] Fix | Delete
if(isset($share_counts[$i])){
[1339] Fix | Delete
$total_share += round($share_counts[$i]);
[1340] Fix | Delete
}
[1341] Fix | Delete
}
[1342] Fix | Delete
}
[1343] Fix | Delete
$_append = '<a class="heateor_sss_amp heateor-total-share-count">
[1344] Fix | Delete
<span class="sss_share_count">'.intval($total_share).'</span> <span class="sss_share_lbl">Shares</span></a>';
[1345] Fix | Delete
preg_match_all('/<div class="heateorSssClear"><\/div><div class="heateor_sss_sharing_container (.*)">(.*)<div class="heateorSssClear"><\/div><\/div><div class="heateorSssClear"><\/div>/', $ampforwp_the_content, $matches);
[1346] Fix | Delete
[1347] Fix | Delete
$_actual = $matches[0];
[1348] Fix | Delete
if(isset($matches[1][0])){
[1349] Fix | Delete
$_replace = '<div class="heateorSssClear"></div><div class="heateor_sss_sharing_container '.$matches[1][0].'"></amp-img></a>'.$_append.'</div><div class="heateorSssClear"></div><div class="heateorSssClear"></div>';
[1350] Fix | Delete
$ampforwp_the_content = str_replace($_actual, $_replace, $ampforwp_the_content);
[1351] Fix | Delete
}
[1352] Fix | Delete
}
[1353] Fix | Delete
}
[1354] Fix | Delete
return $ampforwp_the_content;
[1355] Fix | Delete
}
[1356] Fix | Delete
}
[1357] Fix | Delete
[1358] Fix | Delete
// Notice for Dev Mode
[1359] Fix | Delete
function ampforwp_dev_mode_notice(){
[1360] Fix | Delete
global $redux_builder_amp;
[1361] Fix | Delete
$message = '';
[1362] Fix | Delete
if(isset($redux_builder_amp['ampforwp-development-mode']) && $redux_builder_amp['ampforwp-development-mode']) {
[1363] Fix | Delete
$message = ' Please turn off Development mode, when you are done.';?>
[1364] Fix | Delete
[1365] Fix | Delete
<div class="notice notice-success amp-dev-notice" style="position:relative;
[1366] Fix | Delete
height: 40px; overflow: hidden; ">
[1367] Fix | Delete
<div class="ampforwp-dev-mode-message" style="margin-top: 10px;">
[1368] Fix | Delete
<?php echo '<strong>'. esc_html__('AMP Dev mode is Enabled!', 'accelerated-mobile-pages').'</strong>'. esc_html__($message, 'accelerated-mobile-pages'); ?>
[1369] Fix | Delete
</div>
[1370] Fix | Delete
</div>
[1371] Fix | Delete
<?php }
[1372] Fix | Delete
}
[1373] Fix | Delete
[1374] Fix | Delete
function ampforwp_seo_selection_notice() {
[1375] Fix | Delete
$seo = '';
[1376] Fix | Delete
if(function_exists('genesis_theme_support')){
[1377] Fix | Delete
$seo = 'Genesis';
[1378] Fix | Delete
}
[1379] Fix | Delete
if(class_exists('WPSEO_Options')){
[1380] Fix | Delete
$seo = 'Yoast SEO';
[1381] Fix | Delete
}
[1382] Fix | Delete
if(class_exists('All_in_One_SEO_Pack')){
[1383] Fix | Delete
$seo = 'All in One SEO';
[1384] Fix | Delete
}
[1385] Fix | Delete
if(function_exists( 'the_seo_framework' )){
[1386] Fix | Delete
$seo = 'The SEO Framework';
[1387] Fix | Delete
}
[1388] Fix | Delete
if(function_exists('qode_header_meta')){
[1389] Fix | Delete
$seo = 'Bridge Qode SEO';
[1390] Fix | Delete
}
[1391] Fix | Delete
if(defined( 'RANK_MATH_FILE' )){
[1392] Fix | Delete
$seo = 'Rank Math SEO';
[1393] Fix | Delete
}
[1394] Fix | Delete
if(defined( 'SQ_ALL_PATTERNS' )){
[1395] Fix | Delete
$seo = 'Squirrly SEO';
[1396] Fix | Delete
}
[1397] Fix | Delete
if(class_exists('Smartcrawl_Loader')){
[1398] Fix | Delete
$seo = 'Smartcrawl SEO';
[1399] Fix | Delete
}
[1400] Fix | Delete
if(function_exists('seopress_activation')){
[1401] Fix | Delete
$seo = 'SEO Press';
[1402] Fix | Delete
}
[1403] Fix | Delete
$seosel = false;
[1404] Fix | Delete
if(class_exists('WPSEO_Options') && 'yoast' != ampforwp_get_setting('ampforwp-seo-selection')){
[1405] Fix | Delete
$seosel = true;
[1406] Fix | Delete
}
[1407] Fix | Delete
else if (defined( 'RANK_MATH_FILE' ) && 'rank_math' != ampforwp_get_setting('ampforwp-seo-selection')){
[1408] Fix | Delete
$seosel = true;
[1409] Fix | Delete
}
[1410] Fix | Delete
else if (class_exists('All_in_One_SEO_Pack') && 'aioseo' != ampforwp_get_setting('ampforwp-seo-selection')){
[1411] Fix | Delete
$seosel = true;
[1412] Fix | Delete
}
[1413] Fix | Delete
else if (function_exists( 'the_seo_framework' ) && 'seo_framework' != ampforwp_get_setting('ampforwp-seo-selection')){
[1414] Fix | Delete
$seosel = true;
[1415] Fix | Delete
}
[1416] Fix | Delete
else if (defined( 'SQ_ALL_PATTERNS' ) && 'squirrly' != ampforwp_get_setting('ampforwp-seo-selection')){
[1417] Fix | Delete
$seosel = true;
[1418] Fix | Delete
}
[1419] Fix | Delete
else if (class_exists('Smartcrawl_Loader') && 'smartcrawl' != ampforwp_get_setting('ampforwp-seo-selection')){
[1420] Fix | Delete
$seosel = true;
[1421] Fix | Delete
}
[1422] Fix | Delete
else if (function_exists('genesis_theme_support') && 'genesis' != ampforwp_get_setting('ampforwp-seo-selection') && !class_exists('WPSEO_Options') && !defined( 'RANK_MATH_FILE' ) && !class_exists('All_in_One_SEO_Pack') && !defined( 'SQ_ALL_PATTERNS' ) && !class_exists('Smartcrawl_Loader') && !function_exists('seopress_activation')){
[1423] Fix | Delete
$seosel = true;
[1424] Fix | Delete
}
[1425] Fix | Delete
else if (function_exists('seopress_activation') && 'seopress' != ampforwp_get_setting('ampforwp-seo-selection')){
[1426] Fix | Delete
$seosel = true;
[1427] Fix | Delete
}
[1428] Fix | Delete
else if (function_exists('qode_header_meta') && 'bridge' != ampforwp_get_setting('ampforwp-seo-selection')){
[1429] Fix | Delete
$seosel = true;
[1430] Fix | Delete
}
[1431] Fix | Delete
if($seosel && ( '' != ampforwp_get_setting('ampforwp-seo-selection') ) ){
[1432] Fix | Delete
echo sprintf(('<div class="notice notice-error"><p>%s</p></div>'), esc_html__('Incorrect SEO plugin has been selected in AMPforWP SEO Settings, Please select '.esc_html($seo).' from SEO Settings.','accelerated-mobile-pages'));
[1433] Fix | Delete
}
[1434] Fix | Delete
[1435] Fix | Delete
if('' != ampforwp_get_setting('ampforwp-seo-selection')){
[1436] Fix | Delete
return;
[1437] Fix | Delete
}
[1438] Fix | Delete
[1439] Fix | Delete
if(!empty($seo)){
[1440] Fix | Delete
echo sprintf(('<div class="notice notice-error"><p>%s </p></div>'), esc_html__('The configuration of AMPforWP and '.esc_html($seo).' plugin is seems incorrect. Please go to AMPforWP plugin settings -> SEO -> SEO Plugin Integration and select '.esc_html($seo).' plugin from the drop down.','accelerated-mobile-pages'));
[1441] Fix | Delete
}
[1442] Fix | Delete
}
[1443] Fix | Delete
add_action('wp_ajax_ampforwp_subscribe_newsletter','ampforwp_subscribe_for_newsletter');
[1444] Fix | Delete
add_action('wp_ajax_nopriv_ampforwp_subscribe_newsletter','ampforwp_subscribe_for_newsletter');
[1445] Fix | Delete
function ampforwp_subscribe_for_newsletter(){
[1446] Fix | Delete
$api_url = 'http://magazine3.company/wp-json/api/central/email/subscribe';
[1447] Fix | Delete
$api_params = array(
[1448] Fix | Delete
'name' => sanitize_text_field($_POST['name']),
[1449] Fix | Delete
'email'=> sanitize_text_field($_POST['email']),
[1450] Fix | Delete
'website'=> sanitize_text_field($_POST['website']),
[1451] Fix | Delete
'type'=> 'amp'
[1452] Fix | Delete
);
[1453] Fix | Delete
$response = wp_remote_post( $api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
[1454] Fix | Delete
$response = wp_remote_retrieve_body( $response );
[1455] Fix | Delete
echo $response;
[1456] Fix | Delete
die;
[1457] Fix | Delete
}
[1458] Fix | Delete
function ampforwp_mobile_redirection_notice(){
[1459] Fix | Delete
if(false == ampforwp_get_setting('amp-mobile-redirection')){
[1460] Fix | Delete
return;
[1461] Fix | Delete
}
[1462] Fix | Delete
$plugin = $option = '';
[1463] Fix | Delete
if(function_exists('rocket_load_textdomain') && (function_exists('get_rocket_option') && 0 == get_rocket_option( 'do_caching_mobile_files' ))){
[1464] Fix | Delete
$plugin = 'WP Rocket';
[1465] Fix | Delete
$option = 'Separate cache files for mobile devices';
[1466] Fix | Delete
}
[1467] Fix | Delete
if(function_exists('wp_super_cache_init_action')) {
[1468] Fix | Delete
global $wp_cache_mobile_enabled;
[1469] Fix | Delete
if(0 == $wp_cache_mobile_enabled){
[1470] Fix | Delete
$plugin = 'WP Super Cache';
[1471] Fix | Delete
$option = 'Mobile device support';
[1472] Fix | Delete
}else{
[1473] Fix | Delete
return;
[1474] Fix | Delete
}
[1475] Fix | Delete
}
[1476] Fix | Delete
if(function_exists('litespeed_purge_single_post') && !LiteSpeed_Cache_Admin_Rules::get_instance()->get_rewrite_rule_mobile_agents()) {
[1477] Fix | Delete
$plugin = 'LiteSpeed Cache';
[1478] Fix | Delete
$option = 'Cache Mobile';
[1479] Fix | Delete
}
[1480] Fix | Delete
if(function_exists('wpfastestcache_activate') && isset($GLOBALS["wp_fastest_cache_options"]->wpFastestCacheMobile) && 'on' != $GLOBALS["wp_fastest_cache_options"]->wpFastestCacheMobile) {
[1481] Fix | Delete
$plugin = 'WP Fastest Cache';
[1482] Fix | Delete
$option = 'Mobile';
[1483] Fix | Delete
}
[1484] Fix | Delete
if(!empty($plugin) && !empty($option)){
[1485] Fix | Delete
echo sprintf(('<div class="notice notice-error"><p>%s <a target="_blank" href="%s">%s</a></p></div>'), esc_html__('You need to enable the option of "'.esc_html($option).'" in '.esc_html($plugin).' plugin for mobile redirection to work properly in AMP','accelerated-mobile-pages'),esc_url('https://ampforwp.com/tutorials/article/how-to-redirect-all-mobile-visitors-to-amp/'),esc_html__('Click here for more info','accelerated-mobile-pages')); }
[1486] Fix | Delete
}
[1487] Fix | Delete
function ampforwp_category_base_remove_notice(){
[1488] Fix | Delete
if(true == ampforwp_get_setting('ampforwp-category-base-removel-link')){
[1489] Fix | Delete
return;
[1490] Fix | Delete
}
[1491] Fix | Delete
if(class_exists('WPSEO_Options') && method_exists('WPSEO_Options', 'get') && WPSEO_Options::get( 'stripcategorybase' ) == true ){
[1492] Fix | Delete
echo sprintf(('<div class="notice notice-error"><p>%s <a href="%s">%s</a>%s<a href="%s">%s</a></p></div>'), esc_html__('We have detected that you removed Category Base from Yoast SEO plugin but not from AMPforWP settings. Please','accelerated-mobile-pages'),
[1493] Fix | Delete
esc_url('admin.php?page=amp_options&tab=17'),
[1494] Fix | Delete
esc_html__('Click here','accelerated-mobile-pages'),
[1495] Fix | Delete
esc_html__(' to set up to make sure AMP pages work properly on category pages or ','accelerated-mobile-pages'),
[1496] Fix | Delete
esc_url('https://ampforwp.com/tutorials/article/how-to-remove-the-category-base-in-the-amp/'),esc_html__('Click here for the tutorial','accelerated-mobile-pages'),esc_html__('Click here for the tutorial','accelerated-mobile-pages'));
[1497] Fix | Delete
}
[1498] Fix | Delete
}
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function