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


PHP App::import方法代码示例

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


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

示例1: __construct

 /**
  * Setup the config based on either the Configure::read() values
  * or the PaypalIpnConfig in config/paypal_ipn_config.php
  *
  * Will attempt to read configuration in the following order:
  *   Configure::read('PaypalIpn')
  *   App::import() of config/paypal_ipn_config.php
  *   App::import() of plugin's config/paypal_ipn_config.php
  */
 function __construct()
 {
     $this->config = Configure::read('PaypalIpn');
     if (empty($this->config)) {
         $importConfig = array('type' => 'File', 'name' => 'PaypalIpn.PaypalIpnConfig', 'file' => CONFIGS . 'paypal_ipn_config.php');
         if (!class_exists('PaypalIpnConfig')) {
             App::import($importConfig);
         }
         if (!class_exists('PaypalIpnConfig')) {
             // Import from paypal plugin configuration
             $importConfig['file'] = 'config' . DS . 'paypal_ipn_config.php';
             App::import($importConfig);
         }
         if (!class_exists('PaypalIpnConfig')) {
             trigger_error(__d('paypal_ipn', 'PaypalIpnConfig: The configuration could not be loaded.', true), E_USER_ERROR);
         }
         if (!PHP5) {
             $config =& new PaypalIpnConfig();
         } else {
             $config = new PaypalIpnConfig();
         }
         $vars = get_object_vars($config);
         foreach ($vars as $property => $configuration) {
             if (strpos($property, 'encryption_') === 0) {
                 $name = substr($property, 11);
                 $this->encryption[$name] = $configuration;
             } else {
                 $this->config[$property] = $configuration;
             }
         }
     }
     parent::__construct();
 }
开发者ID:ranium,项目名称:CakePHP-Paypal-IPN-Plugin,代码行数:42,代码来源:paypal.php

示例2: _fetch

 /**
  * Function which actially fetch the data from the database
  * @param object $options
  * @return nested array of menu nodes.
  */
 private function _fetch($options = array())
 {
     App::import('Model', 'Cakemenu.Menu');
     $menu = new Menu();
     if (isset($options['subtree'])) {
         $parent = true;
         if (isset($options['subtree']['parent'])) {
             $parent = $options['subtree']['parent'];
             unset($options['subtree']['parent']);
         }
         $subtree = $menu->find('first', array('conditions' => $options['subtree']));
         if ($subtree != false) {
             if ($parent == true) {
                 $conditions = array('Menu.lft >=' => $subtree['Menu']['lft'], 'Menu.rght <=' => $subtree['Menu']['rght']);
             } else {
                 $conditions = array('Menu.lft >' => $subtree['Menu']['lft'], 'Menu.rght <' => $subtree['Menu']['rght']);
             }
             if (isset($options['conditions'])) {
                 $options['conditions'] = am($options['conditions'], $conditions);
             } else {
                 $options['conditions'] = $conditions;
             }
         }
         unset($options['subtree']);
     }
     $nodes = $menu->find('threaded', am(array('order' => 'Menu.lft ASC'), $options));
     return $nodes;
 }
开发者ID:nchankov,项目名称:cakemenu,代码行数:33,代码来源:cakemenu.php

示例3: uninstall

 function uninstall()
 {
     App::import('Model', 'Module');
     $this->Module =& new Module();
     // Delete the module record
     $module = $this->Module->findByAlias('coupons');
     $this->Module->delete($module['Module']['id']);
     // Deletes the tables
     $uninstall_query = "DROP TABLE `module_coupons`;";
     $this->Module->execute($uninstall_query);
     // Delete any associated events.
     App::import('Model', 'Event');
     $this->Event =& new Event();
     $handlers = $this->Event->EventHandler->find('all', array('conditions' => array('EventHandler.originator' => 'CouponsModule')));
     foreach ($handlers as $value) {
         $this->Event->EventHandler->delete($value['EventHandler']['id']);
     }
     // Delete the core page
     App::import('Model', 'Content');
     $this->Content =& new Content();
     $core_page = $this->Content->find(array('Content.parent_id' => '-1', 'alias' => 'coupon-details'));
     $this->Content->delete($core_page['Content']['id'], true);
     $this->Session->setFlash(__('Module Uninstalled', true));
     $this->redirect('/modules/admin/');
 }
开发者ID:risnandar,项目名称:testing,代码行数:25,代码来源:setup_controller.php

示例4: initialize

 /**
  * initialize method
  *
  * Merge settings and set Config.language to a valid locale
  *
  * @return void
  * @access public
  */
 function initialize(&$Controller, $config = array())
 {
     App::import('Vendor', 'Mi.MiCache');
     $lang = MiCache::setting('Site.lang');
     if (!$lang) {
         if (!defined('DEFAULT_LANGUAGE')) {
             return;
         }
         $lang = DEFAULT_LANGUAGE;
     } elseif (!defined('DEFAULT_LANGUAGE')) {
         define('DEFAULT_LANGUAGE', $lang);
     }
     Configure::write('Config.language', $lang);
     App::import('Core', 'I18n');
     $I18n =& I18n::getInstance();
     $I18n->domain = 'default_' . $lang;
     $I18n->__lang = $lang;
     $I18n->l10n->get($lang);
     if (!empty($Controller->plugin)) {
         $config['plugins'][] = Inflector::underscore($Controller->plugin);
     }
     if (!empty($config['plugins'])) {
         $plugins = array_intersect(MiCache::mi('plugins'), $config['plugins']);
         $Inst = App::getInstance();
         foreach ($plugins as $path => $name) {
             $Inst->locales[] = $path . DS . 'locale' . DS;
         }
     }
 }
开发者ID:hiromi2424,项目名称:mi,代码行数:37,代码来源:language.php

示例5: initialize

 /**
  * Configuration method.
  *
  * In addition to configuring the settings (see $__defaults above for settings explanation),
  * this function also loops through the installed plugins and 'registers' those that have a
  * PluginNameCallback class.
  *
  * @param object $controller    Controller object
  * @param array $settings       Component settings
  * @access public
  * @return void
  */
 public function initialize(&$controller, $settings = array())
 {
     $this->__controller =& $controller;
     $this->settings = array_merge($this->__defaults, $settings);
     if (empty($this->settings['priority'])) {
         $this->settings['priority'] = Configure::listobjects('plugin');
     } else {
         foreach (Configure::listobjects('plugin') as $plugin) {
             if (!in_array($plugin, $this->settings['priority'])) {
                 array_push($this->settings['priority'], $plugin);
             }
         }
     }
     foreach ($this->settings['priority'] as $plugin) {
         $file = Inflector::underscore($plugin) . '_callback';
         $className = $plugin . 'Callback';
         if (App::import('File', $className, true, array(APP . 'plugins' . DS . Inflector::underscore($plugin)), $file . '.php')) {
             if (class_exists($className)) {
                 $class = new $className();
                 ClassRegistry::addObject($className, $class);
                 $this->__registered[] = $className;
             }
         }
     }
     /**
      * Called before the controller's beforeFilter method.
      */
     $this->executeCallbacks('initialize');
 }
开发者ID:jamienay,项目名称:register_callbacks_component,代码行数:41,代码来源:register_callbacks.php

示例6: pick

 function pick($layout_scheme)
 {
     App::import('Config', 'Typographer.' . $layout_scheme . '_config');
     $c_layout_scheme = Inflector::camelize($layout_scheme);
     //carrega os instrumentos e as configurações deste layout específico/
     $tools = Configure::read('Typographer.' . $c_layout_scheme . '.tools');
     $used_automatic_classes = Configure::read('Typographer.' . $c_layout_scheme . '.used_automatic_classes');
     foreach ($this->controller->helpers as $helper => $params) {
         if (is_array($params)) {
             if (isset($params['receive_tools'])) {
                 $this->controller->helpers[$helper]['tools'] = $tools;
                 unset($params['receive_tools']);
             }
             if (isset($params['receive_automatic_classes'])) {
                 $this->controller->helpers[$helper]['used_automatic_classes'] = $used_automatic_classes;
                 unset($params['used_automatic_classes']);
             }
         }
     }
     if (!isset($this->controller->view) || $this->controller->view == 'View') {
         $this->controller->view = 'Typographer.Type';
     }
     $this->controller->set('used_automatic_classes', $used_automatic_classes);
     $this->controller->set($tools);
     $this->controller->set('layout_scheme', $layout_scheme);
 }
开发者ID:rcaravita,项目名称:jodeljodel,代码行数:26,代码来源:type_layout_scheme_picker.php

示例7: beforeFind

 public function beforeFind($queryData)
 {
     $this->basePath = Configure::read('Filemanager.base_path');
     if (empty($this->basePath)) {
         $this->validationErrors[] = array('field' => 'basePath', 'message' => __('Base path does not exist'));
         return false;
     }
     $this->path = $this->basePath;
     if (isset($queryData['conditions']['path'])) {
         $this->path = $this->basePath . $queryData['conditions']['path'];
     }
     App::import('Folder');
     App::import('File');
     $Folder = new Folder($this->path);
     if (empty($Folder->path)) {
         $this->validationErrors[] = array('field' => 'path', 'message' => __('Path does not exist'));
         return false;
     }
     $this->fileList = $Folder->read();
     unset($this->fileList[1]);
     if (!empty($queryData['order'])) {
         $this->__order($queryData['order']);
     }
     return true;
 }
开发者ID:nani8124,项目名称:infinitas,代码行数:25,代码来源:Folders.php

示例8: getWebsiteMenus

 function getWebsiteMenus()
 {
     App::import('Model', 'Page');
     $this->Page = new Page();
     $pages = $this->Page->find('all', array('conditions' => array('Page.menu' => '1'), 'order' => 'Page.order ASC'));
     return $pages;
 }
开发者ID:MortalROs,项目名称:Naxasius-Game-Engine,代码行数:7,代码来源:interface.php

示例9: smarty_function_language_box

function smarty_function_language_box($params, $template)
{
    // Cache the output.
    $cache_name = 'vam_language_box_output' . (isset($params['template']) ? '_' . $params['template'] : '') . '_' . $_SESSION['Customer']['language_id'];
    $language_box_output = Cache::read($cache_name);
    if ($language_box_output === false) {
        ob_start();
        global $content;
        App::import('Component', 'Smarty');
        $Smarty =& new SmartyComponent();
        App::import('Model', 'Language');
        $Language =& new Language();
        $languages = $Language->find('all', array('conditions' => array('active' => '1')));
        if (count($languages) == 1) {
            return;
        }
        $keyed_languages = array();
        foreach ($languages as $language) {
            $language['Language']['url'] = BASE . '/languages/pick_language/' . $language['Language']['id'];
            $language['Language']['image'] = BASE . '/img/flags/' . $language['Language']['iso_code_2'] . '.png';
            $keyed_languages[] = $language['Language'];
        }
        $vars = array('languages' => $keyed_languages);
        $display_template = $Smarty->load_template($params, 'language_box');
        $Smarty->display($display_template, $vars);
        // Write the output to cache and echo them
        $language_box_output = @ob_get_contents();
        ob_end_clean();
        Cache::write($cache_name, $language_box_output);
    }
    echo $language_box_output;
}
开发者ID:risnandar,项目名称:testing,代码行数:32,代码来源:function.language_box.php

示例10: buildBookStatReportExcel

 public function buildBookStatReportExcel($books)
 {
     App::import("Vendor", "phpexcel/PHPExcel");
     App::import("Vendor", "phpexcel/PHPExcel/Writer/Excel5");
     $r['path'] = TMP . 'tests' . DS;
     $r['file'] = 'tmp_books_stat_' . $this->Session->read('user_id');
     $file = $r['path'] . $r['file'];
     $excel = new PHPExcel();
     $excel->setActiveSheetIndex(0);
     $excel->getActiveSheet()->setTitle('Books');
     $excel->getActiveSheet()->setCellValueByColumnAndRow(0, 1, '級別');
     $excel->getActiveSheet()->setCellValueByColumnAndRow(1, 1, '書籍名稱');
     $excel->getActiveSheet()->setCellValueByColumnAndRow(2, 1, '作者');
     $excel->getActiveSheet()->setCellValueByColumnAndRow(3, 1, 'ISBN');
     $excel->getActiveSheet()->setCellValueByColumnAndRow(4, 1, '索書號');
     $excel->getActiveSheet()->setCellValueByColumnAndRow(5, 1, '出借分校');
     $excel->getActiveSheet()->setCellValueByColumnAndRow(6, 1, '出借次數');
     $i = 1;
     foreach ($books as $book) {
         $i++;
         $excel->getActiveSheet()->setCellValueExplicitByColumnAndRow(0, $i, $book['books']['cate_id'], PHPExcel_Cell_DataType::TYPE_STRING);
         $excel->getActiveSheet()->setCellValueByColumnAndRow(1, $i, $book['books']['book_name']);
         $excel->getActiveSheet()->setCellValueByColumnAndRow(2, $i, $book['books']['book_author']);
         $excel->getActiveSheet()->setCellValueExplicitByColumnAndRow(3, $i, $book['books']['isbn'], PHPExcel_Cell_DataType::TYPE_STRING);
         $excel->getActiveSheet()->setCellValueExplicitByColumnAndRow(4, $i, $book['books']['book_search_code'], PHPExcel_Cell_DataType::TYPE_STRING);
         $excel->getActiveSheet()->setCellValueByColumnAndRow(5, $i, $book['system_locations']['location_name']);
         $excel->getActiveSheet()->setCellValueByColumnAndRow(6, $i, $book[0]['cnt']);
     }
     $objWriter = new PHPExcel_Writer_Excel5($excel);
     $objWriter->save($file);
     return $r;
 }
开发者ID:laiello,项目名称:double-l-bookmanagement,代码行数:32,代码来源:ReportfuncComponent.php

示例11: evaluate

 function evaluate($affiliate, $params, $team, $strict, $text_reason, $complete, $absolute_url)
 {
     if ($text_reason) {
         $this->reason = sprintf(__('have signed the %s waiver', true), $this->waiver);
     } else {
         App::import('Helper', 'Html');
         $html = new HtmlHelper();
         $url = array('controller' => 'waivers', 'action' => 'sign', 'waiver' => $this->config[0], 'date' => $this->date);
         if ($absolute_url) {
             $url = $html->url($url, true);
         } else {
             $url['return'] = true;
         }
         $this->reason = $html->link(sprintf(__('have signed the %s waiver', true), $this->waiver), $url);
     }
     $this->redirect = array('controller' => 'waivers', 'action' => 'sign', 'waiver' => $this->config[0], 'date' => $this->date);
     if (!$strict) {
         $this->invariant = true;
         return true;
     }
     if (is_array($params) && array_key_exists('Waiver', $params)) {
         $matches = array_intersect($this->config, Set::extract("/Waiver/WaiversPerson[valid_from<={$this->date}][valid_until>={$this->date}]/waiver_id", $params));
         if (!empty($matches)) {
             $this->invariant = true;
             return true;
         }
     }
     return false;
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:29,代码来源:rule_signed_waiver.php

示例12: createComment

 function createComment(&$model, $id, $data = array())
 {
     if (!empty($data[$this->__settings[$model->alias]['class']])) {
         unset($data[$model->alias]);
         $model->Comment->validate = array($this->__settings[$model->alias]['column_author'] => array('notempty' => array('rule' => array('notempty'))), $this->__settings[$model->alias]['column_content'] => array('notempty' => array('rule' => array('notempty'))), $this->__settings[$model->alias]['column_email'] => array('notempty' => array('rule' => array('notempty')), 'email' => array('rule' => array('email'), 'message' => 'Please enter a valid email address')), $this->__settings[$model->alias]['column_class'] => array('notempty' => array('rule' => array('notempty'))), $this->__settings[$model->alias]['column_foreign_id'] => array('notempty' => array('rule' => array('notempty'))), $this->__settings[$model->alias]['column_status'] => array('notempty' => array('rule' => array('notempty'))), $this->__settings[$model->alias]['column_points'] => array('notempty' => array('rule' => array('notempty')), 'numeric' => array('rule' => array('numeric'))));
         $data[$this->__settings[$model->alias]['class']][$this->__settings[$model->alias]['column_class']] = $model->alias;
         $data[$this->__settings[$model->alias]['class']][$this->__settings[$model->alias]['column_foreign_id']] = $id;
         $data[$this->__settings[$model->alias]['class']] = $this->_rateComment($model, $data['Comment']);
         if ($data[$this->__settings[$model->alias]['class']]['status'] == 'spam') {
             $data[$this->__settings[$model->alias]['class']]['active'] == 0;
         } else {
             if (Configure::read('Comments.auto_moderate') === true && $data[$this->__settings[$model->alias]['class']]['status'] != 'spam') {
                 $data[$this->__settings[$model->alias]['class']]['active'] == 1;
             }
         }
         if ($this->__settings[$model->alias]['sanitize']) {
             App::import('Sanitize');
             $data[$this->__settings[$model->alias]['class']][$this->__settings[$model->alias]['column_author']] = Sanitize::clean($data[$this->__settings[$model->alias]['class']][$this->__settings[$model->alias]['column_author']]);
             $data[$this->__settings[$model->alias]['class']][$this->__settings[$model->alias]['column_email']] = Sanitize::clean($data[$this->__settings[$model->alias]['class']][$this->__settings[$model->alias]['column_email']]);
             $data[$this->__settings[$model->alias]['class']][$this->__settings[$model->alias]['column_content']] = Sanitize::clean($data[$this->__settings[$model->alias]['class']][$this->__settings[$model->alias]['column_content']]);
         } else {
             $data[$this->__settings[$model->alias]['class']][$this->__settings[$model->alias]['column_author']] = $data[$this->__settings[$model->alias]['class']][$this->__settings[$model->alias]['column_author']];
             $data[$this->__settings[$model->alias]['class']][$this->__settings[$model->alias]['column_email']] = $data[$this->__settings[$model->alias]['class']][$this->__settings[$model->alias]['column_email']];
             $data[$this->__settings[$model->alias]['class']][$this->__settings[$model->alias]['column_content']] = $data[$this->__settings[$model->alias]['class']][$this->__settings[$model->alias]['column_content']];
         }
         if ($this->_checkForEmptyVal($data[$this->__settings[$model->alias]['class']]) == false) {
             $model->Comment->create();
             if ($model->Comment->save($data)) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:sdoney,项目名称:infinitas,代码行数:34,代码来源:commentable.php

示例13: hash

 /**
  * PwdShell::hash()
  *
  * @return void
  */
 public function hash()
 {
     $components = array('Tools.AuthExt', 'Auth');
     $class = null;
     foreach ($components as $component) {
         if (App::import('Component', $component)) {
             $component .= 'Component';
             list($plugin, $class) = pluginSplit($component);
             break;
         }
     }
     if (!$class || !method_exists($class, 'password')) {
         return $this->error(__('No Auth Component found'));
     }
     $this->out('Using: ' . $class);
     while (empty($pwToHash) || mb_strlen($pwToHash) < 2) {
         $pwToHash = $this->in(__('Password to Hash (2 characters at least)'));
     }
     if ($authType = Configure::read('Passwordable.authType')) {
         list($plugin, $authType) = pluginSplit($authType, true);
         $className = $authType . 'PasswordHasher';
         App::uses($className, $plugin . 'Controller/Component/Auth');
         $passwordHasher = new $className();
         $pw = $passwordHasher->hash($pwToHash);
     } else {
         $class = new $class(new ComponentCollection());
         $pw = $class->password($pwToHash);
     }
     $this->hr();
     $this->out($pw);
 }
开发者ID:Jony01,项目名称:LLD,代码行数:36,代码来源:PwdShell.php

示例14: getAdresses

 function getAdresses($options = array())
 {
     $defaultOptions = array('aro' => null);
     $options = array_merge($defaultOptions, $options);
     if (empty($options['aro'])) {
         $aroProvider = Configure::read('Shop.address.ACL.aroProvider');
         //debug($aroProvider);
         if (isset($aroProvider['component']) && isset($aroProvider['component'])) {
             $aro = $this->ShopFunct->callExternalfunction($aroProvider);
         }
         if (empty($aro)) {
             $aro = Configure::read('Shop.address.ACL.defaultAro');
         }
     } else {
         $aro = $options['aro'];
     }
     if (!$this->ShopAddress) {
         App::import('ShopAddress', 'Shop.ShopAddress');
         $this->ShopAddress = new ShopAddress();
     }
     //!!!!!!! Méthode trop lente quand il y a beaucoup d'élémemts. !!!!!!!
     $this->ShopAddress->recursive = -1;
     $allAdresses = $this->ShopAddress->find('all', array('conditions' => array('active' => 1)));
     if (count($allAdresses) > 250) {
         trigger_error(__d('shop', "Too many entries for the current analysing method. May be slow.", true), E_USER_NOTICE);
     }
     $adresses = true();
     foreach ($allAdresses as $adress) {
         if (!$this->Acl->check($aro, array('model' => $this->ShopAddress->alias, 'foreign_key' => $adress['ShopAddress']['id']))) {
             $adresses[] = $adress;
         }
     }
     return $adresses;
 }
开发者ID:kevthunder,项目名称:cake-shop,代码行数:34,代码来源:address_funct.php

示例15: index

 function index()
 {
     if (!empty($this->data) && !empty($_POST['submit'])) {
         $string = explode(",", trim($this->data['EbayenglishListing']['all_item']));
         $prsku = $string[0];
         if (!empty($string[1])) {
             $prname = $string[1];
         }
         if (!empty($prsku) && !empty($prname)) {
             $conditions = array('EbayenglishListing.title LIKE' => '%' . $prname . '%', 'EbayenglishListing.title LIKE' => '%' . $prsku . '%');
             $this->paginate = array('limit' => 1000, 'totallimit' => 2000, 'order' => 'EbayenglishListing.sku  id', 'conditions' => $conditions);
         }
         if (!empty($prsku)) {
             $conditions = array('OR' => array('EbayenglishListing.title LIKE' => "%{$prsku}%", 'EbayenglishListing.sku LIKE' => "%{$prsku}%"));
             $this->paginate = array('limit' => 1000, 'totallimit' => 2000, 'order' => 'EbayenglishListing.id  ASC', 'conditions' => $conditions);
         }
         $this->set('ebayenglishlistings', $this->paginate());
     } else {
         if (!empty($_POST['checkid']) && !empty($_POST['exports'])) {
             $checkboxid = $_POST['checkid'];
             App::import("Vendor", "parsecsv");
             $csv = new parseCSV();
             $filepath = "C:\\Users\\Administrator\\Downloads" . "ebayenglishlistings.csv";
             $csv->auto($filepath);
             $this->set('ebayenglishlistings', $this->EbayenglishListing->find('all', array('conditions' => array('EbayenglishListing.id' => $checkboxid))));
             $this->layout = null;
             $this->autoLayout = false;
             Configure::write('debug', '2');
         } else {
             $this->EbayenglishListing->recursive = 1;
             $this->paginate = array('limit' => 1000, 'totallimit' => 2000, 'order' => 'EbayenglishListing.id  ASC');
             $this->set('ebayenglishlistings', $this->paginate());
         }
     }
 }
开发者ID:princespn,项目名称:listing-software,代码行数:35,代码来源:ebayenglish_listings_controller111.php


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