Exemplo n.º 1
0
 /**
  * @return bool|void
  */
 public function save()
 {
     foreach ($this->types as $type) {
         if ($object = new AB_Notification()) {
             if (!$object->loadBy(array('type' => $type, 'gateway' => $this->gateway))) {
                 $this->data[$type]['type'] = $type;
             }
             $object->setFields($this->data[$type]);
             $object->save();
             // Register string for translate in WPML.
             do_action('wpml_register_single_string', 'bookly', $this->gateway . '_' . $type, $this->data[$type]['message']);
             if ($this->gateway == 'email') {
                 do_action('wpml_register_single_string', 'bookly', $this->gateway . '_' . $type . '_subject', $this->data[$type]['subject']);
             }
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Load data.
  */
 private function _load_data()
 {
     // Insert notifications.
     foreach ($this->notifications as $data) {
         $notification = new AB_Notification($data);
         $notification->save();
         // Register string for translate in WPML.
         do_action('wpml_register_single_string', 'bookly', $data['gateway'] . '_' . $data['type'], $data['message']);
         if ($data['gateway'] == 'email') {
             do_action('wpml_register_single_string', 'bookly', $data['gateway'] . '_' . $data['type'] . '_subject', $data['subject']);
         }
     }
     // Add options.
     foreach ($this->options as $name => $value) {
         add_option($name, $value, '', 'yes');
         if (strpos($name, 'ab_appearance_text_') === 0) {
             do_action('wpml_register_single_string', 'bookly', $name, $value);
         }
     }
 }