當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CoreUtils類代碼示例

本文整理匯總了PHP中CoreUtils的典型用法代碼示例。如果您正苦於以下問題:PHP CoreUtils類的具體用法?PHP CoreUtils怎麽用?PHP CoreUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CoreUtils類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: checkUserPermissionsForRecord

 protected function checkUserPermissionsForRecord()
 {
     if ($this->currentUser['adminRole'] < $this->adminRoles['adminRoleSuperadmin'] && $this->currentUser['id'] != $this->record['id']) {
         CoreServices2::getDB()->transactionCommit();
         CoreUtils::redirect($this->getListPageAddress());
     }
 }
開發者ID:piotrPiechura,項目名稱:3dPathProject,代碼行數:7,代碼來源:AdminCMSEditController.class.php

示例2: prepareData

 public function prepareData()
 {
     parent::prepareData();
     if (CoreServices2::getRequest()->getFromGet('_sm')) {
         $this->successMessage = 1;
         return;
     }
     $this->dao = new UserDAO();
     $this->initRecord();
     $this->initForm();
     $this->createFormFields();
     if (empty($this->record['id'])) {
         // @TODO: własciwie w tym wypadku powinno sie przejść z powrotem do pierwszego
         //        formularza i rozpocząć całą procedurę od nowa
         $this->errorMessageContainer = new CoreFormValidationMessageContainer();
         $this->errorMessageContainer->addMessage('errorInvalidCode');
         return;
     }
     if ($this->form->isSubmitted()) {
         $this->addFormValidators();
         $this->form->setFieldValuesFromRequest();
         $this->handleRequest();
     } else {
         $this->setFormFieldValuesFromRecord();
     }
     if (!empty($this->redirectAddress)) {
         CoreUtils::redirect($this->redirectAddress);
     }
 }
開發者ID:piotrPiechura,項目名稱:3dPathProject,代碼行數:29,代碼來源:UserWebsitePasswordRecovery2Controller.class.php

示例3: process

 /**
  * Processes a preference item's new value
  *
  * @param string $key
  *
  * @return mixed
  */
 static function process($key)
 {
     $value = isset($_POST['value']) ? CoreUtils::trim($_POST['value']) : null;
     switch ($key) {
         case "cg_itemsperpage":
             $thing = 'Color Guide items per page';
             if (!is_numeric($value)) {
                 throw new \Exception("{$thing} must be a number");
             }
             $value = intval($value, 10);
             if ($value < 7 || $value > 20) {
                 throw new \Exception("{$thing} must be between 7 and 20");
             }
             break;
         case "p_vectorapp":
             if (!empty($value) && !isset(CoreUtils::$VECTOR_APPS[$value])) {
                 throw new \Exception("The specified app is invalid");
             }
             break;
         case "p_hidediscord":
         case "p_disable_ga":
         case "cg_hidesynon":
         case "cg_hideclrinfo":
             $value = $value ? 1 : 0;
             break;
         case "discord_token":
             Response::fail("You cannot change the {$key} setting");
     }
     return $value;
 }
開發者ID:ponydevs,項目名稱:MLPVC-RR,代碼行數:37,代碼來源:UserPrefs.php

示例4: initRecord

 protected function initRecord()
 {
     parent::initRecord();
     if (empty($this->record['id']) || $this->record['subpageModule'] != 'Subpage' || $this->record['subpageMode'] != 'Website') {
         CoreUtils::redirect($this->getListPageAddress());
     }
 }
開發者ID:piotrPiechura,項目名稱:3dPathProject,代碼行數:7,代碼來源:SubpageCMSEditController.class.php

示例5: getTimeRemaining

 /**
  * Ta funkcja zwraca na razie liczbę dni, godzin, minut, sekund
  * pozostających do momentu podanego w parametrze. Podanie ilości
  * miesięcy i lat to trochę gorsza sprawa (szczególnie z miesiącami
  * jest problem koncepcyjny).
  * @param string
  * @return array
  */
 public function getTimeRemaining($time)
 {
     $timeSeconds = strtotime($time) - strtotime(CoreUtils::getDateTime());
     if ($timeSeconds <= 0) {
         return null;
     }
     return array('timeSeconds' => $timeSeconds, 's' => $timeSeconds % 60, 'm' => floor($timeSeconds / 60) % 60, 'h' => floor($timeSeconds / (60 * 60)) % 24, 'D' => floor($timeSeconds / (60 * 60 * 24)));
 }
開發者ID:piotrPiechura,項目名稱:3dPathProject,代碼行數:16,代碼來源:CoreTime.class.php

示例6: eventFinish

 public function eventFinish($category, $eventName)
 {
     $eventId = $this->getIdByName($eventName);
     if (empty($this->info[$category]['events'][$eventId]['eventName'])) {
         $this->info[$category]['events'][$eventId]['eventName'] = $eventName;
     }
     $this->info[$category]['events'][$eventId]['finishTime'] = CoreUtils::getTimeMicroseconds() - $this->startTime;
 }
開發者ID:piotrPiechura,項目名稱:3dPathProject,代碼行數:8,代碼來源:CoreDebug.class.php

示例7: initParams

 protected function initParams(&$params)
 {
     CoreUtils::checkConstraint(is_null($params) || is_array($params));
     if (!empty($params)) {
         $this->params = $params;
     } else {
         $this->params = array();
     }
 }
開發者ID:piotrPiechura,項目名稱:3dPathProject,代碼行數:9,代碼來源:MailAbstractContent.class.php

示例8: validate

 public function validate($messageManager)
 {
     $field = $this->form->getField($this->fieldName);
     $fieldValue = $field->getValue();
     if (!is_null($fieldValue)) {
         if (date('Y-m-d', strtotime($fieldValue)) < CoreUtils::getDate()) {
             $messageManager->addMessage('dateInThePast', array($this->fieldName => $field->getCaption()));
         }
     }
 }
開發者ID:piotrPiechura,項目名稱:3dPathProject,代碼行數:10,代碼來源:CoreFormValidatorDateNotInThePast.class.php

示例9: logAction

 protected function logAction($action)
 {
     $logRecord = $this->logDAO->getRecordTemplate();
     $logRecord['adminId'] = CoreServices2::getAccess()->getCurrentUserId();
     $logRecord['recordType'] = $this->recordType;
     $logRecord['recordId'] = CoreServices2::getAccess()->getCurrentUserId();
     $logRecord['logTime'] = CoreUtils::getDateTime();
     $logRecord['logIP'] = CoreServices2::getRequest()->getRealIP();
     $logRecord['logOperation'] = $action;
     $this->logDAO->save($logRecord);
 }
開發者ID:piotrPiechura,項目名稱:3dPathProject,代碼行數:11,代碼來源:AdminLoginController.class.php

示例10: checkHTTPS

 /**
  * Teoretycznie jest to odporne na thickboxy.
  */
 protected function checkHTTPS()
 {
     $httpsOn = CoreServices2::getUrl()->isHTTPSOn();
     $httpsRequired = CoreConfig::get('Environment', 'httpsForWebsite');
     if ($httpsRequired && !$httpsOn) {
         CoreUtils::redirect(CoreServices2::getUrl()->getCurrentExactAddress('https'));
     }
     if (!$httpsRequired && $httpsOn) {
         CoreUtils::redirect(CoreServices2::getUrl()->getCurrentExactAddress('http'));
     }
 }
開發者ID:piotrPiechura,項目名稱:3dPathProject,代碼行數:14,代碼來源:WebsiteAbstractController.class.php

示例11: redirectToPage

 protected function redirectToPage($url, $layoutType)
 {
     switch ($layoutType) {
         case 'standard':
             CoreUtils::redirect(CoreServices2::getUrl()->createAddress('_m', 'Helper', '_o', 'WebsiteThickboxParentRedirect', 'url', $url));
         case 'thickbox':
             CoreUtils::redirect($url);
         default:
             throw new CoreException('Invalid layout type ' . $layoutType);
     }
 }
開發者ID:piotrPiechura,項目名稱:3dPathProject,代碼行數:11,代碼來源:WebsiteAbstractControllerThickboxLayout.class.php

示例12: handleRequest

 protected function handleRequest()
 {
     $this->errorMessageContainer = $this->form->getValidationResults();
     if (!$this->errorMessageContainer->isAnyErrorMessage()) {
         $this->setRecordValuesFromForm();
         $this->record['userEraseRequestTime'] = CoreUtils::getDateTime();
         $this->record['userState'] = 'forDeletion';
         $this->dao->save($this->record);
         CoreServices2::getAccess()->logout();
         $this->redirectToStep2();
     }
 }
開發者ID:piotrPiechura,項目名稱:3dPathProject,代碼行數:12,代碼來源:UserWebsiteDeleteController.class.php

示例13: add

 public static function add($pointName = '')
 {
     if (self::$index == 0) {
         self::$timePoints = array();
     }
     self::$timePoints[self::$index] = array();
     $currentTime = CoreUtils::getTimeMicroseconds();
     self::$timePoints[self::$index]['diff'] = self::$index != 0 ? $currentTime - self::$timePoints[self::$index - 1]['time'] : 0;
     self::$timePoints[self::$index]['time'] = $currentTime;
     self::$timePoints[self::$index]['name'] = $pointName;
     self::$index++;
 }
開發者ID:piotrPiechura,項目名稱:3dPathProject,代碼行數:12,代碼來源:CoreTestTime.class.php

示例14: getChildrenCount

    public function getChildrenCount(&$record)
    {
        CoreUtils::checkConstraint(!empty($record['id']));
        $db = CoreServices2::getDB();
        $sql = '
			SELECT COUNT(*) AS num
			FROM subpage
			WHERE
				subpageParentId = ' . $db->prepareInputValue($record['id']);
        $row = $db->getRow($sql);
        return $row['num'];
    }
開發者ID:piotrPiechura,項目名稱:3dPathProject,代碼行數:12,代碼來源:SubpageDAO.class.php

示例15: prepareData

 public function prepareData()
 {
     if (!$this->isCLI()) {
         CoreUtils::redirect(CoreServices::get('url')->createAddress());
     }
     $this->garbageCollector = new TmpRecordGarbageCollector();
     try {
         $this->garbageCollector->clean();
     } catch (Exception $e) {
         $this->reportError($e->getMessage());
     }
 }
開發者ID:piotrPiechura,項目名稱:3dPathProject,代碼行數:12,代碼來源:TmpRecordCronDeleteController.class.php


注:本文中的CoreUtils類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。