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


PHP object::addFile方法代码示例

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


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

示例1: handle

 /**
  * This method determines what should be done with a given file and adds
  * it via {@link GroupTest::addTestFile()} if necessary.
  *
  * This method should be overriden to provide custom matching criteria,
  * such as pattern matching, recursive matching, etc.  For an example, see
  * {@link SimplePatternCollector::_handle()}.
  *
  * @param object $test      Group test with {@link GroupTest::addTestFile()} method.
  * @param string $filename  A filename as generated by {@link collect()}
  * @see collect()
  * @access protected
  */
 protected function handle(&$test, $file)
 {
     if (is_dir($file)) {
         return;
     }
     $test->addFile($file);
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:20,代码来源:collector.php

示例2: getDisplay

 /**
  * Generates the header
  *
  * @return string The header
  */
 public function getDisplay()
 {
     $retval = '';
     if (!$this->_headerIsSent) {
         if (!$this->_isAjax && $this->_isEnabled) {
             $this->sendHttpHeaders();
             $retval .= $this->_getHtmlStart();
             $retval .= $this->_getMetaTags();
             $retval .= $this->_getLinkTags();
             $retval .= $this->getTitleTag();
             // The user preferences have been merged at this point
             // so we can conditionally add CodeMirror
             if ($GLOBALS['cfg']['CodemirrorEnable']) {
                 $this->_scripts->addFile('codemirror/lib/codemirror.js');
                 $this->_scripts->addFile('codemirror/mode/sql/sql.js');
                 $this->_scripts->addFile('codemirror/addon/runmode/runmode.js');
             }
             if ($this->_userprefsOfferImport) {
                 $this->_scripts->addFile('config.js');
             }
             $retval .= $this->_scripts->getDisplay();
             $retval .= $this->_getBodyStart();
             if ($this->_menuEnabled && $GLOBALS['server'] > 0) {
                 $nav = new PMA_Navigation();
                 $retval .= $nav->getDisplay();
             }
             // Include possible custom headers
             if (file_exists(CUSTOM_HEADER_FILE)) {
                 $retval .= '<div id="pma_header">';
                 ob_start();
                 include CUSTOM_HEADER_FILE;
                 $retval .= ob_get_contents();
                 ob_end_clean();
                 $retval .= '</div>';
             }
             // offer to load user preferences from localStorage
             if ($this->_userprefsOfferImport) {
                 include_once './libraries/user_preferences.lib.php';
                 $retval .= PMA_userprefsAutoloadGetHeader();
             }
             // pass configuration for hint tooltip display
             // (to be used by PMA_tooltip() in js/functions.js)
             if (!$GLOBALS['cfg']['ShowHint']) {
                 $retval .= '<span id="no_hint" class="hide"></span>';
             }
             $retval .= $this->_getWarnings();
             if ($this->_menuEnabled && $GLOBALS['server'] > 0) {
                 $retval .= $this->_menu->getDisplay();
                 $retval .= sprintf('<a id="goto_pagetop" href="#" title="%s">%s</a>', __('Click on the bar to scroll to top of page'), PMA_Util::getImage('s_top.png'));
             }
             $retval .= '<div id="page_content">';
             $retval .= $this->getMessage();
         }
         if ($this->_isEnabled && empty($_REQUEST['recent_table'])) {
             $retval .= $this->_addRecentTable($GLOBALS['db'], $GLOBALS['table']);
         }
     }
     return $retval;
 }
开发者ID:lcylp,项目名称:wamp,代码行数:64,代码来源:Header.class.php

示例3: compress

 /**
  * Compress data into the archive
  *
  * @param string $sFile Name of the ZIP file
  * @param string $sFolder Name of the folder we are going to compress. Must be located within the "file/cache/" folder.
  * @return mixed Returns the full path to the newly created ZIP file.
  */
 public function compress($sFile, $sFolder)
 {
     // Create random ZIP
     $sArchive = PHPFOX_DIR_CACHE . md5((is_array($sFile) ? serialize($sFile) : $sFile) . Phpfox::getParam('core.salt') . PHPFOX_TIME) . '.zip';
     chdir(PHPFOX_DIR_CACHE . $sFolder . PHPFOX_DS);
     if (is_object($this->_oZip)) {
         if ($this->_oZip->open($sArchive, ZipArchive::CREATE)) {
             $aFiles = Phpfox::getLib('file')->getAllFiles(PHPFOX_DIR_CACHE . $sFolder . PHPFOX_DS);
             foreach ($aFiles as $sNewFile) {
                 $sNewFile = str_replace(PHPFOX_DIR_CACHE . $sFolder . PHPFOX_DS, '', $sNewFile);
                 $this->_oZip->addFile($sNewFile);
             }
             $this->_oZip->close();
         }
     } else {
         shell_exec(Phpfox::getParam('core.zip_path') . ' -r ' . escapeshellarg($sArchive) . ' ./');
     }
     chdir(PHPFOX_DIR);
     return $sArchive;
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:27,代码来源:zip.class.php

示例4: test1CheckMimes

 /**
  * Test check mimes
  *
  * @param array $file - list of file data
  * @param array $mimes - list of allowed MIME-types
  *
  * @dataProvider providerCheckMimes
  *
  * @return void
  */
 public function test1CheckMimes($file, $mimes)
 {
     $this->uploader->addFile($file);
     $this->uploader->setMimes($mimes);
     $this->callMethod($this->uploader, 'checkMimes');
     $this->assertCount(0, $this->uploader->getErrors());
     $file['type'] = 'image/gif';
     $this->uploader->addFile($file);
     $this->callMethod($this->uploader, 'checkMimes');
     $this->assertCount(1, $this->uploader->getErrors());
 }
开发者ID:ieternal,项目名称:uploader,代码行数:21,代码来源:UploaderTest.php

示例5: addFile

 /**
  * Add file to zip archive
  * 
  * @param 	string 	$file       File to add to archive
  * @param 	string 	$location   Location in archive
  * 
  * @return  void
  */
 public function addFile($file, $location = null)
 {
     if (!file_exists($file)) {
         return;
     }
     if (is_dir($file)) {
         return $this->addDir($file, $location);
     }
     if (substr($location, -1) != DIRECTORY_SEPARATOR) {
         $location .= DIRECTORY_SEPARATOR;
     }
     if (!@$this->zip->addFile($file, $location . pathinfo($file, PATHINFO_BASENAME)) === true) {
         throw new \Exception("Could not add {$file} to archive", 3);
     }
 }
开发者ID:barry127,项目名称:zippr,代码行数:23,代码来源:Zippr.php

示例6: saveFile

 public function saveFile(Form $addForm)
 {
     $params = $this->getRequest()->getParams();
     $values = $addForm->getValues();
     $id = $params['id'];
     try {
         if ($this->gallery->addFile($id, $values['file_id'])) {
             $this->flashMessage('Image added into the gallery.', 'ok');
         } else {
             $this->flashMessage('Image is already in gallery.');
         }
     } catch (DibiException $e) {
         $this->flashMessage('Error' . $e, 'err');
     }
     $this->redirect('this');
 }
开发者ID:soundake,项目名称:pd,代码行数:16,代码来源:GalleriesPresenter.php

示例7: addItem

 /**
  * Add item to zip archive
  *
  * @param   string $file       File to add (realpath)
  * @param   bool   $flatroot   (optional) If true, source directory will be not included
  * @param   string $base       (optional) Base to record in zip file
  * 
  * @throws  \Comodojo\Exception\ZipException
  */
 private function addItem($file, $flatroot = false, $base = null)
 {
     $file = is_null($this->path) ? $file : $this->path . $file;
     $real_file = str_replace('\\', '/', realpath($file));
     $real_name = basename($real_file);
     if (!is_null($base)) {
         if ($real_name[0] == "." and in_array($this->skip_mode, array("HIDDEN", "ALL"))) {
             return;
         }
         if ($real_name[0] == "." and @$real_name[1] == "_" and in_array($this->skip_mode, array("COMODOJO", "ALL"))) {
             return;
         }
     }
     if (is_dir($real_file)) {
         if (!$flatroot) {
             $folder_target = is_null($base) ? $real_name : $base . $real_name;
             $new_folder = $this->zip_archive->addEmptyDir($folder_target);
             if ($new_folder === false) {
                 throw new ZipException(self::getStatus($this->zip_archive->status));
             }
         } else {
             $folder_target = null;
         }
         foreach (new \DirectoryIterator($real_file) as $path) {
             if ($path->isDot()) {
                 continue;
             }
             $file_real = $path->getPathname();
             $base = is_null($folder_target) ? null : $folder_target . "/";
             try {
                 $this->addItem($file_real, false, $base);
             } catch (ZipException $ze) {
                 throw $ze;
             }
         }
     } else {
         if (is_file($real_file)) {
             $file_target = is_null($base) ? $real_name : $base . $real_name;
             $add_file = $this->zip_archive->addFile($real_file, $file_target);
             if ($add_file === false) {
                 throw new ZipException(self::getStatus($this->zip_archive->status));
             }
         } else {
             return;
         }
     }
 }
开发者ID:falconchen,项目名称:JianshuDaily,代码行数:56,代码来源:Zip.php

示例8: getDisplay

 /**
  * Generates the header
  *
  * @return string The header
  */
 public function getDisplay()
 {
     $retval = '';
     if (!$this->_headerIsSent) {
         if (!$this->_isAjax && $this->_isEnabled) {
             $this->sendHttpHeaders();
             $retval .= $this->_getHtmlStart();
             $retval .= $this->_getMetaTags();
             $retval .= $this->_getLinkTags();
             $retval .= $this->_getTitleTag();
             $title = PMA_sanitize(PMA_escapeJsString($this->_getPageTitle()), false, true);
             $this->_scripts->addCode("if (typeof(parent.document) != 'undefined'" . " && typeof(parent.document) != 'unknown'" . " && typeof(parent.document.title) == 'string')" . "{" . "parent.document.title = '{$title}'" . "}");
             if ($this->_userprefsOfferImport) {
                 $this->_scripts->addFile('config.js');
             }
             $retval .= $this->_scripts->getDisplay();
             $retval .= $this->_getBodyStart();
             // Include possible custom headers
             if (file_exists(CUSTOM_HEADER_FILE)) {
                 ob_start();
                 include CUSTOM_HEADER_FILE;
                 $retval .= ob_get_contents();
                 ob_end_clean();
             }
             // offer to load user preferences from localStorage
             if ($this->_userprefsOfferImport) {
                 include_once './libraries/user_preferences.lib.php';
                 $retval .= PMA_userprefsAutoloadGetHeader();
             }
             // pass configuration for hint tooltip display
             // (to be used by PMA_createqTip in js/functions.js)
             if (!$GLOBALS['cfg']['ShowHint']) {
                 $retval .= '<span id="no_hint" class="hide"></span>';
             }
             $retval .= $this->_getWarnings();
             if ($this->_menuEnabled && $GLOBALS['server'] > 0) {
                 $retval .= $this->_menu->getDisplay();
             }
             $retval .= $this->_addRecentTable($GLOBALS['db'], $GLOBALS['table']);
         }
     }
     return $retval;
 }
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:48,代码来源:Header.class.php

示例9: copyInto

 /**
  * Sets contents of passed object to values from current object.
  *
  * If desired, this method can also make copies of all associated (fkey referrers)
  * objects.
  *
  * @param      object $copyObj An object of \Models\Note (or compatible) type.
  * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  * @param      boolean $makeNew Whether to reset autoincrement PKs and make the object new.
  * @throws PropelException
  */
 public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
 {
     $copyObj->setUserId($this->getUserId());
     $copyObj->setImportance($this->getImportance());
     $copyObj->setTitle($this->getTitle());
     $copyObj->setDeadline($this->getDeadline());
     $copyObj->setCategoryId($this->getCategoryId());
     $copyObj->setState($this->getState());
     $copyObj->setRepeatAfter($this->getRepeatAfter());
     $copyObj->setDoneAt($this->getDoneAt());
     $copyObj->setPublic($this->getPublic());
     $copyObj->setDescription($this->getDescription());
     $copyObj->setCreatedAt($this->getCreatedAt());
     $copyObj->setUpdatedAt($this->getUpdatedAt());
     if ($deepCopy) {
         // important: temporarily setNew(false) because this affects the behavior of
         // the getter/setter methods for fkey referrer objects.
         $copyObj->setNew(false);
         foreach ($this->getSubNotes() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addSubNote($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getFiles() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addFile($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getNotifications() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addNotification($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getComments() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addComment($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getShareds() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addShared($relObj->copy($deepCopy));
             }
         }
     }
     // if ($deepCopy)
     if ($makeNew) {
         $copyObj->setNew(true);
         $copyObj->setId(NULL);
         // this is a auto-increment column, so set to default value
     }
 }
开发者ID:OneTimeCZ,项目名称:Tasker,代码行数:67,代码来源:Note.php

示例10: lfInitUploadFile

 /**
  * アップロードファイルパラメーター初期化.
  *
  * @param object $objUpFile SC_UploadFileのインスタンス.
  * @return void
  */
 function lfInitUploadFile(&$objUpFile)
 {
     $objUpFile->addFile("プラグイン", 'plugin_file', array('tar', 'tar.gz'), TEMPLATE_SIZE, true, 0, 0, false);
 }
开发者ID:nanasess,项目名称:ec-azure,代码行数:10,代码来源:LC_Page_Admin_System_Plugin.php

示例11: copyInto

 /**
  * Sets contents of passed object to values from current object.
  *
  * If desired, this method can also make copies of all associated (fkey referrers)
  * objects.
  *
  * @param      object $copyObj An object of sfGuardUser (or compatible) type.
  * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  * @param      boolean $makeNew Whether to reset autoincrement PKs and make the object new.
  * @throws     PropelException
  */
 public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
 {
     $copyObj->setUsername($this->getUsername());
     $copyObj->setAlgorithm($this->getAlgorithm());
     $copyObj->setSalt($this->getSalt());
     $copyObj->setPassword($this->getPassword());
     $copyObj->setCreatedAt($this->getCreatedAt());
     $copyObj->setLastLogin($this->getLastLogin());
     $copyObj->setIsActive($this->getIsActive());
     $copyObj->setIsSuperAdmin($this->getIsSuperAdmin());
     if ($deepCopy) {
         // important: temporarily setNew(false) because this affects the behavior of
         // the getter/setter methods for fkey referrer objects.
         $copyObj->setNew(false);
         foreach ($this->getBranchs() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addBranch($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getCommentsRelatedByUserId() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addCommentRelatedByUserId($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getCommentsRelatedByCheckUserId() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addCommentRelatedByCheckUserId($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getFiles() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addFile($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getProfiles() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addProfile($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getStatusActions() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addStatusAction($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getsfGuardUserPermissions() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addsfGuardUserPermission($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getsfGuardUserGroups() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addsfGuardUserGroup($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getsfGuardRememberKeys() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addsfGuardRememberKey($relObj->copy($deepCopy));
             }
         }
     }
     // if ($deepCopy)
     if ($makeNew) {
         $copyObj->setNew(true);
         $copyObj->setId(NULL);
         // this is a auto-increment column, so set to default value
     }
 }
开发者ID:ratibus,项目名称:Crew,代码行数:87,代码来源:BasesfGuardUser.php

示例12: copyInto

 /**
  * Sets contents of passed object to values from current object.
  *
  * If desired, this method can also make copies of all associated (fkey referrers)
  * objects.
  *
  * @param      object $copyObj An object of Track (or compatible) type.
  * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  * @throws     PropelException
  */
 public function copyInto($copyObj, $deepCopy = false)
 {
     $copyObj->setFingerprint($this->fingerprint);
     $copyObj->setInserted($this->inserted);
     $copyObj->setUpdated($this->updated);
     $copyObj->setMbid($this->mbid);
     if ($deepCopy) {
         // important: temporarily setNew(false) because this affects the behavior of
         // the getter/setter methods for fkey referrer objects.
         $copyObj->setNew(false);
         foreach ($this->getFeaturevectors() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addFeaturevector($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getFiles() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addFile($relObj->copy($deepCopy));
             }
         }
     }
     // if ($deepCopy)
     $copyObj->setNew(true);
     $copyObj->setId(NULL);
     // this is a auto-increment column, so set to default value
 }
开发者ID:EQ4,项目名称:smint,代码行数:38,代码来源:BaseTrack.php

示例13: lfInitDownFile

 /**
  * アップロードファイルパラメーター情報の初期化
  * - ダウンロード商品ファイル用
  *
  * @param object $objDownFile SC_UploadFileインスタンス
  * @return void
  */
 function lfInitDownFile(&$objDownFile)
 {
     $objDownFile->addFile(t('c_File for download sales_01'), 'down_file', explode(',', DOWNLOAD_EXTENSION), DOWN_SIZE, true, 0, 0);
 }
开发者ID:Rise-Up-Cambodia,项目名称:Rise-Up,代码行数:11,代码来源:LC_Page_Admin_Products_Product.php

示例14: lfInitFile

 /**
  * アップロードファイルパラメーター情報の初期化
  * - 画像ファイル用
  *
  * @param object $objUpFile SC_UploadFileインスタンス
  * @return void
  */
 function lfInitFile(&$objUpFile)
 {
     $objUpFile->addFile('一覧-メイン画像', 'main_list_image', array('jpg', 'gif', 'png'), IMAGE_SIZE, false, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
     $objUpFile->addFile('詳細-メイン画像', 'main_image', array('jpg', 'gif', 'png'), IMAGE_SIZE, false, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT);
     $objUpFile->addFile('詳細-メイン拡大画像', 'main_large_image', array('jpg', 'gif', 'png'), IMAGE_SIZE, false, LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT);
     for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
         $objUpFile->addFile("詳細-サブ画像{$cnt}", "sub_image{$cnt}", array('jpg', 'gif', 'png'), IMAGE_SIZE, false, NORMAL_SUBIMAGE_WIDTH, NORMAL_SUBIMAGE_HEIGHT);
         $objUpFile->addFile("詳細-サブ拡大画像{$cnt}", "sub_large_image{$cnt}", array('jpg', 'gif', 'png'), IMAGE_SIZE, false, LARGE_SUBIMAGE_WIDTH, LARGE_SUBIMAGE_HEIGHT);
     }
 }
开发者ID:rocky-ice-cream,项目名称:003_eccube_test,代码行数:17,代码来源:plg_AddProduct_AddProduct.php

示例15: Zip

 /**
  * zip the directory
  * @param string $dir
  * @param object $zip 
  * @return mixed
  */
 private function Zip($dir, &$zip)
 {
     $cnt = 0;
     $pos = mb_strlen($dir) + 1;
     // remove part of the path
     $itr = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD);
     foreach ($itr as $fle => $spl) {
         if ($spl->isFile()) {
             $nme = str_replace(self::DS, '/', substr($fle, $pos));
             // normalize localname
             if ($zip->addFile($fle, $nme)) {
                 // add a file
                 $cnt++;
             } else {
                 $cnt = $fle;
                 // couldn't add the file
                 break;
             }
         }
     }
     return $cnt;
 }
开发者ID:hareko,项目名称:php-application-packer,代码行数:28,代码来源:PackApp.php


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