本文整理汇总了PHP中app::import方法的典型用法代码示例。如果您正苦于以下问题:PHP app::import方法的具体用法?PHP app::import怎么用?PHP app::import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app
的用法示例。
在下文中一共展示了app::import方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render($image, $params)
{
//Set defaults
$path = '';
$width = 150;
$height = 225;
$quality = 75;
//Extract Parameters
if (isset($params['path'])) {
$path = $params['path'] . DS;
}
if (isset($params['width'])) {
$width = $params['width'];
}
if (isset($params['height'])) {
$height = $params['height'];
}
if (isset($params['quality'])) {
$quality = $params['quality'];
}
//import phpThumb class
app::import('Vendor', 'phpthumb', array('file' => 'phpThumb' . DS . 'phpthumb.class.php'));
$thumbNail = new phpthumb();
$thumbNail->src = WWW_ROOT . 'img' . DS . $path . $image;
$thumbNail->w = $width;
$thumbNail->h = $height;
$thumbNail->q = $quality;
$thumbNail->config_imagemagick_path = '/usr/bin/convert';
$thumbNail->config_prefer_imagemagick = true;
$thumbNail->config_output_format = 'jpg';
$thumbNail->config_error_die_on_error = true;
$thumbNail->config_document_root = '';
$thumbNail->config_temp_directory = APP . 'tmp';
$thumbNail->config_cache_directory = WWW_ROOT . 'img' . DS . 'thumbs' . DS;
$thumbNail->config_cache_disable_warning = true;
$cacheFilename = $image;
$thumbNail->cache_filename = $thumbNail->config_cache_directory . $cacheFilename;
if (!is_file($thumbNail->cache_filename)) {
if ($thumbNail->GenerateThumbnail()) {
$thumbNail->RenderToFile($thumbNail->cache_filename);
}
}
if (is_file($thumbNail->cache_filename)) {
return $cacheFilename;
}
}
示例2: redirectUrl
* LICENSE: This source file is subject to version 3.01 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_01.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category UserAuthComponent
* @package Component
* @author Vijay.Ch <vijay.ch@vendus.com>
* @license http://www.opensource.org/licenses/mit-license.php MIT License
* @link http://localhost/cacsv2/index
* @dateCreated 07/17/2015 MM/DD/YYYY
* @dateUpdated 07/17/2015 MM/DD/YYYY
* @functions 2
*/
app::import('Component', 'Auth');
/**
* UserAuth Component: Based on user type we are redirecting
*
* @category UserAuthComponent
* @package Component
* @author Vijay.Ch <vijay.ch@vendus.com>
* @license http://www.opensource.org/licenses/mit-license.php MIT License
* @link http://localhost/cacsv2/index
*/
class UserAuthComponent extends AuthComponent
{
public function redirectUrl($url = null)
{
if ($url !== null) {
$redir = $url;
示例3: admin_history
function admin_history()
{
$this->layout = 'backend/backend';
$this->set("title_for_layout", COUPON_LISTING);
App::import("Model", "User");
$this->User = new User();
$user_profile_join = array('table' => 'user_profiles', 'alias' => 'UserProfile', 'forignKey' => false, 'type' => 'left', 'conditions' => array('UserProfile.user_id = User.id'), 'order' => array("UserProfile.first_name" => "DESC"));
$sub_dealer_data = $this->User->find("list", array("fields" => array("id", "UserProfile.first_name"), "joins" => array($user_profile_join), "conditions" => array("User.is_deleted" => "0", "User.is_active" => "1", "User.parent_id" => $this->Session->read("Auth.User.id"))));
$this->set("sub_dealer_data", $sub_dealer_data);
App::import("Model", "Product");
$this->Product = new Product();
$product_data = $this->Product->find("list", array("fields" => array("product_code", "title"), "conditions" => array("Product.is_deleted" => "0", "Product.is_active" => "1")));
$this->set("product_data", $product_data);
App::import("Model", "CouponSale");
$this->CouponSale = new CouponSale();
$this->CouponSale->bindModel(array('belongsTo' => array('UserProfile' => array('className' => 'UserProfile', 'foreignKey' => 'dealer_id'), 'Coupon' => array('className' => 'Coupon', 'foreignKey' => 'coupon_id'))));
$conditions = array();
$user = $this->Auth->user();
if ($user['role_id'] == 2) {
App::import("Model", "User");
$this->User = new User();
$sub_dealer = $this->User->find('list', array('conditions' => array('parent_id' => $user['id']), 'fields' => array('id', 'id')));
$sub_dealer[] = $user['id'];
$conditions = array_merge($conditions, array("dealer_id" => $sub_dealer));
}
if ($user['role_id'] == 3) {
$conditions = array_merge($conditions, array("dealer_id" => $user['id']));
}
if (!empty($this->data)) {
$from = $this->data['Coupon']['from'];
$to = $this->data['Coupon']['to'];
$c_id = $this->data['Coupon']['c_id'];
$s_d = $this->data['Coupon']['s_d'];
$p_c = $this->data['Coupon']['p_c'];
$limit = $this->data['Coupon']['limit'];
if (trim($from) != "") {
$from = $this->covertToSystemDate($from);
$conditions = array_merge($conditions, array("DATE_FORMAT(CouponSale.created,'%Y-%m-%d') >=" => trim($from)));
}
if (trim($to) != "") {
$to = $this->covertToSystemDate($to);
$conditions = array_merge($conditions, array("DATE_FORMAT(CouponSale.created,'%Y-%m-%d') <=" => trim($to)));
}
if (trim($c_id) != "") {
app::import("Model", "Coupon");
$this->Coupon = new Coupon();
$c_code = $this->Coupon->field("id", array("coupon_id" => $c_id));
$conditions = array_merge($conditions, array("CouponSale.coupon_id" => trim($c_code)));
}
if (trim($s_d) != "") {
$conditions = array_merge($conditions, array("CouponSale.dealer_id" => trim($s_d)));
$this->set("sub_dealer", $s_d);
}
if (trim($p_c) != "") {
$conditions = array_merge($conditions, array("CouponSale.product_code" => trim($p_c)));
$this->set("product_c", $p_c);
}
if (trim($limit) == "" || trim($limit) <= 0) {
$limit = 100;
}
} else {
$limit = 100;
}
$coupon_data = $this->CouponSale->find('all', array('conditions' => $conditions, 'order' => array("CouponSale.created" => "desc"), 'limit' => $limit));
$this->set('coupon_data', $coupon_data);
}
示例4:
<?php
app::import('Model', 'Site.UserGroupBase');
class UserGroup extends UserGroupBase
{
}
示例5: __updateData
function __updateData()
{
$data = array('Enumeration' => array(1 => __('User documentation', true), 2 => __('Technical documentation', true), 3 => __('Low', true), 4 => __('Normal', true), 5 => __('High', true), 6 => __('Urgent', true), 7 => __('Immediate', true), 8 => __('Design', true), 9 => __('Development', true)), 'IssueStatus' => array(1 => __('New', true), 2 => __('Assigned', true), 3 => __('Resolved', true), 4 => __('Feedback', true), 5 => __('Closed', true), 6 => __('Rejected', true)), 'Role' => array(3 => __('Manager', true), 4 => __('Developer', true), 5 => __('Reporter', true)), 'Tracker' => array(1 => __('Bug', true), 2 => __('Feature', true), 3 => __('Support', true)));
foreach ($data as $model_name => $map) {
app::import('model', $model_name);
$obj =& ClassRegistry::init($model_name);
foreach ($map as $id => $name) {
$obj->id = $id;
$obj->saveField('name', $name);
}
}
}
示例6: array
<?php
app::import('Controller', 'Plugins');
//継承するコントローラのpluginsをインポートする
class FrontAuthController extends PluginsController
{
var $name = "FrontAuth";
var $uses = array('Plugin', 'User', 'GlobalMenu', 'UserGroup', 'FrontAuth.FrontAuthMember');
var $components = array('BcReplacePrefix', 'BcAuth', 'Cookie', 'BcAuthConfigure');
//認証がかかる
/**
* ぱんくずナビ
*
* @var array
* @access public
*/
var $crumbs = array(array('name' => 'メンバーログイン画面', 'url' => array('plugin' => 'front_auth', 'controller' => 'front_auth', 'action' => 'index')));
/**
* beforeFilter
*/
function beforeFilter()
{
parent::beforeFilter();
if (!preg_match('/^admin_/', $this->action)) {
$this->BcAuth->allow($this->action);
}
}
function index()
{
$this->redirect('/news');
$this->pageTitle = 'トピックス一覧';
示例7:
<?php
app::import('Model', 'Site.LogRequestBase');
/**
* For basic request loging
*
*/
class LogRequest extends LogRequestBase
{
}
示例8: array
<?php
app::import('Model', 'Mongodb.MongodbModel');
abstract class UserBase extends MongodbModel
{
public $name = "User";
public $useTable = 'users';
public $displayField = 'login';
public $actsAs = array('Mongodb.SqlCompatible', 'Mongodb.Schemaless', 'Site.SimpleCredentialable');
/*
var $mongoSchema = array(
'login'=>array('type'=>'string'),
'password'=>array('type'=>'string'),
'haveRoles'=>array('type'=>'array'),
'dontHaveRoles'=>array('type'=>'array'),
'created'=>array('type'=>'datetime'),
'modified'=>array('type'=>'datetime'),
);
//*/
public $hasMany = array('Directories' => array('className' => 'UserDirectory', 'foreignKey' => 'user_id', 'reverse' => 'Owner'));
public $belongsTo = array('LivingCity' => array('className' => 'City', 'foreignKey' => 'city_id', 'reverse' => 'Inhabitants'));
public $hasOne = array('Profile' => array('className' => 'UserProfile', 'foreignKey' => 'user_id', 'reverse' => 'Owner'));
public $hasList = array('Photo', 'UserGroups' => array('className' => 'UserGroup'));
}
示例9:
<?php
app::import('Model', 'Site.UserBase');
class User extends UserBase
{
}
示例10:
<?php
app::import('Model', 'Site.UserProfileBase');
class UserProfile extends UserProfileBase
{
}
示例11: doupload
function doupload()
{
Configure::write('debug', '0');
$max_torrent_size = 1000000;
$announce_urls = array();
$announce_urls[] = $this->webroot . 'announce.php';
$this->layout = 'ajax';
$uses = array('Torrent', 'File');
app::import('vendor', 'ztracker/global');
app::import('vendor', 'ztracker/dict');
app::import('vendor', 'ztracker/torrentfile');
if (!preg_match('/^(.+)\\.torrent$/si', $this->params['form']['torrentFile']['name'], $matches)) {
$this->set('success', '{success:false,msg:"Это не файл торрента"}');
return;
}
$shortname = $torrent = $matches[1];
$tmp_name = $this->params['form']['torrentFile']['tmp_name'];
if (!is_uploaded_file($tmp_name) || !filesize($tmp_name)) {
$this->set('success', '{success:false,msg:"Ошибка"}');
return;
}
$tor = new TTorrentFile($tmp_name, $max_torrent_size);
$tor->setComment("Torrent was created for BYMEP.COM");
$tor->setUser($this->ZTAuth->user('username'), $this->ZTAuth->user('id'));
// setup torrent {{{
$utype = $this->Uploadtype->find("user_lvl <= " . $this->ZTAuth->user('group_id') . " AND id = " . $this->data['Torrent']['free_type']);
if (empty($utype)) {
$utype = $this->Uploadtype->find("user_lvl <= " . $this->ZTAuth->user('group_id'));
$this->data['Torrent']['free_type'] = $utype['id'];
}
$this->data['Torrent']['filename'] = $this->params['form']['torrentFile']['name'];
$this->data['Torrent']['added'] = date('Y-m-d H:i:s');
$this->data['Torrent']['owner'] = $this->ZTAuth->user('id');
$this->data['Torrent']['info_hash'] = $tor->getInfoHash();
$this->data['Torrent']['size'] = $tor->totalSize;
$this->data['Torrent']['numfiles'] = $tor->numFiles;
if ($this->data['Torrent']['numfiles'] > 1) {
$this->data['Torrent']['type'] = 'multi';
} else {
$this->data['Torrent']['type'] = 'single';
}
$this->data['Torrent']['save_as'] = $tor->downloadName;
$this->Torrent->save($this->data['Torrent']);
$torid = $this->Torrent->getLastInsertId();
// }}}
foreach ($tor->filelist as $file) {
$file['torrent'] = $torid;
$this->Ufile->create();
$this->Ufile->save(array('Ufile' => $file));
}
$tor->move("../torrents/{$torid}.torrent");
$this->set('success', '{success:false}');
// DONE: Move Info file to specific directory
move_uploaded_file($this->params['form']['torrentNFO']['tmp_name'], "../nfo/{$torid}.nfo");
// TODO: Sanitize NFO file
//
$this->Log->create();
$this->Log->save(array('Log' => array('user_id' => $this->ZTAuth->user('id'), 'msg' => "Пользователь " . $this->ZTAuth->user('username') . " залил торрент " . $this->data['Torrent']['name'])));
}
示例12:
<?php
app::import('Model', 'Site.UserSessionBase');
class UserSession extends UserSessionBase
{
}