本文整理汇总了PHP中ipRequest函数的典型用法代码示例。如果您正苦于以下问题:PHP ipRequest函数的具体用法?PHP ipRequest怎么用?PHP ipRequest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ipRequest函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addLanguage
public function addLanguage()
{
ipRequest()->mustBePost();
$data = ipRequest()->getPost();
if (empty($data['code'])) {
throw new \Ip\Exception('Missing required parameter');
}
$code = $data['code'];
$abbreviation = strtoupper($code);
$url = $code;
$languages = ipContent()->getLanguages();
foreach ($languages as $language) {
if ($language->getCode() == $code) {
return new \Ip\Response\Json(array('error' => 1, 'errorMessage' => __('This language already exist.', 'Ip-admin', false)));
}
}
$languages = Fixture::languageList();
$directionality = Service::TEXT_DIRECTION_LTR;
if (!empty($languages[$code])) {
$language = $languages[$code];
$title = $language['nativeName'];
if (!empty($language['directionality']) && $language['directionality'] == 'rtl') {
$directionality = Service::TEXT_DIRECTION_RTL;
}
} else {
$title = $code;
}
Service::addLanguage($title, $abbreviation, $code, $url, 1, $directionality);
return new \Ip\Response\Json(array());
}
示例2: setWidgetWidth
public function setWidgetWidth()
{
$id = ipRequest()->getRequest('widgetId', false);
$width = ipRequest()->getRequest('width', 50);
ipStorage()->set('FloatImageWidth', 'widget_' . $id, $width);
return new \Ip\Response\Json(array('status' => 'success'));
}
示例3: save
public function save()
{
//$form = Helper::createForm($wget='');
$form = Helper::createForm();
$postData = ipRequest()->getPost();
$errors = $form->validate($postData);
if ($errors) {
// Validation error
$status = array('status' => 'error', 'errors' => $errors);
return new \Ip\Response\Json($status);
} else {
// Success
Model::save(ipRequest()->getPost('language_id'), ipRequest()->getPost('zone_name'), ipRequest()->getPost('user_id'), ipRequest()->getPost('name'), ipRequest()->getPost('email'), ipRequest()->getPost('link'), ipRequest()->getPost('text'), ipRequest()->getPost('ip'), ipRequest()->getPost('approved'), ipRequest()->getPost('session_id'), ipRequest()->getPost('verification_code'), ipRequest()->getPost('active'));
//get page where this widget sits :)
$postData = ipRequest()->getPost();
$vcode = $postData['verification_code'];
$fullWidgetRecord = \Ip\Internal\Content\Model::getWidgetRecord($postData['wgetId']);
$pageTitle = '';
if (isset($fullWidgetRecord['revisionId'])) {
$revision = \Ip\Internal\Revision::getRevision($fullWidgetRecord['revisionId']);
if (!empty($revision['pageId'])) {
$pageTitle = ipPage($revision['pageId'])->getTitle();
}
}
$stamp = date(__('m/d/Y', 'Comments')) . __(', at ', 'Comments') . date('H:i:s');
//sending email notification
Helper::sendMailNotification(trim(ipRequest()->getPost('zone_name')), trim(ipRequest()->getPost('name')), $stamp, trim(ipRequest()->getPost('text')), trim(ipRequest()->getPost('email')), trim($pageTitle), trim($vcode));
//$actionUrl = ipActionUrl(array('sa' => 'FormExample.showSuccessMessage'));
//$status = array('redirectUrl' => $actionUrl);
$status = array('status' => 'ok');
//success
return new \Ip\Response\Json($status);
}
}
示例4: ipRouteAction_150
/**
* @param $info
* @return array|null
* @throws \Ip\Exception
*/
public static function ipRouteAction_150($info)
{
$requestFile = ipFile('') . $info['relativeUri'];
$fileDir = ipFile('file/');
if (ipRequest()->getRelativePath() != $info['relativeUri']) {
return null;
//language specific url.
}
if (mb_strpos($requestFile, $fileDir) !== 0) {
return null;
}
$reflection = mb_substr($requestFile, mb_strlen($fileDir));
$reflection = urldecode($reflection);
$reflectionModel = ReflectionModel::instance();
$reflectionRecord = $reflectionModel->getReflectionByReflection($reflection);
if ($reflectionRecord) {
$reflectionModel->createReflection($reflectionRecord['original'], $reflectionRecord['reflection'], json_decode($reflectionRecord['options'], true));
if (is_file(ipFile('file/' . $reflection))) {
//supply file route
$result['page'] = null;
$result['plugin'] = 'Repository';
$result['controller'] = 'PublicController';
$result['action'] = 'download';
return $result;
}
}
}
示例5: ipBlockContent
public static function ipBlockContent($content, $data)
{
if ($data['blockName'] == "main") {
$pagePassword = Service::pagePassword();
$pageId = Model::getPageId();
if ($pagePassword && !ipAdminId()) {
if (isset($_SESSION['pagePassword']) && is_array($_SESSION['pagePassword']) && in_array($pageId, $_SESSION['pagePassword'])) {
return $content;
}
$data['form'] = Helper::createForm();
$postPassword = ipRequest()->getPost('pagePassword');
if ($postPassword && $postPassword == $pagePassword) {
if (isset($_SESSION['pagePassword']) && is_array($_SESSION['pagePassword'])) {
$_SESSION['pagePassword'][] = $pageId;
} else {
$_SESSION['pagePassword'] = array();
$_SESSION['pagePassword'][] = $pageId;
}
return $content;
} elseif ($postPassword) {
$data['error'] = __('Incorrect password', 'PagePassword', false);
}
return ipView('view/password.php', $data)->render();
}
}
return $content;
}
示例6: grid
/**
* GRID config
*/
public static function grid()
{
$gridConfig = array('title' => 'Masonry Grid Items', 'table' => Config::TABLE_NAME, 'sortField' => 'itemOrder', 'createPosition' => 'top', 'createFilter' => function ($data) {
$data['widgetId'] = ipRequest()->getQuery('widgetId');
return $data;
}, 'fields' => array(array('label' => 'Title', 'field' => 'title', 'validators' => array('Required')), array('label' => 'Image', 'field' => 'image', 'type' => 'RepositoryFile', 'preview' => __CLASS__ . '::imageView', 'fileLimit' => 1, 'validators' => array('Required')), array('label' => 'Description', 'field' => 'description', 'type' => 'RichText', 'preview' => false), array('label' => 'Url', 'field' => 'url', 'type' => 'Url', 'preview' => false), array('label' => 'Visible', 'field' => 'isVisible', 'type' => 'Checkbox', 'defaultValue' => 1)));
return $gridConfig;
}
示例7: ipSendResponse
/**
* @param \Ip\Response $response
* @return mixed
*/
public static function ipSendResponse($response)
{
if (ipGetOption('MaintenanceMode.enabled') == 1 && ipAdminId() === false) {
if (substr(ipRequest()->getRelativePath(), 0, 5) != 'admin') {
return new \Ip\Response(ipGetOption('MaintenanceMode.content'));
}
}
return $response;
}
示例8: __construct
public function __construct($config, $request)
{
$this->request = $request;
$this->config = new Config($config);
$hash = ipRequest()->getRequest('gridHash', '');
$this->statusVariables = Status::parse($hash);
$this->subgridConfig = $this->config->subgridConfig($this->statusVariables);
$this->actions = $this->getActions();
}
示例9: grid
public function grid()
{
$worker = new \Ip\Internal\Grid\Worker($this->config());
$result = $worker->handleMethod(ipRequest());
if (is_array($result) && !empty($result['error']) && !empty($result['errors'])) {
return new \Ip\Response\Json($result);
}
return new \Ip\Response\JsonRpc($result);
}
示例10: grid
/**
* Check widget's posted data and return data to be stored or errors to be displayed
*/
public function grid()
{
$widgetId = ipRequest()->getQuery('widgetId');
ipAddCss('assets/masonryManagement.css');
$config = Config::grid();
if (!empty($widgetId)) {
$config['filter'] = ' `widgetId` = ' . (int) $widgetId;
$config['gatewayData'] = array('widgetId' => $widgetId);
}
return ipGridController($config);
}
示例11: ipBeforeController
public static function ipBeforeController()
{
if (ipIsManagementState()) {
$plugin = explode('.', ipRequest()->getQuery('aa'));
if ($plugin[0] == 'Pages') {
ipAddCss('assets/php.css');
ipAddCss('assets/codeEditorField.css');
ipAddJs('assets/src-noconflict/ace.js');
ipAddJs('assets/initCodeEditorField.js');
}
}
}
示例12: preview
public function preview()
{
$id = ipRequest()->getQuery('id');
if (!$id) {
throw new \Ip\Exception('Email not found');
}
$email = Db::getEmail($id);
$viewData = array('email' => $email);
$content = ipView('view/preview.php', $viewData);
$response = new \Ip\Response($content);
return $response;
}
示例13: ipAdminLoginPrevent
public static function ipAdminLoginPrevent($data)
{
if (empty($data['username'])) {
return 'Missing login data';
//in theory should never happen
}
$ip = ipRequest()->getServer('REMOTE_ADDR');
$antiBruteForce = SecurityModel::instance();
$failedLogins = $antiBruteForce->failedLoginCount($data['username'], $ip);
if ($failedLogins > ipGetOption('Admin.allowFailedLogins', 20)) {
return __('You have exceeded failed login attempts.', 'Ip-admin', false);
}
return null;
}
示例14: match
public function match($path, $request = null)
{
if (!$request) {
$request = ipRequest();
}
$result = $this->auraRouter->match($path, $request->getServer());
if (!$result) {
return array();
}
$result = $result->params;
if (is_callable($result['action'])) {
return $result;
}
return $result;
}
示例15: removeAdminIsAutogeneratedAjax
public function removeAdminIsAutogeneratedAjax()
{
ipRequest()->mustBePost();
// Removing temporary data
ipStorage()->remove('Ip', 'adminIsAutogenerated');
// If user wants to change credentials, redirecting to Administrators list
if (ipRequest()->getPost('action') == 'change') {
// todo: redirect and automatically select user and open popup
$redirect = ipActionUrl(array('aa' => 'Administrators.index')) . "#/hash=&administrator=" . \Ip\Internal\Admin\Backend::userId();
\Ip\Internal\System\Model::sendUsageStatistics(array('action' => 'Install.adminChange'));
return \Ip\Response\JsonRpc::result(array('redirect' => $redirect));
}
\Ip\Internal\System\Model::sendUsageStatistics(array('action' => 'Install.adminKeep'));
return \Ip\Response\JsonRpc::result(array('close' => 1));
}