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


PHP arr::rotate方法代码示例

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


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

示例1: get_document_metadata_fields

 public function get_document_metadata_fields()
 {
     $database = new Database();
     $database->select('key');
     $database->from('document_metadata');
     $database->where('document_id', $this->id);
     $results = arr::rotate($database->get()->result_array(false));
     return $results['key'];
 }
开发者ID:vitrinephp,项目名称:Vitrine-PHP,代码行数:9,代码来源:document.php

示例2: rotate

 /**
  * Tests the arr::rotate() function.
  * @dataProvider rotate_provider
  * @group core.helpers.arr.rotate
  * @test
  */
 public function rotate($input_array, $expected_result)
 {
     $result = arr::rotate($input_array);
     $this->assertEquals($expected_result, $result);
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:11,代码来源:Helper_Arr_Test.php

示例3: prepare_upload

 public function prepare_upload($uploadvar = 'upload')
 {
     if (!arr::get($_FILES, 'mediafile', 'name', $uploadvar)) {
         kohana::log('error', 'Attempted to prepare upload without file');
         return 'Please provide a file to upload';
     }
     $uploadedFile = arr::get(arr::rotate($_FILES['mediafile']), $uploadvar);
     switch ($uploadedFile['error']) {
         case UPLOAD_ERR_INI_SIZE:
             return 'File exceeds upload_max_filesize';
         case UPLOAD_ERR_FORM_SIZE:
             return 'File exceeds MAX_FILE_SIZE';
         case UPLOAD_ERR_PARTIAL:
             return 'File was only partially uploaded';
         case UPLOAD_ERR_NO_FILE:
             return 'No file was uploaded';
         case UPLOAD_ERR_NO_TMP_DIR:
             return 'Missing a temporary folder';
         case UPLOAD_ERR_CANT_WRITE:
             return 'Failed to write file to disk';
         case UPLOAD_ERR_EXTENSION:
             return 'Invalid file extension (type)';
         case UPLOAD_ERR_OK:
             if (!$this->get('file')) {
                 $uploadFilename = $uploadedFile['name'];
                 if (Kohana::config('upload.remove_spaces') === TRUE) {
                     $uploadFilename = preg_replace('/\\s+/', '_', $uploadFilename);
                 }
                 $this->set('file', $uploadFilename);
             }
             if ($this->get('path')) {
                 $path = trim($this->get('path'), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
                 $this->set('path', $path);
             }
             if (!is_file($uploadedFile['tmp_name'])) {
                 kohana::log('error', 'Unable to locate file in temporary storage ' . $uploadedFile['tmp_name']);
                 return 'Unable to upload file';
             }
             if (!($mediainfo = MediaLib::getAudioInfo($uploadedFile['tmp_name']))) {
                 kohana::log('error', 'Unable to determine audio info for tmp upload file "' . $uploadedFile['tmp_name'] . '"');
                 return 'Upload is not a valid audio file or format';
             }
             $this->fromArray($mediainfo);
             if (kohana::config('mediafile.upload_to_rate_folders')) {
                 $rate = $this->get('rates');
                 $path = $this->get('path');
                 if (in_array($rate, kohana::config('mediafile.default_rates')) and !strstr($path, $rate . DIRECTORY_SEPARATOR)) {
                     $path .= $this->get('rates') . DIRECTORY_SEPARATOR;
                     $this->set('path', $path);
                 } else {
                     if ($unknownPath = kohana::config('mediafile.unknown_rate_folder')) {
                         $path .= trim($unknownPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
                         $this->set('path', $path);
                     }
                 }
             }
             $directory = $this->filepath();
             if (!$this->get('name') or !$this->get('description')) {
                 $mediafiles = $this->get_resampled();
                 if (!$this->get('name')) {
                     if (isset($mediafiles[0]['name'])) {
                         $this->set('name', $mediafiles[0]['name']);
                     } else {
                         $this->set('name', pathinfo($uploadedFile['name'], PATHINFO_FILENAME));
                     }
                 }
                 if (!$this->get('description')) {
                     if (isset($mediafiles[0]['description'])) {
                         $this->set('description', $mediafiles[0]['description']);
                     }
                 }
             }
             if (!$directory or !filesystem::is_writable($directory) and !filesystem::createDirectory($directory)) {
                 kohana::log('error', 'The configured media dir is not writable, please chmod "' . $directory . '"');
                 return 'Media collection directory is not writable';
             }
             $this->uploaded_file = $uploadedFile;
             break;
         default:
             return 'Upload failed for an unspecified reason';
     }
     return FALSE;
 }
开发者ID:swk,项目名称:bluebox,代码行数:83,代码来源:MediaFile.php


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