本文整理汇总了PHP中dmp函数的典型用法代码示例。如果您正苦于以下问题:PHP dmp函数的具体用法?PHP dmp怎么用?PHP dmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dmp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filterall
function filterall($tag, $arg=NULL) {
// this one doesn't return the result, so it's safe to use with the new 'all' filter
if ($this->debug) dmp(__FUNCTION__, $this->current_filter());
$args = func_get_args();
$this->events[] = array('filter' => __FUNCTION__, 'tag'=>$tag, 'args'=>array_slice($args, 1));
}
示例2: safe_query
function safe_query($q = '', $debug = '', $unbuf = '')
{
global $DB, $txpcfg, $qcount, $qtime, $production_status;
$method = !$unbuf ? 'mysql_query' : 'mysql_unbuffered_query';
if (!$q) {
return false;
}
if ($debug or TXP_DEBUG === 1) {
dmp($q);
}
$start = getmicrotime();
$result = $method($q, $DB->link);
$time = sprintf('%02.6f', getmicrotime() - $start);
@($qtime += $time);
@$qcount++;
if ($result === false and (txpinterface === 'admin' or @$production_status == 'debug' or @$production_status == 'testing')) {
$caller = $production_status == 'debug' ? n . join("\n", get_caller()) : '';
trigger_error(mysql_error() . n . $q . $caller, E_USER_WARNING);
}
trace_add("[SQL ({$time}): {$q}]");
if (!$result) {
return false;
}
return $result;
}
示例3: safe_query
function safe_query($q = '', $debug = '', $unbuf = '')
{
global $DB, $txpcfg, $qcount, $qtime, $production_status;
$method = !$unbuf ? 'mysql_query' : 'mysql_unbuffered_query';
if (!$q) {
return false;
}
if ($debug or TXP_DEBUG === 1) {
dmp($q);
dmp(mysql_error());
// dmp(debug_backtrace());
}
$start = getmicrotime();
$result = $method($q, $DB->link);
$time = sprintf('%02.6f', getmicrotime() - $start);
@($qtime += $time);
@$qcount++;
if ($result === false and (@$production_status == 'debug' or @$production_status == 'test')) {
trigger_error(mysql_error() . n . $q, E_USER_ERROR);
}
trace_add("[SQL ({$time}): {$q}]");
if (!$result) {
return false;
}
return $result;
}
示例4: testDump
/**
* Test dump().
*
* @return void
*/
public function testDump()
{
$beans = R::dispense('bean', 2);
$beans[0]->name = 'hello';
$beans[1]->name = 'world';
$array = R::dump($beans);
asrt(is_array($array), TRUE);
foreach ($array as $item) {
asrt(is_string($item), TRUE);
}
$beans[1]->name = 'world, and a very long string that should be shortened';
$array = R::dump($beans);
asrt(is_array($array), TRUE);
asrt(strpos($array[1], '...'), 35);
//just to get 100% test cov, we dont need to test this
dmp($beans);
pass();
//test wrong input
asrt(is_array(R::dump(NULL)), TRUE);
asrt(count(R::dump(NULL)), 0);
asrt(is_array(R::dump('')), TRUE);
asrt(count(R::dump('')), 0);
asrt(is_array(R::dump(1)), TRUE);
asrt(count(R::dump(1)), 0);
asrt(is_array(R::dump(TRUE)), TRUE);
asrt(count(R::dump(FALSE)), 0);
}
示例5: safe_query
function safe_query($q = '', $debug = '')
{
global $DB, $txpcfg, $qcount, $qtime, $production_status;
if ($debug) {
dmp($q);
}
if (txpinterface === 'admin' or @$production_status != 'live') {
$debug = true;
}
$r = $DB->query($q, $debug);
return $r;
/*
if (!$q) return false;
if ($debug or TXP_DEBUG === 1) {
dmp($q);
dmp(db_lasterror());
// dmp(debug_backtrace());
}
$start = getmicrotime();
$result = db_query($q,$DB->link);
$time = sprintf('%02.6f', getmicrotime() - $start);
@$qtime += $time;
@$qcount++;
if ($result === false and (txpinterface === 'admin' or @$production_status == 'debug' or @$production_status == 'testing')) {
$caller = ($production_status == 'debug') ? n . join("\n", get_caller()) : '';
trigger_error(db_lasterror() . n . $q . $caller, E_USER_WARNING);
}
trace_add("[SQL ($time): $q]");
if(!$result) return false;
return $result;
*/
}
示例6: safe_query
function safe_query($q = '', $debug = '', $unbuf = '')
{
global $DB, $txpcfg;
$method = !$unbuf ? 'mysql_query' : 'mysql_unbuffered_query';
if (!$q) {
return false;
}
if ($debug) {
dmp($q);
dmp(mysql_error());
}
$result = $method($q, $DB->link);
if (!$result) {
return false;
}
return $result;
}
示例7: initialize
public function initialize($credentials)
{
if (!function_exists('curl_init')) {
throw new Exception('stripe needs the CURL PHP extension.');
}
dmp($credentials);
$this->type = $credentials->type;
$this->name = $credentials->name;
$this->mode = $credentials->mode;
$this->TRANSACTION_KEY = $credentials->fields['transaction_key'];
$this->SECRET_KEY = $credentials->fields['secret_key'];
Stripe::setApiKey($this->TRANSACTION_KEY);
Stripe::setApiVersion("2014-11-05");
if (trim($credentials->mode) == 'test') {
$this->AUTHORIZENET_SANDBOX = 'true';
} else {
$this->AUTHORIZENET_SANDBOX = 'false';
}
}
示例8: safe_query
function safe_query($q = '', $debug = '', $unbuf = '')
{
global $DB, $txpcfg, $qcount, $production_status;
$method = !$unbuf ? 'mysql_query' : 'mysql_unbuffered_query';
if (!$q) {
return false;
}
if ($debug or TXP_DEBUG === 1) {
dmp($q);
dmp(mysql_error());
// dmp(debug_backtrace());
}
$result = $method($q, $DB->link);
@$qcount++;
if ($result === false and (@$production_level == 'debug' or @$production_level == 'test')) {
trigger_error(mysql_error() . n . $q, E_USER_ERROR);
}
if (!$result) {
return false;
}
return $result;
}
示例9: process
function process($name, $phone, $amount, $receipt)
{
$this->response_arr = array('RESULT' => 0, 'RESPONCE' => '', 'id' => 0);
try {
$pesa = new PLUSPEOPLE\PesaPi\PesaPi();
$transactions = $pesa->locateByReceipt($receipt);
dmp($transactions[0]);
if (count($transactions) == 0) {
$this->response_arr = array('RESULT' => '1', 'RESPONCE' => 'Pending, Incoming Mobile Money Transaction Not found ');
throw new Exception('Pending, Incoming Mobile Money Transaction Not found ');
} else {
$transaction = $transactions[0];
if ($transaction->getPhonenumber() != $phone) {
$this->response_arr = array('RESULT' => '8', 'RESPONCE' => 'Invalid phone');
throw new Exception('Invalid phone');
} else {
if ($transaction->getName() != $name) {
$this->response_arr = array('RESULT' => '7', 'RESPONCE' => 'Invalid name');
throw new Exception('Invalid name');
} else {
if ($transaction->getAmount() < $amount) {
$this->response_arr = array('RESULT' => '3', 'RESPONCE' => 'Pending, Incoming Mobile Money Transaction Not found ');
throw new Exception('Pending, Incoming Mobile Money Transaction Not found');
} else {
if ($transaction->getAmount() > $amount) {
$this->response_arr = array('RESULT' => '4', 'RESPONCE' => 'Pending, Incoming Mobile Money Transaction Not found ');
throw new Exception('Pending, Incoming Mobile Money Transaction Not found');
}
}
}
}
$this->response_arr['id'] = $transaction->getId();
}
} catch (Exception $e) {
throw $e;
}
return $this->response_arr;
}
示例10: quickSetup
/**
* Save custom rates by quick setup
* If a rate belongs to a month that have no custom rates defined, all custom rates for that month are generated based on default rate
*
* @param unknown_type $data
*/
function quickSetup($data)
{
dmp($data);
for ($d = strtotime($data["start_date"]); $d <= strtotime($data["end_date"]);) {
$dayString = date("Y-m-d", $d);
$table = $this->getTable();
$rateObj = $table->getRateDetails($data["rate_id"], $dayString);
if (!isset($rateObj)) {
$month = date("m", $d);
$year = date("Y", $d);
$this->saveDefaultRates($data["rate_id"], $month, $year);
$table = $this->getTable();
$rateObj = $table->getRateDetails($data["rate_id"], $dayString);
}
$weekDay = date("N", $d);
if (!in_array($weekDay, $data["week_day"])) {
$d = strtotime(date('Y-m-d', $d) . ' + 1 day ');
continue;
}
if (isset($data["price"]) && strlen($data["price"]) > 0) {
$rateObj->price = $data["price"];
}
if (isset($data["availability"]) && strlen($data["availability"]) > 0) {
$rateObj->availability = $data["availability"];
}
if (isset($data["min_days"]) && strlen($data["min_days"]) > 0) {
$rateObj->min_days = $data["min_days"];
}
if (isset($data["max_days"]) && strlen($data["max_days"]) > 0) {
$rateObj->max_days = $data["max_days"];
}
if (isset($data["child_price"]) && strlen($data["child_price"]) > 0) {
$rateObj->child_price = $data["child_price"];
}
$this->saveRate($rateObj);
$d = strtotime(date('Y-m-d', $d) . ' + 1 day ');
}
return true;
}
示例11: importSliderHandle
/**
*
* import slideer handle (not ajax response)
*/
private static function importSliderHandle()
{
dmp("importing slider setings and data...");
$slider = new RevSlider();
$response = $slider->importSliderFromPost();
$sliderID = $response["sliderID"];
$viewBack = self::getViewUrl(self::VIEW_SLIDER, "id=" . $sliderID);
if (empty($sliderID)) {
$viewBack = self::getViewUrl(self::VIEW_SLIDERS);
}
//handle error
if ($response["success"] == false) {
$message = $response["error"];
dmp("<b>Error: " . $message . "</b>");
echo UniteFunctionsRev::getHtmlLink($viewBack, "Go Back");
} else {
//handle success, js redirect.
dmp("Slider Import Success, redirecting...");
echo "<script>location.href='{$viewBack}'</script>";
}
exit;
}
示例12: requireSettings
/**
*
* require settings file, the filename without .php
*/
protected static function requireSettings($settingsFile)
{
try {
require self::$path_plugin . "settings/{$settingsFile}.php";
} catch (Exception $e) {
echo "<br><br>Settings ({$settingsFile}) Error: <b>" . $e->getMessage() . "</b>";
dmp($e->getTraceAsString());
}
}
示例13: printDefinedConstants
/**
*
* get all defined constants list with values.
*/
public static function printDefinedConstants()
{
$arr = get_defined_constants(true);
$arrUser = $arr["user"];
dmp($arrUser);
exit;
}
示例14: testPatchApply
function testPatchApply()
{
dmp()->Match_Distance = 1000;
dmp()->Match_Threshold = 0.5;
dmp()->Patch_DeleteThreshold = 0.5;
// Exact match.
$patches = dmp()->patch_make("The quick brown fox jumps over the lazy dog.", "That quick brown fox jumped over a lazy dog.");
$results = dmp()->patch_apply($patches, "The quick brown fox jumps over the lazy dog.");
assertEquivalent(array("That quick brown fox jumped over a lazy dog.", array(true, true)), $results);
// Partial match.
$results = dmp()->patch_apply($patches, "The quick red rabbit jumps over the tired tiger.");
assertEquivalent(array("That quick red rabbit jumped over a tired tiger.", array(true, true)), $results);
// Failed match.
$results = dmp()->patch_apply($patches, "I am the very model of a modern major general.");
assertEquivalent(array("I am the very model of a modern major general.", array(false, false)), $results);
// Big delete, small change.
$patches = dmp()->patch_make('x1234567890123456789012345678901234567890123456789012345678901234567890y', 'xabcy');
$results = dmp()->patch_apply($patches, 'x123456789012345678901234567890-----++++++++++-----123456789012345678901234567890y');
assertEquivalent(array('xabcy', array(true, true)), $results);
// Big delete, big change 1.
$patches = dmp()->patch_make('x1234567890123456789012345678901234567890123456789012345678901234567890y', 'xabcy');
$results = dmp()->patch_apply($patches, 'x12345678901234567890---------------++++++++++---------------12345678901234567890y');
assertEquivalent(array('xabc12345678901234567890---------------++++++++++---------------12345678901234567890y', array(false, true)), $results);
// Big delete, big change 2.
dmp()->Patch_DeleteThreshold = 0.6;
$patches = dmp()->patch_make('x1234567890123456789012345678901234567890123456789012345678901234567890y', 'xabcy');
$results = dmp()->patch_apply($patches, 'x12345678901234567890---------------++++++++++---------------12345678901234567890y');
assertEquivalent(array('xabcy', array(true, true)), $results);
dmp()->Patch_DeleteThreshold = 0.5;
// Compensate for failed patch.
dmp()->Match_Threshold = 0.0;
dmp()->Match_Distance = 0;
$patches = dmp()->patch_make('abcdefghijklmnopqrstuvwxyz--------------------1234567890', 'abcXXXXXXXXXXdefghijklmnopqrstuvwxyz--------------------1234567YYYYYYYYYY890');
$results = dmp()->patch_apply($patches, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ--------------------1234567890');
assertEquivalent(array('ABCDEFGHIJKLMNOPQRSTUVWXYZ--------------------1234567YYYYYYYYYY890', array(false, true)), $results);
dmp()->Match_Threshold = 0.5;
dmp()->Match_Distance = 1000;
// No side effects.
$patches = dmp()->patch_make('', 'test');
$patchstr = dmp()->patch_toText($patches);
dmp()->patch_apply($patches, '');
assertEquals($patchstr, dmp()->patch_toText($patches));
// No side effects with major delete.
$patches = dmp()->patch_make('The quick brown fox jumps over the lazy dog.', 'Woof');
$patchstr = dmp()->patch_toText($patches);
dmp()->patch_apply($patches, 'The quick brown fox jumps over the lazy dog.');
assertEquals($patchstr, dmp()->patch_toText($patches));
// Edge exact match.
$patches = dmp()->patch_make('', 'test');
$results = dmp()->patch_apply($patches, '');
assertEquivalent(array('test', array(true)), $results);
// Near edge exact match.
$patches = dmp()->patch_make('XY', 'XtestY');
$results = dmp()->patch_apply($patches, 'XY');
assertEquivalent(array('XtestY', array(true)), $results);
// Edge partial match.
$patches = dmp()->patch_make('y', 'y123');
$results = dmp()->patch_apply($patches, 'x');
assertEquivalent(array('x123', array(true)), $results);
}
示例15: query
function query($q = '', $debug = '')
{
global $qcount, $qtime;
if (!$q) {
return false;
}
$start = getmicrotime();
$result = $this->DB->do_query($q, $this->DB->link);
if ($debug or $this->_debug) {
dmp($q, $result);
}
$time = sprintf('%02.6f', getmicrotime() - $start);
@($qtime += $time);
@$qcount++;
if ($result === false and (txpinterface === 'admin' or !is_production_status('live'))) {
$caller = is_production_status('debug') ? n . join("\n", get_caller()) : '';
trigger_error($this->DB->lasterror() . n . $q . $caller, E_USER_WARNING);
}
trace_add("[SQL ({$time}): {$q}]");
if (!$result) {
return false;
}
return $result;
}