public function __construct(array $data, array $rules, array $messages = [], array $customAttributes = []) { if (empty(static::$messagesBag)) { static::$messagesBag = (require_once './messages.php'); } $this->messages = array_merge(static::$messagesBag, (array) $messages); $validator = new Factory(); ddd($validator); }
/** * Help debug method */ public function help($level = null) { $vars = $this->_data->__var; unset($vars['__env']); unset($vars['app']); if ($level) { Debug::level($level); } ddd($vars); }
public function storeInDb() { $db = OcDb::instance(); if ($_REQUEST['type'] == Log::TYPE_CONQUESTED && $this->powerTrail->isAlreadyConquestedByUser($this->user)) { /* atempt to add second 'conquested' log */ return false; } if ($this->id) { ddd('TODO'); } else { if ($this->type === self::TYPE_ADD_WARNING && $this->user->getIsAdmin() === false) { return false; /* regular user is not allowed to add entery of this type */ } $query = 'INSERT INTO `PowerTrail_comments`(`userId`, `PowerTrailId`, `commentType`, `commentText`, `logDateTime`, `dbInsertDateTime`, `deleted`) VALUES (:1, :2, :3, :4, :5, NOW(),0)'; $db->multiVariableQuery($query, $this->user->getUserId(), $this->powerTrail->getId(), $this->type, $this->text, $this->dateTime->format('Y-m-d H:i:s')); if ($this->type == self::TYPE_CONQUESTED) { $this->powerTrail->increaseConquestedCount(); } } $this->changePowerTrailStatusAfterLog(); return true; }
/** * @param array $params * 'cacheId' => (integer) database cache identifier * 'wpId' => (string) geoCache wayPoint (ex. OP21F4) */ public function __construct(array $params = array()) { if (isset($params['cacheId'])) { // load from DB if cachId param is set $db = OcDb::instance(); $this->id = (int) $params['cacheId']; $queryById = "SELECT size, status, founds, notfounds, topratings, votes, notes, score, name, type, date_hidden, longitude, latitude, wp_oc, wp_gc, wp_nc, wp_tc, wp_ge, user_id, last_found, difficulty, terrain, way_length, logpw, search_time, date_created, watcher, ignorer_count, org_user_id, desc_languages, mp3count, picturescount, date_activate FROM `caches` WHERE `cache_id`=:1 LIMIT 1"; $s = $db->multiVariableQuery($queryById, $this->id); $cacheDbRow = $db->dbResultFetch($s); if (is_array($cacheDbRow)) { $this->loadFromRow($cacheDbRow); } else { ddd('geocache not found in db? TODO: cache-not-found handling'); //TODO: cache-not-found handling? } $this->loadCacheLocation($db); } else { if (isset($params['okapiRow'])) { $this->loadFromOkapiRow($params['okapiRow']); } } $this->dictionary = \cache::instance(); }
$graph->SetScale("textlin"); if ($theme) { $graph->SetTheme(new $theme()); } $theme_class = new Themes\AquaTheme(); $graph->SetTheme($theme_class); $plot = array(); // Create the bar plots for ($i = 0; $i < 4; $i++) { $plot[$i] = new Plot\BarPlot($data[$i]); $plot[$i]->SetLegend('plot' . ($i + 1)); } //$acc1 = new Plot\AccBarPlot(array($plot[0], $plot[1])); //$acc1->value->Show(); Kint::enabled(true); ddd($plot); $gbplot = new Plot\GroupBarPlot(array($plot[2], $plot[1])); for ($i = 4; $i < 8; $i++) { $plot[$i] = new Plot\LinePlot($data[$i]); $plot[$i]->SetLegend('plot' . $i); $plot[$i]->value->Show(); } $graph->Add($gbplot); $graph->Add($plot[4]); $title = "AquaTheme Example"; $title = mb_convert_encoding($title, 'UTF-8'); $graph->title->Set($title); $graph->xaxis->title->Set("X-title"); $graph->yaxis->title->Set("Y-title"); // Display the graph $graph->Stroke();
public function import() { set_time_limit(10000000000.0); if (file_exists(_PS_ROOT_DIR_ . '/upload/import/csv/import.csv')) { $file = fopen(_PS_ROOT_DIR_ . '/upload/import/csv/import.csv', 'r'); fgetcsv($file); //$counter = 0; $escape = "\\"; $imported_lines = 0; $read_lines = 0; while ($line = fgetcsv($file)) { if (count($line) == 20 && ($line = $this->prepareArray($line))) { $this->upsert($line); $imported_lines++; } $read_lines++; } $content .= "Обработано строк для подгрузки картинок: " . $imported_lines . "</br>Прочитано строк: " . $read_lines; } else { $content .= "Файл не найден"; } ddd($content); }
public function traceBack() { $final = $this->finalNode->id; ddd($final); $start = $this->startNode->id; ddd($start); $evalNode = $final; ddd('eval', $evalNode); while ($evalNode !== $start) { $path[] = $evalNode; ddd('path', $path); $evalNode = $this->node[$evalNode]->parentID; } $path[] = $start; $correctPath = array_reverse($path); return $correctPath; }
public function processBulkMirrorpaste() { ddd($this->boxes); }
/** * An alias of ddd() function. * * @param mixed $input * * @return string */ function dumpit($input) { return ddd($input); }
/** * Errors handler. * * @author Krzysztof Trzos * @param integer $errno * @param string $errstr * @param string $errfile * @param integer $errline * @param array $errcontext * @throws Exception\Fatal * @since 1.0.0-alpha * @version 1.0.0-alpha */ function error_handler($errno, $errstr, $errfile = '', $errline = 0, $errcontext = []) { $iLevel = ob_get_level(); for ($i = 1; $i < $iLevel; $i++) { ob_get_clean(); } if (Core::getAppMode() == Core::MODE_DEVELOPMENT) { \Kint::trace(); ddd($errno, $errstr, $errfile, $errline, $errcontext); } else { try { throw new Exception\Fatal(); } catch (Exception $e) { $e->handler(); } } }
<?php ddd($currentApi);
function squeeze($s, $n = 15) { if (strlen($s) > $n) { $s = stip(ddd($s, $n), $s); } return $s; }
<?php require_once __DIR__ . '/vendor/autoload.php'; // initialize the base client try { $exampleSDKClient = \UniApi\UniApiClient::create('ExampleSDK'); } catch (RuntimeException $e) { echo $e->getMessage(); } // call our method and send $response = $exampleSDKClient->httpBinPost()->send(['user' => ['email' => '*****@*****.**', 'password' => md5('password'), 'profile' => ['dob' => '15/08/1992', 'userName' => 'TerryTibbs']]]); ddd($response);
/** * @param User $user * @param $proofOfTransfer * @param array $products * @param array $quantityHash * @param $status * @param $customer * @param $isHq * @param bool $isPickup * @param $ipAddress * @return Order */ private function createOrder(User $user, $proofOfTransfer, array $products, array $quantityHash, $status, $customer, $isHq, $isPickup = false, $ipAddress) { assert($user); assert($user->id); if ($customer) { assert($customer->referral_id == $user->id); } if (empty($products)) { \App::abort(500, 'invalid'); } if (empty($quantityHash)) { \App::abort(500, 'invalid'); } $allowedProducts = $this->productManager->getAvailableProductList($user, (bool) $customer)->pluck('id')->all(); assert(!empty($allowedProducts)); $organizationId = null; $hq = Organization::HQ(); $organizationId = $isHq ? $hq->id : $user->organization_id; $orderModel = config('order.order_model'); $order = new $orderModel(); $order->fill(['order_status_id' => $status, 'proof_of_transfer_id' => $proofOfTransfer->id, 'customer_id' => $customer ? $customer->id : null, 'organization_id' => $organizationId, 'user_id' => $user->id, 'is_hq' => $isHq, 'is_pickup' => $isPickup, 'created_by_id' => $this->userManager->getRealUserId(), 'ip_address' => $ipAddress]); if ($this->date) { $order->created_at = $this->date; } $order->save(); $index = 0; foreach ($products as $key => $product) { if (!config('order.allow_quantity') && $quantityHash[$key] != 1) { \App::abort(500, 'invalid'); } if (env('APP_ENV') != 'production') { if (!in_array($product->id, $allowedProducts)) { ddd([$user, (bool) $customer, $product, $allowedProducts]); } } assert(in_array($product->id, $allowedProducts)); $product->getPriceAndDelivery($user, $customer, $price, $delivery); $organizationId = $product->is_hq ? $hq->id : $user->organization_id; assert($organizationId == $order->organization_id, 'organization_id'); assert($isHq == $product->is_hq, 'is_hq'); $quantity = $quantityHash[$key]; assert($product->max_quantity >= $quantity); // by default awarded_user_id is auth user $awardedUserId = $user->id; // if product->awarded_parent is true the set referral id as awarded // Only applies to new system if ($product->award_parent) { assert($user->new_referral_id); $awardedUserId = $user->new_referral_id; } $orderItem = new OrderItem(); $orderItem->fill(['product_id' => $product->id, 'order_id' => $order->id, 'quantity' => $quantity, 'product_price' => $product->isOtherProduct() ? $proofOfTransfer->amount : $price, 'delivery' => $delivery, 'index' => $index++, 'organization_id' => $organizationId, 'awarded_user_id' => $awardedUserId]); if ($this->date) { $orderItem->created_at = $this->date; } $orderItem->save(); } $this->orderCreated($order); return $order; }
<?php require_once '../vendor/autoload.php'; require_once '../lib/autoload.php'; session_name(\My\Config::get('session_name')); session_start(); try { \My\System::run(); } catch (\My\Exception_system_exit $e) { die; } catch (\My\Exception_view_not_found $e) { echo "<h1>View-Template not found.</h1>"; echo "<h2>" . $e->getMessage() . "</h2>"; ddd($e); } catch (\Exception $e) { echo "<h1>Whoops</h1>"; ddd($e); }
public function storeInDb() { $db = DataBaseSingleton::Instance(); if ($_REQUEST['type'] == Log::TYPE_CONQUESTED && $this->powerTrail->isAlreadyConquestedByUser($this->user)) { /* atempt to add second 'conquested' log */ return false; } if ($this->id) { ddd('TODO'); } else { d($this); $query = 'INSERT INTO `PowerTrail_comments`(`userId`, `PowerTrailId`, `commentType`, `commentText`, `logDateTime`, `dbInsertDateTime`, `deleted`) VALUES (:1, :2, :3, :4, :5, NOW(),0)'; $db->multiVariableQuery($query, $this->user->getUserId(), $this->powerTrail->getId(), $this->type, $this->text, $this->dateTime->format('Y-m-d H:i:s')); if ($this->type == self::TYPE_CONQUESTED) { $this->powerTrail->increaseConquestedCount(); } } $this->changePowerTrailStatusAfterLog(); }
public function testMe() { ddd(Paser::escaped("Failed asserting that ||'201598689788||' matches expected 2015986897.")); $this->assertFalse(TRUE); }
/** * @Route("/{short_url}", name="short_url") */ public function shortUrlAction($short_url) { ddd($short_url); }
private function updatePositionsDnd() { $positions = Tools::getValue('module-helperlist_positions'); ddd($positions); }
use Utils\Database\OcDb; require_once './lib/common.inc.php'; require $stylepath . '/lib/icons.inc.php'; require $stylepath . '/viewcache.inc.php'; require $stylepath . '/viewlogs.inc.php'; require $stylepath . '/smilies.inc.php'; if (isset($_REQUEST['geocacheId']) && $_REQUEST['geocacheId'] != '') { $geocacheId = $_REQUEST['geocacheId']; } else { ddd('error'); } if (isset($_REQUEST['owner_id']) && $_REQUEST['owner_id'] != '') { $owner_id = $_REQUEST['owner_id']; } else { ddd('error - owner_id'); } if (isset($_REQUEST['offset']) && $_REQUEST['offset'] != '') { $offset = (int) $_REQUEST['offset']; } else { $offset = 0; } if (isset($_REQUEST['limit']) && $_REQUEST['limit'] != '') { $limit = (int) $_REQUEST['limit']; } else { $limit = 5; } if ($usr == false && $hide_coords) { $disable_spoiler_view = true; //hide any kind of spoiler if usr not logged in } else {