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


PHP Core\Configure类代码示例

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


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

示例1: beforeDelete

 public function beforeDelete(Event $event, Entity $entity)
 {
     $upload_root_offset = Configure::read('UPLOAD_ROOT_OFFSET');
     $upload_root = Configure::read('UPLOAD_ROOT');
     $id = $entity->id;
     $job_id = $entity->job_id;
     // delete creative folder and all its contents
     AppController::delete_folder($upload_root_offset . DS . $upload_root . DS . $job_id . DS . $id);
     /*
     		$Files = TableRegistry::get('Files');
     		$files = $Files->find('all',['conditions'=>['creative_id'=>$id]])->toArray();
     		if( !empty($files) ) {
     	    	foreach($files as $row){
     			    $file_path = $upload_root_offset . $row['file'];
     			    if( file_exists($file_path) ) {
     					if ( is_dir($file_path) ){
     						if( AppController::delete_folder($file_path) ) {
     							
     						}
     					} else if( unlink($file_path) ) {
     						
     					}
     				}
     		    }
     	    }
     */
 }
开发者ID:dlowetz,项目名称:asset-preview,代码行数:27,代码来源:CreativesTable.php

示例2: setUp

 /**
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     $this->Comments = TableRegistry::get('BitmaskedComments');
     $this->Comments->addBehavior('Tools.Bitmasked', ['mappedField' => 'statuses']);
 }
开发者ID:dereuromark,项目名称:cakephp-tools,代码行数:10,代码来源:BitmaskedBehaviorTest.php

示例3: view

 public function view($reportId)
 {
     if (!$reportId) {
         throw new NotFoundException(__('Invalid Report'));
     }
     $report = $this->Reports->findById($reportId)->toArray();
     if (!$report) {
         throw new NotFoundException(__('Invalid Report'));
     }
     $this->set('report', $report);
     $this->set('project_name', Configure::read('GithubRepoPath'));
     $this->Reports->id = $reportId;
     $this->set('incidents', $this->Reports->getIncidents()->toArray());
     $this->set('incidents_with_description', $this->Reports->getIncidentsWithDescription());
     $this->set('incidents_with_stacktrace', $this->Reports->getIncidentsWithDifferentStacktrace());
     $this->set('related_reports', $this->Reports->getRelatedReports());
     $this->set('status', $this->Reports->status);
     $this->_setSimilarFields($reportId);
     // if there is an unread notification for this report, then mark it as read
     $current_developer = TableRegistry::get('Developers')->findById($this->request->session()->read('Developer.id'))->all()->first();
     //$current_developer = Sanitize::clean($current_developer);
     if ($current_developer) {
         TableRegistry::get('Notifications')->deleteAll(array('developer_id' => $current_developer['Developer']['id'], 'report_id' => $reportId), false);
     }
 }
开发者ID:pkdevbox,项目名称:error-reporting-server,代码行数:25,代码来源:ReportsController.php

示例4: setUp

 /**
  * setUp
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('Acl.classname', 'DbAcl');
     Configure::write('Acl.database', 'test');
     $this->Task = $this->getMock('Acl\\AclExtras', ['in', 'out', 'hr', 'createFile', 'error', 'err', 'clear', 'getControllerList']);
 }
开发者ID:edukondaluetg,项目名称:acl,代码行数:12,代码来源:AclExtrasTest.php

示例5: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Plugin::load('TestPlugin');
     Configure::write('App.namespace', 'TestApp');
     $this->dispatcher = $this->getMockBuilder('Cake\\Console\\ShellDispatcher')->setMethods(['_stop'])->getMock();
 }
开发者ID:rashmi,项目名称:newrepo,代码行数:12,代码来源:ShellDispatcherTest.php

示例6: defineElfinderBrowser

    public function defineElfinderBrowser($return = false)
    {
        $url = Router::url('/cakephp-tinymce-elfinder/Elfinders/elfinder');
        $clientOptions = Configure::read('TinymceElfinder.client_options');
        $title = Configure::read('TinymceElfinder.title');
        $str = '
		<script type="text/javascript">
		function elFinderBrowser (field_name, url, type, win) {
			  tinymce.activeEditor.windowManager.open({
			    file: "' . $url . '",
			    title: "' . $title . '",
			    width: ' . ($clientOptions['width'] + 20) . ',  
			    height: ' . ($clientOptions['height'] + 50) . ',
			    resizable: "' . $clientOptions['resizable'] . '"
			  }, {
			    setUrl: function (url) {
			      win.document.getElementById(field_name).value = url;
			    }
			  });
			  return false;
			}
		</script>';
        if ($return) {
            return $str;
        } else {
            echo $str;
        }
    }
开发者ID:hashmode,项目名称:cakephp-tinymce-elfinder,代码行数:28,代码来源:TinymceElfinderHelper.php

示例7: initialize

 public function initialize()
 {
     if (!Configure::read('Users.defaultController')) {
         $this->redirect($this->referer());
     }
     parent::initialize();
 }
开发者ID:cakemanager,项目名称:cakephp-users,代码行数:7,代码来源:UsersController.php

示例8: main

 /**
  * Main
  *
  * @return void
  */
 public function main()
 {
     $batchSize = 10;
     if (is_numeric(Configure::read('Notifications.batch_size'))) {
         $batchSize = Configure::read('Notifications.batch_size');
     }
     $this->loadModel('Notifications.NotificationQueue');
     $batch = $this->NotificationQueue->getBatch($batchSize);
     if (!empty($batch)) {
         $batchIds = [];
         $sent = 0;
         $failed = 0;
         foreach ($batch as $notification) {
             $batchIds[] = $notification->id;
             if ($this->NotificationQueue->send($notification)) {
                 $this->NotificationQueue->success($notification->id);
                 $sent++;
             } else {
                 $this->NotificationQueue->fail($notification->id);
                 $failed++;
             }
         }
         $this->NotificationQueue->releaseLocks($batchIds);
         $this->out("Batch Size: " . count($batch) . " - Successes: {$sent} - Failures: {$failed}");
     } else {
         $this->out('Notification Queue Batch is empty.');
     }
 }
开发者ID:codekanzlei,项目名称:cake-notifications,代码行数:33,代码来源:SenderShell.php

示例9: _getAssetFile

 /**
  * Builds asset file path based off url
  *
  * @param string $url Asset URL
  * @return string Absolute path for asset file
  */
 protected function _getAssetFile($url)
 {
     //Brood unload hack cause vendor plugin loaded for some reason
     Plugin::unload('Garderobe');
     $parts = explode('/', $url);
     $fileType = array_shift($parts);
     $fileFragment = implode(DS, $parts);
     $allowedExtensions = ComponentInstallerConfigureTrait::getSupportedExtensions();
     $registeredComponents = (require ROOT . DS . 'vendor' . DS . 'cakephp-components.php');
     foreach ($registeredComponents as $component) {
         $extensions = implode('|', $allowedExtensions);
         if (preg_match("/({$extensions})\$/i", $fileFragment)) {
             foreach ($component as $type => $chunk) {
                 if ($fileType != $type) {
                     continue;
                 }
                 $path = ROOT . DS . Configure::read('App.webroot') . DS . $chunk . DS;
                 if (Configure::read('debug') == false && !strpos($fileFragment, 'min')) {
                     $fileFragment = preg_replace("/(css|js)\$/i", "min.\$1", $fileFragment);
                 }
                 if (file_exists($path . $fileFragment)) {
                     return $path . $fileFragment;
                 }
             }
         }
     }
 }
开发者ID:mindforce,项目名称:cakephp-garderobe,代码行数:33,代码来源:AssetFilter.php

示例10: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('Acl.classname', __NAMESPACE__ . '\\CachedDbAclTwoTest');
     $this->CachedDb = new CachedDbAclTwoTest();
     Cache::config('tests', ['engine' => 'File', 'path' => TMP, 'prefix' => 'test_']);
 }
开发者ID:edukondaluetg,项目名称:acl,代码行数:12,代码来源:CacheDbAclTest.php

示例11: display

 /**
  * Displays a view
  *
  * @return void|\Cake\Network\Response
  * @throws \Cake\Network\Exception\NotFoundException When the view file could not
  *   be found or \Cake\View\Exception\MissingTemplateException in debug mode.
  */
 public function display()
 {
     $path = func_get_args();
     $count = count($path);
     if (!$count) {
         return $this->redirect('/');
     }
     $page = $subpage = null;
     if (!empty($path[0])) {
         $page = $path[0];
     }
     if (!empty($path[1])) {
         $subpage = $path[1];
     }
     $data = $this->getHeadquartersData();
     $this->set('data', $data);
     $this->set(compact('page', 'subpage'));
     try {
         $this->render(implode('/', $path));
     } catch (MissingTemplateException $e) {
         if (Configure::read('debug')) {
             throw $e;
         }
         throw new NotFoundException();
     }
 }
开发者ID:raguilar0,项目名称:TCU_FEUCR,代码行数:33,代码来源:PagesController.php

示例12:

 function __construct()
 {
     Configure::load('amazon', 'default');
     $this->awsAccessKey = Configure::read('AwsAccessKey');
     $this->awsSecretKey = Configure::read('AwsSecretKey');
     $this->associateTag = Configure::read('AssociateTag');
 }
开发者ID:matdion,项目名称:Product-Tracker,代码行数:7,代码来源:AmazonHelper.php

示例13: getModelClass

 public function getModelClass()
 {
     $parts = explode('\\', get_class($this));
     $factory = array_pop($parts);
     $entity = preg_replace('/Factory$/', '', $factory);
     return Configure::read('App.namespace') . '\\Model\\Entity\\' . $entity;
 }
开发者ID:gourmet,项目名称:muffin,代码行数:7,代码来源:TestFactory.php

示例14: _thumbnailsHtml

 /**
  * Method that generates and returns thumbnails html markup.
  *
  * @param ResultSet $entities File Entities
  * @param FileUploadsUtils $fileUploadsUtils fileUploadsUtils class object
  * @param array $options for default thumbs versions and other setttings
  *
  * @return string
  */
 protected function _thumbnailsHtml($entities, FileUploadsUtils $fileUploadsUtils, $options = [])
 {
     $result = null;
     $colWidth = static::GRID_COUNT / static::THUMBNAIL_LIMIT;
     $thumbnailUrl = 'CsvMigrations.thumbnails/' . static::NO_THUMBNAIL_FILE;
     $hashes = Configure::read('FileStorage.imageHashes.file_storage');
     $extensions = $fileUploadsUtils->getImgExtensions();
     foreach ($entities as $k => $entity) {
         if ($k >= static::THUMBNAIL_LIMIT) {
             break;
         }
         if (in_array($entity->extension, $extensions)) {
             $thumbnailUrl = $entity->path;
             if (isset($hashes[$options['imageSize']])) {
                 $version = $hashes[$options['imageSize']];
                 $exists = $this->_checkThumbnail($entity, $version, $fileUploadsUtils);
                 if ($exists) {
                     $path = dirname($entity->path) . '/' . basename($entity->path, $entity->extension);
                     $path .= $version . '.' . $entity->extension;
                     $thumbnailUrl = $path;
                 }
             }
         }
         $thumbnail = sprintf(static::THUMBNAIL_HTML, $this->cakeView->Html->image($thumbnailUrl, ['title' => $entity->filename]));
         $thumbnail = $this->cakeView->Html->link($thumbnail, $entity->path, ['escape' => false, 'target' => '_blank']);
         $result .= sprintf(static::GRID_COL_HTML, $colWidth, $colWidth, $colWidth, $colWidth, $thumbnail);
     }
     $result = sprintf(static::GRID_ROW_HTML, $result);
     return $result;
 }
开发者ID:QoboLtd,项目名称:cakephp-csv-migrations,代码行数:39,代码来源:ImagesFieldHandler.php

示例15: render

    /**
     * Renders a date time widget.
     *
     * @param array $data Data to render with.
     * @param \Cake\View\Form\ContextInterface $context The current form context.
     * @return string A generated select box.
     * @throws \RuntimeException When option data is invalid.
     */
    public function render(array $data, ContextInterface $context)
    {
        $id = $data['id'];
        $name = $data['name'];
        $val = $data['val'];
        $type = $data['type'];
        $required = $data['required'] ? 'required' : '';
        $disabled = isset($data['disabled']) && $data['disabled'] ? 'disabled' : '';
        $role = isset($data['role']) ? $data['role'] : 'datetime-picker';
        $format = null;
        $locale = isset($data['locale']) ? $data['locale'] : I18n::locale();
        $timezoneAware = Configure::read('CrudView.timezoneAwareDateTimeWidget');
        $timestamp = null;
        $timezoneOffset = null;
        if (isset($data['data-format'])) {
            $format = $this->_convertPHPToMomentFormat($data['data-format']);
        }
        if (!$val instanceof DateTimeInterface && !empty($val)) {
            $val = $type === 'date' ? Time::parseDate($val) : Time::parseDateTime($val);
        }
        if ($val) {
            if ($timezoneAware) {
                $timestamp = $val->format('U');
                $dateTimeZone = new DateTimeZone(date_default_timezone_get());
                $timezoneOffset = $dateTimeZone->getOffset($val) / 60;
            }
            $val = $val->format($type === 'date' ? 'Y-m-d' : 'Y-m-d H:i:s');
        }
        if (!$format) {
            $format = $type === 'date' ? 'L' : 'L LT';
        }
        $widget = <<<html
            <div class="input-group {$type}">
                <input
                    type="text"
                    class="form-control"
                    name="{$name}"
                    value="{$val}"
                    id="{$id}"
                    role="{$role}"
                    data-locale="{$locale}"
                    data-format="{$format}"
html;
        if ($timezoneAware && isset($timestamp, $timezoneOffset)) {
            $widget .= <<<html
                    data-timestamp="{$timestamp}"
                    data-timezone-offset="{$timezoneOffset}"
html;
        }
        $widget .= <<<html
                    {$required}
                    {$disabled}
                />
                <label for="{$id}" class="input-group-addon">
                    <span class="glyphicon glyphicon-calendar"></span>
                </label>
            </div>
html;
        return $widget;
    }
开发者ID:friendsofcake,项目名称:crud-view,代码行数:68,代码来源:DateTimeWidget.php


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