Advertisement
Guest User

Untitled

a guest
Oct 10th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.91 KB | None | 0 0
  1. $pageHasTemplates = $this->getPageHasTemplates($template['id'], $variation['id']);
  2.  
  3.                 foreach ($pageHasTemplates as $pageHasTemplate) {
  4.                     $groups = $this->getGroups();
  5.  
  6.                     foreach ($groups as $group) {
  7.                         $hookValues = $this->getRealHookValues($group['id']);
  8.  
  9.                         $buttonValue = [
  10.                             $hookVariationCtaAlign['select_value'],
  11.                             $hookVariationCtaLink['link_value'],
  12.                             $hookVariationCtaStyle['select_value'],
  13.                             $hookVariationCtaText['text_value']
  14.                         ];
  15.    
  16.                         $overwrited = false;
  17.    
  18.                         foreach ($hookValues as $hookValue) {
  19.                             if ($hookValue['hook_variation_id'] == $hookVariationCtaAlign['id']) {
  20.                                 $buttonValue[0] = $hookValue['select_value'];
  21.                                 $overwrited = true;
  22.                             }
  23.    
  24.                             if ($hookValue['hook_variation_id'] == $hookVariationCtaLink['id']) {
  25.                                 $buttonValue[1] = $hookValue['link_value'];
  26.                                 $overwrited = true;
  27.                             }
  28.    
  29.                             if ($hookValue['hook_variation_id'] == $hookVariationCtaStyle['id']) {
  30.                                 $buttonValue[2] = $hookValue['select_value'];
  31.                                 $overwrited = true;
  32.                             }
  33.    
  34.                             if ($hookValue['hook_variation_id'] == $hookVariationCtaText['id']) {
  35.                                 $buttonValue[3] = $hookValue['text_value'];
  36.                                 $overwrited = true;
  37.                             }
  38.                         }
  39.    
  40.                         if ($overwrited) {
  41.                             $this->addHookValue([
  42.                                 'page_id' => $pageHasTemplate['page_id'],
  43.                                 'creation_date' => $this->getTimestamp(),
  44.                                 'hook_id' => $hookButton,
  45.                                 'hook_variation_id' => $hookVariationButton,
  46.                                 'button_value' => json_encode($buttonValue),
  47.                                 'account_id' => 1
  48.                             ]);
  49.                         }
  50.  
  51.                         $buttonHookValue = $buttonValue;
  52.  
  53.                         $hookValuesWithPage = $this->getRealHookValues($group['id'], $pageHasTemplate['page_id']);
  54.  
  55.                         $buttonValue = $buttonHookValue;
  56.  
  57.                         $overwrited = false;
  58.        
  59.                         foreach ($hookValuesWithPage as $hookValue) {      
  60.                             if ($hookValue['hook_variation_id'] == $hookVariationCtaAlign['id']) {
  61.                                 $buttonValue[0] = $hookValue['select_value'];
  62.                                 $overwrited = true;
  63.                             }
  64.  
  65.                             if ($hookValue['hook_variation_id'] == $hookVariationCtaLink['id']) {
  66.                                 $buttonValue[1] = $hookValue['link_value'];
  67.                                 $overwrited = true;
  68.                             }
  69.  
  70.                             if ($hookValue['hook_variation_id'] == $hookVariationCtaStyle['id']) {
  71.                                 $buttonValue[2] = $hookValue['select_value'];
  72.                                 $overwrited = true;
  73.                             }
  74.  
  75.                             if ($hookValue['hook_variation_id'] == $hookVariationCtaText['id']) {
  76.                                 $buttonValue[3] = $hookValue['text_value'];
  77.                                 $overwrited = true;
  78.                             }
  79.                            
  80.                             if ($overwrited) {
  81.                                 $this->addHookValue([
  82.                                     'page_id' => $hookValue['page_id'],
  83.                                     'creation_date' => $this->getTimestamp(),
  84.                                     'hook_id' => $hookButton,
  85.                                     'hook_variation_id' => $hookVariationButton,
  86.                                     'button_value' => json_encode($buttonValue),
  87.                                     'account_id' => 1
  88.                                 ]);
  89.                             }
  90.                         }
  91.                     }
  92.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement