WYSIJA_help_campaigns

The MailPoet Newsletters WYSIJA help campaigns class.

Defined (1)

The class is defined in the following location(s).

/helpers/campaigns.php  
  1. class WYSIJA_help_campaigns extends WYSIJA_object{ 
  2.  
  3. function __construct() { 
  4. parent::__construct(); 
  5.  
  6. function saveParameters($email_id, $key, $value) 
  7. // 1. get params field for given campaign 
  8. $modelEmail = WYSIJA::get('email', 'model'); 
  9. $email = $modelEmail->getOne('params', array('email_id' => $email_id)); 
  10. $params = $email['params']; 
  11.  
  12. if(!is_array($params)) { 
  13. $params = array(); 
  14.  
  15. // 2 update data for given key 
  16. if(array_key_exists($key, $params)) { 
  17. $params[$key] = $value; 
  18. } else { 
  19. $params = array_merge($params, array($key => $value)); 
  20.  
  21. // 3. update campaign 
  22. return $modelEmail->update(array('params' => $params), array('email_id' => $email_id)); 
  23.  
  24. function getParameters($email_id, $key = null) { 
  25. // 1. get params field for given campaign 
  26. $modelEmail = WYSIJA::get('email', 'model'); 
  27. $email = $modelEmail->getOne('params', array('email_id' => $email_id)); 
  28. $params = $email['params']; 
  29.  
  30. if($key === null) { 
  31. return $params; 
  32. } else { 
  33. if(!is_array($params) or array_key_exists($key, $params) === false) { 
  34. return false; 
  35. } else { 
  36. return $params[$key];