当前位置: 首页>>代码示例>>PHP>>正文


PHP Helpers类代码示例

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


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

示例1: helper

 /**
  * @param Helpers $helpers
  */
 public static function helper($helpers)
 {
     $escape = $helpers->get('escape');
     return function ($attr) use($escape) {
         $renderer = new static($attr, $escape);
         return $renderer->toString();
     };
 }
开发者ID:rakorium,项目名称:okapi,代码行数:11,代码来源:Attributes.php

示例2: run

 public function run()
 {
     writeln("<comment>Create Docker machine {$this->name}</comment>");
     $output = runLocally("docker-machine create -d virtualbox {$this->name}", 999);
     writeln("<comment>Docker-machine {$this->name} created</comment>");
     $this->ip = Helpers::getMachineIp();
 }
开发者ID:ekandreas,项目名称:docker-laravel,代码行数:7,代码来源:Machine.php

示例3: userIsAuthorized

 public function userIsAuthorized($action)
 {
     // Dafür sorgen, dass eine Anfrage ggf. auf das Login weitergeleitet wird,
     // wenn die Session abgelaufen ist und nach erfolgtem Login nahtlos auf
     // die angeforderte Seite weitergeleitet wird
     if ($this->module_name != 'login' && !Auth::isLoggedIn()) {
         $_SESSION['pixelmanager_temp_login_redirect']['uri'] = $_SERVER['REQUEST_URI'];
         $_SESSION['pixelmanager_temp_login_redirect']['get'] = $_GET;
         $_SESSION['pixelmanager_temp_login_redirect']['post'] = $_POST;
         $_SESSION['pixelmanager_temp_login_redirect']['request'] = $_REQUEST;
         Helpers::redirect(Config::get()->baseUrl . 'admin/html-output/login');
     } else {
         if ($this->module_name != 'login') {
             if (isset($_SESSION['pixelmanager_temp_login_redirect'])) {
                 $_GET = $_SESSION['pixelmanager_temp_login_redirect']['get'];
                 $_POST = $_SESSION['pixelmanager_temp_login_redirect']['post'];
                 $_REQUEST = $_SESSION['pixelmanager_temp_login_redirect']['request'];
                 unset($_SESSION['pixelmanager_temp_login_redirect']);
             }
         }
     }
     // Wenn es sich um ein Zusatzmodul handelt, ggf. auf Zugangsberechtigung prüfen
     if ($this->isCustomBackendModule()) {
         $can_user_access = $this->canUserAccessCustomBackendModule();
         if ($can_user_access === false) {
             $this->accessDenied();
         }
         return $can_user_access;
     }
     // Anfrage wurde bis jetzt nicht abgefangen, also erstmal annehmen, dass der Zugriff erlaubt ist
     return true;
 }
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:32,代码来源:HtmlOutputController.php

示例4: login

/**
* This function is beign used to load info that's needed for the login page.
* it will try to auto-login, this can only be used while ingame, the web browser sends additional cookie information that's also stored in the open_ring db.
* We will compare the values and if they match, the user will be automatically logged in!
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function login()
{
    global $INGAME_WEBPATH;
    global $WEBPATH;
    if (helpers::check_if_game_client()) {
        //check if you are logged in ingame, this should auto login
        $result = Helpers::check_login_ingame();
        if ($result) {
            //handle successful login
            $_SESSION['user'] = $result['name'];
            $_SESSION['id'] = WebUsers::getId($result['name']);
            $_SESSION['ticket_user'] = serialize(Ticket_User::constr_ExternId($_SESSION['id']));
            //go back to the index page.
            header("Cache-Control: max-age=1");
            if (Helpers::check_if_game_client()) {
                header('Location: ' . $INGAME_WEBPATH);
            } else {
                header('Location: ' . $WEBPATH);
            }
            throw new SystemExit();
        }
    }
    $pageElements['ingame_webpath'] = $INGAME_WEBPATH;
    $GETString = "";
    foreach ($_GET as $key => $value) {
        $GETString = $GETString . $key . '=' . $value . "&";
    }
    if ($GETString != "") {
        $GETString = '?' . $GETString;
    }
    $pageElements['getstring'] = $GETString;
    return $pageElements;
}
开发者ID:cls1991,项目名称:ryzomcore,代码行数:39,代码来源:login.php

示例5: __construct

 /**
  * @param string $publicKey
  * @param string $keyHandle
  * @param string|NULL $certificate
  */
 public function __construct($publicKey, $keyHandle, $certificate = NULL)
 {
     $this->publicKey = $publicKey;
     Helpers::publicKey2Pem($this->publicKey);
     $this->keyHandle = $keyHandle;
     $this->certificate = $certificate;
 }
开发者ID:lookyman,项目名称:u2f,代码行数:12,代码来源:Registration.php

示例6: Create

 public function Create($request, $response, $args)
 {
     //init database
     $db = DB::getInstance();
     //gat user data
     $user = json_decode($request->getBody()->getContents());
     if (empty($user->first_name) || empty($user->last_name) || empty($user->email) || empty($user->password)) {
         echo "ERROR";
     } else {
         //check email exit ?
         $exists = $db->user('email = ?', $user->email)->fetch();
         if ($exists) {
             echo json_encode(array('success' => false, 'message' => 'Email already in use'));
         } else {
             $data = array();
             $data['first_name'] = Helpers::sanitize($user->first_name);
             $data['last_name'] = Helpers::sanitize($user->last_name);
             $data['email'] = Helpers::sanitize($user->email);
             $data['password'] = Helpers::EncrytPassword(Helpers::sanitize($user->password));
             //insert in db
             $db->user->insert($data);
             echo json_encode(array('success' => true));
         }
     }
     return $response->withHeader('Content-type', 'application/json');
 }
开发者ID:senegalesegirl,项目名称:CrowdHelp,代码行数:26,代码来源:user.php

示例7: beforeActionExecute

 private function beforeActionExecute()
 {
     $userId = (string) HttpContext::getInstance()->getSession()->userId;
     if ($userId !== "") {
         Helpers::redirect('');
     }
 }
开发者ID:k0ksi,项目名称:Web-Development-Basics-Project,代码行数:7,代码来源:AnonymousAnnotation.php

示例8: actionInfo

 /**
  * Displays information about an exercise (code, assignment, etc.).
  * @param integer $id the ID of the model to be displayed
  */
 public function actionInfo($k = '', $code = '', $hash = '', $defaultcode = '')
 {
     $exerciseInfoForm = new ExerciseInfoForm();
     $exerciseInfoForm->code = $defaultcode;
     $model = null;
     $files = null;
     if (isset($_POST['ExerciseInfoForm'])) {
         $exerciseInfoForm->attributes = $_POST['ExerciseInfoForm'];
         if ($exerciseInfoForm->validate()) {
             if (Yii::app()->user->isGuest) {
                 // if a students looks up an exercise using the code, it means that he/she has received the code...
                 $exerciseInfoForm->exercise->increaseStatus(Exercise::STATUS_ACKNOWLEDGED);
             }
             $this->redirect(array('exercise/info', 'code' => $exerciseInfoForm->exercise->code, 'hash' => Helpers::hash($exerciseInfoForm->exercise->id, 12)));
         }
     }
     if ($code) {
         $model = $this->loadModelByCode($code);
         if ($model && Helpers::hash($model->id, 12) != $hash) {
             $model = null;
         }
         if ($model === null) {
             Yii::app()->user->setFlash('flash-error', 'Our bad. We couldn\'t find an exercise with that code.');
             $this->redirect(array('exercise/info', 'defaultcode' => $code));
         }
     } elseif ($k) {
         $model = $this->loadModelByInfokey($k);
     }
     $this->render('info', array('model' => $model, 'files' => $this->getFilesOfExercise($model), 'code' => $code, 'exerciseInfoForm' => $exerciseInfoForm));
 }
开发者ID:loristissino,项目名称:swu,代码行数:34,代码来源:ExerciseController.php

示例9: loadTargetModel

 /**
  * Loads Target Model for the Comment
  * It needs to be a SiContentBehavior Object
  *
  * @return type
  */
 private function loadTargetModel()
 {
     // Fast lane
     if ($this->cachedLoadedTarget != null) {
         return $this->cachedLoadedTarget;
     }
     // Request Params
     $targetModelClass = Yii::app()->request->getParam('model');
     $targetModelId = (int) Yii::app()->request->getParam('id');
     $targetModelClass = Yii::app()->input->stripClean(trim($targetModelClass));
     if ($targetModelClass == "" || $targetModelId == "") {
         throw new CHttpException(500, Yii::t('CommentModule.controllers_CommentController', 'Model & Id Parameter required!'));
     }
     if (!Helpers::CheckClassType($targetModelClass, 'HActiveRecordContent')) {
         throw new CHttpException(500, Yii::t('CommentModule.controllers_CommentController', 'Invalid target class given'));
     }
     $model = call_user_func(array($targetModelClass, 'model'));
     $target = $model->findByPk($targetModelId);
     if (!$target instanceof HActiveRecordContent) {
         throw new CHttpException(500, Yii::t('CommentModule.controllers_CommentController', 'Invalid target class given'));
     }
     if ($target == null) {
         throw new CHttpException(404, Yii::t('CommentModule.controllers_CommentController', 'Target not found!'));
     }
     // Check if we can read the target model, so we can comment it?
     if (!$target->content->canRead(Yii::app()->user->id)) {
         throw new CHttpException(403, Yii::t('CommentModule.controllers_CommentController', 'Access denied!'));
     }
     // Create Fastlane:
     $this->cachedLoadedTarget = $target;
     return $target;
 }
开发者ID:alefernie,项目名称:intranet,代码行数:38,代码来源:CommentController.php

示例10: __construct

 public function __construct(OLEFile $oleFile)
 {
     $oleStream = $oleFile->Get_OLE_Stream();
     fseek($oleStream, 0);
     $this->oleHeaderSignature = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 8))));
     $this->oleHeaderCLSID = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 16))));
     $this->oleMinorVersion = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 2))));
     $this->oleMajorVersion = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 2))));
     $this->oleByteOrder = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 2))));
     $this->oleSectorShift = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 2))));
     $this->oleMiniSectorShift = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 2))));
     $this->oleReserved = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 6))));
     $this->numDirSectors = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 4))));
     $this->numFATSectors = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 4))));
     $this->firstDirSectorLoc = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 4))));
     $this->transactionSigNum = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 4))));
     $this->miniStreamCutoffSize = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 4))));
     $this->firstMiniFATSectorLoc = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 4))));
     $this->numMiniFATSectors = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 4))));
     $this->firstDIFATSectorLoc = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 4))));
     $this->numDIFATSectors = hexdec(Helpers::Fix_Hex(bin2hex(fread($oleStream, 4))));
     $this->difat = Helpers::Hex_Str_To_Array(Helpers::Fix_Hex(bin2hex(fread($oleStream, 436)), 8), 8);
     $this->oleStream = $oleStream;
     fseek($this->oleStream, 0);
 }
开发者ID:justinmassiot,项目名称:binary-compound-file-reader,代码行数:25,代码来源:OLEHeader.php

示例11: load

 /**
  * Loads WP-palvelu features
  */
 public static function load()
 {
     /**
      * Show WP-Palvelu notifications if this is WP-Palvelu instance
      */
     if (Helpers::isProduction() or Helpers::isShadow()) {
         add_action('admin_notices', array(__CLASS__, 'showAdminNotification'));
     }
     /**
      * Hide update nofications if this is not development
      */
     if (!Helpers::isDevelopment()) {
         add_action('admin_menu', array(__CLASS__, 'hideUpdateNotifications'));
         add_filter('wp_get_update_data', array(__CLASS__, 'hideUpdateData'));
     }
     /**
      * Ask browser not cache anything if blog is in development, non-public or debug
      * This makes everyones life easier when clients don't know how to reset their browser cache from old stylesheets
      */
     if (Helpers::isDevelopment() || !Helpers::isPublic() || WP_DEBUG) {
         add_action('send_headers', array(__CLASS__, 'sendNoCacheHeaders'));
     }
     /**
      * Send proper headers after unsuccesful login
      */
     add_action('wp_login_failed', array(__CLASS__, 'changeHttpCodeToUnauthorized'));
 }
开发者ID:rask,项目名称:wp-palvelu-plugin,代码行数:30,代码来源:fixes.php

示例12: byQuery

 /**
  * Use current dataprovider to perform seacrh
  * by given query and return view with results.
  * 
  * @return View
  */
 public function byQuery()
 {
     $input = (string) Input::get('q');
     if (!$input || Str::length($input) <= 1) {
         return View::make('search.results')->withTerm('');
     }
     if (is_a($this->search, 'Lib\\Services\\Search\\DbSearch')) {
         $encoded = $input;
     } else {
         $encoded = urlencode($input);
     }
     $clean = e($input);
     //make search cache section name
     $section = 'search' . $this->provider;
     if ($encoded) {
         if (Helpers::hasSuperAccess()) {
             $results = $this->search->byQuery($encoded);
         } else {
             if ($this->options->useCache()) {
                 $results = $this->cache->get($section, md5($encoded));
                 if (!$results || count($results) == 0) {
                     $results = $this->search->byQuery($encoded);
                     $this->cache->put($section, md5($encoded), $results);
                 }
             } else {
                 $results = $this->search->byQuery($encoded);
             }
         }
         return View::make('search.results')->withData($results)->withTerm($clean);
     }
     return View::make('search.results')->withTerm($clean);
 }
开发者ID:samirios1,项目名称:niter,代码行数:38,代码来源:SearchController.php

示例13: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     //Coger eventos del día siguiente
     $events = Evento::getNextDayEventos()->get();
     foreach ($events as $e) {
         //Coger los gcm_regids de los voluntarios asignados al evento que pueden recibir notificaciones
         $registration_ids = Asistencia::getUsersToNotificate($e->ideventos)->get()->lists('gcm_token');
         $title = 'AFI Perú - Evento';
         $message = 'Recordatorio de evento: ' . $e->nombre . ' - ' . $e->fecha_evento;
         $type = 1;
         $m = ['title' => $title, 'message' => $message, 'type' => $type];
         $response = Helpers::pushGCM($registration_ids, $m);
         //$this->info(var_dump($response));
     }
     ///Coger todos los padrinos
     $sponsors = Padrino::getActivePadrinosPushInfo()->get();
     foreach ($sponsors as $s) {
         //Si el padrino tiene activado el push de pagos y tiene registadro su gcm_token
         if ($s->push_pagos && $s->gcm_token) {
             //Buscar si hay una deuda pendiente para el día siguiente
             $fee = CalendarioPago::getCalendarioPagoPendienteNextDayByPadrino($s->idpadrinos)->first();
             if ($fee) {
                 //$this->info(var_dump($s->gcm_regid));
                 $title = 'AFI Perú - Padrino';
                 $message = 'Recordatorio de pago: ' . $fee->vencimiento;
                 $type = 2;
                 $m = ['title' => $title, 'message' => $message, 'type' => $type];
                 $response = Helpers::pushGCM(array($s->gcm_token), $m);
                 //$this->info(var_dump($response));
             }
         }
     }
 }
开发者ID:EMerino236,项目名称:afiperularavel,代码行数:38,代码来源:PushGCM.php

示例14: getDotEnv

 /**
  * @return Dotenv\Dotenv Bedrock Settings
  */
 public static function getDotEnv()
 {
     $dotenv = new \Dotenv\Dotenv(Helpers::getProjectDir());
     $dotenv->load();
     //$dotenv->required(['DB_NAME', 'DB_USER', 'DB_PASSWORD']);
     return $dotenv;
 }
开发者ID:ekandreas,项目名称:docker-laravel,代码行数:10,代码来源:Env.php

示例15: getPDO

 /**
  *   Erstellt ein PDO Objekt
  *
  * @return PDO pdo
  */
 public static function getPDO()
 {
     if (self::$pdo == null) {
         $config = Config::getArray();
         if (!isset($config["database"])) {
             Helpers::fatalError("No database configuration found.");
         }
         $host = '';
         if (isset($config['database']['host'])) {
             $host = 'host=' . $config['database']['host'] . ';';
         }
         $port = '';
         if (isset($config['database']['port'])) {
             $port = 'port=' . $config['database']['port'] . ';';
         }
         $socket = '';
         if (isset($config['database']['socket'])) {
             $socket = 'unix_socket=' . $config['database']['socket'] . ';';
         }
         $dsn = 'mysql:dbname=' . $config["database"]["name"] . ';' . $host . $port . $socket . 'charset=utf8;';
         try {
             $pdo = new PDO($dsn, $config["database"]["user"], $config["database"]["password"], array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         } catch (PDOException $e) {
             Helpers::fatalError("Could no connect to the database: " . $e->getMessage());
         }
         self::$pdo = $pdo;
     }
     return self::$pdo;
 }
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:34,代码来源:Db.php


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