ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPaypalSettings.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
13 include_once './Services/Payment/classes/class.ilPaymentSettings.php';
14 
16 {
17  public $pSettings;
18 
19 // private $settings;
20 
21  private $server_host;
22  private $server_path;
23  private $vendor;
24 // private $vender_password;
25  private $auth_token;
26  private $page_style;
27  private $ssl;
28 
29  static private $instance = null;
30 
37  public static function getInstance()
38  {
39  if (!self::$instance)
40  {
41  self::$instance = new ilPaypalSettings();
42  }
43 
44  return self::$instance;
45  }
46 
52  private function __construct()
53  {
54  $this->pSettings = ilPaymentSettings::_getInstance();
55  $this->getSettings();
56  }
57 
63  private function getSettings()
64  {
65  $paypal = null;
66  $paypal = $this->pSettings->get('paypal');
67  $data = array();
68 
69  if ($paypal != "" && $paypal != NULL )
70  {
71  $data = unserialize($paypal);
72  }
73 
74  $this->setServerHost($data["server_host"]);
75  $this->setServerPath($data["server_path"]);
76  $this->setVendor($data["vendor"]);
77 // $this->setVendorPassword($data['vendor_password']);
78  $this->setAuthToken($data["auth_token"]);
79  $this->setPageStyle($data["page_style"]);
80  $this->setSsl($data["ssl"]);
81  }
82 
86  public function setServerHost($a_server_host)
87  {
88  $this->server_host = $a_server_host;
89  }
90 
94  public function getServerHost()
95  {
96  return $this->server_host;
97  }
98 
102  public function setServerPath($a_server_path)
103  {
104  $this->server_path = $a_server_path;
105  }
106 
110  public function getServerPath()
111  {
112  return $this->server_path;
113  }
114 
118  public function setVendor($a_vendor)
119  {
120  $this->vendor = $a_vendor;
121  }
122 
126  public function getVendor()
127  {
128  return $this->vendor;
129  }
130 
134  public function setVendorPassword($a_vendor_password)
135  {
136  $this->vender_password = $a_vendor_password;
137  }
138 
142  public function getVendorPassword()
143  {
144  return $this->vender_password;
145  }
149  public function setAuthToken($a_auth_token)
150  {
151  $this->auth_token = $a_auth_token;
152  }
153 
157  public function getAuthToken()
158  {
159  return $this->auth_token;
160  }
161 
165  public function setPageStyle($a_page_style)
166  {
167  $this->page_style = $a_page_style;
168  }
169 
173  public function getPageStyle()
174  {
175  return $this->page_style;
176  }
177 
181  public function setSsl($a_ssl)
182  {
183  $this->ssl = $a_ssl;
184  }
185 
189  public function getSsl()
190  {
191  return $this->ssl;
192  }
193 
200  public function getAll()
201  {
202  $values = array(
203  "server_host" => $this->getServerHost(),
204  "server_path" => $this->getServerPath(),
205  "vendor" => $this->getVendor(),
206 // "vendor_password" => $this->getVendorPassword(),
207  "auth_token" => $this->getAuthToken(),
208  "page_style" => $this->getPageStyle(),
209  "ssl" => $this->getSsl()
210  );
211 
212  return $values;
213  }
214 
220  public function clearAll()
221  {
222  $this->pSettings->set('paypal', NULL, 'paypal');
223 // $this->settings = array();
224  }
225 
231  public function save()
232  {
233  $values = array(
234  "server_host" => $this->getServerHost(),
235  "server_path" => $this->getServerPath(),
236  "vendor" => $this->getVendor(),
237 // "vendor_password" => $this->getVendorPassword(),
238  "auth_token" => $this->getAuthToken(),
239  "page_style" => $this->getPageStyle(),
240  "ssl" => $this->getSsl()
241  );
242 
243  $this->pSettings->set('paypal', serialize($values), 'paypal');
244  }
245 }