• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Utilities类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Utilities的典型用法代码示例。如果您正苦于以下问题:PHP Utilities类的具体用法?PHP Utilities怎么用?PHP Utilities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Utilities类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: index

 public static function index()
 {
     $count = new Utilities();
     $count->countDrinks();
     $drinks = Drink::findAll();
     View::make('drink/index.html', array('drinks' => $drinks, 'count' => $count));
 }
开发者ID:PauliNiva,项目名称:DrinkArchive,代码行数:7,代码来源:drink_controller.php


示例2: __call

 public function __call($name, $arguments)
 {
     $file = '';
     foreach ($arguments as $key => $argument) {
         if (empty($argument)) {
             unset($arguments[$key]);
             continue;
         }
         if (!is_array($argument)) {
             continue;
         }
         if (isset($argument['folder'])) {
             $file .= $argument['folder'];
             unset($arguments[$key]);
         }
     }
     if (!empty($arguments)) {
         $filename = array(implode('.', $arguments), $name, self::FILE_EXTENSION);
     } else {
         $filename = array($name, self::FILE_EXTENSION);
     }
     $file .= '/' . implode('.', $filename);
     if (file_exists(CONTRIB_PATH . self::FOLDER . $file)) {
         header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
         header('Etag: ' . md5(file_get_contents(CONTRIB_PATH . self::FOLDER . $file)));
         header('Vary: *');
         header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime(CONTRIB_PATH . self::FOLDER . $file)) . ' GMT');
         header('Content-type: ' . Utilities::getMimeType(self::FILE_EXTENSION));
         echo file_get_contents(CONTRIB_PATH . self::FOLDER . $file);
         exit;
     } else {
         $this->bye();
     }
 }
开发者ID:highfidelity,项目名称:love,代码行数:34,代码来源:Javascript.php


示例3: get

 public function get($qid, $class, $student)
 {
     if ($student != USERNAME) {
         Permissions::TA_GATE($qid, $class, USERNAME);
     }
     $config = Utilities::get_configuration($qid, $class);
     $class_dir = Utilities::get_class_base($qid, $class);
     $assns = Utilities::get_all_directories($class_dir . "/" . $config->submissions_dir);
     $student_submissions = array();
     foreach ($assns as $assn) {
         $a_dir = $class_dir . "/" . $config->submissions_dir . "/" . $assn;
         $all_subs = Utilities::get_all_directories($a_dir);
         foreach ($all_subs as $sub) {
             $sunetid = Utilities::get_sunetid($sub);
             if ($sunetid == $student) {
                 $test = $a_dir . "/" . $sub;
                 if (is_dir($test)) {
                     $student_submissions[] = array("assn" => $assn, "dir" => $sub);
                 }
             }
         }
     }
     //print_r($student_submissions);
     $this->smarty->assign("student", $student);
     $this->smarty->assign("submissions", $student_submissions);
     $this->smarty->display("student.html");
 }
开发者ID:jadawebster,项目名称:paperless2,代码行数:27,代码来源:student.php


示例4: pay

 /**
  * @method POST
  */
 function pay()
 {
     // get token
     $token = Utilities::ValidateJWTToken(apache_request_headers());
     // check if token is not null
     if ($token != NULL) {
         // parse request
         parse_str($this->request->data, $request);
         $site = Site::GetBySiteId($token->SiteId);
         $siteId = $site['SiteId'];
         $email = $site['PrimaryEmail'];
         $status = 'Active';
         $stripe_token = $request['token'];
         $plan = $request['plan'];
         // set API key
         Stripe::setApiKey(STRIPE_SECRET_KEY);
         // create a new customer and subscribe them to the plan
         $customer = Stripe_Customer::create(array("card" => $stripe_token, "plan" => $plan, "email" => $email));
         // get back the id and the end period for the plan
         $id = $customer->id;
         // get subscription information
         $subscription = $customer->subscriptions->data[0];
         $subscriptionId = $subscription->id;
         $stripe_status = $subscription->status;
         $stripe_plan = $subscription->plan->id;
         $stripe_planname = $subscription->plan->name;
         // subscribe to a plan
         Site::Subscribe($siteId, $status, $plan, 'stripe', $subscriptionId, $customerId);
         // return a json response
         return new Tonic\Response(Tonic\Response::OK);
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:sanderdrummer,项目名称:Homepages,代码行数:37,代码来源:pay.php


示例5: error

 public static function error($message, $class = "N/A", $method = "N/A")
 {
     if (LOG_LEVEL == "ERROR") {
         Utilities::checkSize(LOG_FOLDER . "debug.log");
         error_log("/r/n[ERROR] " . date("Y-m-d h:i:s") . " - [" . str_pad($class, 20, " ") . "] - [" . str_pad($method, 20, " ") . "] - " . $message . "", 3, LOG_FOLDER . "error.log");
     }
 }
开发者ID:giraldomauricio,项目名称:phpXelerator5,代码行数:7,代码来源:Logger.php


示例6: create

 /**
  * Create a new translatable email
  * 
  * @param DBObject $context
  * @param string $translation_id
  * @param array $variables
  * 
  * @return TranslatableEmail
  */
 public static function create($translation_id, $variables)
 {
     $email = new self();
     // Get translation data and variables
     $email->translation_id = $translation_id;
     $email->variables = array();
     if ($variables) {
         foreach ($variables as $k => $v) {
             // Convert DBObject types to type/id pairs for saving
             if ($v instanceof DBObject) {
                 $v = array('dbobject_type' => get_class($v), 'dbobject_id' => $v->id);
             }
             $email->variables[$k] = $v;
         }
     }
     // Add meta
     $email->created = time();
     // Generate token until it is indeed unique
     $email->token = Utilities::generateUID(function ($token) {
         $statement = DBI::prepare('SELECT * FROM ' . TranslatableEmail::getDBTable() . ' WHERE token = :token');
         $statement->execute(array(':token' => $token));
         $data = $statement->fetch();
         return !$data;
     });
     $email->save();
     return $email;
 }
开发者ID:eheb,项目名称:renater-decide,代码行数:36,代码来源:TranslatableEmail.class.php


示例7: register

 public static function register($device_uuid)
 {
     $parts = explode(" ", microtime());
     $data = array('id' => $parts[1] . round($parts[0] * 1000), 'secret_key' => \Utilities::getRandomCode(64), 'device_uuid' => $device_uuid);
     $inserted = static::instance()->createEntity($data)->save();
     return $inserted ? static::instance()->getEntity($data['id']) : null;
 }
开发者ID:logbon72,项目名称:pebble-movies-server,代码行数:7,代码来源:UserDeviceManager.php


示例8: __construct

 function __construct($message, $type)
 {
     $bootstrap = false;
     if (!empty(Utilities::FindKey('BootstrapMessages', $GLOBALS['Config']))) {
         $bootstrap = Utilities::FindKey('BootstrapMessages', $GLOBALS['Config']);
     }
     switch (strtoupper($type)) {
         default:
         case 'ERR':
         case 'ERROR':
             $style = 'danger';
             break;
         case 'SUCC':
         case 'SUCCESS':
             $style = 'success';
             break;
         case 'WARN':
         case 'WARNING':
             $style = 'warning';
             break;
         case 'INFO':
         case 'INFORMATION':
             $style = 'info';
             break;
     }
     if ($bootstrap === true) {
         $message = '<p class="alert alert-' . $style . '" role="alert">' . $message . '</p>';
     }
     echo $message;
 }
开发者ID:Nozemi,项目名称:MyFramework,代码行数:30,代码来源:MessageHandler.class.php


示例9: form

 /**
  * @method POST
  */
 function form()
 {
     // parse request
     parse_str($this->request->data, $request);
     $siteUniqId = SITE_UNIQ_ID;
     $pageUniqId = $request['pageUniqId'];
     $body = $request['body'];
     $site = Site::GetBySiteUniqId($siteUniqId);
     $page = Page::GetByPageUniqId($pageUniqId);
     if ($site != null && $page != null) {
         $subject = 'RespondCMS: Form Submission [' . $site['Name'] . ': ' . $page['Name'] . ']';
         $content = '<h3>Site Information</h3>' . '<table>' . '<tr>' . '<td style="padding: 5px 25px 5px 0;">Site:</td>' . '<td style="padding: 5px 0">' . $site['Name'] . '</td>' . '</tr>' . '<tr>' . '<td style="padding: 5px 25px 5px 0;">Page:</td>' . '<td style="padding: 5px 0">' . $page['Name'] . '</td>' . '</tr>' . '</table>' . '<h3>Form Details</h3>' . $body;
         // send an email
         $headers = 'MIME-Version: 1.0' . "\r\n";
         $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
         $headers .= 'From: ' . $site['PrimaryEmail'] . "\r\n" . 'Reply-To: ' . $site['PrimaryEmail'] . "\r\n";
         // sends the email
         $to = $site['PrimaryEmail'];
         $from = $site['PrimaryEmail'];
         $fromName = $site['Name'];
         Utilities::SendEmail($to, $from, $fromName, $subject, $content);
         // return a successful response (200)
         return new Tonic\Response(Tonic\Response::OK);
     } else {
         // unauthorized access
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:31,代码来源:form.php


示例10: getEntryCategories

 protected function getEntryCategories($entries)
 {
     $cat_arr = array();
     if (isset($entries[0]['data2'])) {
         foreach ($entries as $e) {
             $cat_url = strtolower(Utilities::makeUrl($e['data2']));
             if (!isset($cat_arr[$cat_url])) {
                 $cat_arr[$cat_url] = array('category-url' => "{$this->url0}/category/{$cat_url}", 'category-name' => $e['data2'], 'count' => 1);
             } else {
                 $cat_arr[$cat_url]['count'] += 1;
             }
         }
         /*
          * Sort the array
          */
         usort($cat_arr, "CategorizedGallery::cmp");
         /*
          * Load the template into a variable
          */
         $template = UTILITIES::loadTemplate($this->url0 . '-category.inc');
         return UTILITIES::parseTemplate(array_values($cat_arr), $template);
     } else {
         return NULL;
     }
 }
开发者ID:RobMacKay,项目名称:Ennui-CMS,代码行数:25,代码来源:class.page.inc.php


示例11: get

 function get($request)
 {
     // admin Only
     Utilities::checkAdmin();
     $db = Database::obtain();
     $response = new Response($request);
     $this->tm->smarty->assign('title', 'Admin Infos Tours');
     $no_tours = $db->query_first("SELECT count(*) AS no FROM " . TABLE_TOURS);
     $no_tours = $no_tours['no'];
     $last_page = ceil($no_tours / $this->rows);
     //this makes sure the page number isn't below one, or more than our maximum pages
     if ($this->page < 1) {
         $this->page = 1;
     } elseif ($this->page > $last_page) {
         $this->page = $last_page;
     }
     $max = 'LIMIT ' . ($this->page - 1) * $this->rows . ',' . $this->rows;
     $tours = $db->fetch_array("SELECT * FROM `" . TABLE_TOURS . "` " . $max);
     $this->tm->smarty->assign('lastpage', $last_page);
     $this->tm->smarty->assign('pagenum', $this->page);
     $em = GeocacheManager::getInstance();
     $tours_obj = array();
     foreach ($tours as $tour) {
         $tours_obj[] = $geocacheManager = $em->fetchTour($tour['webcode']);
     }
     $this->tm->smarty->assign('tours', $tours_obj);
     $body = $this->tm->render('admin_info_tour');
     $response->code = Response::OK;
     $response->addHeader('Content-type', 'text/html');
     $response->body = $body;
     return $response;
 }
开发者ID:ThomDietrich,项目名称:gctour,代码行数:32,代码来源:admin.php


示例12: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     if (isset($this->city)) {
         $this->city = Utilities::getLookupIdByValue(Constants::$city_lookup_code, $this->city);
     }
     if (isset($this->blood_group)) {
         $this->blood_group = Utilities::getLookupIdByValue(Constants::$bloodgrp_lookup_code, $this->blood_group);
     }
     if (isset($this->area)) {
         $this->area = Utilities::getLookupIdByValue(Constants::$area_lookup_code, $this->area);
     }
     $criteria->compare('request_id', $this->request_id);
     $criteria->compare('name', $this->name, true);
     $criteria->compare('city', $this->city);
     $criteria->compare('state', $this->state);
     $criteria->compare('number', $this->number, true);
     $criteria->compare('date', $this->date, true);
     $criteria->compare('blood_group', $this->blood_group);
     $criteria->compare('area', $this->area);
     $criteria->compare('status', $this->status, true);
     $criteria->compare('remarks', $this->remarks, true);
     $criteria->compare('donor', $this->donor);
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
开发者ID:rbhattad31,项目名称:bloodRequest,代码行数:31,代码来源:DonationRequest.php


示例13: __construct

 public function __construct($title, $message, $code = 500, Exception $previous = null)
 {
     $this->title = $title;
     parent::__construct($message, $code, $previous);
     Utilities::statusCode($code, $title);
     Utilities::sendHeaders();
 }
开发者ID:Crecket,项目名称:dependency-manager,代码行数:7,代码来源:Exception.php


示例14: __construct

 /**
  * StringsHandler constructor.
  */
 public function __construct()
 {
     $config = Config::getInstance();
     $adapterClass = __NAMESPACE__ . '\\ConfigAdapter\\' . Utilities::formatClassName($config->get('strings_adapter', 'ini'));
     $this->adapter = new $adapterClass('strings');
     $this->loadStrings();
 }
开发者ID:ArtifexTech,项目名称:life-jacket,代码行数:10,代码来源:StringsHandler.php


示例15: admin_reset_password

 public function admin_reset_password($token = null)
 {
     if ($this->Auth->loggedIn()) {
         $this->redirect('/admin/index');
     }
     if (!isset($token)) {
         if ($this->request->is('post')) {
             $user = $this->User->findByEmail($this->request->data['User']['email']);
             if (empty($user)) {
                 $this->Session->setFlash('W bazie nie ma takiego adresu e-mail', 'flash_warning');
                 $this->redirect('/admin/users/reset_password');
             }
             $token = Utilities::token();
             $this->adminSendMail($this->request->data['User']['email'], 'kAdmin - resetowanie hasła', 'reset_password', array('username' => $user['User']['username'], 'link' => '<a href="' . Router::url('/admin/users/reset_password/' . $token, true) . '">' . Router::url('/admin/users/reset_password/' . $token . $user['User']['id'], true) . '</a>'));
             $this->User->id = $user['User']['id'];
             $this->User->saveField('token', $token);
             $this->set('afterPost', true);
         }
     } else {
         $user = $this->User->findByToken($token);
         if (empty($user)) {
             throw new NotFoundException('Podany token jest nieprawidłowy.');
         }
         $pass = substr(str_shuffle('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!$'), 0, 6);
         $this->User->id = $user['User']['id'];
         $this->User->save(array('token' => null, 'password' => $pass), false);
         $this->adminSendMail($user['User']['email'], 'kAdmin - resetowanie hasła', 'new_password', array('password' => $pass, 'username' => $user['User']['username']));
         $this->set('afterReset', true);
     }
 }
开发者ID:knyk,项目名称:kAdmin,代码行数:30,代码来源:UsersController.php


示例16: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['DonationRequest'])) {
         $model->attributes = $_POST['DonationRequest'];
         $model->city = Utilities::getLookupIdByValue(Constants::$city_lookup_code, $model->city);
         $model->blood_group = Utilities::getLookupIdByValue(Constants::$bloodgrp_lookup_code, $model->blood_group);
         $model->area = Utilities::getLookupIdByValue(Constants::$area_lookup_code, $model->area);
         $model->state = $model->city0->lookup_parent_id;
         if (!Utilities::checkDateFormat($model->date)) {
             $model->date = DateTime::createFromFormat('d/M/yyyy', $model->date)->format('Y-m-d');
         }
         if ($model->save()) {
             if ($model->status == "Donor Assigned") {
                 $donor = UserDetails::model()->findByPk($model->donor);
                 $donor->last_donation_date = date("Y-m-d");
                 $donor->donation_status = 'Y';
                 $donor->save(false);
             }
             $this->redirect(array('view', 'id' => $model->request_id));
         }
     }
     $model->city = $model->city0->lookup_value;
     $model->area = $model->area0->lookup_value;
     $model->blood_group = $model->bloodGroup->lookup_value;
     //$model->date = DateTime::createFromFormat('Y-m-d', $model->date )->format('d/M/y');
     $this->render('update', array('model' => $model));
 }
开发者ID:rbhattad31,项目名称:bloodRequest,代码行数:35,代码来源:DonationRequestController.php


示例17: loadShowtimes

 /**
  * @param GeocodeCached $geocode Previously stored geoLocation information
  * @param string $currentDate date for showtimes to load, advisable to pass it in
  * @param int $dateOffset number of days from the current dates
  * @return TheatreData[] an array of schema TheatreData, see below for description
  *
  * Organized in the format =>
  *
  * ```
  *
  *  TheatreData : [
  *      'theatre' => [
  *              ...fields from theatre table, MUST contain name and address...,
  *      ]
  *      'movies' => MovieData[]
  *  ]
  *
  * MovieData : [
  *     'movie' => [
  *          ...fields from movie table, MUST contain title...,
  *     ]
  *     'showtimes' => ShowtimeData[]
  * ]
  *
  * ShowtimeData: [
  *      ...fields from showtime table, must conatin show_date, show_time & type...
  * ]
  * ```
  */
 public function loadShowtimes(GeocodeCached $geocode, $currentDate = null, $dateOffset = 0)
 {
     $params = ['country' => $geocode->country_iso, 'event_date' => \Utilities::dateFromOffset($currentDate ?: date('Y-m-d'), $dateOffset)];
     \SystemLogger::debug('Begining API Request to Tripican');
     $start = microtime(true);
     $allCinemaMovieShowtimes = TripicanDataLoader::GetCinemaMovieShowtimes($this->apiClient, $params);
     \SystemLogger::debug('Request to API completed in :', microtime(true) - $start);
     $theatres = [];
     foreach ($allCinemaMovieShowtimes as $cinemaMovieShowtimes) {
         $theatre = $cinemaMovieShowtimes['cinema'];
         $id = $theatre['id'];
         if (!isset($theatres[$id])) {
             $theatres[$id] = ['theatre' => ['name' => $theatre['centre_name'], 'address' => $this->_getAddress($theatre), 'longitude' => $theatre['place']['long'], 'latitude' => $theatre['place']['lat']], 'movies' => []];
         }
         $theatreData =& $theatres[$id];
         foreach ($cinemaMovieShowtimes['movie_showtimes'] as $movieShowtimes) {
             $movie = $movieShowtimes['movie'];
             $mId = $movie['id'];
             if (!isset($theatreData['movies'][$mId])) {
                 $theatreData['movies'][$mId] = ['movie' => ['title' => $movie['title'], 'genre' => $movie['genre'][0], 'user_rating' => isset($movie['imdb_rating']) ? floatval($movie['imdb_rating'][0] / 10.0) : null, 'poster_url' => $movie['poster'], 'rated' => $movie['rated'][0], 'runtime' => $movie['duration']], 'showtimes' => []];
             }
             $movieData =& $theatreData['movies'][$mId];
             foreach ($movieShowtimes['showtimes'] as $showtime) {
                 $movieData['showtimes'][] = ['show_date' => $showtime['event_date'], 'show_time' => $showtime['event_time'], 'type' => $this->_getMapType($showtime['type']), 'url' => $showtime['online_ticketing'] ? $showtime['url'] : null];
             }
         }
     }
     array_walk($theatres, function (&$t) {
         $t['movies'] = array_values($t['movies']);
     });
     if (!empty($theatres)) {
         $this->overrideDistanceCompute();
     }
     return array_values($theatres);
 }
开发者ID:logbon72,项目名称:pebble-movies-server,代码行数:64,代码来源:Tripican.php


示例18: loginView

 public function loginView()
 {
     $users = User::all();
     if (count($users) == 0) {
         $token = Utilities::generateTokenForm();
         $action = $this->app->urlFor('add_admin');
         $vars = array();
         if (isset($_SESSION['vars'])) {
             $vars = $_SESSION['vars'];
             unset($_SESSION['vars']);
         }
         $this->view = new NewAdmin($action, $token['token'], $vars);
         $this->view->display();
     } else {
         $action = $this->app->urlFor('login_post');
         $token = Utilities::generateTokenForm();
         $vars = array();
         if (isset($_SESSION['vars'])) {
             $vars = $_SESSION['vars'];
             unset($_SESSION['vars']);
         }
         $this->view = new LoginView($action, $token['token'], $vars);
         $this->view->display();
     }
 }
开发者ID:alsvader,项目名称:percasBlog,代码行数:25,代码来源:UserController.class.php


示例19: findController

 /**
  * Find a controller based on the parsed request path
  */
 protected function findController()
 {
     $parts = $this->path;
     $className = '\\Controllers\\';
     array_pop($parts);
     $dir = APPLICATION_PATH . '/controllers/';
     foreach ($parts as $part) {
         if (file_exists($dir . $part . '.php')) {
             $this->controller = $dir . $part . '.php';
             $this->controllerClassName = $className . Utilities::formatClassName($part);
             return;
         }
         if (!is_dir($dir . $part . '/')) {
             break;
         }
         $dir .= $part . '/';
         if (file_exists($dir . 'Index.php')) {
             $this->controller = $dir . 'Index.php';
             $this->controllerClassName = $className . 'Index';
             return;
         }
     }
     if (file_exists($dir . 'Index.php')) {
         $this->controller = $dir . 'Index.php';
         $this->controllerClassName = $className . 'Index';
     }
 }
开发者ID:ArtifexTech,项目名称:life-jacket,代码行数:30,代码来源:Router.php


示例20: __construct

 public function __construct($Object)
 {
     $this->CachePath = getcwd() . DS . "Cache" . DS . "Compile" . DS . $Object . DS;
     $this->CacheExtension = '.fnc';
     $this->CacheLife = 86400;
     $this->CacheObject = $Object;
     $this->CacheLocale = Utilities::GetLanguage(true);
 }
开发者ID:anonymous33rus,项目名称:FreedomCore,代码行数:8,代码来源:Cache.FreedomCore.php



注:本文中的Utilities类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Utility类代码示例发布时间:2022-05-23
下一篇:
PHP UtilisateurProfessionnelPeer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap