• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP BxDolStorage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: cleanDatabase

 /**
  * Clean database by deleting some expired data
  */
 protected function cleanDatabase()
 {
     // clean expired membership levels
     bx_import('BxDolAcl');
     $oAcl = BxDolAcl::getInstance();
     $iDeleteMemLevels = $oAcl ? $oAcl->maintenance() : 0;
     //--- Clean sessions ---//
     bx_import('BxDolSession');
     $oSession = BxDolSession::getInstance();
     $iSessions = $oSession ? $oSession->maintenance() : 0;
     // clean old views
     bx_import('BxDolView');
     $iDeletedViews = BxDolView::maintenance();
     // clean storage engine expired private file tokens
     bx_import('BxDolStorage');
     $iDeletedExpiredTokens = BxDolStorage::pruning();
     // clean outdated transcoded images
     bx_import('BxDolImageTranscoder');
     $iDeletedTranscodedImages = BxDolImageTranscoder::pruning();
     // clean expired keys
     bx_import('BxDolKey');
     $oKey = BxDolKey::getInstance();
     $iDeletedKeys = $oKey ? $oKey->prune() : 0;
     // clean old votes
     bx_import('BxDolVote');
     $iDeletedVotes = BxDolVote::maintenance();
     echo _t('_sys_pruning_db', $iDeleteMemLevels, $iSessions, $iDeletedViews, $iDeletedVotes, $iDeletedKeys, $iDeletedExpiredTokens, $iDeletedTranscodedImages);
 }
开发者ID:Baloo7super,项目名称:dolphin,代码行数:31,代码来源:BxDolCronPruning.php


示例2: getFileUrl

 /**
  * Depending on original file mime type call appropriate transcoder 
  */
 public function getFileUrl($mixedHandler)
 {
     $oStorageOriginal = BxDolStorage::getObjectInstance($this->_aObject['source_params']['object']);
     if (!$oStorageOriginal) {
         return false;
     }
     $aFile = $oStorageOriginal->getFile($mixedHandler);
     if (!$aFile) {
         return false;
     }
     $sTranscoder = '';
     if (0 === strncmp($aFile['mime_type'], 'image/', 6) && !empty($this->_aObject['source_params']['image'])) {
         $sTranscoder = $this->_aObject['source_params']['image'];
     } elseif (0 === strncmp($aFile['mime_type'], 'video/', 6) && !empty($this->_aObject['source_params']['video_poster'])) {
         $sTranscoder = $this->_aObject['source_params']['video_poster'];
         // if additional video transcoders provided call it to force video conversion
         if (empty($this->_aObject['source_params']['video'])) {
             continue;
         }
         foreach ($this->_aObject['source_params']['video'] as $sVideoTranscoder) {
             if (!($oTranscoder = BxDolTranscoderImage::getObjectInstance($sVideoTranscoder))) {
                 continue;
             }
             $oTranscoder->getFileUrl($mixedHandler);
         }
     }
     if (!$sTranscoder) {
         return false;
     }
     if (!($oTranscoder = BxDolTranscoderImage::getObjectInstance($sTranscoder))) {
         return false;
     }
     return $oTranscoder->getFileUrl($mixedHandler);
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:37,代码来源:BxDolTranscoderProxy.php


示例3: checkModulesPendingUninstall

 /**
  * Check all pending for uninstallation modules and uninstall them if no pending for deletion files are found
  */
 public static function checkModulesPendingUninstall()
 {
     bx_import('BxDolModuleQuery');
     $a = BxDolModuleQuery::getInstance()->getModules();
     foreach ($a as $aModule) {
         // after we make sure that all pending for deletion files are deleted
         if (!$aModule['pending_uninstall'] || BxDolStorage::isQueuedFilesForDeletion($aModule['name'])) {
             continue;
         }
         // remove pending uninstall flag
         self::setModulePendingUninstall($aModule['uri'], false);
         // perform uninstallation
         bx_import('BxDolStudioInstallerUtils');
         $aResult = BxDolStudioInstallerUtils::getInstance()->perform($aModule['path'], 'uninstall');
         // send email nofitication
         $aTemplateKeys = array('Module' => $aModule['title'], 'Result' => _t('_Success'), 'Message' => '');
         if ($aResult['code'] > 0) {
             $aTemplateKeys['Result'] = _t('_Failed');
             $aTemplateKeys['Message'] = $aResult['message'];
         }
         bx_import('BxDolEmailTemplates');
         $aMessage = BxDolEmailTemplates::getInstance()->parseTemplate('t_DelayedModuleUninstall', $aTemplateKeys);
         sendMail(getParam('site_email'), $aMessage['Subject'], $aMessage['Body'], 0, array(), BX_EMAIL_SYSTEM);
     }
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:28,代码来源:BxDolInstallerUtils.php


示例4: genRowImageUploader

 function genRowImageUploader(&$aInput)
 {
     $aTmplVarsPreview = array('bx_if:show_empty' => array('condition' => true, 'content' => array()), 'bx_if:show_image' => array('condition' => false, 'content' => array()));
     if (($iId = (int) $aInput['value']) != 0) {
         $sFileUrl = false;
         if (!empty($aInput['transcoder_object'])) {
             $oTranscoder = BxDolTranscoderImage::getObjectInstance($aInput['transcoder_object']);
             $sFileUrl = $oTranscoder->getFileUrlNotReady($iId);
             if (isset($aInput['transcoder_image_width']) && $aInput['transcoder_image_width'] > 0) {
                 $sFileUrl = bx_append_url_params($sFileUrl, array('x' => $aInput['transcoder_image_width']));
             }
             if (isset($aInput['transcoder_image_height']) && $aInput['transcoder_image_height'] > 0) {
                 $sFileUrl = bx_append_url_params($sFileUrl, array('y' => $aInput['transcoder_image_height']));
             }
         } else {
             $sStorage = isset($aInput['storage_object']) && $aInput['storage_object'] != '' ? $aInput['storage_object'] : BX_DOL_STORAGE_OBJ_IMAGES;
             $oStorage = BxDolStorage::getObjectInstance($sStorage);
             $sFileUrl = $oStorage->getFileUrlById($iId);
         }
         if ($sFileUrl !== false) {
             $aTmplVarsPreview['bx_if:show_empty']['condition'] = false;
             $aTmplVarsPreview['bx_if:show_image'] = array('condition' => true, 'content' => array('url' => $sFileUrl, 'bx_if:show_action_delete' => array('condition' => isset($aInput['ajax_action_delete']) && $aInput['ajax_action_delete'] != "", 'content' => array('action' => $aInput['ajax_action_delete']))));
         }
     }
     $sRow = '';
     $aInputPreview = array('type' => 'custom', 'name' => 'preview', 'caption' => isset($aInput['caption_preview']) ? $aInput['caption_preview'] : _t('_adm_txt_form_view_iu_preview'), 'content' => $this->oTemplate->parseHtmlByName('form_view_iu_preview.html', $aTmplVarsPreview));
     $sRow .= $this->genRow($aInputPreview);
     $aInput['type'] = 'file';
     $sRow .= $this->genRow($aInput);
     return $sRow;
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:31,代码来源:BxBaseStudioFormView.php


示例5: processing

 public function processing()
 {
     set_time_limit(36000);
     ignore_user_abort();
     if (BxDolStorage::pruneDeletions()) {
         // if any files were deleted
         BxDolInstallerUtils::checkModulesPendingUninstall();
     }
     // try to uninstall modules pending for uninstall
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:10,代码来源:BxDolCronStorage.php


示例6: performActionImport

 public function performActionImport()
 {
     $iAffected = 0;
     $aIds = bx_get('ids');
     if (!$aIds || !is_array($aIds)) {
         $this->_echoResultJson(array());
         exit;
     }
     $aIdsAffected = array();
     foreach ($aIds as $iId) {
         $aItem = array();
         $iItem = $this->oDb->getItems(array('type' => 'by_id', 'value' => (int) $iId), $aItem);
         if ($iItem != 1 || empty($aItem)) {
             continue;
         }
         $mixedIcon = 0;
         if (is_numeric($aItem['icon']) && (int) $aItem['icon'] != 0) {
             bx_import('BxDolStorage');
             $oStorage = BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES);
             if (($mixedIcon = $oStorage->storeFileFromStorage(array('id' => (int) $aItem['icon']), false, 0)) === false) {
                 $this->_echoResultJson(array('msg' => _t('_adm_nav_err_items_icon_copy') . $oStorage->getErrorString()), true);
                 return;
             }
             $oStorage->afterUploadCleanup($mixedIcon, 0);
         }
         $iIdImported = (int) $aItem['id'];
         $sTitleKey = $aItem['title'];
         unset($aItem['id']);
         $aItem['set_name'] = $this->sSet;
         $aItem['module'] = BX_DOL_STUDIO_MODULE_CUSTOM;
         $aItem['title'] .= '_' . time();
         $aItem['icon'] = $mixedIcon != 0 ? $mixedIcon : '';
         $aItem['active'] = 1;
         $aItem['order'] = $this->oDb->getItemOrderMax($this->sSet) + 1;
         if (($iIdAdded = (int) $this->oDb->addItem($aItem)) == 0) {
             continue;
         }
         bx_import('BxDolStudioLanguagesUtils');
         BxDolStudioLanguagesUtils::getInstance()->addLanguageString($aItem['title'], _t($sTitleKey));
         $aIdsImported[] = $iIdImported;
         $aIdsAdded[] = $iIdAdded;
         $iAffected++;
     }
     $aResult = array('msg' => _t('_adm_nav_err_items_import'));
     if ($iAffected) {
         $oGrid = BxDolGrid::getObjectInstance('sys_studio_nav_items');
         if ($oGrid !== false) {
             $aResult = array('parent_grid' => $oGrid->getCode(false), 'parent_blink' => $aIdsAdded, 'disable' => $aIdsImported, 'eval' => $this->getJsObject() . '.onImport(oData)');
         }
     }
     $this->_echoResultJson($aResult);
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:52,代码来源:BxBaseStudioNavigationImport.php


示例7: uninstall

 function uninstall($aParams, $bDisable = false)
 {
     // check if module is already waiting while files are deleting
     bx_import('BxDolInstallerUtils');
     if (BxDolInstallerUtils::isModulePendingUninstall($this->_aConfig['home_uri'])) {
         return array('message' => _t('_adm_err_modules_pending_uninstall_already'), 'result' => false);
     }
     // queue for deletion storage files
     $bSetModulePendingUninstall = false;
     foreach ($this->_aStorages as $s) {
         if (($o = BxDolStorage::getObjectInstance($s)) && $o->queueFilesForDeletionFromObject()) {
             $bSetModulePendingUninstall = true;
         }
     }
     // delete comments and queue for deletion comments attachments
     bx_import('BxDolCmts');
     $iFiles = 0;
     BxDolCmts::onModuleUninstall($this->_aConfig['name'], $iFiles);
     if ($iFiles) {
         $bSetModulePendingUninstall = true;
     }
     // if some files were added to the queue, set module as pending uninstall
     if ($bSetModulePendingUninstall) {
         BxDolInstallerUtils::setModulePendingUninstall($this->_aConfig['home_uri']);
         return array('message' => _t('_adm_err_modules_pending_uninstall'), 'result' => false);
     }
     // delete associated connections
     if ($this->_aConnections) {
         bx_import('BxDolConnection');
         foreach ($this->_aConnections as $sObjectConnections => $a) {
             $o = BxDolConnection::getObjectInstance($sObjectConnections);
             if (!$o) {
                 continue;
             }
             $sFuncSuffix = 'DeleteInitiatorAndContent';
             if (isset($a['conn']) && 'initiator' == $a['conn']) {
                 $sFuncSuffix = 'DeleteInitiator';
             } elseif (isset($a['conn']) && 'content' == $a['conn']) {
                 $sFuncSuffix = 'DeleteContent';
             }
             if (isset($a['type']) && 'profiles' == $a['type']) {
                 $sFunc = 'onModuleProfile' . $sFuncSuffix;
                 $o->{$sFunc}($this->_aConfig['name']);
             } else {
                 $sFunc = 'onModule' . $sFuncSuffix;
                 $o->{$sFunc}($a['table'], $a['field_id']);
             }
         }
     }
     return parent::uninstall($aParams, $bDisable);
 }
开发者ID:Baloo7super,项目名称:dolphin,代码行数:51,代码来源:BxBaseModGeneralInstaller.php


示例8: deleteByItem

 function deleteByItem(&$aItem)
 {
     if (is_numeric($aItem['icon']) && (int) $aItem['icon'] != 0) {
         if (!BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES)->deleteFile((int) $aItem['icon'], 0)) {
             return false;
         }
     }
     if ((int) $this->_delete($aItem['id']) <= 0) {
         return false;
     }
     $oLanguage = BxDolStudioLanguagesUtils::getInstance();
     $oLanguage->deleteLanguageString($aItem['title_system']);
     $oLanguage->deleteLanguageString($aItem['title']);
     return true;
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:15,代码来源:BxDolStudioNavigationItems.php


示例9: metaAdd

 /**
  * Add all available meta tags to the head section 
  * @return number of successfully added metas
  */
 public function metaAdd($iId, $mixedImage = false)
 {
     $i = 0;
     foreach ($this->_aMetas as $sMeta) {
         $sFunc = $sMeta . 'AddMeta';
         $i += $this->{$sFunc}($iId);
     }
     if ($mixedImage && is_array($mixedImage)) {
         bx_import('BxDolStorage');
         $oStorage = BxDolStorage::getObjectInstance($mixedImage['object']);
         $mixedImage = $oStorage ? $oStorage->getFileUrlById($mixedImage['id']) : false;
     }
     if ($mixedImage) {
         BxDolTemplate::getInstance()->addPageMetaImage($mixedImage);
     }
     return $i;
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:21,代码来源:BxDolMetatags.php


示例10: delete

 protected function delete($iId)
 {
     $aLevel = array();
     $iLevel = $this->oDb->getLevels(array('type' => 'by_id', 'value' => (int) $iId), $aLevel);
     if ($iLevel != 1 || empty($aLevel)) {
         return false;
     }
     if ($aLevel['removable'] != 'yes' || $this->oDb->isLevelUsed($aLevel['id'])) {
         return false;
     }
     if (is_numeric($aLevel['icon'])) {
         if (!BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES)->deleteFile((int) $aLevel['icon'], 0)) {
             return false;
         }
     }
     $oLanguage = BxDolStudioLanguagesUtils::getInstance();
     $oLanguage->deleteLanguageString($aLevel['name']);
     $oLanguage->deleteLanguageString($aLevel['description']);
     return $this->oDb->deleteLevel(array('type' => 'by_id', 'value' => $aLevel['id']));
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:20,代码来源:BxDolStudioPermissionsLevels.php


示例11: actionDeleteProfileImg

 public function actionDeleteProfileImg($iFileId, $iContentId, $sFieldPicture)
 {
     $aResult = array();
     $CNF =& $this->_oConfig->CNF;
     $oSrorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
     if (!($aFile = $oSrorage->getFile((int) $iFileId)) || !($aContentInfo = $this->_oDb->getContentInfoById($iContentId)) || $aContentInfo[$sFieldPicture] != (int) $iFileId) {
         $aResult = array('error' => 1, 'msg' => _t('_sys_storage_err_file_not_found'));
     }
     if (!$aResult && !isLogged() || !$aResult && $aFile['profile_id'] != bx_get_logged_profile_id() && !$this->_isModerator()) {
         $aResult = array('error' => 2, 'msg' => _t('_Access denied'));
     }
     $oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $CNF['OBJECT_FORM_ENTRY_DISPLAY_ADD'], $this->_oTemplate);
     if (!$aResult && !$oForm->_deleteFile($iContentId, $sFieldPicture, (int) $iFileId, true)) {
         $aResult = array('error' => 3, 'msg' => _t('_Failed'));
     } elseif (!$aResult) {
         $aResult = array('error' => 0, 'msg' => '');
     }
     header('Content-Type: application/json; charset=utf-8');
     echo json_encode($aResult);
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:20,代码来源:BxBaseModProfileModule.php


示例12: handleUploads

 /**
  * Handle uploads here.
  * @param $mixedFiles as usual $_FILES['some_name'] array, but maybe some other params depending on the uploader
  * @return nothing, but if some files failed to upload, the actual error message can be determined by calling BxDolUploader::getUploadErrorMessages()
  */
 public function handleUploads($iProfileId, $mixedFiles, $isMultiple = true, $iContentId = false, $bPrivate = true)
 {
     $oStorage = BxDolStorage::getObjectInstance($this->_sStorageObject);
     $iProfileId = bx_get_logged_profile_id();
     if (!$isMultiple) {
         $this->cleanupGhostsForProfile($iProfileId, $iContentId);
     }
     if (bx_get('qqfile')) {
         $iId = $oStorage->storeFileFromXhr(bx_get('qqfile'), $bPrivate, $iProfileId, $iContentId);
     } else {
         $iId = $oStorage->storeFileFromForm($_FILES['qqfile'], $bPrivate, $iProfileId, $iContentId);
     }
     if ($iId) {
         $aResponse = array('success' => 1);
     } else {
         $this->appendUploadErrorMessage(_t('_sys_uploader_err_msg', isset($_FILES['qqfile']['name']) ? $_FILES['qqfile']['name'] : bx_get('qqfile'), $oStorage->getErrorString()));
         $aResponse = array('error' => $this->getUploadErrorMessages());
     }
     echo htmlspecialchars(json_encode($aResponse), ENT_NOQUOTES);
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:25,代码来源:BxBaseUploaderHTML5.php


示例13: delete

 function delete($iContentId, $aContentInfo = array())
 {
     $CNF =& $this->_oModule->_oConfig->CNF;
     // delete associated files
     if (!empty($CNF['OBJECT_STORAGE'])) {
         bx_import('BxDolStorage');
         $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
         if ($oStorage) {
             $oStorage->queueFilesForDeletionFromGhosts($aContentInfo[$CNF['FIELD_AUTHOR']], $iContentId);
         }
     }
     // delete associated objects data
     if (!empty($CNF['OBJECT_VIEWS'])) {
         bx_import('BxDolView');
         $o = BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $iContentId);
         if ($o) {
             $o->onObjectDelete();
         }
     }
     if (!empty($CNF['OBJECT_VOTES'])) {
         bx_import('BxDolVote');
         $o = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES'], $iContentId);
         if ($o) {
             $o->onObjectDelete();
         }
     }
     if (!empty($CNF['OBJECT_COMMENTS'])) {
         bx_import('BxDolCmts');
         $o = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS'], $iContentId);
         if ($o) {
             $o->onObjectDelete();
         }
     }
     if (!empty($CNF['OBJECT_METATAGS'])) {
         bx_import('BxDolMetatags');
         $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
         $oMetatags->onDeleteContent($iContentId);
     }
     // delete db record
     return parent::delete($iContentId);
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:41,代码来源:BxBaseModGeneralFormEntry.php


示例14: processImageUploaderSave

 function processImageUploaderSave($sName, $iId = 0)
 {
     if ($this->aInputs[$sName]['type'] != 'image_uploader') {
         return $iId;
     }
     $aInput = $this->aInputs[$sName];
     if (!empty($_FILES[$sName]['tmp_name'])) {
         $iProfileId = getLoggedId();
         $sStorage = isset($aInput['storage_object']) && $aInput['storage_object'] != '' ? $aInput['storage_object'] : BX_DOL_STORAGE_OBJ_IMAGES;
         $oStorage = BxDolStorage::getObjectInstance($sStorage);
         if ((int) $iId != 0 && !$oStorage->deleteFile($iId)) {
             return _t('_adm_err_form_view_iu_delete');
         }
         $iId = $oStorage->storeFileFromForm($_FILES[$aInput['name']], false, $iProfileId);
         if ($iId === false) {
             return _t('_adm_err_form_view_iu_save') . $oStorage->getErrorString();
         }
         $oStorage->afterUploadCleanup($iId, $iProfileId);
     }
     return (int) $iId;
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:21,代码来源:BxDolStudioForm.php


示例15: BxDolStorageHelperStorage

 function BxDolStorageHelperStorage($aParams)
 {
     $this->iFileId = $aParams['id'];
     $this->oStorage = BxDolStorage::getObjectInstance($aParams['storage']);
     $this->aFile = false;
     if ($this->oStorage) {
         $this->aFile = $this->oStorage->getFile($this->iFileId);
     }
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:9,代码来源:BxDolStorage.php


示例16: _getFormObject

 protected function _getFormObject($sAction, $aItem = array())
 {
     $aForm = array('form_attrs' => array('id' => 'adm-nav-item-', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction . '&set=' . $this->sSet, 'method' => BX_DOL_STUDIO_METHOD_DEFAULT, 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'sys_menu_items', 'key' => 'id', 'uri' => '', 'uri_title' => '', 'submit_name' => 'do_submit')), 'inputs' => array('id' => array('type' => 'hidden', 'name' => 'id', 'value' => isset($aItem['id']) ? (int) $aItem['id'] : 0, 'db' => array('pass' => 'Int')), 'set_name' => array('type' => 'hidden', 'name' => 'set_name', 'value' => $this->sSet, 'db' => array('pass' => 'Xss')), 'onclick' => array('type' => 'hidden', 'name' => 'onclick', 'value' => isset($aItem['onclick']) ? $aItem['onclick'] : '', 'db' => array('pass' => 'Xss')), 'title_system' => array('type' => 'text_translatable', 'name' => 'title_system', 'caption' => _t('_adm_nav_txt_items_title_system'), 'info' => _t('_adm_nav_dsc_items_title_system'), 'value' => isset($aItem['title_system']) ? $aItem['title_system'] : '_adm_nav_txt_item', 'required' => '1', 'db' => array('pass' => 'Xss'), 'checker' => array('func' => 'LengthTranslatable', 'params' => array(3, 100, 'title_system'), 'error' => _t('_adm_nav_err_items_title_system'))), 'title' => array('type' => 'text_translatable', 'name' => 'title', 'caption' => _t('_adm_nav_txt_items_title'), 'info' => _t('_adm_nav_dsc_items_title'), 'value' => isset($aItem['title']) ? $aItem['title'] : '_adm_nav_txt_item', 'required' => '0', 'db' => array('pass' => 'Xss')), 'submenu_object' => array('type' => 'select', 'name' => 'submenu_object', 'caption' => _t('_adm_nav_txt_items_submenu'), 'info' => _t('_adm_nav_dsc_items_submenu'), 'value' => isset($aItem['submenu_object']) ? $aItem['submenu_object'] : '', 'values' => array(), 'required' => '0', 'attrs' => array('onChange' => 'javascript:' . $this->getJsObject() . '.onChangeSubmenu(this)'), 'db' => array('pass' => 'Xss')), 'link' => array('type' => 'text', 'name' => 'link', 'caption' => _t('_adm_nav_txt_items_link'), 'info' => _t('_adm_nav_dsc_items_link'), 'value' => isset($aItem['link']) ? $aItem['link'] : '', 'required' => '0', 'db' => array('pass' => 'Xss'), 'checker' => array('func' => '', 'params' => array(), 'error' => _t('_adm_nav_err_items_link'))), 'target' => array('type' => 'select', 'name' => 'target', 'caption' => _t('_adm_nav_txt_items_target'), 'info' => _t('_adm_nav_dsc_items_target'), 'value' => isset($aItem['target']) ? $aItem['target'] : '_self', 'values' => array(array('key' => '', 'value' => _t('_adm_nav_txt_items_target_self')), array('key' => '_blank', 'value' => _t('_adm_nav_txt_items_target_blank'))), 'required' => '0', 'db' => array('pass' => 'Xss')), 'icon' => array('type' => 'text', 'name' => 'icon', 'caption' => _t('_adm_nav_txt_items_icon'), 'info' => _t('_adm_nav_dsc_items_icon'), 'value' => '', 'required' => '0', 'db' => array('pass' => 'Xss'), 'checker' => array('func' => '', 'params' => array(), 'error' => _t('_adm_nav_err_items_icon'))), 'icon_image' => array('type' => 'file', 'name' => 'icon_image', 'caption' => _t('_adm_nav_txt_items_icon_image'), 'info' => _t('_adm_nav_dsc_items_icon_image'), 'value' => '', 'checker' => array('func' => '', 'params' => '', 'error' => _t('_adm_nav_err_items_icon_image'))), 'icon_preview' => array('type' => 'custom', 'name' => 'icon_preview', 'caption' => _t('_adm_nav_txt_items_icon_image_old'), 'content' => ''), 'controls' => array('name' => 'controls', 'type' => 'input_set', array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_adm_nav_btn_items_add')), array('type' => 'reset', 'name' => 'close', 'value' => _t('_adm_nav_btn_items_cancel'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
     $aMenus = array();
     $this->oDb->getMenus(array('type' => 'all'), $aMenus, false);
     foreach ($aMenus as $aMenu) {
         $aForm['inputs']['submenu_object']['values'][$aMenu['object']] = _t($aMenu['title']);
     }
     asort($aForm['inputs']['submenu_object']['values']);
     $aForm['inputs']['submenu_object']['values'] = array_merge(array('' => _t('_adm_nav_txt_items_submenu_empty')), $aForm['inputs']['submenu_object']['values']);
     switch ($sAction) {
         case 'add':
             unset($aForm['inputs']['id']);
             unset($aForm['inputs']['icon_preview']);
             $aForm['form_attrs']['id'] .= 'create';
             break;
         case 'edit':
             unset($aForm['inputs']['set_name']);
             $aForm['form_attrs']['id'] .= 'edit';
             $aForm['inputs']['icon_image']['caption'] = _t('_adm_nav_txt_items_icon_image_new');
             $aForm['inputs']['controls'][0]['value'] = _t('_adm_nav_btn_items_save');
             if (($bSubmenu = !empty($aItem['submenu_object'])) === true) {
                 $aForm['inputs']['link']['tr_attrs']['style'] = 'display:none;';
                 $aForm['inputs']['target']['tr_attrs']['style'] = 'display:none;';
             }
             if (!$bSubmenu && ($aItem['onclick'] != "" || !in_array($aItem['target'], array('', '_blank')))) {
                 $aForm['inputs']['submenu_object']['tr_attrs']['style'] = 'display:none;';
                 $aForm['inputs']['link']['tr_attrs']['style'] = 'display:none;';
                 $aForm['inputs']['target']['tr_attrs']['style'] = 'display:none;';
             }
             $sIconImage = $sIconFont = "";
             if (!empty($aItem['icon'])) {
                 if (is_numeric($aItem['icon']) && (int) $aItem['icon'] != 0) {
                     $oStorage = BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES);
                     $sIconImage = $oStorage->getFileUrlById((int) $aItem['icon']);
                 } else {
                     $sIconFont = $aItem['icon'];
                     $aForm['inputs']['icon']['value'] = $sIconFont;
                 }
             }
             $aForm['inputs']['icon_preview']['content'] = $this->_getIconPreview($aItem['id'], $sIconImage, $sIconFont);
             break;
     }
     return new BxTemplStudioFormView($aForm);
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:45,代码来源:BxBaseStudioNavigationItems.php


示例17: PageCompMainCode

/**
 * page code function
 */
function PageCompMainCode()
{
    ob_start();
    $sTranscoderObjectPoster = 'sample_video_poster';
    $sTranscoderObjectMP4 = 'sample_video_mp4';
    $sTranscoderObjectWebM = 'sample_video_webm';
    $sStorageObjectOrig = 'sample_transcoder_video_orig';
    $iProfileId = bx_get_logged_profile_id();
    if (!$iProfileId) {
        echo "You aren't logged in.";
        exit;
    }
    $iPrunedFiles = BxDolTranscoder::pruning();
    if ($iPrunedFiles) {
        echo "iPrunedFiles: {$iPrunedFiles}";
        exit;
    }
    $oTranscoderPoster = BxDolTranscoderVideo::getObjectInstance($sTranscoderObjectPoster);
    $oTranscoderMP4 = BxDolTranscoderVideo::getObjectInstance($sTranscoderObjectMP4);
    $oTranscoderWebM = BxDolTranscoderVideo::getObjectInstance($sTranscoderObjectWebM);
    if (!$oTranscoderPoster || !$oTranscoderMP4 || !$oTranscoderWebM) {
        echo "Transcoder object is not available: " . $sTranscoderObjectPoster . ', ' . $sTranscoderObjectMP4 . ', ' . $sTranscoderObjectWebM;
        exit;
    }
    echo "registerHandlers poster: [" . $oTranscoderPoster->registerHandlers() . "] <br />\n";
    echo "registerHandlers mp4: [" . $oTranscoderMP4->registerHandlers() . "] <br />\n";
    echo "registerHandlers webm: [" . $oTranscoderWebM->registerHandlers() . "] <hr class='bx-def-hr' />\n";
    $oStorageOrig = BxDolStorage::getObjectInstance($sStorageObjectOrig);
    if (!$oStorageOrig) {
        echo "Storage object is not available: " . $sStorageObjectOrig;
        exit;
    }
    if (isset($_POST['upload'])) {
        $iId = $oStorageOrig->storeFileFromForm($_FILES['file'], true, $iProfileId);
        if ($iId) {
            $iCount = $oStorageOrig->afterUploadCleanup($iId, $iProfileId);
            echo "<h2>Uploaded file id: " . $iId . "(deleted ghosts:" . $iCount . ") </h2>";
            // force transcode
            echo "Force transcode: <br />";
            echo "poster: " . $oTranscoderPoster->getFileUrl($iId) . '<br />';
            echo "mp4: " . $oTranscoderMP4->getFileUrl($iId) . '<br />';
            echo "webm: " . $oTranscoderWebM->getFileUrl($iId) . '<hr class="bx-def-hr" />';
        } else {
            echo "<h2>Error uploading file: " . $oStorage->getErrorString() . '</h2><hr class="bx-def-hr" />';
        }
    } elseif (isset($_POST['delete'])) {
        foreach ($_POST['file_id'] as $iFileId) {
            $bRet = $oStorageOrig->deleteFile($iFileId, $iProfileId);
            if ($bRet) {
                echo "<h2>Deleted file id: " . $iFileId . '</h2><hr class="bx-def-hr" />';
            } else {
                echo "<h2>File deleting error: " . $oStorageOrig->getErrorString() . '</h2><hr class="bx-def-hr" />';
            }
        }
    } else {
        $a = $oStorageOrig->getFilesAll();
        foreach ($a as $r) {
            $sUrlPoster = $oTranscoderPoster->getFileUrl($r['id']);
            $sUrlMP4 = $oTranscoderMP4->getFileUrl($r['id']);
            $sUrlWebM = $oTranscoderWebM->getFileUrl($r['id']);
            echo '<h3>' . $r['file_name'] . '</h3>';
            echo BxTemplFunctions::getInstance()->videoPlayer($sUrlPoster, $sUrlMP4, $sUrlWebM, false, 'height:200px;');
            echo '<hr class="bx-def-hr" />';
        }
    }
    $a = $oStorageOrig->getFilesAll();
    ?>
    <h2>Files List</h2>
    <form method="POST">
        <?php 
    foreach ($a as $r) {
        ?>
            <input type="checkbox" name="file_id[]" value="<?php 
        echo $r['id'];
        ?>
" />
            <?php 
        echo $r['file_name'];
        ?>
            <br />
        <?php 
    }
    ?>
        <input type="submit" name="delete" value="Delete" class="bx-btn bx-btn-small bx-def-margin-sec-top" style="float:none;" />
    </form>
    <hr class="bx-def-hr" /> 


    <h2>Upload</h2>
    <form enctype="multipart/form-data" method="POST">
        <input type="file" name="file" />
        <br />
        <input type="submit" name="upload" value="Upload" class="bx-btn bx-btn-small bx-def-margin-sec-top" style="float:none;" />
    </form>
<?php 
    $s = ob_get_clean();
    return DesignBoxContent("Sample video transcoder", $s, BX_DB_PADDING_DEF);
//.........这里部分代码省略.........
开发者ID:blas-dmx,项目名称:trident,代码行数:101,代码来源:transcoder_video.php


示例18: actionProcessStorages

 /**
  * 
  * Storage objects to automatically delete files from upon module uninstallation.
  * Note. Don't add storage objects used in transcoder objects.
  * @param string $sOperation - operation type.
  */
 protected function actionProcessStorages($sOperation)
 {
     if (empty($this->_aConfig['storages'])) {
         return BX_DOL_STUDIO_INSTALLER_FAILED;
     }
     // check if module is already waiting while files are deleting
     if (self::isModulePendingUninstall($this->_aConfig['home_uri'])) {
         return array('code' => BX_DOL_STUDIO_INSTALLER_FAILED, 'content' => _t('_adm_err_modules_pending_uninstall_already'));
     }
     $bSetModulePendingUninstall = false;
     // queue for deletion storage files
     foreach ($this->_aConfig['storages'] as $s) {
         if (($o = BxDolStorage::getObjectInstance($s)) && $o->queueFilesForDeletionFromObject()) {
             $bSetModulePendingUninstall = true;
         }
     }
     // delete comments and queue for deletion comments attachments
     $iFiles = 0;
     BxDolCmts::onModuleUninstall($this->_aConfig['name'], $iFiles);
     if ($iFiles) {
         $bSetModulePendingUninstall = true;
     }
     // if some files were added to the queue, set module as pending uninstall
     if ($bSetModulePendingUninstall) {
         self::setModulePendingUninstall($this->_aConfig['home_uri']);
         return array('code' => BX_DOL_STUDIO_INSTALLER_FAILED, 'content' => _t('_adm_err_modules_pending_uninstall'));
     }
     return BX_DOL_STUDIO_INSTALLER_SUCCESS;
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:35,代码来源:BxDolStudioInstaller.php


示例19: entryAttachments

 function entryAttachments($aData)
 {
     $oModule = BxDolModule::getInstance($this->MODULE);
     $CNF =& $oModule->_oConfig->CNF;
     bx_import('BxTemplFunctions');
     bx_import('BxDolStorage');
     bx_import('BxDolTranscoderImage');
     $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
     $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW']);
     $aTranscodersVideo = false;
     if ($CNF['OBJECT_VIDEOS_TRANSCODERS']) {
         $aTranscodersVideo = array('poster' => BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['poster']), 'mp4' => BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['mp4']), 'webm' => BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['webm']));
     }
     $aGhostFiles = $oStorage->getGhosts($aData[$CNF['FIELD_AUTHOR']], $aData[$CNF['FIELD_ID']]);
     if (!$aGhostFiles) {
         return false;
     }
     foreach ($aGhostFiles as $k => $a) {
         $isImage = $oTranscoder && 0 == strncmp('image/', $a['mime_type'], 6);
         // preview for images, transcoder object for preview must be defined
         $isVideo = $aTranscodersVideo && 0 == strncmp('video/', $a['mime_type'], 6);
         // preview for videos, transcoder object for video must be defined
         $sUrlOriginal = $oStorage->getFileUrlById($a['id']);
         $sImgPopupId = 'bx-messages-atachment-popup-' . $a['id'];
         // images are displayed with preview and popup upon clicking
         $aGhostFiles[$k]['bx_if:image'] = array('condition' => $isImage, 'content' => array('url_original' => $sUrlOriginal, 'attr_file_name' => bx_html_attribute($a['file_name']), 'popup_id' => $sImgPopupId, 'url_preview' => $oTranscoder->getFileUrl($a['id']), 'popup' => BxTemplFunctions::getInstance()->transBox($sImgPopupId, '<img src="' . $sUrlOriginal . '" />', true, true)));
         // videos are displayed inline
         $aGhostFiles[$k]['bx_if:video'] = array('condition' => $isVideo, 'content' => array('video' => $aTranscodersVideo ? BxTemplFunctions::getInstance()->videoPlayer($aTranscodersVideo['poster']->getFileUrl($a['id']), $aTranscodersVideo['mp4']->getFileUrl($a['id']), $aTranscodersVideo['webm']->getFileUrl($a['id']), false, '') : ''));
         // non-images are displayed as text links to original file
         $aGhostFiles[$k]['bx_if:not_image'] = array('condition' => !$isImage && !$isVideo, 'content' => array('url_original' => $sUrlOriginal, 'attr_file_name' => bx_html_attribute($a['file_name']), 'file_name' => bx_process_output($a['file_name'])));
     }
     $aVars = array('bx_repeat:attachments' => $aGhostFiles);
     return $this->parseHtmlByName('attachments.html', $aVars);
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:34,代码来源:BxBaseModTextTemplate.php


示例20: getOrigFileUrl_Storage

 protected function getOrigFileUrl_Storage($mixedHandler)
 {
     $oStorageOriginal = BxDolStorage::getObjectInstance($this->_aObject['source_params']['object']);
     if (!$oStorageOriginal) {
         return false;
     }
     return $oStorageOriginal->getFileUrlById($mixedHandler);
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:8,代码来源:BxDolTranscoder.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP BxDolStudioTemplate类代码示例发布时间:2022-05-23
下一篇:
PHP BxDolService类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap