public function indexAction() { print Site::setResource('advert_timer', 100); return; $form = new Paypal_Models_Forms_Admin_Settings(); if ($form->isValid($_POST)) { //don't save submit button unset($_POST['submit']); Paypal_Models_Paypal::save($_POST); } $this->view->form = $form; }
function __construct() { parent::__construct(); $this->setName('Paypal Settings'); $this->setMethod('POST'); $this->setAction('/paypal/admin'); Paypal_Models_Paypal::initSettings(); $this->addElement('text', 'APIUsername', array('value' => Paypal_Models_Paypal::get('APIUsername'), 'label' => 'API Username')); $this->addElement('text', 'APIPassword', array('value' => Paypal_Models_Paypal::get('APIPassword'), 'label' => 'API Password')); $this->addElement('text', 'APISignature', array('value' => Paypal_Models_Paypal::get('APISignature'), 'label' => 'API Signature')); $this->addElement('text', 'APIVersion', array('value' => Paypal_Models_Paypal::get('APIVersion'), 'label' => 'The API Version to use')); $this->addElement('text', 'IPNUrl', array('value' => Paypal_Models_Paypal::get('IPNUrl'), 'label' => 'IPN URL')); $this->addElement('text', 'currencyCode', array('value' => Paypal_Models_Paypal::get('currencyCode'), 'label' => 'Currency Code')); $this->addElement('text', 'sellersEmail', array('value' => Paypal_Models_Paypal::get('sellersEmail'), 'label' => 'Your Paypal Email')); $this->addElement('submit', 'submit', array('value' => 'save')); }
/** * Load the module settings from the storage */ static function initSettings() { $db = Zend_Registry::get('db'); $stmt = $db->query("SELECT * FROM " . self::PAYPAL_TABLE); $row = $stmt->fetch(); foreach ($row as $key => $value) { /** * unfortunately PHP < 5.1.0 does not allow you set or get * dynamic static variables, We will use eval for now to get around * this problem, since these settings are coming from storage and are * entered by an administrator then there should be no threat of unexpected * code executed within eval * PHP BUG Report: http://bugs.php.net/bug.php?id=30716&edit=1 */ //eval("self::\$$key = '$value';"); self::set($key, $value); } self::$curl = new CurlWrapper(); }
function __construct($transaction) { parent::__construct(); Paypal_Models_Paypal::initSettings(); $this->setMethod('POST'); $this->setAction(Paypal_Models_Paypal::get('IPNUrl')); $this->addElement('hidden', 'cmd', array('value' => '_xclick')); $this->addElement('hidden', 'business', array('value' => Paypal_Models_Paypal::get('sellersEmail'))); $this->addElement('hidden', 'amount', array('value' => $transaction->amount)); $this->addElement('hidden', 'item_name', array('value' => $transaction->name)); $this->addElement('hidden', 'item_number', array('value' => $transaction->transactionID)); $this->addElement('hidden', 'notify_url', array('value' => 'http://www.project.supersaid.net/paypal/ipn')); $this->addElement('image', 'submit', array('src' => 'https://www.paypal.com/en_GB/i/btn/btn_cart_LG.gif')); $this->addElement('hidden', 'return', array('value' => $transaction->returnUrl)); $this->addElement('hidden', 'cancel_return', array('value' => $transaction->cancelUrl)); foreach ($this->getElements() as $key => $value) { $this->getElement($key)->removeDecorator('label'); } }
function payAction() { Paypal_Models_Paypal::initSettings(); Paypal_Models_Paypal::pay(array()); }
public function ipnAction() { Paypal_Models_Paypal::initSettings(); Paypal_Models_Paypal::IPN($this->_getAllParams()); }