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.../pagebuil.../inc
File: viewShowFrontData.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
/***
[5] Fix | Delete
Show Front Data
[6] Fix | Delete
****/
[7] Fix | Delete
[8] Fix | Delete
add_action('pre_amp_render_post','amp_pagebuilder_content');
[9] Fix | Delete
function amp_pagebuilder_content(){
[10] Fix | Delete
global $post, $redux_builder_amp;
[11] Fix | Delete
[12] Fix | Delete
$postId = (is_object($post) ? $post->ID : '');
[13] Fix | Delete
[14] Fix | Delete
if( ampforwp_is_front_page() ){
[15] Fix | Delete
$postId = ampforwp_get_frontpage_id();
[16] Fix | Delete
}
[17] Fix | Delete
if ( ampforwp_polylang_front_page() ) {
[18] Fix | Delete
$front_page_id = get_option('page_on_front');
[19] Fix | Delete
if($front_page_id){
[20] Fix | Delete
$postId = pll_get_post($front_page_id);
[21] Fix | Delete
}
[22] Fix | Delete
}
[23] Fix | Delete
[24] Fix | Delete
add_filter( 'amp_pagebuilder_content', 'ampforwp_insert_pb_content' );
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
function bodyClassForAMPPagebuilder($classes, $class){
[28] Fix | Delete
$classes[] = 'amppb-pages';
[29] Fix | Delete
return $classes;
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
function ampforwp_insert_pb_content( $content ){
[33] Fix | Delete
$new_content = "";
[34] Fix | Delete
$new_content = amppb_post_content($content);
[35] Fix | Delete
$content = $new_content;
[36] Fix | Delete
return $content;
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
add_action('amp_post_template_head','ampforwp_pagebuilder_header_html_output',11);
[40] Fix | Delete
function ampforwp_pagebuilder_header_html_output(){
[41] Fix | Delete
//To load css of modules which are in use
[42] Fix | Delete
global $redux_builder_amp, $moduleTemplate, $post, $containerCommonSettings;
[43] Fix | Delete
[44] Fix | Delete
$postId = (is_object($post)? $post->ID: '');
[45] Fix | Delete
if( ampforwp_is_front_page() ){
[46] Fix | Delete
$postId = ampforwp_get_frontpage_id();
[47] Fix | Delete
}
[48] Fix | Delete
$previousData = get_post_meta($postId,'amp-page-builder');
[49] Fix | Delete
$previousData = isset($previousData[0])? $previousData[0]: null;
[50] Fix | Delete
$ampforwp_pagebuilder_enable = get_post_meta($postId,'ampforwp_page_builder_enable', true);
[51] Fix | Delete
if($previousData!="" && $ampforwp_pagebuilder_enable=='yes'){
[52] Fix | Delete
$previousData = json_decode($previousData,true);
[53] Fix | Delete
if(isset($previousData['settingdata']['scripts_data']) && $previousData['settingdata']['scripts_data']!=""){
[54] Fix | Delete
preg_match_all("/<script(?:(?!src).)*>(.*?)<\/script>/",$previousData['settingdata']['scripts_data'], $outremove, PREG_SET_ORDER);
[55] Fix | Delete
if($outremove && count($outremove)>0){
[56] Fix | Delete
foreach($outremove as $unwanted){
[57] Fix | Delete
$previousData['settingdata']['scripts_data'] = str_replace($unwanted[0], '', $previousData['settingdata']['scripts_data']);
[58] Fix | Delete
}
[59] Fix | Delete
}
[60] Fix | Delete
echo $previousData['settingdata']['scripts_data']; // nothing to escaped
[61] Fix | Delete
}
[62] Fix | Delete
}
[63] Fix | Delete
}
[64] Fix | Delete
add_action('amp_post_template_data','amp_pagebuilder_script_loader',100);
[65] Fix | Delete
function amp_pagebuilder_script_loader($scriptData){
[66] Fix | Delete
//To load css of modules which are in use
[67] Fix | Delete
global $redux_builder_amp, $moduleTemplate, $post, $containerCommonSettings;
[68] Fix | Delete
[69] Fix | Delete
$postId = (is_object($post)? $post->ID: '');
[70] Fix | Delete
if( ampforwp_is_front_page() ){
[71] Fix | Delete
$postId = ampforwp_get_frontpage_id();
[72] Fix | Delete
}
[73] Fix | Delete
$previousData = get_post_meta($postId,'amp-page-builder');
[74] Fix | Delete
$previousData = isset($previousData[0])? $previousData[0]: null;
[75] Fix | Delete
$ampforwp_pagebuilder_enable = get_post_meta($postId,'ampforwp_page_builder_enable', true);
[76] Fix | Delete
if($previousData!="" && $ampforwp_pagebuilder_enable=='yes'){
[77] Fix | Delete
$previousData = json_decode($previousData,true);
[78] Fix | Delete
if(isset($previousData['rows']) && count($previousData['rows'])>0){
[79] Fix | Delete
foreach ($previousData['rows'] as $key => $rowsData) {
[80] Fix | Delete
$container = $rowsData['cell_data'];
[81] Fix | Delete
if(count($container)>0){
[82] Fix | Delete
//Module specific styles
[83] Fix | Delete
$moduleCommonCss = array();
[84] Fix | Delete
foreach($container as $contentArray){
[85] Fix | Delete
if(!isset($moduleTemplate[$contentArray['type']])){
[86] Fix | Delete
continue;
[87] Fix | Delete
}
[88] Fix | Delete
foreach($moduleTemplate[$contentArray['type']]['fields'] as $modulefield){
[89] Fix | Delete
$replaceModule = "";
[90] Fix | Delete
if(isset($contentArray[$modulefield['name']])){
[91] Fix | Delete
$replaceModule = $contentArray[$modulefield['name']];
[92] Fix | Delete
}
[93] Fix | Delete
if($modulefield['content_type']=='js'){
[94] Fix | Delete
[95] Fix | Delete
if(isset($modulefield['required']) && count($modulefield['required'])>0){
[96] Fix | Delete
foreach($modulefield['required'] as $requiredKey=>$requiredValue){
[97] Fix | Delete
$userSelectedvalue = (isset($contentArray[$requiredKey])? $contentArray[$requiredKey]: "");
[98] Fix | Delete
if($userSelectedvalue != $requiredValue){
[99] Fix | Delete
$replaceModule ='';
[100] Fix | Delete
}
[101] Fix | Delete
}
[102] Fix | Delete
}//Require IF Closed
[103] Fix | Delete
[104] Fix | Delete
if ($replaceModule !="" && empty( $scriptData['amp_component_scripts'][$modulefield['label']] ) ) {
[105] Fix | Delete
$scriptData['amp_component_scripts'][$modulefield['label']] = $replaceModule;
[106] Fix | Delete
}
[107] Fix | Delete
}//content_type Check if Closed
[108] Fix | Delete
}
[109] Fix | Delete
[110] Fix | Delete
}
[111] Fix | Delete
}
[112] Fix | Delete
}
[113] Fix | Delete
}
[114] Fix | Delete
[115] Fix | Delete
[116] Fix | Delete
}
[117] Fix | Delete
[118] Fix | Delete
[119] Fix | Delete
[120] Fix | Delete
[121] Fix | Delete
return $scriptData;
[122] Fix | Delete
}
[123] Fix | Delete
[124] Fix | Delete
add_action('amp_post_template_css','amp_pagebuilder_content_styles',100);
[125] Fix | Delete
function amp_pagebuilder_content_styles(){
[126] Fix | Delete
//To load css of modules which are in use
[127] Fix | Delete
global $redux_builder_amp, $moduleTemplate, $post, $containerCommonSettings;
[128] Fix | Delete
$completeCssOfPB = '';
[129] Fix | Delete
$postId = (is_object($post)? $post->ID: '');
[130] Fix | Delete
if( ampforwp_is_front_page() ) {
[131] Fix | Delete
$postId = ampforwp_get_frontpage_id();
[132] Fix | Delete
}
[133] Fix | Delete
if ( ampforwp_polylang_front_page() ) {
[134] Fix | Delete
$front_page_id = get_option('page_on_front');
[135] Fix | Delete
if($front_page_id){
[136] Fix | Delete
$postId = pll_get_post($front_page_id);
[137] Fix | Delete
}
[138] Fix | Delete
}
[139] Fix | Delete
$previousData = get_post_meta($postId,'amp-page-builder');
[140] Fix | Delete
$previousData = isset($previousData[0])? $previousData[0]: null;
[141] Fix | Delete
$ampforwp_pagebuilder_enable = get_post_meta($postId,'ampforwp_page_builder_enable', true);
[142] Fix | Delete
if($previousData!="" && $ampforwp_pagebuilder_enable=='yes'){
[143] Fix | Delete
[144] Fix | Delete
$completeCssOfPB .= '.amp_pb{display: inline-block;width: 100%;}
[145] Fix | Delete
.row{display: inline-flex;width: 100%;}
[146] Fix | Delete
.col-2{ width: calc(50% - 5px);float:left;}
[147] Fix | Delete
.col-2-wrap .col-2:nth-child(1){
[148] Fix | Delete
padding-right:5px;
[149] Fix | Delete
}
[150] Fix | Delete
.col-2-wrap .col-2:nth-child(2){
[151] Fix | Delete
padding-left:5px;
[152] Fix | Delete
}
[153] Fix | Delete
.cb{clear:both;}
[154] Fix | Delete
.amp_blurb{text-align:center}
[155] Fix | Delete
.amp_blurb amp-img{margin: 0 auto;}
[156] Fix | Delete
.amp_btn{text-align:center}
[157] Fix | Delete
.amp_btn a{background: #f92c8b;color: #fff;padding: 9px 20px;border-radius: 3px;display: inline-block;box-shadow: 1px 1px 4px #ccc;}
[158] Fix | Delete
[159] Fix | Delete
[160] Fix | Delete
@media(max-width:1024px){
[161] Fix | Delete
.amppb-fixed{width:100%;}
[162] Fix | Delete
}
[163] Fix | Delete
@media(max-width:425px){
[164] Fix | Delete
.col-2{width:100%;float:none;margin-bottom:10%;}
[165] Fix | Delete
.col-2-wrap .col-2:nth-child(1){padding-right:0px;}
[166] Fix | Delete
.col-2-wrap .col-2:nth-child(2){padding-left:0px;}
[167] Fix | Delete
.sbs .col-2{width: calc(50% - 5px);float: left;margin:2px;}
[168] Fix | Delete
}
[169] Fix | Delete
';
[170] Fix | Delete
[171] Fix | Delete
add_filter('ampforwp_body_class', 'bodyClassForAMPPagebuilder',10,2);
[172] Fix | Delete
$previousData = json_decode($previousData,true);
[173] Fix | Delete
if(isset($previousData['rows']) && count($previousData['rows'])>0){
[174] Fix | Delete
[175] Fix | Delete
foreach ($previousData['rows'] as $key => $rowsData) {
[176] Fix | Delete
$container = $rowsData['cell_data'];
[177] Fix | Delete
$rowContainer = $rowsData['data'];
[178] Fix | Delete
[179] Fix | Delete
if(isset($containerCommonSettings['front_css'])){
[180] Fix | Delete
$rowCss = $containerCommonSettings['front_css'];
[181] Fix | Delete
if( true == $redux_builder_amp['amp-rtl-select-option'] && isset($containerCommonSettings['front_rtl_css'])) {
[182] Fix | Delete
$rowCss .= $containerCommonSettings['front_rtl_css'];
[183] Fix | Delete
}
[184] Fix | Delete
$rowCss = str_replace('{{row-class}}', '.ap_r_'.$rowsData['id'], $rowCss);
[185] Fix | Delete
foreach($containerCommonSettings['fields'] as $rowfield){
[186] Fix | Delete
$replaceRow = '';
[187] Fix | Delete
//if($rowfield['content_type']=='css'){
[188] Fix | Delete
if(isset($rowContainer[$rowfield['name']])){
[189] Fix | Delete
$replaceRow = $rowContainer[$rowfield['name']];
[190] Fix | Delete
[191] Fix | Delete
}elseif(!isset($rowContainer[$rowfield['name']])){
[192] Fix | Delete
$replaceRow = $rowfield['default'];
[193] Fix | Delete
}
[194] Fix | Delete
if(isset($rowfield['required']) && count($rowfield['required'])>0){
[195] Fix | Delete
foreach($rowfield['required'] as $requiredKey=>$requiredValue){
[196] Fix | Delete
$valueCheckWith = '';
[197] Fix | Delete
if(isset($rowContainer[$requiredKey])){
[198] Fix | Delete
$valueCheckWith = $rowContainer[$requiredKey];
[199] Fix | Delete
}
[200] Fix | Delete
if( is_array($valueCheckWith) ) {
[201] Fix | Delete
$valueCheckWith = $rowContainer[$requiredKey][0];
[202] Fix | Delete
}
[203] Fix | Delete
if( $valueCheckWith !== $requiredValue){
[204] Fix | Delete
$replaceRow ='';
[205] Fix | Delete
}
[206] Fix | Delete
}
[207] Fix | Delete
[208] Fix | Delete
}
[209] Fix | Delete
switch ($rowfield['type']) {
[210] Fix | Delete
case 'spacing':
[211] Fix | Delete
$replaceSpacing ='';
[212] Fix | Delete
if(
[213] Fix | Delete
isset($replaceRow['top'])&&
[214] Fix | Delete
isset($replaceRow['right'])&&
[215] Fix | Delete
isset($replaceRow['bottom'])&&
[216] Fix | Delete
isset($replaceRow['left'])
[217] Fix | Delete
){
[218] Fix | Delete
$replaceSpacing = $replaceRow['top']." ".$replaceRow['right']." ".$replaceRow['bottom']." ".$replaceRow['left']." ";
[219] Fix | Delete
}
[220] Fix | Delete
$rowCss = str_replace('{{'.$rowfield['name'].'}}', $replaceSpacing, $rowCss);
[221] Fix | Delete
[222] Fix | Delete
break;
[223] Fix | Delete
case 'upload':
[224] Fix | Delete
//$imageDetails = ampforwp_get_attachment_id( $replaceRow);
[225] Fix | Delete
$image_alt = $imageUrl = $imageWidth = $imageHeight = '';
[226] Fix | Delete
if(isset($rowContainer[$rowfield['name']."_image_data"])){
[227] Fix | Delete
$replace= $rowContainer[$rowfield['name']."_image_data"];
[228] Fix | Delete
$imageUrl = $replace[0];
[229] Fix | Delete
$imageWidth = $replace[1];
[230] Fix | Delete
$imageHeight = $replace[2];
[231] Fix | Delete
$image_alt = (isset($replace['alt'])? $replace['alt']: "");;
[232] Fix | Delete
}elseif($replaceRow != ""){
[233] Fix | Delete
$imageDetails = ampforwp_get_attachment_id( $replaceRow);
[234] Fix | Delete
if(is_array($imageDetails)){
[235] Fix | Delete
$imageUrl = (isset($imageDetails[0])? $imageDetails[0]: "");
[236] Fix | Delete
$imageWidth = (isset($imageDetails[1])? $imageDetails[1]: "");
[237] Fix | Delete
$imageHeight = (isset($imageDetails[3])? $imageDetails[2]: "");
[238] Fix | Delete
$image_alt = (isset($imageDetails['alt'])? $imageDetails['alt']: "");
[239] Fix | Delete
}
[240] Fix | Delete
}
[241] Fix | Delete
$rowCss = str_replace(
[242] Fix | Delete
'{{'.$rowfield['name'].'}}',
[243] Fix | Delete
$imageUrl,
[244] Fix | Delete
$rowCss
[245] Fix | Delete
);
[246] Fix | Delete
$rowCss = str_replace(
[247] Fix | Delete
array('{{image_width}}','{{image_width_'.$rowfield['name'].'}}'),
[248] Fix | Delete
array($imageWidth,$imageWidth),
[249] Fix | Delete
$rowCss
[250] Fix | Delete
);
[251] Fix | Delete
$rowCss = str_replace(
[252] Fix | Delete
array('{{image_height}}','{{image_height_'.$rowfield['name'].'}}'),
[253] Fix | Delete
array($imageHeight,$imageHeight),
[254] Fix | Delete
$rowCss
[255] Fix | Delete
);
[256] Fix | Delete
$rowCss = str_replace(
[257] Fix | Delete
array('{{image_alt}}','{{image_alt_'.$rowfield['name'].'}}'),
[258] Fix | Delete
array($image_alt,$image_alt),
[259] Fix | Delete
$rowCss
[260] Fix | Delete
);
[261] Fix | Delete
$rowCss = str_replace('{{'.$rowfield['name'].'}}', $replaceRow, $rowCss);
[262] Fix | Delete
break;
[263] Fix | Delete
default:
[264] Fix | Delete
if(is_array($replaceRow)){
[265] Fix | Delete
if(count($replaceRow)>0){
[266] Fix | Delete
if(count($replaceRow)==1){
[267] Fix | Delete
$rowCss = str_replace('{{'.$rowfield['name'].'}}', $replaceRow[0], $rowCss);
[268] Fix | Delete
}
[269] Fix | Delete
}else{
[270] Fix | Delete
$rowCss = str_replace('{{'.$rowfield['name'].'}}', '', $rowCss);
[271] Fix | Delete
}
[272] Fix | Delete
[273] Fix | Delete
/*foreach ($rowContainer[$rowfield['name']] as $key => $cssValue) {
[274] Fix | Delete
# code...
[275] Fix | Delete
}()*/
[276] Fix | Delete
}else{
[277] Fix | Delete
$rowCss = str_replace('{{'.$rowfield['name'].'}}', $replaceRow, $rowCss);
[278] Fix | Delete
}
[279] Fix | Delete
break;
[280] Fix | Delete
}
[281] Fix | Delete
//}
[282] Fix | Delete
$rowCss = ampforwp_replaceIfContentConditional($rowfield['name'], $replaceRow, $rowCss);
[283] Fix | Delete
}
[284] Fix | Delete
$completeCssOfPB .= $rowCss;
[285] Fix | Delete
}//Row Settings Css foreach closed
[286] Fix | Delete
[287] Fix | Delete
if(count($container)>0){
[288] Fix | Delete
//Module specific styles
[289] Fix | Delete
$moduleCommonCss = array();
[290] Fix | Delete
foreach($container as $contentArray){
[291] Fix | Delete
[292] Fix | Delete
if(isset($moduleTemplate[$contentArray['type']]['front_css'])){
[293] Fix | Delete
$completeCss = $moduleTemplate[$contentArray['type']]['front_css'];
[294] Fix | Delete
if( true == $redux_builder_amp['amp-rtl-select-option'] && isset($moduleTemplate[$contentArray['type']]['front_rtl_css'])) {
[295] Fix | Delete
$completeCss .= $moduleTemplate[$contentArray['type']]['front_rtl_css'];
[296] Fix | Delete
}
[297] Fix | Delete
$completeCss = str_replace("{{module-class}}", '.ap_m_'.$contentArray['cell_id'], $completeCss );
[298] Fix | Delete
}
[299] Fix | Delete
if(isset($moduleTemplate[$contentArray['type']]['front_common_css'])){
[300] Fix | Delete
$moduleCommonCss[$moduleTemplate[$contentArray['type']]['name']] = $moduleTemplate[$contentArray['type']]['front_common_css'];
[301] Fix | Delete
}
[302] Fix | Delete
if(!isset($moduleTemplate[$contentArray['type']])){
[303] Fix | Delete
continue;
[304] Fix | Delete
}
[305] Fix | Delete
foreach($moduleTemplate[$contentArray['type']]['fields'] as $modulefield){
[306] Fix | Delete
$replaceModule = "";
[307] Fix | Delete
if(isset($contentArray[$modulefield['name']])){
[308] Fix | Delete
$replaceModule = $contentArray[$modulefield['name']];
[309] Fix | Delete
}else{
[310] Fix | Delete
$replaceModule = getdefaultValue($modulefield['name'],$moduleTemplate[$contentArray['type']]['fields']);
[311] Fix | Delete
}
[312] Fix | Delete
//LOAD Icon Css
[313] Fix | Delete
if($modulefield['type']=='icon-selector'){
[314] Fix | Delete
add_amp_icon(array($replaceModule));
[315] Fix | Delete
}
[316] Fix | Delete
[317] Fix | Delete
if($modulefield['content_type']=='css'){
[318] Fix | Delete
[319] Fix | Delete
if(isset($modulefield['required']) && count($modulefield['required'])>0){
[320] Fix | Delete
$requiredCheck[] = true;
[321] Fix | Delete
foreach($modulefield['required'] as $requiredKey=>$requiredValue){
[322] Fix | Delete
//if value not set than get default value
[323] Fix | Delete
if(!isset($contentArray[$requiredKey])){
[324] Fix | Delete
$userSelectedvalue = getdefaultValue($requiredKey,$moduleTemplate[$contentArray['type']]['fields']);
[325] Fix | Delete
}else{
[326] Fix | Delete
$userSelectedvalue = $contentArray[$requiredKey];
[327] Fix | Delete
[328] Fix | Delete
}
[329] Fix | Delete
if(is_array($requiredValue) && !in_array($userSelectedvalue, $requiredValue) ){
[330] Fix | Delete
$requiredCheck[] = false;
[331] Fix | Delete
}elseif($userSelectedvalue != $requiredValue){
[332] Fix | Delete
$requiredCheck[] = false;
[333] Fix | Delete
}
[334] Fix | Delete
}
[335] Fix | Delete
$requiredCheck = array_unique($requiredCheck);
[336] Fix | Delete
if(count($requiredCheck)>1 && $requiredCheck[0] != true){
[337] Fix | Delete
$replaceModule ='';
[338] Fix | Delete
}
[339] Fix | Delete
[340] Fix | Delete
}
[341] Fix | Delete
switch ($modulefield['type']) {
[342] Fix | Delete
case 'spacing':
[343] Fix | Delete
$replacespacing ="";
[344] Fix | Delete
if(isset($replaceModule['top'])
[345] Fix | Delete
&& isset($replaceModule['right'])
[346] Fix | Delete
&& isset($replaceModule['bottom'])
[347] Fix | Delete
&& isset($replaceModule['left'])
[348] Fix | Delete
){
[349] Fix | Delete
$replacespacing = $replaceModule['top']." ".$replaceModule['right']." ".$replaceModule['bottom']." ".$replaceModule['left']." ";
[350] Fix | Delete
}
[351] Fix | Delete
$completeCss = str_replace('{{'.$modulefield['name'].'}}', $replacespacing, $completeCss);
[352] Fix | Delete
[353] Fix | Delete
break;
[354] Fix | Delete
case 'upload':
[355] Fix | Delete
$image_alt = $imageUrl = $imageWidth = $imageHeight = '';
[356] Fix | Delete
if(isset($contentArray[$modulefield['name']."_image_data"])){
[357] Fix | Delete
$replace= $contentArray[$modulefield['name']."_image_data"];
[358] Fix | Delete
$imageUrl = $replace[0];
[359] Fix | Delete
$imageWidth = $replace[1];
[360] Fix | Delete
$imageHeight = $replace[2];
[361] Fix | Delete
$image_alt = (isset($replace['alt'])? $replace['alt']: "");;
[362] Fix | Delete
}elseif($replaceModule != ""){
[363] Fix | Delete
$imageDetails = ampforwp_get_attachment_id( $replaceModule);
[364] Fix | Delete
if(is_array($imageDetails)){
[365] Fix | Delete
$imageUrl = (isset($imageDetails[0])? $imageDetails[0]: "");
[366] Fix | Delete
$imageWidth = (isset($imageDetails[1])? $imageDetails[1]: "");
[367] Fix | Delete
$imageHeight = (isset($imageDetails[3])? $imageDetails[2]: "");
[368] Fix | Delete
$image_alt = (isset($imageDetails['alt'])? $imageDetails['alt']: "");
[369] Fix | Delete
}
[370] Fix | Delete
}
[371] Fix | Delete
[372] Fix | Delete
$completeCss = str_replace(
[373] Fix | Delete
'{{'.$modulefield['name'].'}}',
[374] Fix | Delete
$imageUrl,
[375] Fix | Delete
$completeCss
[376] Fix | Delete
);
[377] Fix | Delete
$completeCss = str_replace(
[378] Fix | Delete
array('{{image_width}}','{{image_width_'.$modulefield['name'].'}}'),
[379] Fix | Delete
array($imageWidth,$imageWidth),
[380] Fix | Delete
$completeCss
[381] Fix | Delete
);
[382] Fix | Delete
$completeCss = str_replace(
[383] Fix | Delete
array('{{image_height}}','{{image_height_'.$modulefield['name'].'}}'),
[384] Fix | Delete
array($imageHeight,$imageHeight),
[385] Fix | Delete
$completeCss
[386] Fix | Delete
);
[387] Fix | Delete
$completeCss = str_replace(
[388] Fix | Delete
array('{{image_alt}}','{{image_alt_'.$modulefield['name'].'}}'),
[389] Fix | Delete
array($image_alt,$image_alt),
[390] Fix | Delete
$completeCss
[391] Fix | Delete
);
[392] Fix | Delete
[393] Fix | Delete
break;
[394] Fix | Delete
default:
[395] Fix | Delete
if(is_array($replaceModule)){
[396] Fix | Delete
/*foreach ($contentArray[$modulefield['name']] as $key => $cssValue) {
[397] Fix | Delete
# code...
[398] Fix | Delete
}()*/
[399] Fix | Delete
}else{
[400] Fix | Delete
$completeCss = str_replace('{{'.$modulefield['name'].'}}', $replaceModule, $completeCss);
[401] Fix | Delete
}
[402] Fix | Delete
break;
[403] Fix | Delete
}
[404] Fix | Delete
}
[405] Fix | Delete
[406] Fix | Delete
$completeCss = ampforwp_replaceIfContentConditional($modulefield['name'], $replaceModule, $completeCss);
[407] Fix | Delete
}
[408] Fix | Delete
$completeCssOfPB .= $completeCss;
[409] Fix | Delete
[410] Fix | Delete
//For Repeater Fields
[411] Fix | Delete
$repeaterFieldsCss = '';
[412] Fix | Delete
if(isset($moduleTemplate[$contentArray['type']]['repeater'])){
[413] Fix | Delete
[414] Fix | Delete
if(isset($contentArray['repeater']) && is_array($contentArray['repeater'])){
[415] Fix | Delete
$repeaterUserContents = $contentArray['repeater'];
[416] Fix | Delete
foreach ($repeaterUserContents as $repeaterUserKey => $repeaterUserValues) {
[417] Fix | Delete
[418] Fix | Delete
//reset($repeaterUserValues);
[419] Fix | Delete
$repeaterVarIndex = key($repeaterUserValues);
[420] Fix | Delete
$repeaterVarIndex = explode('_', $repeaterVarIndex);
[421] Fix | Delete
$repeaterVarIndex = end($repeaterVarIndex);
[422] Fix | Delete
$repeaterFrontCss = '';
[423] Fix | Delete
foreach ($moduleTemplate[$contentArray['type']]['repeater']['fields'] as $moduleKey => $moduleField) {
[424] Fix | Delete
[425] Fix | Delete
//LOAD Icon Css
[426] Fix | Delete
if($moduleField['type']=='icon-selector'){
[427] Fix | Delete
add_amp_icon(array( $repeaterUserValues[$moduleField['name'].'_'.$repeaterVarIndex]));
[428] Fix | Delete
}
[429] Fix | Delete
[430] Fix | Delete
//Check if there is no front css
[431] Fix | Delete
if(!isset($moduleTemplate[$contentArray['type']]['repeater']['front_css'])){
[432] Fix | Delete
continue;
[433] Fix | Delete
}
[434] Fix | Delete
$repeaterFrontCss = $moduleTemplate[$contentArray['type']]['repeater']['front_css'];
[435] Fix | Delete
$repeaterFrontCss = str_replace("{{acc_head_type}}", $moduleTemplate["accordion-mod"]["repeater"]["fields"][1]["default"] , $repeaterFrontCss );
[436] Fix | Delete
if($moduleField['content_type']=='css'){
[437] Fix | Delete
$repeaterFrontCss = str_replace("{{module-class}}", '.ap_m_'.$contentArray['cell_id'], $repeaterFrontCss );
[438] Fix | Delete
$repeaterFrontCss = str_replace('{{repeater-module-class}}', $moduleField['name'].'_'.$repeaterVarIndex, $repeaterFrontCss);
[439] Fix | Delete
$replace = $repeaterUserValues[$moduleField['name'].'_'.$repeaterVarIndex];
[440] Fix | Delete
if(is_array($replace)){
[441] Fix | Delete
if(count($replace)>0){
[442] Fix | Delete
$replace = $replace[0];
[443] Fix | Delete
}else{
[444] Fix | Delete
$replace ='';
[445] Fix | Delete
}
[446] Fix | Delete
}
[447] Fix | Delete
[448] Fix | Delete
if($modulefield['type']=='spacing'){
[449] Fix | Delete
$replacespacing ="";
[450] Fix | Delete
if(isset($replaceModule['top'])
[451] Fix | Delete
&& isset($replaceModule['right'])
[452] Fix | Delete
&& isset($replaceModule['bottom'])
[453] Fix | Delete
&& isset($replaceModule['left'])
[454] Fix | Delete
){
[455] Fix | Delete
$replacespacing = $replaceModule['top']." ".$replaceModule['right']." ".$replaceModule['bottom']." ".$replaceModule['left']." ";
[456] Fix | Delete
}
[457] Fix | Delete
$repeaterFrontCss = str_replace('{{'.$modulefield['name'].'}}', $replacespacing, $repeaterFrontCss);
[458] Fix | Delete
}else{
[459] Fix | Delete
$repeaterFrontCss = str_replace(
[460] Fix | Delete
'{{'.$moduleField['name'].'}}',
[461] Fix | Delete
$replace,
[462] Fix | Delete
$repeaterFrontCss
[463] Fix | Delete
);
[464] Fix | Delete
}
[465] Fix | Delete
}else{
[466] Fix | Delete
$repeaterCss = $moduleTemplate[$contentArray['type']]['repeater']['front_css'];
[467] Fix | Delete
if(strpos($repeaterCss, '{{'.$moduleField['name'].'}}')!==false){
[468] Fix | Delete
$repeaterFrontCss = $repeaterCss;
[469] Fix | Delete
$replace_with = $repeaterUserValues[$moduleField['name'].'_'.$repeaterVarIndex];
[470] Fix | Delete
$repeaterFrontCss = str_replace('{{'.$moduleField['name'].'}}',$replace_with, $repeaterFrontCss);
[471] Fix | Delete
}
[472] Fix | Delete
}
[473] Fix | Delete
}
[474] Fix | Delete
$repeaterFieldsCss .= $repeaterFrontCss;
[475] Fix | Delete
}
[476] Fix | Delete
}//If Check for Fall back
[477] Fix | Delete
[478] Fix | Delete
}//If for Module is repeater or not
[479] Fix | Delete
$completeCssOfPB .= $repeaterFieldsCss;
[480] Fix | Delete
[481] Fix | Delete
[482] Fix | Delete
[483] Fix | Delete
}//foreach content closed
[484] Fix | Delete
[485] Fix | Delete
//For Comon CSS
[486] Fix | Delete
if(count($moduleCommonCss)>0){
[487] Fix | Delete
$completeCssOfPB .= implode(" ", $moduleCommonCss);
[488] Fix | Delete
}
[489] Fix | Delete
[490] Fix | Delete
}//ic container check closed
[491] Fix | Delete
//Create row css
[492] Fix | Delete
[493] Fix | Delete
[494] Fix | Delete
[495] Fix | Delete
}//foreach closed complete data
[496] Fix | Delete
}//if closed count($previousData['rows'])>0
[497] Fix | Delete
[498] Fix | Delete
if(isset($previousData['settingdata']['style_data']) && $previousData['settingdata']['style_data']!=""){
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function