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


PHP helpers\Hooks类代码示例

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


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

示例1: login

 public function login()
 {
     Hooks::addHook('js', 'Controllers\\auth@js');
     Hooks::addHook('css', 'Controllers\\auth@css');
     $error = 'hi';
     $success = 'hi';
     if (Session::get('loggedin')) {
         Url::redirect();
     }
     if (isset($_POST['submit'])) {
         $username = $_POST['username'];
         $password = $_POST['password'];
         //validation
         if (Password::verify($password, $this->_model->getHash($username)) == false) {
             $error[] = 'Wrong username or password';
         }
         //if validation has passed carry on
         if (!$error) {
             Session::set('loggedin', true);
             Session::set('username', $username);
             Session::set('memberID', $this->_model->getID($username));
             $data = array('lastLogin' => date('Y-m-d G:i:s'));
             $where = array('memberID' => $this->_model->getID($username));
             $this->_model->update($data, $where);
             $error = 'hi';
             Url::redirect();
         }
     }
     $data['title'] = 'Login';
     View::rendertemplate('header', $data);
     View::render('auth/login', $data, $error, $success);
     View::rendertemplate('footer', $data);
 }
开发者ID:pacozaa,项目名称:simple-mvc-framework-inventory,代码行数:33,代码来源:auth.php

示例2: index

 public function index()
 {
     if (!Session::get('loggedin')) {
         Url::redirect('login');
     }
     if (isset($_POST['submit']) && $_FILES['fileToUpload']['size'] > 0) {
         $name = !isset($_POST['productName']) || trim($_POST['productName']) == '' ? '' : $_POST['productName'];
         $price = !isset($_POST['productPrice']) || trim($_POST['productPrice']) == '' ? 0 : floatval($_POST['productPrice']);
         $description = !isset($_POST['productDescription']) || trim($_POST['productDescription']) == '' ? '' : $_POST['productDescription'];
         $target_dir = "uploads/";
         $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
         $uploadOk = 1;
         $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION);
         // Check if image file is a actual image or fake image
         if (isset($_POST["submit"])) {
             $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
             if ($check !== false) {
                 //echo "File is an image - " . $check["mime"] . ".";
                 $uploadOk = 1;
             } else {
                 //echo "File is not an image.";
                 $uploadOk = 0;
             }
         }
         // Check if file already exists
         if (file_exists($target_file)) {
             $error = "Sorry, file already exists." . $error;
             $uploadOk = 0;
         }
         // Check file size
         if ($_FILES["fileToUpload"]["size"] > 500000) {
             $error = "Sorry, your file is too large." . $error;
             $uploadOk = 0;
         }
         // Allow certain file formats
         if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
             $error = "Sorry, only JPG, JPEG, PNG & GIF files are allowed." . $error;
             $uploadOk = 0;
         }
         // Check if $uploadOk is set to 0 by an error
         if ($uploadOk == 0) {
             $error = "Sorry, your file was not uploaded." . $error;
             // if everything is ok, try to upload file
         } else {
             //if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], str_replace(' ','-',strtolower($target_file)))) {
             //echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
             $product['product'] = array('name' => $name, 'price' => $price, 'description' => $description, 'lastUpdate' => date('Y-m-d G:i:s'));
             $product['image'] = array('image' => file_get_contents($_FILES['fileToUpload']['tmp_name']), 'size' => $_FILES["fileToUpload"]["size"], 'type' => $imageFileType);
             $this->_model->insertProduct($product);
             //unlink(str_replace(' ','-',strtolower($target_file)));
         }
     }
     Hooks::addHook('js', 'Controllers\\menu@indexJS');
     Hooks::addHook('css', 'Controllers\\menu@indexCss');
     $data['title'] = 'index';
     $data['username'] = Session::get('username');
     View::rendertemplate('header', $data);
     View::render('menu/index', $data, $error);
     View::rendertemplate('footer', $data);
 }
开发者ID:pacozaa,项目名称:simple-mvc-framework-inventory,代码行数:60,代码来源:menu.php

示例3: dataLoadandConvert

 /**
  * place hook calls into the relevant data array call
  * @param  array $data
  * @return array $data
  */
 public static function dataLoadandConvert($data)
 {
     $hooks = Hooks::get();
     $data['afterBody'] = $hooks->run('afterBody', $data['afterBody']);
     $data['css'] = $hooks->run('css', $data['css']);
     $data['js'] = $hooks->run('js', $data['js']);
     return $data;
 }
开发者ID:sisnox,项目名称:framework,代码行数:13,代码来源:View.php

示例4: before

 /**
  * Method automatically invoked before the current Action, stopping the flight
  * when it return false. This Method is supposed to be overriden for using it.
  */
 protected function before()
 {
     // Run the Hooks associated to Views.
     $hooks = Hooks::get();
     foreach (array('afterBody', 'css', 'js') as $hook) {
         $result = $hooks->run($hook);
         // Share the result into Views.
         View::share($hook, $result);
     }
     // Return true to continue the processing.
     return true;
 }
开发者ID:alejandrozepeda,项目名称:dcorrido,代码行数:16,代码来源:Controller.php

示例5: GetUser

 public function GetUser($id_contato, $messages = [])
 {
     $data['name'] = $this->contatos->getOneName($id_contato);
     $data['mail'] = $this->contatos->getOneMail($id_contato);
     $data['mail_type'] = $this->contatos->getMailType();
     $data['phone'] = $this->contatos->getOnePhone($id_contato);
     $data['phone_type'] = $this->contatos->getPhoneType();
     $data['messages'] = $messages;
     Hooks::addHook('js', '\\Controllers\\PainelContatoUsuario@scripts');
     // var_dump($data['mail_type']);
     // var_dump('aaa');
     // die();
     View::renderTemplate('header', $data);
     View::render('painel_contato_usuario/edit_contato_usuario', $data);
     View::renderTemplate('footer', $data);
 }
开发者ID:JrzenonDev,项目名称:simple_mvc_framework_landing_page,代码行数:16,代码来源:PainelContatoUsuario.php

示例6: login

 public function login()
 {
     Hooks::addHook('js', 'Controllers\\auth@js');
     Hooks::addHook('css', 'Controllers\\auth@css');
     // if(Session::get('loggedin')){
     //           Url::redirect();
     //       }
     $currentUser = ParseUser::getCurrentUser();
     if ($currentUser) {
         // do stuff with the user
         Url::redirect();
     } else {
         // show the signup or login page
     }
     //==============Sign Up Manually==========================
     // $user = new ParseUser();
     // $user->set("username", "yoak");
     // $user->set("password", "yoakyoak");
     // $user->set("email", "pacosarin@gmail.com");
     // // other fields can be set just like with ParseObject
     // $user->set("phone", "0909814465");
     // try {
     //   $user->signUp();
     //   // Hooray! Let them use the app now.
     //   $error = 'Hooray! Let them use the app now.';
     // } catch (ParseException $ex) {
     //   // Show the error message somewhere and let the user try again.
     //   echo "Error: " . $ex->getCode() . " " . $ex->getMessage();
     // }
     //==============Sign Up Manually==========================
     if (isset($_POST['submit'])) {
         $username = $_POST['username'];
         $password = $_POST['password'];
         try {
             $user = ParseUser::logIn($username, $password);
             Url::redirect();
             // Do stuff after successful login.
         } catch (ParseException $ex) {
             // The login failed. Check error to see why.
             $error = "ParseException: " . $ex->getCode() . " " . $ex->getMessage();
         }
     }
     $data['title'] = 'Login';
     View::rendertemplate('header', $data);
     View::render('auth/login', $data, $error);
     View::rendertemplate('footer', $data);
 }
开发者ID:pacozaa,项目名称:simple-mvc-framework-inventory-parse,代码行数:47,代码来源:auth.php

示例7:

<?php

use Helpers\Hooks;
Hooks::addHook('routes', 'Modules\\Blog\\Controllers\\Blog@routes');
开发者ID:zszymczyk,项目名称:intranet,代码行数:4,代码来源:blog.module.php

示例8:

<?php

use Helpers\Hooks;
Hooks::addHook('sidebar', 'Modules\\Members\\Controllers\\Members@index');
Hooks::addHook('routes', 'Modules\\Members\\Controllers\\Members@routes');
开发者ID:BryanYeh,项目名称:apple-pie,代码行数:5,代码来源:members.module.php

示例9:

<?php

use Helpers\Hooks;
Hooks::addHook('sidebar', 'Modules\\Members\\Controllers\\Members@index');
Hooks::addHook('routes', 'Modules\\Members\\Controllers\\Members@routes');
Hooks::addHook('navbar', 'Modules\\Members\\Controllers\\Members@navbar');
开发者ID:davarravad,项目名称:apple-pie,代码行数:6,代码来源:members.module.php

示例10:

<?php

use Helpers\Hooks;
Hooks::addhook('routes', 'Modules\\Forum\\Controllers\\Forum@routes');
开发者ID:davarravad,项目名称:UserApplePie-v-2,代码行数:4,代码来源:forum.module.php

示例11:

<?php

use Helpers\Hooks;
//use Modules\Search\Controllers\Config as config;
Hooks::addHook('routes', 'Modules\\Search\\Controllers\\Main@routes');
开发者ID:geomorillo,项目名称:Search,代码行数:5,代码来源:search.module.php

示例12: order


//.........这里部分代码省略.........
         } else {
             $query = new ParseQuery('Order');
             $query->equalTo('objectId', $objectId);
             $order = $query->first();
             $order->set('productId', $productId);
             $order->set('productName', $productName);
             $order->set('customerName', $customerName);
             $order->set('customerId', $customerId);
             $order->setAssociativeArray('contact', $contact);
             $order->set('transportDate', $transportDate);
             $order->set('address', $address);
             $order->set('transportStatus', $transportStatus);
             $order->set('transferStatus', $transferStatus);
             $order->set('trackingNumber', $trackingNumber);
             $order->save();
         }
     } else {
         if (isset($_POST['submit'])) {
             $productId = !isset($_POST['productId']) || trim($_POST['productId']) == '' ? '' : $_POST['productId'];
             $productName = !isset($_POST['productName']) || trim($_POST['productName']) == '' ? '' : $_POST['productName'];
             $customerId = !isset($_POST['customerId']) || trim($_POST['customerId']) == '' ? '' : $_POST['customerId'];
             $customerName = !isset($_POST['customerName']) || trim($_POST['customerName']) == '' ? '' : $_POST['customerName'];
             $lineId = !isset($_POST['lineId']) || trim($_POST['lineId']) == '' ? '' : $_POST['lineId'];
             $facebook = !isset($_POST['facebook']) || trim($_POST['facebook']) == '' ? '' : $_POST['facebook'];
             $telephone = !isset($_POST['telephone']) || trim($_POST['telephone']) == '' ? '' : $_POST['telephone'];
             $transportDate = !isset($_POST['transportDate']) || trim($_POST['transportDate']) == '' ? null : DateTime::createFromFormat('d/m/Y', $_POST['transportDate']);
             $transportStatus = !isset($_POST['transportStatus']) || trim($_POST['transportStatus']) == '' ? '' : $_POST['transportStatus'];
             $transferStatus = !isset($_POST['transferStatus']) || trim($_POST['transferStatus']) == '' ? '' : $_POST['transferStatus'];
             $trackingNumber = !isset($_POST['trackingNumber']) || trim($_POST['trackingNumber']) == '' ? '' : $_POST['trackingNumber'];
             $contact = ['telephone' => $telephone, 'lineId' => $lineId, 'facebook' => $facebook];
             if ($_FILES['fileToUpload']['size'] > 0) {
                 $target_file = basename($_FILES["fileToUpload"]["name"]);
                 $uploadOk = 1;
                 $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));
                 $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
                 if ($check !== false) {
                     //echo "File is an image - " . $check["mime"] . ".";
                     $uploadOk = 1;
                 } else {
                     //echo "File is not an image.";
                     $uploadOk = 0;
                 }
                 // Check file size
                 if ($_FILES["fileToUpload"]["size"] > 500000) {
                     $error = "Sorry, your file is too large." . $error;
                     $uploadOk = 0;
                 }
                 // Allow certain file formats
                 if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
                     $error = "Sorry, only JPG, JPEG, PNG & GIF files are allowed." . $error;
                     $uploadOk = 0;
                 }
                 // Check if $uploadOk is set to 0 by an error
                 if ($uploadOk == 0) {
                     $error = "Sorry, your file was not uploaded." . $error;
                     // if everything is ok, try to upload file
                 } else {
                     $imageFile = ParseFile::createFromData(file_get_contents($_FILES['fileToUpload']['tmp_name']), $target_file);
                     $order = new ParseObject('Order');
                     $order->set('productId', $productId);
                     $order->set('productName', $productName);
                     $order->set('customerName', $customerName);
                     $order->set('customerId', $customerId);
                     $order->setAssociativeArray('contact', $contact);
                     $order->set('slipPayin', $imageFile);
                     $order->set('transportDate', $transportDate);
                     $order->set('address', $address);
                     $order->set('transportStatus', $transportStatus);
                     $order->set('transferStatus', $transferStatus);
                     $order->set('trackingNumber', $trackingNumber);
                     $order->save();
                 }
             } else {
                 $order = new ParseObject('Order');
                 $order->set('productId', $productId);
                 $order->set('productName', $productName);
                 $order->set('customerName', $customerName);
                 $order->set('customerId', $customerId);
                 $order->setAssociativeArray('contact', $contact);
                 $order->set('transportDate', $transportDate);
                 $order->set('address', $address);
                 $order->set('transportStatus', $transportStatus);
                 $order->set('transferStatus', $transferStatus);
                 $order->set('trackingNumber', $trackingNumber);
                 $order->save();
             }
             Url::redirect('order');
         }
         $sidemenu = new ParseQuery('SideMenu');
         $result = $sidemenu->find();
         Hooks::addHook('js', 'Controllers\\inventory\\Order@JS');
         Hooks::addHook('css', 'Controllers\\inventory\\Order@CSS');
         $data['title'] = 'รายการสั่งซื้อสินค้า';
         $data['username'] = $currentUser->get('username');
         $data['sidemenu'] = $result;
         View::rendertemplate('header', $data);
         View::render('inventory/order', $data, $error);
         View::rendertemplate('footer', $data);
     }
 }
开发者ID:pacozaa,项目名称:simple-mvc-framework-inventory-parse,代码行数:101,代码来源:order.php

示例13:

<?php

\Helpers\Hooks::get()->run('footer');
?>
</body>
</html>
开发者ID:APKO,项目名称:Billing,代码行数:6,代码来源:footer.php

示例14:

<?php

/**
 * Sample layout
 */
use Helpers\Assets;
use Helpers\Url;
use Helpers\Hooks;
//initialise hooks
$hooks = Hooks::get();
?>
<!DOCTYPE html>
<html lang="<?php 
echo LANGUAGE_CODE;
?>
">
    <head>

        <!-- Site meta -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

        <?php 
//hook for plugging in meta tags
$hooks->run('meta');
?>
        <title><?php 
echo $data['title'] . ' - ' . SITETITLE;
//SITETITLE defined in app/Core/Config.php
?>
</title>
开发者ID:geomorillo,项目名称:Auth,代码行数:31,代码来源:header.php

示例15: product


//.........这里部分代码省略.........
                 $uploadOk = 1;
             } else {
                 //echo "File is not an image.";
                 $uploadOk = 0;
             }
             // Check file size
             if ($_FILES["fileToUpload"]["size"] > 500000) {
                 $error = "Sorry, your file is too large." . $error;
                 $uploadOk = 0;
             }
             // Allow certain file formats
             if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
                 $error = "Sorry, only JPG, JPEG, PNG & GIF files are allowed." . $error;
                 $uploadOk = 0;
             }
             // Check if $uploadOk is set to 0 by an error
             if ($uploadOk == 0) {
                 $error = "Sorry, your file was not uploaded." . $error;
                 // if everything is ok, try to upload file
             } else {
                 $imageFile = ParseFile::createFromData(file_get_contents($_FILES['fileToUpload']['tmp_name']), $target_file);
                 $query = new ParseQuery('Product');
                 $query->equalTo('objectId', $objectId);
                 $product = $query->first();
                 $product->set('name', $_POST['productName']);
                 $product->set('price', $price);
                 $product->set('description', $description);
                 $product->set('picture', $imageFile);
                 $product->save();
             }
         } else {
             $query = new ParseQuery('Product');
             $query->equalTo('objectId', $objectId);
             $product = $query->first();
             $product->set('name', $name);
             $product->set('price', $price);
             $product->set('description', $description);
             $product->save();
         }
     } else {
         if (isset($_POST['submit'])) {
             $name = !isset($_POST['productName']) || trim($_POST['productName']) == '' ? '' : $_POST['productName'];
             $price = !isset($_POST['productPrice']) || trim($_POST['productPrice']) == '' ? 0 : floatval($_POST['productPrice']);
             $description = !isset($_POST['productDescription']) || trim($_POST['productDescription']) == '' ? '' : $_POST['productDescription'];
             if ($_FILES['fileToUpload']['size'] > 0) {
                 $target_file = basename($_FILES["fileToUpload"]["name"]);
                 $uploadOk = 1;
                 $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));
                 $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
                 if ($check !== false) {
                     //echo "File is an image - " . $check["mime"] . ".";
                     $uploadOk = 1;
                 } else {
                     //echo "File is not an image.";
                     $uploadOk = 0;
                 }
                 // Check file size
                 if ($_FILES["fileToUpload"]["size"] > 500000) {
                     $error = "Sorry, your file is too large." . $error;
                     $uploadOk = 0;
                 }
                 // Allow certain file formats
                 if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
                     $error = "Sorry, only JPG, JPEG, PNG & GIF files are allowed." . $error;
                     $uploadOk = 0;
                 }
                 // Check if $uploadOk is set to 0 by an error
                 if ($uploadOk == 0) {
                     $error = "Sorry, your file was not uploaded." . $error;
                     // if everything is ok, try to upload file
                 } else {
                     $imageFile = ParseFile::createFromData(file_get_contents($_FILES['fileToUpload']['tmp_name']), $target_file);
                     $product = new ParseObject('Product');
                     $product->set('name', $name);
                     $product->set('price', $price);
                     $product->set('description', $description);
                     $product->set('picture', $imageFile);
                     $product->save();
                 }
             } else {
                 $product = new ParseObject('Product');
                 $product->set('name', $name);
                 $product->set('price', $price);
                 $product->set('description', $description);
                 $product->save();
             }
             Url::redirect('product');
         }
         $sidemenu = new ParseQuery('SideMenu');
         $result = $sidemenu->find();
         Hooks::addHook('js', 'Controllers\\inventory\\Product@JS');
         Hooks::addHook('css', 'Controllers\\inventory\\Product@CSS');
         $data['title'] = 'สินค้า';
         $data['username'] = $currentUser->get('username');
         $data['sidemenu'] = $result;
         View::rendertemplate('header', $data);
         View::render('inventory/product', $data, $error);
         View::rendertemplate('footer', $data);
     }
 }
开发者ID:pacozaa,项目名称:simple-mvc-framework-inventory-parse,代码行数:101,代码来源:product.php


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