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.../template...
File: design-manager.php
<?php
[0] Fix | Delete
// Exit if accessed directly
[1] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[2] Fix | Delete
exit;
[3] Fix | Delete
}
[4] Fix | Delete
if ( is_customize_preview() ) {
[5] Fix | Delete
// Load all the elements in the customizer as we want all the elements in design-manager
[6] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_the_title' );
[7] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_meta_info' );
[8] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_featured_image' );
[9] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_the_content' );
[10] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_meta_taxonomy' );
[11] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_social_icons' );
[12] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_comments' );
[13] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_related_posts' );
[14] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_bread_crumbs' );
[15] Fix | Delete
}
[16] Fix | Delete
// Design Selector
[17] Fix | Delete
add_action('pre_amp_render_post','ampforwp_design_selector', 11 );
[18] Fix | Delete
function ampforwp_design_selector() {
[19] Fix | Delete
$url_path = trim(parse_url(add_query_arg(array()), PHP_URL_PATH),'/' );
[20] Fix | Delete
if( function_exists('ampforwp_is_amp_inURL') && ampforwp_is_amp_inURL($url_path)) {
[21] Fix | Delete
$design = ampforwp_get_setting('amp-design-selector');
[22] Fix | Delete
if ( empty( $design )){
[23] Fix | Delete
$design = 4;
[24] Fix | Delete
}
[25] Fix | Delete
if ( 4 != $design) {
[26] Fix | Delete
$data = get_option( 'ampforwp_design',array());
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
// Adding default Value
[30] Fix | Delete
if (empty($data)){
[31] Fix | Delete
$data['elements'] = "bread_crumbs:1,meta_info:1,title:1,featured_image:1,content:1,meta_taxonomy:1,social_icons:1,comments:1,related_posts:1";
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
if( isset( $data['elements'] ) || ! empty( $data['elements'] ) ){
[35] Fix | Delete
$options = explode( ',', $data['elements'] );
[36] Fix | Delete
};
[37] Fix | Delete
[38] Fix | Delete
if ($options): foreach ($options as $key=>$value) {
[39] Fix | Delete
if ( ! is_customize_preview() ) {
[40] Fix | Delete
switch ($value) {
[41] Fix | Delete
case 'bread_crumbs:1':
[42] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_bread_crumbs' );
[43] Fix | Delete
break;
[44] Fix | Delete
case 'title:1':
[45] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_the_title' );
[46] Fix | Delete
break;
[47] Fix | Delete
case 'meta_info:1':
[48] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_meta_info' );
[49] Fix | Delete
break;
[50] Fix | Delete
case 'featured_image:1':
[51] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_featured_image' );
[52] Fix | Delete
break;
[53] Fix | Delete
case 'content:1':
[54] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_the_content' );
[55] Fix | Delete
break;
[56] Fix | Delete
case 'meta_taxonomy:1':
[57] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_meta_taxonomy' );
[58] Fix | Delete
break;
[59] Fix | Delete
case 'social_icons:1':
[60] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_social_icons' );
[61] Fix | Delete
break;
[62] Fix | Delete
case 'comments:1':
[63] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_comments' );
[64] Fix | Delete
break;
[65] Fix | Delete
case 'related_posts:1':
[66] Fix | Delete
add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_related_posts' );
[67] Fix | Delete
break;
[68] Fix | Delete
[69] Fix | Delete
}
[70] Fix | Delete
}
[71] Fix | Delete
}
[72] Fix | Delete
endif;
[73] Fix | Delete
}
[74] Fix | Delete
$design = '';
[75] Fix | Delete
$design = ampforwp_get_setting('amp-design-selector');
[76] Fix | Delete
if ( empty( $design )){
[77] Fix | Delete
return 4;
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
if ( $design ) {
[81] Fix | Delete
if ( file_exists(AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. $design . '/style.php') ) {
[82] Fix | Delete
return ampforwp_get_setting('amp-design-selector');
[83] Fix | Delete
}
[84] Fix | Delete
elseif ( 4 == $design && file_exists(AMPFORWP_PLUGIN_DIR . 'templates/design-manager/swift/style.php') ) {
[85] Fix | Delete
return ampforwp_get_setting('amp-design-selector');
[86] Fix | Delete
}
[87] Fix | Delete
else {
[88] Fix | Delete
if ( file_exists( WP_PLUGIN_DIR.'/'.$design.'/functions.php' ) ){
[89] Fix | Delete
return $design;
[90] Fix | Delete
} else {
[91] Fix | Delete
return 4;
[92] Fix | Delete
}
[93] Fix | Delete
}
[94] Fix | Delete
return 2;
[95] Fix | Delete
}
[96] Fix | Delete
return 2;
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
add_action('pre_amp_render_post','ampforwp_stylesheet_file_insertion', 12 );
[100] Fix | Delete
function ampforwp_stylesheet_file_insertion() {
[101] Fix | Delete
[102] Fix | Delete
if ( ! ampforwp_design_selector() ) {
[103] Fix | Delete
$ampforwp_design_selector = 4;
[104] Fix | Delete
} else {
[105] Fix | Delete
$ampforwp_design_selector = ampforwp_design_selector();
[106] Fix | Delete
}
[107] Fix | Delete
// Add StyleSheet
[108] Fix | Delete
if ( file_exists(AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. $ampforwp_design_selector . '/style.php') && 4 != $ampforwp_design_selector ) {
[109] Fix | Delete
//require AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. $ampforwp_design_selector . '/style.php';
[110] Fix | Delete
}else {
[111] Fix | Delete
require AMPFORWP_PLUGIN_DIR."/components/theme-loader.php";
[112] Fix | Delete
}
[113] Fix | Delete
}
[114] Fix | Delete
if(4 != ampforwp_design_selector()){
[115] Fix | Delete
add_filter( 'amp_post_template_file', 'ampforwp_design_element_the_title', 10, 3 );
[116] Fix | Delete
add_filter( 'amp_post_template_file', 'ampforwp_design_element_meta_info', 10, 3 );
[117] Fix | Delete
add_filter( 'amp_post_template_file', 'ampforwp_design_element_featured_image', 10, 3 );
[118] Fix | Delete
add_filter( 'amp_post_template_file', 'ampforwp_design_element_bread_crumbs', 10, 3 );
[119] Fix | Delete
add_filter( 'amp_post_template_file', 'ampforwp_design_element_the_content', 10, 3 );
[120] Fix | Delete
add_filter( 'amp_post_template_file', 'ampforwp_design_element_social_icons', 10, 3 );
[121] Fix | Delete
add_filter( 'amp_post_template_file', 'ampforwp_design_element_meta_taxonomy', 10, 3 );
[122] Fix | Delete
add_filter( 'amp_post_template_file', 'ampforwp_design_element_comments', 10, 3 );
[123] Fix | Delete
add_filter( 'amp_post_template_file', 'ampforwp_design_element_related_posts', 10, 3 );
[124] Fix | Delete
add_filter('ampforwp_design_elements', 'ampforwp_empty_design_elements', 12);
[125] Fix | Delete
}
[126] Fix | Delete
// Post Title
[127] Fix | Delete
function ampforwp_add_element_the_title( $meta_parts ) {
[128] Fix | Delete
$meta_parts[] = 'ampforwp-the-title';
[129] Fix | Delete
return $meta_parts;
[130] Fix | Delete
}
[131] Fix | Delete
[132] Fix | Delete
function ampforwp_design_element_the_title( $file, $type, $post ) {
[133] Fix | Delete
if ( 'ampforwp-the-title' === $type ) {
[134] Fix | Delete
$file = AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. ampforwp_design_selector() .'/elements/title.php' ;
[135] Fix | Delete
}
[136] Fix | Delete
return $file;
[137] Fix | Delete
}
[138] Fix | Delete
[139] Fix | Delete
[140] Fix | Delete
// Meta Info
[141] Fix | Delete
function ampforwp_add_element_meta_info( $meta_parts ) {
[142] Fix | Delete
$meta_parts[] = 'ampforwp-meta-info';
[143] Fix | Delete
return $meta_parts;
[144] Fix | Delete
}
[145] Fix | Delete
[146] Fix | Delete
function ampforwp_design_element_meta_info( $file, $type, $post ) {
[147] Fix | Delete
if ( 'ampforwp-meta-info' === $type ) {
[148] Fix | Delete
$file = AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. ampforwp_design_selector() .'/elements/meta-info.php' ;
[149] Fix | Delete
}
[150] Fix | Delete
return $file;
[151] Fix | Delete
}
[152] Fix | Delete
[153] Fix | Delete
// Featured Image
[154] Fix | Delete
function ampforwp_add_element_featured_image( $meta_parts ) {
[155] Fix | Delete
$meta_parts[] = 'ampforwp-featured-image';
[156] Fix | Delete
return $meta_parts;
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
function ampforwp_design_element_featured_image( $file, $type, $post ) {
[160] Fix | Delete
if ( 'ampforwp-featured-image' === $type ) {
[161] Fix | Delete
$file = AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. ampforwp_design_selector() .'/elements/featured-image.php';
[162] Fix | Delete
}
[163] Fix | Delete
return $file;
[164] Fix | Delete
}
[165] Fix | Delete
[166] Fix | Delete
// Bread-Crumbs
[167] Fix | Delete
function ampforwp_add_element_bread_crumbs( $meta_parts ) {
[168] Fix | Delete
$meta_parts[] = 'ampforwp-bread-crumbs';
[169] Fix | Delete
return $meta_parts;
[170] Fix | Delete
}
[171] Fix | Delete
[172] Fix | Delete
function ampforwp_design_element_bread_crumbs( $file, $type, $post ) {
[173] Fix | Delete
if ( 'ampforwp-bread-crumbs' === $type ) {
[174] Fix | Delete
$file = AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. ampforwp_design_selector() .'/elements/bread-crumbs.php' ;
[175] Fix | Delete
}
[176] Fix | Delete
return $file;
[177] Fix | Delete
}
[178] Fix | Delete
// The Content
[179] Fix | Delete
function ampforwp_add_element_the_content( $meta_parts ) {
[180] Fix | Delete
$meta_parts[] = 'ampforwp-the-content';
[181] Fix | Delete
return $meta_parts;
[182] Fix | Delete
}
[183] Fix | Delete
[184] Fix | Delete
function ampforwp_design_element_the_content( $file, $type, $post ) {
[185] Fix | Delete
if ( 'ampforwp-the-content' === $type ) {
[186] Fix | Delete
$file = AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. ampforwp_design_selector() .'/elements/content.php';
[187] Fix | Delete
}
[188] Fix | Delete
return $file;
[189] Fix | Delete
}
[190] Fix | Delete
[191] Fix | Delete
// Meta Texonomy
[192] Fix | Delete
function ampforwp_add_element_meta_taxonomy( $meta_parts ) {
[193] Fix | Delete
$meta_parts[] = 'ampforwp-meta-taxonomy';
[194] Fix | Delete
return $meta_parts;
[195] Fix | Delete
}
[196] Fix | Delete
[197] Fix | Delete
function ampforwp_design_element_meta_taxonomy( $file, $type, $post ) {
[198] Fix | Delete
if ( 'ampforwp-meta-taxonomy' === $type ) {
[199] Fix | Delete
$file = AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. ampforwp_design_selector() .'/elements/meta-taxonomy.php';
[200] Fix | Delete
}
[201] Fix | Delete
return $file;
[202] Fix | Delete
}
[203] Fix | Delete
[204] Fix | Delete
// Social Icons
[205] Fix | Delete
function ampforwp_add_element_social_icons( $meta_parts ) {
[206] Fix | Delete
$meta_parts[] = 'ampforwp-social-icons';
[207] Fix | Delete
return $meta_parts;
[208] Fix | Delete
}
[209] Fix | Delete
[210] Fix | Delete
function ampforwp_design_element_social_icons( $file, $type, $post ) {
[211] Fix | Delete
if ( 'ampforwp-social-icons' === $type ) {
[212] Fix | Delete
$file = AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. ampforwp_design_selector() .'/elements/social-icons.php';
[213] Fix | Delete
}
[214] Fix | Delete
return $file;
[215] Fix | Delete
}
[216] Fix | Delete
[217] Fix | Delete
[218] Fix | Delete
// Comments
[219] Fix | Delete
function ampforwp_add_element_comments( $meta_parts ) {
[220] Fix | Delete
$meta_parts[] = 'ampforwp-comments';
[221] Fix | Delete
return $meta_parts;
[222] Fix | Delete
}
[223] Fix | Delete
[224] Fix | Delete
function ampforwp_design_element_comments( $file, $type, $post ) {
[225] Fix | Delete
if ( 'ampforwp-comments' === $type ) {
[226] Fix | Delete
$file = AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. ampforwp_design_selector() .'/elements/comments.php';
[227] Fix | Delete
}
[228] Fix | Delete
return $file;
[229] Fix | Delete
}
[230] Fix | Delete
[231] Fix | Delete
// Related Posts
[232] Fix | Delete
function ampforwp_add_element_related_posts( $meta_parts ) {
[233] Fix | Delete
$meta_parts[] = 'ampforwp-related-posts';
[234] Fix | Delete
return $meta_parts;
[235] Fix | Delete
}
[236] Fix | Delete
[237] Fix | Delete
function ampforwp_design_element_related_posts( $file, $type, $post ) {
[238] Fix | Delete
if ( 'ampforwp-related-posts' === $type ) {
[239] Fix | Delete
$file = AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. ampforwp_design_selector() .'/elements/related-posts.php';
[240] Fix | Delete
}
[241] Fix | Delete
return $file;
[242] Fix | Delete
}
[243] Fix | Delete
[244] Fix | Delete
// Empty meta parts when Pagebuilder is enabled
[245] Fix | Delete
function ampforwp_empty_design_elements($meta_parts) {
[246] Fix | Delete
if( checkAMPforPageBuilderStatus(get_the_ID()) ){
[247] Fix | Delete
$meta_parts = array();
[248] Fix | Delete
$meta_parts[] = 'ampforwp-the-content';
[249] Fix | Delete
}
[250] Fix | Delete
return $meta_parts;
[251] Fix | Delete
} ?>
[252] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function