當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。