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
$current_url_in_pieces = array();
[500] Fix | Delete
if(is_home() && get_option('show_on_front') == 'page' ) {
[501] Fix | Delete
$current_url = home_url( $GLOBALS['wp']->request );
[502] Fix | Delete
$current_url_in_pieces = explode( '/', $current_url );
[503] Fix | Delete
$page_for_posts = get_option( 'page_for_posts' );
[504] Fix | Delete
if( $page_for_posts ){
[505] Fix | Delete
$post = get_post($page_for_posts);
[506] Fix | Delete
if ( $post ) {
[507] Fix | Delete
$slug = $post->post_name;
[508] Fix | Delete
$title = $post->post_title;
[509] Fix | Delete
$blog_id = $post->ID;
[510] Fix | Delete
}
[511] Fix | Delete
switch ($param) {
[512] Fix | Delete
case 'title':
[513] Fix | Delete
$output = $title;
[514] Fix | Delete
break;
[515] Fix | Delete
case 'name':
[516] Fix | Delete
$output = $slug;
[517] Fix | Delete
break;
[518] Fix | Delete
case 'id':
[519] Fix | Delete
$output = $blog_id;
[520] Fix | Delete
break;
[521] Fix | Delete
default:
[522] Fix | Delete
if( in_array( $slug , $current_url_in_pieces , true ) || get_query_var('page_id') == $blog_id ) {
[523] Fix | Delete
$output = true;
[524] Fix | Delete
}
[525] Fix | Delete
else
[526] Fix | Delete
$output = false;
[527] Fix | Delete
break;
[528] Fix | Delete
}
[529] Fix | Delete
}
[530] Fix | Delete
else
[531] Fix | Delete
$output = false;
[532] Fix | Delete
}
[533] Fix | Delete
return $output;
[534] Fix | Delete
}
[535] Fix | Delete
}
[536] Fix | Delete
[537] Fix | Delete
// 56. Multi Translation Feature #540
[538] Fix | Delete
function ampforwp_translation( $redux_style_translation , $pot_style_translation ) {
[539] Fix | Delete
$single_translation_enabled = ampforwp_get_setting('amp-use-pot');
[540] Fix | Delete
if ( !$single_translation_enabled ) {
[541] Fix | Delete
return $redux_style_translation;
[542] Fix | Delete
} else {
[543] Fix | Delete
if(!empty($redux_style_translation)){
[544] Fix | Delete
$pot_style_translation = $redux_style_translation;
[545] Fix | Delete
}
[546] Fix | Delete
return __($pot_style_translation,'accelerated-mobile-pages');
[547] Fix | Delete
}
[548] Fix | Delete
}
[549] Fix | Delete
[550] Fix | Delete
// END Point
[551] Fix | Delete
function ampforwp_end_point_controller( $url, $check='' ) {
[552] Fix | Delete
global $redux_builder_amp;
[553] Fix | Delete
$checker = '';
[554] Fix | Delete
$endpoint = AMPFORWP_AMP_QUERY_VAR;
[555] Fix | Delete
$endpoint = '?' . $endpoint;
[556] Fix | Delete
if ( isset($redux_builder_amp['amp-core-end-point']) && true == $redux_builder_amp['amp-core-end-point'] ) {
[557] Fix | Delete
$url = untrailingslashit($url.$endpoint);
[558] Fix | Delete
}
[559] Fix | Delete
else
[560] Fix | Delete
$url = $url . user_trailingslashit( AMP_QUERY_VAR, 'single_amp' );
[561] Fix | Delete
[562] Fix | Delete
return $url;
[563] Fix | Delete
}
[564] Fix | Delete
[565] Fix | Delete
if ( ! function_exists( 'ampforwp_isexternal ') ) {
[566] Fix | Delete
function ampforwp_isexternal($url) {
[567] Fix | Delete
$components = parse_url($url);
[568] Fix | Delete
[569] Fix | Delete
// we will treat url like '/relative.php' as relative
[570] Fix | Delete
if ( empty($components['host']) ) return false;
[571] Fix | Delete
[572] Fix | Delete
// url host looks exactly like the local host
[573] Fix | Delete
if ( strcasecmp($components['host'], AMPFROWP_HOST_NAME) === 0 ) return false;
[574] Fix | Delete
[575] Fix | Delete
// check if the url host is a subdomain
[576] Fix | Delete
$check = strrpos(strtolower($components['host']), $_SERVER['HTTP_HOST']) !== strlen($components['host']) - strlen($_SERVER['HTTP_HOST']);// #3561 - it's returing empty that is why it's creating broken link. So checking empty condition and returning 1 to not create amp link.
[577] Fix | Delete
if($check==""){
[578] Fix | Delete
return 1;
[579] Fix | Delete
}else{
[580] Fix | Delete
return $check;
[581] Fix | Delete
}
[582] Fix | Delete
}
[583] Fix | Delete
} // end ampforwp_isexternal
[584] Fix | Delete
[585] Fix | Delete
if(!function_exists('ampforwp_findInternalUrl')){
[586] Fix | Delete
function ampforwp_findInternalUrl($url){
[587] Fix | Delete
if(function_exists('googlesitekit_activate_plugin')){
[588] Fix | Delete
if(strpos($url, '_gl') !== false){
[589] Fix | Delete
$url = remove_query_arg( '_gl', $url);
[590] Fix | Delete
//remove ? from jump links.
[591] Fix | Delete
if(strpos($url, '?#') === 0){
[592] Fix | Delete
$url = str_replace('?#', '#', $url);
[593] Fix | Delete
}
[594] Fix | Delete
}
[595] Fix | Delete
}
[596] Fix | Delete
global $redux_builder_amp;
[597] Fix | Delete
if(isset($redux_builder_amp['convert-internal-nonamplinks-to-amp']) && ! $redux_builder_amp['convert-internal-nonamplinks-to-amp']){
[598] Fix | Delete
return $url;
[599] Fix | Delete
}
[600] Fix | Delete
$get_skip_media_path = array();
[601] Fix | Delete
$skip_media_extensions = array();
[602] Fix | Delete
$get_skip_media_path = pathinfo($url);
[603] Fix | Delete
$skip_media_extensions = array('jpg','jpeg','gif','png');
[604] Fix | Delete
[605] Fix | Delete
if ( isset( $get_skip_media_path['extension'] ) && !empty($get_skip_media_path['extension'])){
[606] Fix | Delete
if (! in_array( $get_skip_media_path['extension'], $skip_media_extensions ) && !strpos(get_option( 'permalink_structure' ), $get_skip_media_path['extension'])){
[607] Fix | Delete
$skip_media_extensions[] = $get_skip_media_path['extension'];
[608] Fix | Delete
}
[609] Fix | Delete
}
[610] Fix | Delete
$skip_media_extensions = apply_filters( 'ampforwp_internal_links_skip_media', $skip_media_extensions );
[611] Fix | Delete
[612] Fix | Delete
if ( isset( $get_skip_media_path['extension'] ) ){
[613] Fix | Delete
if( in_array( $get_skip_media_path['extension'], $skip_media_extensions ) ) {
[614] Fix | Delete
return $url;
[615] Fix | Delete
}
[616] Fix | Delete
}
[617] Fix | Delete
if ( false !== strpos($url, '#') && false === ampforwp_is_amp_inURL($url) && !ampforwp_isexternal($url) ) {
[618] Fix | Delete
$url_array = explode('#', $url);
[619] Fix | Delete
if ( !empty($url_array) && '' !== $url_array[0]) {
[620] Fix | Delete
$url = ampforwp_url_controller($url_array[0]).'#'.$url_array[1];
[621] Fix | Delete
return $url;
[622] Fix | Delete
}
[623] Fix | Delete
}
[624] Fix | Delete
if( false === wp_http_validate_url($url) ) {
[625] Fix | Delete
return $url;
[626] Fix | Delete
}
[627] Fix | Delete
if(!ampforwp_isexternal($url) && ampforwp_is_amp_inURL($url)===false){
[628] Fix | Delete
// Skip the URL's that have edit link to it
[629] Fix | Delete
$parts = parse_url($url);
[630] Fix | Delete
if ( isset($parts['query']) && $parts['query']) {
[631] Fix | Delete
parse_str($parts['query'], $query);
[632] Fix | Delete
}
[633] Fix | Delete
if ( (isset( $query['action'] ) && $query['action']) || (isset( $query['amp'] ) && $query['amp'] ) ) {
[634] Fix | Delete
return $url;
[635] Fix | Delete
}
[636] Fix | Delete
$qmarkAmp = (isset($redux_builder_amp['amp-core-end-point']) ? $redux_builder_amp['amp-core-end-point']: false );//amp-core-end-point
[637] Fix | Delete
if ( $qmarkAmp ){
[638] Fix | Delete
$url = add_query_arg( 'amp', '1', $url);
[639] Fix | Delete
return $url;
[640] Fix | Delete
}
[641] Fix | Delete
else{
[642] Fix | Delete
if ( get_option('permalink_structure') ) {
[643] Fix | Delete
if ( strpos($url, "?") && strpos($url, "=") ){
[644] Fix | Delete
$url = explode('?', $url);
[645] Fix | Delete
$url = ampforwp_url_controller($url[0]).'?'.$url[1];
[646] Fix | Delete
}
[647] Fix | Delete
else
[648] Fix | Delete
$url = ampforwp_url_controller($url);
[649] Fix | Delete
}
[650] Fix | Delete
else
[651] Fix | Delete
$url = add_query_arg( 'amp', '1', $url );
[652] Fix | Delete
}
[653] Fix | Delete
return $url;
[654] Fix | Delete
}
[655] Fix | Delete
return $url;
[656] Fix | Delete
}
[657] Fix | Delete
} // end ampforwp_findInternalUrl
[658] Fix | Delete
[659] Fix | Delete
/* AMPforWP allowed html tags #1950
[660] Fix | Delete
* ampforwp_wp_kses_allowed_html()
[661] Fix | Delete
* This fucntion can be heavy for sanitizing items.
[662] Fix | Delete
* As it scans though all the generated AMP tags and attributes.
[663] Fix | Delete
* Use it cautiously.
[664] Fix | Delete
*/
[665] Fix | Delete
function ampforwp_wp_kses_allowed_html(){
[666] Fix | Delete
$allowed_html = $allowed_normal_html = $allowed_amp_tags = array();
[667] Fix | Delete
$allowed_normal_html = wp_kses_allowed_html( 'post' );
[668] Fix | Delete
if ( class_exists('AMP_Allowed_Tags_Generated') ) {
[669] Fix | Delete
$allowed_amp_tags = AMP_Allowed_Tags_Generated::get_allowed_tags();
[670] Fix | Delete
$allowed_atts = AMP_Allowed_Tags_Generated::get_allowed_attributes();
[671] Fix | Delete
foreach ($allowed_atts as $att => $value) {
[672] Fix | Delete
$allowed_atts[$att] = true;
[673] Fix | Delete
}
[674] Fix | Delete
foreach ($allowed_amp_tags as $amp_tag => $values ) {
[675] Fix | Delete
$allowed_amp_tags[$amp_tag] = $allowed_atts;
[676] Fix | Delete
}
[677] Fix | Delete
}
[678] Fix | Delete
$allowed_html = array_merge_recursive($allowed_normal_html, $allowed_amp_tags);
[679] Fix | Delete
if( $allowed_html ) {
[680] Fix | Delete
foreach ( $allowed_html as $tag => $atts ) {
[681] Fix | Delete
if ( is_array($atts) ){
[682] Fix | Delete
unset($allowed_html[$tag]['style']);
[683] Fix | Delete
}
[684] Fix | Delete
if ( 'a' == $tag ) {
[685] Fix | Delete
$allowed_html[$tag]['data-toggle'] = true;
[686] Fix | Delete
}
[687] Fix | Delete
if ( 'label' == $tag ) {
[688] Fix | Delete
$allowed_html[$tag]['aria-label'] = true;
[689] Fix | Delete
}
[690] Fix | Delete
if ( 'amp-img' == $tag ) {
[691] Fix | Delete
$allowed_html[$tag] = array('width'=>true,'height'=>true,'src'=>true,'layout'=>true,'alt'=>true,'on'=>true,'role'=>true,'tabindex'=>true);
[692] Fix | Delete
}
[693] Fix | Delete
}
[694] Fix | Delete
$allowed_html['input'] = array('class'=>true,'type'=>true,'id'=>true,'placeholder'=>true,'value'=>true,'name'=>true);
[695] Fix | Delete
}
[696] Fix | Delete
return $allowed_html;
[697] Fix | Delete
}
[698] Fix | Delete
function ampforwp_wp_kses($data){
[699] Fix | Delete
$allowed_html = ampforwp_wp_kses_allowed_html();
[700] Fix | Delete
$data = wp_kses( stripslashes( $data ), $allowed_html );
[701] Fix | Delete
return $data;
[702] Fix | Delete
}
[703] Fix | Delete
[704] Fix | Delete
//93. added AMP url purifire for amphtml
[705] Fix | Delete
function ampforwp_url_purifier($url){
[706] Fix | Delete
global $wp_query,$wp,$redux_builder_amp;
[707] Fix | Delete
$get_permalink_structure = "";
[708] Fix | Delete
$endpoint = "";
[709] Fix | Delete
$endpointq = "";
[710] Fix | Delete
$queried_var = "";
[711] Fix | Delete
$quried_value = "";
[712] Fix | Delete
$query_arg = "";
[713] Fix | Delete
$wpml_lang_checker = true;
[714] Fix | Delete
$endpoint = AMPFORWP_AMP_QUERY_VAR;
[715] Fix | Delete
$get_permalink_structure = get_option('permalink_structure');
[716] Fix | Delete
$checker = isset($redux_builder_amp['amp-core-end-point']) ? $redux_builder_amp['amp-core-end-point'] : false;
[717] Fix | Delete
$endpointq = '?' . $endpoint;
[718] Fix | Delete
if ( empty( $get_permalink_structure ) ) {
[719] Fix | Delete
if ( is_home() || is_archive() || is_front_page() ) {
[720] Fix | Delete
$url = add_query_arg(AMPFORWP_AMP_QUERY_VAR,'1', $url);
[721] Fix | Delete
if ( is_home() && get_query_var('page_id') == ampforwp_get_blog_details('id') ) {
[722] Fix | Delete
$quried_value = get_query_var('page_id');
[723] Fix | Delete
if ( '' != $quried_value)
[724] Fix | Delete
$url = add_query_arg('page_id',$quried_value, $url);
[725] Fix | Delete
}
[726] Fix | Delete
if ( get_query_var('paged') >= 2 ) {
[727] Fix | Delete
$quried_value = get_query_var('paged');
[728] Fix | Delete
$url = add_query_arg('paged',$quried_value, $url);
[729] Fix | Delete
}
[730] Fix | Delete
}
[731] Fix | Delete
if ( is_archive() ) {
[732] Fix | Delete
if ( is_archive() ) {
[733] Fix | Delete
$queried_var = 'm';
[734] Fix | Delete
}
[735] Fix | Delete
if ( is_tag() ) {
[736] Fix | Delete
$queried_var = 'tag';
[737] Fix | Delete
}
[738] Fix | Delete
if ( is_category() ) {
[739] Fix | Delete
$queried_var = 'cat';
[740] Fix | Delete
}
[741] Fix | Delete
if ( is_author() ) {
[742] Fix | Delete
$queried_var = 'author';
[743] Fix | Delete
}
[744] Fix | Delete
$quried_value = get_query_var($queried_var);
[745] Fix | Delete
$url = add_query_arg($queried_var,$quried_value, $url);
[746] Fix | Delete
}
[747] Fix | Delete
} else {
[748] Fix | Delete
if ( is_singular() && true == $checker ) {
[749] Fix | Delete
$url = untrailingslashit($url);
[750] Fix | Delete
}
[751] Fix | Delete
// WPML compatibility
[752] Fix | Delete
if( class_exists('SitePress') ){
[753] Fix | Delete
if( get_option('permalink_structure') ){
[754] Fix | Delete
global $sitepress_settings, $wp;
[755] Fix | Delete
$wpml_lang_checker = false;
[756] Fix | Delete
if($sitepress_settings[ 'language_negotiation_type' ] == 3){
[757] Fix | Delete
if( is_singular() ){
[758] Fix | Delete
$active_langs = $sitepress_settings['active_languages'];
[759] Fix | Delete
$found = '';
[760] Fix | Delete
$wpml_url =get_permalink( get_queried_object_id() );
[761] Fix | Delete
$untrail_wpml_url = untrailingslashit($wpml_url);
[762] Fix | Delete
$explode_url = explode('/', $untrail_wpml_url);
[763] Fix | Delete
$append_amp = AMPFORWP_AMP_QUERY_VAR;
[764] Fix | Delete
foreach ($active_langs as $active_lang) {
[765] Fix | Delete
foreach($explode_url as $a) {
[766] Fix | Delete
if (stripos('?lang='.$active_lang ,$a) !== false){
[767] Fix | Delete
$url = add_query_arg('amp','1',$wpml_url);
[768] Fix | Delete
$found = 'found';
[769] Fix | Delete
break 2;
[770] Fix | Delete
}
[771] Fix | Delete
}
[772] Fix | Delete
}
[773] Fix | Delete
if($found == ''){
[774] Fix | Delete
array_splice( $explode_url, count($explode_url), 0, $append_amp );
[775] Fix | Delete
$impode_url = implode('/', $explode_url);
[776] Fix | Delete
$url = user_trailingslashit($impode_url);
[777] Fix | Delete
}
[778] Fix | Delete
}
[779] Fix | Delete
if ( is_home() || is_archive() ){
[780] Fix | Delete
global $wp;
[781] Fix | Delete
$current_archive_url = home_url( $wp->request );
[782] Fix | Delete
$explode_path = explode("/",$current_archive_url);
[783] Fix | Delete
$inserted = array(AMPFORWP_AMP_QUERY_VAR);
[784] Fix | Delete
$query_arg_array = $wp->query_vars;
[785] Fix | Delete
if( array_key_exists( 'paged' , $query_arg_array ) ) {
[786] Fix | Delete
$active_langs = $sitepress_settings['active_languages'];
[787] Fix | Delete
$found = '';
[788] Fix | Delete
foreach ($active_langs as $active_lang) {
[789] Fix | Delete
[790] Fix | Delete
foreach($explode_path as $a) {
[791] Fix | Delete
if (stripos('?lang='.$active_lang ,$a) !== false){
[792] Fix | Delete
$url = add_query_arg('amp','1',$current_archive_url);
[793] Fix | Delete
$found = 'found';
[794] Fix | Delete
break 2;
[795] Fix | Delete
}
[796] Fix | Delete
}
[797] Fix | Delete
}
[798] Fix | Delete
if($found == ''){
[799] Fix | Delete
array_splice( $explode_path, count($explode_path), 0, $inserted );
[800] Fix | Delete
$impode_url = implode('/', $explode_path);
[801] Fix | Delete
$url = user_trailingslashit($impode_url);
[802] Fix | Delete
[803] Fix | Delete
}
[804] Fix | Delete
}
[805] Fix | Delete
else{
[806] Fix | Delete
$active_langs = $sitepress_settings['active_languages'];
[807] Fix | Delete
$found = '';
[808] Fix | Delete
foreach ($active_langs as $active_lang) {
[809] Fix | Delete
[810] Fix | Delete
foreach($explode_path as $a) {
[811] Fix | Delete
if (stripos('?lang='.$active_lang ,$a) !== false){
[812] Fix | Delete
$url = add_query_arg('amp','1',$current_archive_url);
[813] Fix | Delete
$found = 'found';
[814] Fix | Delete
break 2;
[815] Fix | Delete
}
[816] Fix | Delete
}
[817] Fix | Delete
}
[818] Fix | Delete
if($found == ''){
[819] Fix | Delete
array_splice( $explode_path, count($explode_path), 0, $inserted );
[820] Fix | Delete
$impode_url = implode('/', $explode_path);
[821] Fix | Delete
$url = $impode_url;
[822] Fix | Delete
[823] Fix | Delete
}
[824] Fix | Delete
}
[825] Fix | Delete
}
[826] Fix | Delete
}else{
[827] Fix | Delete
$wpml_lang_checker = true;
[828] Fix | Delete
}
[829] Fix | Delete
}
[830] Fix | Delete
$url = esc_url($url);
[831] Fix | Delete
$active_langs = $sitepress_settings['active_languages'];
[832] Fix | Delete
foreach ($active_langs as $active_lang) {
[833] Fix | Delete
if (preg_match('/\?lang='.$active_lang.'/', $url)){
[834] Fix | Delete
$url = str_replace('&amp=1', '', $url);
[835] Fix | Delete
if(false == ampforwp_get_setting('amp-core-end-point')){
[836] Fix | Delete
$url = str_replace('?lang='.$active_lang, 'amp/', $url);
[837] Fix | Delete
}else{
[838] Fix | Delete
$url = str_replace('?lang='.$active_lang, '?amp=1', $url);
[839] Fix | Delete
}
[840] Fix | Delete
$url = add_query_arg( 'lang',$active_lang, $url);
[841] Fix | Delete
}
[842] Fix | Delete
}
[843] Fix | Delete
}
[844] Fix | Delete
if ( true == $wpml_lang_checker && ( is_home() || is_archive() || is_front_page() ) ) {
[845] Fix | Delete
if ( ( is_archive() || is_home() ) && get_query_var('paged') > 1 ) {
[846] Fix | Delete
if ( true == $checker )
[847] Fix | Delete
$url = trailingslashit($url).$endpointq;
[848] Fix | Delete
else
[849] Fix | Delete
$url = user_trailingslashit( trailingslashit($url) );
[850] Fix | Delete
} else {
[851] Fix | Delete
if ( true == $checker && false == strpos($url, $endpointq) )
[852] Fix | Delete
$url = trailingslashit($url) . $endpointq;
[853] Fix | Delete
else {
[854] Fix | Delete
$checker = explode('/', $url);
[855] Fix | Delete
$amp_check = in_array($endpoint, $checker);
[856] Fix | Delete
if ( false == $amp_check ) {
[857] Fix | Delete
$url = user_trailingslashit( trailingslashit($url) . $endpoint );
[858] Fix | Delete
}
[859] Fix | Delete
if ( true == $amp_check ) {
[860] Fix | Delete
$url = user_trailingslashit( trailingslashit($url) . $endpoint);
[861] Fix | Delete
}
[862] Fix | Delete
}
[863] Fix | Delete
}
[864] Fix | Delete
}
[865] Fix | Delete
}
[866] Fix | Delete
if ( is_singular() && !empty($_SERVER['QUERY_STRING']) ) {
[867] Fix | Delete
$query_arg = wp_parse_args($_SERVER['QUERY_STRING']);
[868] Fix | Delete
$query_name = '';
[869] Fix | Delete
if(is_single()){
[870] Fix | Delete
$query_name = isset($wp_query->query['name'])?$wp_query->query['name']:'';
[871] Fix | Delete
}
[872] Fix | Delete
else{
[873] Fix | Delete
$query_name = isset($wp_query->query['pagename'])?$wp_query->query['pagename']:'';
[874] Fix | Delete
}
[875] Fix | Delete
if ( $query_name && isset( $query_arg['q'] ) ){
[876] Fix | Delete
unset($query_arg['q']);
[877] Fix | Delete
}
[878] Fix | Delete
$url = add_query_arg( $query_arg, $url);
[879] Fix | Delete
}
[880] Fix | Delete
return apply_filters( 'ampforwp_url_purifier', $url );
[881] Fix | Delete
}
[882] Fix | Delete
// 98. Create Dynamic url of amp according to the permalink structure #1318
[883] Fix | Delete
function ampforwp_url_controller( $url, $nonamp = '' ) {
[884] Fix | Delete
global $redux_builder_amp;
[885] Fix | Delete
$non_amp = false;
[886] Fix | Delete
$non_amp = apply_filters( 'ampforwp_non_amp_links', $non_amp );
[887] Fix | Delete
if($non_amp == true){
[888] Fix | Delete
return $url;
[889] Fix | Delete
}
[890] Fix | Delete
$new_url = "";
[891] Fix | Delete
$get_permalink_structure = "";
[892] Fix | Delete
$mob_pres_link = false;
[893] Fix | Delete
if(function_exists('ampforwp_mobile_redirect_preseve_link')){
[894] Fix | Delete
$mob_pres_link = ampforwp_mobile_redirect_preseve_link();
[895] Fix | Delete
}
[896] Fix | Delete
if ( ampforwp_amp_nonamp_convert("", "check") || ($mob_pres_link == true || true == ampforwp_get_setting('ampforwp-amp-takeover'))) {
[897] Fix | Delete
$nonamp = 'nonamp';
[898] Fix | Delete
}
[899] Fix | Delete
if ( isset($nonamp) && 'nonamp' == $nonamp ) {
[900] Fix | Delete
return $url;
[901] Fix | Delete
}
[902] Fix | Delete
$get_permalink_structure = get_option('permalink_structure');
[903] Fix | Delete
if ( $get_permalink_structure ) {
[904] Fix | Delete
if(true == ampforwp_get_setting('amp-core-end-point')){
[905] Fix | Delete
$new_url = user_trailingslashit($url);
[906] Fix | Delete
$new_url = add_query_arg( 'amp', '', $new_url );
[907] Fix | Delete
}
[908] Fix | Delete
else {
[909] Fix | Delete
$new_url = user_trailingslashit( trailingslashit( $url ) . AMPFORWP_AMP_QUERY_VAR);
[910] Fix | Delete
// WPML COMPATIBILITY FOR LOOP
[911] Fix | Delete
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
[912] Fix | Delete
if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
[913] Fix | Delete
global $sitepress_settings,$wp;
[914] Fix | Delete
if($sitepress_settings[ 'language_negotiation_type' ] == 3){
[915] Fix | Delete
$current_archive_url = untrailingslashit($url);
[916] Fix | Delete
$explode_path = explode("/",$current_archive_url);
[917] Fix | Delete
$inserted = array(AMPFORWP_AMP_QUERY_VAR);
[918] Fix | Delete
$query_arg_array = $wp->query_vars;
[919] Fix | Delete
$active_langs = $sitepress_settings['active_languages'];
[920] Fix | Delete
$found = '';
[921] Fix | Delete
foreach ($active_langs as $active_lang) {
[922] Fix | Delete
foreach($explode_path as $a) {
[923] Fix | Delete
if (stripos('?lang='.$active_lang ,$a) !== false){
[924] Fix | Delete
$new_url = add_query_arg('amp','1',$current_archive_url);
[925] Fix | Delete
$found = 'found';
[926] Fix | Delete
break 2;
[927] Fix | Delete
}
[928] Fix | Delete
}
[929] Fix | Delete
}
[930] Fix | Delete
if($found == ''){
[931] Fix | Delete
array_splice( $explode_path, count($explode_path), 0, $inserted );
[932] Fix | Delete
$impode_url = implode('/', $explode_path);
[933] Fix | Delete
$new_url = $impode_url;
[934] Fix | Delete
}
[935] Fix | Delete
}
[936] Fix | Delete
}
[937] Fix | Delete
}
[938] Fix | Delete
} else {
[939] Fix | Delete
$new_url = add_query_arg( 'amp', '1', $url );
[940] Fix | Delete
}
[941] Fix | Delete
return esc_url( apply_filters( 'ampforwp_url_controller', $new_url ) );
[942] Fix | Delete
}
[943] Fix | Delete
[944] Fix | Delete
// Function ampforwp_amp_nonamp_convert
[945] Fix | Delete
if(!function_exists('ampforwp_amp_nonamp_convert')){
[946] Fix | Delete
function ampforwp_amp_nonamp_convert($ampData, $type=""){
[947] Fix | Delete
$returnData = '';
[948] Fix | Delete
if("check" === $type){
[949] Fix | Delete
return ampforwp_is_non_amp('non_amp_check_convert');
[950] Fix | Delete
}
[951] Fix | Delete
if(!ampforwp_is_non_amp('non_amp_check_convert')){
[952] Fix | Delete
return $ampData;
[953] Fix | Delete
}
[954] Fix | Delete
switch($type){
[955] Fix | Delete
case 'filter':
[956] Fix | Delete
$returnData = str_replace(array(
[957] Fix | Delete
"amp-img",
[958] Fix | Delete
"<style amp-custom>",
[959] Fix | Delete
"<amp-sidebar ",
[960] Fix | Delete
"</amp-sidebar>",
[961] Fix | Delete
'on="tap:ampforwpConsent.dismiss"',
[962] Fix | Delete
'<div id="post-consent-ui"',
[963] Fix | Delete
'on="tap:ampforwpConsent.reject"',
[964] Fix | Delete
'on="tap:ampforwpConsent.accept"'
[965] Fix | Delete
),
[966] Fix | Delete
array(
[967] Fix | Delete
"img",
[968] Fix | Delete
"<style type=\"text/css\">",
[969] Fix | Delete
"<sidebar ",
[970] Fix | Delete
"</sidebar>",
[971] Fix | Delete
'onClick="ampforwp_gdrp_set()"',
[972] Fix | Delete
'<script>
[973] Fix | Delete
function ampforwp_gdpr_getCookie(name) {
[974] Fix | Delete
var value = "; " + document.cookie;
[975] Fix | Delete
var parts = value.split("; " + name + "=");
[976] Fix | Delete
if (parts.length == 2) return parts.pop().split(";").shift();
[977] Fix | Delete
}
[978] Fix | Delete
function ampforwp_gdpr(){
[979] Fix | Delete
if(ampforwp_gdpr_getCookie(\'ampforwpcookie\') == \'1\'){document.getElementById(\'gdpr_c\').remove();}
[980] Fix | Delete
}ampforwp_gdpr();
[981] Fix | Delete
function ampforwp_gdrp_set(){document.getElementById(\'ampforwpConsent\').remove(); document.cookie = \'ampforwpcookie=1;expires;path=/\';}
[982] Fix | Delete
</script><div id="post-consent-ui"',
[983] Fix | Delete
'onClick="ampforwp_gdrp_set()"',
[984] Fix | Delete
'onClick="ampforwp_gdrp_set()"',
[985] Fix | Delete
)
[986] Fix | Delete
, $ampData);
[987] Fix | Delete
// CSS
[988] Fix | Delete
[989] Fix | Delete
if( false !== strpos($returnData, 'amp-carousel') ) {
[990] Fix | Delete
$galleryCss = '* {box-sizing: border-box}.mySlides{display: none}
[991] Fix | Delete
/* Slideshow container */
[992] Fix | Delete
.slideshow-container {
[993] Fix | Delete
max-width: 1000px;
[994] Fix | Delete
position: relative;
[995] Fix | Delete
margin: auto;
[996] Fix | Delete
}
[997] Fix | Delete
/* Next & previous buttons */
[998] Fix | Delete
.nonamp-prev, .nonamp-next {
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function