本文整理汇总了PHP中ST::isAjaxRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP ST::isAjaxRequest方法的具体用法?PHP ST::isAjaxRequest怎么用?PHP ST::isAjaxRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ST
的用法示例。
在下文中一共展示了ST::isAjaxRequest方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isCodeInUse
public function isCodeInUse($code, $period_start, $period_end, $force_no_ajax = false)
{
$use = false;
$period_start = $period_start instanceof DateTime ? $period_start : date_create($period_start);
$period_end = $period_end instanceof DateTime ? $period_end : date_create($period_end);
// dump($period_start, $period_end);
$vc = new Vks_controller();
//how much digits in num
$digits = strlen((string) $code);
$vkses = Vks::with('connection_codes')->where('start_date_time', '<=', $period_end->modify("+" . Settings_controller::getOther('pause_gap') . " minutes"))->where('end_date_time', '>=', $period_start->modify("-" . Settings_controller::getOther('pause_gap') . " minutes"))->approved()->get(['id', 'title', 'start_date_time', 'end_date_time', 'date']);
// dump($vkses);
foreach ($vkses as $vks) {
if (count($vks->connection_codes)) {
foreach ($vks->connection_codes as $vcode) {
if (substr($vcode->value, -$digits) == $code) {
$vks = $vc->humanize($vks);
$use = $vks;
break;
}
}
}
}
if ($force_no_ajax) {
return $use;
}
// ST::makeDebug($use);
if (ST::isAjaxRequest()) {
if ($use) {
$use = $use->toJson();
}
print json_encode($use);
} else {
return $use;
}
}
示例2: run
public function run()
{
//add counter
$params = count($this->params) ? "/" . implode("/", $this->params) : "";
$mskTime = date_create()->setTimezone(new DateTimeZone(App::$instance->opt->ca_timezone));
Counter::create(['origin' => MY_NODE, 'ip' => App::$instance->user->ip, 'request' => $this->controller . "/" . $this->action . urlencode($params), 'type' => ST::isAjaxRequest() ? REQUEST_AJAX : REQUEST_REGULAR, 'created_at' => $mskTime, 'updated_at' => $mskTime]);
call_user_func_array(array(new $this->controller(), $this->action), $this->params);
}
示例3: search
public function search($phrase)
{
if (ST::isAjaxRequest()) {
$vksWSC = new Vks_controller();
$result = [];
$result['ws'] = Vks::where("id", $phrase)->whereIn('status', [VKS_STATUS_APPROVED, VKS_STATUS_PENDING])->take(1)->get();
foreach ($result['ws'] as $vks) {
$vksWSC->humanize($vks);
}
print json_encode($result);
}
}
示例4: isExist
public function isExist($key)
{
$result = false;
if (file_exists(self::SAVE_PATH . App::$instance->user->id . "_" . $key)) {
$result = true;
}
if (!ST::isAjaxRequest()) {
return $result;
} else {
print json_encode($result);
}
}
示例5: ask
public function ask($file, $key)
{
$result = null;
if (file_exists(NODE_REAL_PATH . "config/" . $file . ".xml")) {
$helpfile = (object) simplexml_load_file(NODE_REAL_PATH . "config/" . $file . ".xml");
foreach ($helpfile as $element) {
if (strval($element->name) == $key) {
$result = "<div style='font-size: 16px;'>" . strval($element->content) . "</div>";
if (isset($element->image)) {
$result = "<div class='text-center'><image style='width:95%;' src='" . $element->image . "'/></div>" . $result;
}
}
}
}
if (ST::isAjaxRequest()) {
print json_encode([$result]);
} else {
return $result;
}
}
示例6: pull
public function pull()
{
if (!Auth::isLogged(App::$instance)) {
die(json_encode([]));
}
// not auth
//set time barrier
if (!$this->isCanBePulled()) {
die(json_encode([]));
}
// not time come
$startThere = date_create()->modify("-120 seconds");
$readed = $this->sesRead();
//define last access time
$this->putLastRequestTime();
//get notices
$notifications = Notification::where("created_at", ">", $startThere)->where("created_at", "<", date_create())->whereNotIn("id", $readed['filtered'])->whereIn("to", [0, App::$instance->user->id])->take(5)->get();
//humanize
if (count($notifications)) {
foreach ($notifications as $notice) {
$notice->humanized = new stdClass();
$notice->humanized->created_at = date_create($notice->created_at)->format("d.m.Y H:i:s");
}
}
//mark as collected
if (count($notifications)) {
foreach ($notifications as $notice) {
$readed['raw'][] = [$notice->id, date_create()->format("Y-m-d H:i:s")];
}
$this->sesWrite($readed['raw']);
}
if (ST::isAjaxRequest()) {
print json_encode($notifications);
} else {
return $notifications;
}
}
示例7: askAtDateTime
public function askAtDateTime(DateTime $startDateTime, DateTime $endDateTime, $vks_blocked_type)
{
$blocks = BlockedTime::where('end_at', ">=", $startDateTime)->where('start_at', '<=', $endDateTime)->where('vks_type_blocked', intval($vks_blocked_type))->get();
if (ST::isAjaxRequest()) {
print json_encode($blocks);
} else {
return $blocks;
}
}
示例8: getCodesCores
public function getCodesCores()
{
Auth::isAdminOrDie(App::$instance);
$this->castCodeDelivery();
$codes = (object) simplexml_load_file("config/code-delivery-cfg.xml");
$result = [];
foreach ($codes as $option) {
if (!in_array((string) $option['core'], $result)) {
$result[] = (string) $option['core'];
}
}
if (ST::isAjaxRequest()) {
print json_encode($result);
} else {
return $result;
}
}
示例9: ProcessCheck
public function ProcessCheck(stdClass $requestCheckResult)
{
if (ST::isAjaxRequest() && !$requestCheckResult->ajax) {
print json_encode(['response' => 'false']);
die;
}
if (!$requestCheckResult->controller) {
$this->error('404');
}
if (!$requestCheckResult->action) {
$this->error('404');
}
if (!$requestCheckResult->method) {
$this->error('router-method-restricted');
}
if (!$requestCheckResult->access) {
$this->error('router-role-access-restricted');
}
}
示例10: find
public function find($searchString, $humanized = false)
{
Auth::isAdminOrDie(App::$instance);
if (ST::isAjaxRequest()) {
$users = User::where("login", 'LIKE', "%{$searchString}%")->where("status", USER_STATUS_APPROVED)->take(10)->get();
if ($humanized) {
foreach ($users as $user) {
$user = self::humanize($user);
}
}
print json_encode($users);
}
}
示例11: drawOverAllImage
private function drawOverAllImage($date)
{
$res1 = $this->dataForGraph($date, 0);
$res2 = $this->dataForGraph($date, 1);
$MyData = new pData();
$MyData->addPoints($res1['percents'], "Load in % for server 1");
$MyData->addPoints($res2['percents'], "Load in % for server 2");
$MyData->setAxisName(0, "Participants");
$MyData->addPoints($res1['times'], "Labels");
// $MyData->addPoints($res2['times'], "Labels");
$MyData->setSerieDescription("Labels", "Months");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(1200, 560, $MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = TRUE;
/* Add a border to the picture */
//$myPicture->drawRectangle(0,0,890,290,array("R"=>0,"G"=>0,"B"=>0));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => CORE_REPOSITORY_REAL_PATH . "class/pChart/fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(200, 35, "All Servers Resource Usage (" . $date . ")", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => CORE_REPOSITORY_REAL_PATH . "class/pChart/fonts/pf_arma_five.ttf", "FontSize" => 8));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 1100, 500);
$AxisBoundaries = array(0 => array("Min" => 0, "Max" => 100));
/* Draw the scale */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE, "LabelSkip" => 1, 'Mode' => SCALE_MODE_MANUAL, "ManualScale" => $AxisBoundaries);
$myPicture->drawScale($scaleSettings);
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the stacked area chart */
$myPicture->drawStackedAreaChart(array("DrawLine" => TRUE, "LineSurrounding" => -20));
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Draw the line chart */
$myPicture->drawLineChart();
/* Write the chart legend */
$myPicture->drawLegend(800, 20, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
//$myPicture->autoOutput(App::$instance->opt->fizPath."class/pChart/pictures/example.drawLineChart.simple.png");
$myPicture->render(CORE_REPOSITORY_REAL_PATH . "class/pChart/pictures/load_at_" . $date . "_on_overall.png");
$path = CORE_REPOSITORY_HTTP_PATH . "class/pChart/pictures/load_at_" . $date . "_on_overall.png";
if (ST::isAjaxRequest()) {
$data = [];
print json_encode($data['path'] = $path);
} else {
return $path;
}
}
示例12: hasLocalVks
public function hasLocalVks($caVksId)
{
$result = Vks::where('link_ca_vks_id', $caVksId)->count();
if (ST::isAjaxRequest()) {
print json_encode($result ? ['response' => 1] : ['response' => 0]);
} else {
return $result;
}
}