コード例 #1
0
 public function payRedirect(Request $request, Locator $locator, Order $orderModel)
 {
     $transaction_id = $request["transaction_id"];
     $transaction = $locator->getByCode($transaction_id);
     $orderId = $transaction->getDetails()->getReference();
     $order = $orderModel->find($orderId);
     $order->transaction_id = $transaction_id;
     $order->save();
     return view('store.payredirect', ['transaction_id' => $transaction_id]);
 }
コード例 #2
0
ファイル: Conference.php プロジェクト: robtro/php-bandwidth
 /**
  * Add a member inside
  * a conference
  *
  * @param id: Catapult id
  * @param params -> List of member parameters
  *       joinTone
  *       leavingTone
  */
 public function addMember($params)
 {
     $args = Ensure::Input($params);
     $url = URIResource::Make($this->path, array($this->id, "members"));
     $memberid = Locator::Find($this->client->post($url, $args->get()));
     return $this->member($memberid);
 }
コード例 #3
0
ファイル: Translator.php プロジェクト: barcodex/templar
 public function translateTemplate($untranslated, $moduleName, $templateName, $language = null)
 {
     // $translations is expected to be an array
     $translations = Locator::getInstance()->getTemplateTranslation($moduleName, $templateName, $language);
     if (is_array($translations)) {
         $translations = array();
     }
     return TextProcessor::doTextVariation($untranslated, '[[', ']]', $translations);
 }
コード例 #4
0
ファイル: Message.php プロジェクト: romonzaman/php-bandwidth
 /**
  * Send message with additional parameters
  * important rewrite in place of
  * more polymorphic style. 
  * i.e send(from, to, message, calback)
  *
  * @param args:  list of valid parameters
  */
 public function send($args)
 {
     $data = Ensure::Input($args);
     $url = URIResource::Make($this->path);
     if ($data->has("media")) {
         $data->add("media", (string) new MediaURL($data->val("media", $this)));
     }
     $message_id = Locator::Find($this->client->post($url, $data->get()));
     $data->add("id", $message_id);
     return Constructor::Make($this, $data->get(), array("messageId" => "id"));
 }
コード例 #5
0
 /**
  * LocatorForm constructor.
  * @param Controller $controller
  * @param string $name
  */
 public function __construct(Controller $controller, $name)
 {
     $fields = FieldList::create(TextField::create('Address')->setTitle('')->setAttribute('placeholder', 'address or zip code'));
     $pageCategories = Locator::locator_categories_by_locator($controller->data()->ID);
     if ($pageCategories && $pageCategories->count() > 0) {
         $categories = false;
     } else {
         $categories = Locator::get_all_categories();
     }
     if ($categories) {
         $categoriesField = DropdownField::create('CategoryID')->setTitle('')->setEmptyString('All Categories')->setSource($categories->map());
         $fields->push($categoriesField);
     }
     $actions = FieldList::create(FormAction::create('doFilterLocations')->setTitle('Search'));
     $validator = RequiredFields::create();
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
コード例 #6
0
 /**
  * allocate a new number
  * number must be available
  * or warning will be thrown
  * @param args
  *   number, 
  *   application (one you want to associate this number with)
  *   fallback a fallback option if this isnt available
  */
 public function allocate($args)
 {
     $data = Ensure::Input($args);
     $url = URIResource::Make($this->path);
     $id = Locator::Find($this->client->post($url, $data->get()));
     $data->add("id", $id);
     return Constructor::Make($this, $data->get());
 }
コード例 #7
0
 public function __construct($x, $y, $xOut, $yOut)
 {
     parent::__construct($x, $y, $xOut, $yOut);
 }
コード例 #8
0
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    BookReader is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with BookReader.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once '/petabox/setup.inc';
$id = $_REQUEST['id'];
$book = $_REQUEST['book'];
// support multiple books within an item
if ("" == $id) {
    echo "No identifier specified!";
    die(-1);
}
$locator = new Locator();
$results = $locator->locateUDP($id, 1, false);
$server = $results[0][0];
$serverBaseURL = BookReader::serverBaseURL($server);
$url = "http://{$serverBaseURL}/BookReader/BookReaderJSIA.php?id=" . urlencode($id) . "&itemPath={$results[0][1]}&server={$server}";
if ($book) {
    $url .= "&subPrefix=" . urlencode($book);
}
if ("" != $results[0][0] && "" != $results[0][1]) {
    header("Location: {$url}");
}
コード例 #9
0
ファイル: Prototype.php プロジェクト: robtro/php-bandwidth
 /**
  * prototypal add. This needs
  * term to be set as a function 
  * in its caller it will be used
  * to initialize the resulting
  * object
  *
  * Conference->addMember 
  * should return
  * ConferenceMember
  *
  * @params: mix of function arguments as well as object prototypes, terms
  */
 public static function add()
 {
     $args = func_get_args();
     $that = self::get_this($args);
     $term = self::get_term($args);
     $url = URIResource::Make($that->path, array($that->id, $term));
     $id = Locator::Find($that->client->post($url, $args->get()));
     return $this->{$term}($id);
 }
コード例 #10
0
ファイル: sitemap.php プロジェクト: alegroleo/alegrocart
<?php

// Installed?
if (filesize('config.php') == 0) {
    exit;
}
require_once 'library/application/string_modify.php';
define('VALID_ACCESS', TRUE);
define('APP', 'CATALOG');
// Config
require 'config.php';
require 'common.php';
// Locator
require DIR_LIBRARY . 'locator.php';
$locator = new Locator();
// Config
$config =& $locator->get('config');
// Database
$database =& $locator->get('database');
// Settings
$sql = "SELECT * FROM setting WHERE type = 'catalog' OR type = 'global'";
$settings = $database->getRows($sql);
foreach ($settings as $setting) {
    $config->set($setting['key'], $setting['value']);
}
$request =& $locator->get('request');
// Request
$url =& $locator->get('url');
// URL
if ($config->get('config_sitemap_status')) {
    $base = htmlentities(HTTP_SERVER, ENT_QUOTES, 'UTF-8');
コード例 #11
0
 /**
  * LocationSearch form.
  *
  * Search form for locations, updates map and results list via AJAX
  *
  * @return Form
  */
 public function LocationSearch()
 {
     $fields = FieldList::create($address = TextField::create('address', ''));
     $address->setAttribute('placeholder', 'address or zip code');
     if (LocationCategory::get()->Count() > 0) {
         $filter = array();
         $locals = Locator::getLocations($filter, $exclude = array('CategoryID' => 0));
         $categories = ArrayList::create();
         foreach ($locals as $local) {
             $categories->add($local->Category());
         }
         if ($categories->count() > 0) {
             $fields->push(DropdownField::create('category', '', $categories->map('Title', 'Title'))->setEmptyString('Select Category'));
         }
     }
     $actions = FieldList::create(FormAction::create('', 'Search'));
     return Form::create($this, 'LocationSearch', $fields, $actions);
 }
コード例 #12
0
// Installed?
if (filesize('../config.php') == 0) {
    header('Location: ../install/index.php');
    exit;
}
define('VALID_ACCESS', TRUE);
define('APP', 'ADMIN');
// Include Config and Common
require '../config.php';
require '../common.php';
// Page Time
$time = time() + microtime();
// Locator
require DIR_LIBRARY . 'locator.php';
$locator = new Locator();
// Config
$config =& $locator->get('config');
// Database
$database =& $locator->get('database');
// Settings
$settings = $database->getRows("select * from (setting) where (type = 'admin' or type = 'global')");
foreach ($settings as $setting) {
    $config->set($setting['key'], $setting['value']);
}
date_default_timezone_set($config->get('config_time_zone') ? $config->get('config_time_zone') : 'UTC');
if ($config->get('error_handler_status')) {
    $error_handler =& $locator->get('errorhandler');
    set_error_handler(array(&$error_handler, "handler"));
}
// Upgrade check
コード例 #13
0
ファイル: init.php プロジェクト: efoft/hydra
<?php

defined('INSIDE') or exit('Direct access is not permitted');
/**
 * Init script for all used classes.
 * This version of the script is intended for online shop.
 *
 * @author  efoft
 */
/* Locator
  ------------------------------------------------------------------------ */
$loc = new Locator();
/* Config
  ------------------------------------------------------------------------ */
$cfg = new Cfg();
if ($cfg->val('SECFILE')) {
    if (!file_exists($loc->path($cfg->val('SECFILE')))) {
        throw new Exception('SECFILE defined but the file not found');
    }
    $cfg->loadSecrets($loc->path($cfg->val('SECFILE')));
}
/* Logging
  ------------------------------------------------------------------------ */
$log = new Logger($loc->path('log'), $cfg->val('DEBUG'));
/* Database
  ------------------------------------------------------------------------ */
if ($cfg->val('DBdriver')) {
    $dbdrv = $cfg->val('DBdriver');
    switch ($dbdrv) {
        case 'mysql':
            $dbhost = $cfg->val('DBhost', true);
コード例 #14
0
ファイル: Found.php プロジェクト: openbuildings/spiderling
 public function __construct(Locator $locator, Driver $driver)
 {
     $this->driver = $driver;
     $this->locator = $locator;
     parent::__construct('Item (:type) ":selector", filters :filters, found by driver ":driver"', array(':type' => $locator->type(), ':selector' => $locator->selector(), ':driver' => $driver->name, ':filters' => json_encode($locator->filters())));
 }
コード例 #15
0
ファイル: Call.php プロジェクト: robtro/php-bandwidth
 /**
  * Accept an incoming
  * call.
  *
  * @return void
  */
 public function accept()
 {
     $url = URIResource::Make($this->path, array($this->id));
     $data = new DataPacket(array("state" => CALL_STATES::active));
     $id = Locator::Find($this->client->post($url, $data->get()));
     $data->add("id", $id);
     return Constructor::Make($this, $data->get());
 }
コード例 #16
0
 protected function _setScriptSrc($src, $className)
 {
     $basePathHelper = $this->locator->get('ViewHelperManager')->get('basepath');
     return "<script type=\"text/javascript\" src=\"" . $basePathHelper->__invoke($this->_publicLink . '/' . $src) . "\" id=\"script_" . $className . "\"></script>";
 }
コード例 #17
0
ファイル: rss.php プロジェクト: digitaldevelopers/alegrocart
<?php

// Installed?
if (filesize('config.php') == 0) {
    exit;
}
require_once 'library/application/string_modify.php';
define('VALID_ACCESS', TRUE);
define('APP', 'CATALOG');
// Include Config and Common
require 'config.php';
require 'common.php';
// Locator
require DIR_LIBRARY . 'locator.php';
$locator = new Locator();
// Config
$config =& $locator->get('config');
// Database
$database =& $locator->get('database');
// Settings
$sql = "select * from setting where type = 'catalog' or type = 'global'";
$settings = $database->getRows($sql);
foreach ($settings as $setting) {
    $config->set($setting['key'], $setting['value']);
}
date_default_timezone_set($config->get('config_time_zone') ? $config->get('config_time_zone') : 'UTC');
$image =& $locator->get('image');
// Image
$request =& $locator->get('request');
// Request
$url =& $locator->get('url');
コード例 #18
0
ファイル: Container.php プロジェクト: spryker/Kernel
 /**
  * @return \Generated\Client\Ide\AutoCompletion
  */
 public function getLocator()
 {
     return Locator::getInstance();
 }
コード例 #19
0
 /**
  * @param SS_HTTPRequest|null $request
  * @return $this
  */
 public function setLocations(SS_HTTPRequest $request = null)
 {
     if ($request === null) {
         $request = $this->request;
     }
     $filter = $this->config()->get('base_filter');
     if ($request->getVar('CategoryID')) {
         $filter['CategoryID'] = $request->getVar('CategoryID');
     } else {
         if ($this->getPageCategories()->exists()) {
             foreach ($this->getPageCategories() as $category) {
                 $filter['CategoryID'][] = $category->ID;
             }
         }
     }
     $this->extend('updateLocatorFilter', $filter, $request);
     $filterAny = $this->config()->get('base_filter_any');
     $this->extend('updateLocatorFilterAny', $filterAny, $request);
     $exclude = $this->config()->get('base_exclude');
     $this->extend('updateLocatorExclude', $exclude, $request);
     $locations = Locator::get_locations($filter, $filterAny, $exclude);
     $locations = DataToArrayListHelper::to_array_list($locations);
     //allow for adjusting list post possible distance calculation
     $this->extend('updateLocationList', $locations);
     if ($locations->canSortBy('distance')) {
         $locations = $locations->sort('distance');
     }
     //allow for returning list to be set as
     $this->extend('updateListType', $locations);
     $this->locations = $locations;
     return $this;
 }
コード例 #20
0
ファイル: Page.php プロジェクト: irs/behat-uimap-extension
 /**
  * Returns XPath query of page element that correstonds to given locator
  *
  * @return string XPath query
  * @throws \OutOfRangeException If cannot find path by locator
  */
 public function getXpath(Locator $locator)
 {
     // prepare query
     $query = '';
     if ($locator->hasTab()) {
         $query .= "p:tab[@key='{$locator->getTab()}']";
     }
     if ($locator->hasFieldset()) {
         $query .= "//p:fieldset[@key='{$locator->getFieldset()}']";
     }
     if ($locator->hasKey()) {
         $query .= '//p:' . ($locator->getType() ?: '*') . "[@key='{$locator->getKey()}']";
     }
     $query .= '/ancestor-or-self::*/@xpath';
     // execute query
     $list = $this->query($query);
     // precess result
     if (!$list->length) {
         throw new \OutOfRangeException("Cannot find XPath by {$locator} on page '{$this->getKey()}'.");
     }
     $result = '';
     foreach ($list as $item) {
         $result .= $item->value;
     }
     if ($locator->hasParameters()) {
         $patterns = array_map(function ($p) {
             return "%{$p}%";
         }, array_keys($locator->getParameters()));
         $values = array_values($locator->getParameters());
         $result = str_replace($patterns, $values, $result);
     }
     return $result;
 }
コード例 #21
0
ファイル: settings.php プロジェクト: efoft/hydra
/* Error reporting
  ------------------------------------------------------------------------ */
ini_set('error_reporting', 'true');
error_reporting(E_ALL | E_STRICT);
/* class Cfg is mandatory for futher work
  ------------------------------------------------------------------------ */
if (!class_exists('CfgData')) {
    die('CfgData not found. Have you done install steps?');
}
/* Session
  ------------------------------------------------------------------------ */
session_start();
/* Functions
  ------------------------------------------------------------------------ */
// this function below will handle all arising exception
set_exception_handler(function ($exception) {
    // inside here we must declare vital classes separately
    $loc = new Locator();
    $log = new Logger($loc->path('log'));
    $log->log($exception, LOG_ERR);
    // emergency mailer is defined separately
    $mail = MailerFactory::createMailerProvider('PHP');
    // notify by email only once per exception
    $lockfile = $loc->path('secure') . '/lock.err_' . md5($exception);
    if (!file_exists($lockfile)) {
        touch($lockfile);
        $mail->sendEmail('root', gethostname(), 'Site Reporter', 'Problem occured', $exception);
    }
    include_once $loc->path('pages/error.php');
    exit;
});
コード例 #22
0
 /**
  * @dataProvider providerLocatorContructorsArguments
  */
 public function testHasMethodsShouldReturnFalseForNullValuesAndTrueForNotNull($url, $key, $type, $fieldset, $tab, $parameters, $pageKey)
 {
     $locator = new Locator($url, $key, $type, $fieldset, $tab, $parameters, $pageKey);
     if (null === $url) {
         $this->assertFalse($locator->hasPageUrl());
     } else {
         $this->assertTrue($locator->hasPageUrl());
     }
     if (null === $key) {
         $this->assertFalse($locator->hasKey());
     } else {
         $this->assertTrue($locator->hasKey());
     }
     if (null === $type) {
         $this->assertFalse($locator->hasType());
     } else {
         $this->assertTrue($locator->hasType());
     }
     if (null === $fieldset) {
         $this->assertFalse($locator->hasFieldset());
     } else {
         $this->assertTrue($locator->hasFieldset());
     }
     if (null === $tab) {
         $this->assertFalse($locator->hasTab());
     } else {
         $this->assertTrue($locator->hasTab());
     }
     if ($parameters) {
         $this->assertTrue($locator->hasParameters());
     } else {
         $this->assertFalse($locator->hasParameters());
     }
     if (null === $pageKey) {
         $this->assertFalse($locator->hasPageKey());
     } else {
         $this->assertTrue($locator->hasPageKey());
     }
 }