_config = json_decode(file_get_contents(realpath(dirname(__FILE__) . "/private.json"))); } /** * @return SoapClient A public service soap client * @TODO Check for exceptions. */ public function publicService () { if (is_null($this->_publicService)) { $this->_publicService = new SoapClient(PR_PUBLIC_SERVICE_WSDL); } return $this->_publicService; } /** * @return SoapClient An agency provider service soap client * @TODO Check for exceptions. */ public function providerService () { if (is_null($this->_providerService)) { $this->_providerService = new SoapClient(PR_PROVIDER_SERVICE_WSDL); } return $this->_providerService; } /** * @return SoapClient An activity wholesaler service soap client * @TODO Check for exceptions. */ public function wholesalerService () { if (is_null($this->_wholesalerService)) { $this->_wholesalerService = new SoapClient(PR_WHOLESALER_SERVICE_WSDL); } return $this->_wholesalerService; } /** * @return SoapVar A ServiceLogin object */ public function serviceLogin () { return array("username" => get_option('pr_username'), "password" => get_option('pr_password')); } public function config () { return $this->_config; } /** * @return PonoRez - Singleton instance * @see PR() */ public static function instance () { if (is_null(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; } } /** * Returns the main instance of the PonoRez object. * * @return PonoRez */ function PR() { return PonoRez::instance(); } /** * Bootstrap function for admin pages. */ function pr_bootstrap_admin () { require_once('lib/class-ponorezadminconfig.php'); $prc = new PonoRezAdminConfig (); $prc->init(); } add_action('init', 'pr_bootstrap_admin'); /** * Bootstrap function for public pages. */ function pr_bootstrap_public () { // require_once('lib/class-ponorezrest.php'); require_once('lib/class-ponoreztemplate.php'); $prt = new PonoRezTemplate (); $prt->init(); } add_action('init', 'pr_bootstrap_public'); /** * Shortcode to test login information. */ function pr_test_login_sc ($atts = array(), $content = null, $tag) { $pr = PR(); $psc = $pr->providerService(); $sl = $pr->serviceLogin(); $result = $psc->testLogin(array('serviceLogin' => $pr->serviceLogin())); if (true == $result->return) { $rval = "Login succeeded.\n"; } else { $rval= "Login failed.\n"; $rval .= sprintf("
\n%s\n", $result->out_status); } return $rval; } add_shortcode('pr_test_login', 'pr_test_login_sc'); // End a3h.php