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


PHP kString::stripUtf8InvalidChars方法代码示例

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


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

示例1: watchFolder

 public function watchFolder(KalturaDropFolder $folder)
 {
     $this->dropFolder = $folder;
     $this->fileTransferMgr = self::getFileTransferManager($this->dropFolder);
     KalturaLog::info('Watching folder [' . $this->dropFolder->id . ']');
     $physicalFiles = $this->getDropFolderFilesFromPhysicalFolder();
     if (count($physicalFiles) > 0) {
         $dropFolderFilesMap = $this->loadDropFolderFiles();
     } else {
         $dropFolderFilesMap = array();
     }
     $maxModificationTime = 0;
     foreach ($physicalFiles as &$physicalFile) {
         /* @var $physicalFile FileObject */
         $physicalFileName = $physicalFile->filename;
         $utfFileName = kString::stripUtf8InvalidChars($physicalFileName);
         if ($physicalFileName != $utfFileName) {
             KalturaLog::info("File name [{$physicalFileName}] is not utf-8 compatible, Skipping file...");
             continue;
         }
         if (!kXml::isXMLValidContent($utfFileName)) {
             KalturaLog::info("File name [{$physicalFileName}] contains invalid XML characters, Skipping file...");
             continue;
         }
         if ($this->dropFolder->incremental && $physicalFile->modificationTime < $this->dropFolder->lastFileTimestamp) {
             KalturaLog::info("File modification time [" . $physicalFile->modificationTime . "] predates drop folder last timestamp [" . $this->dropFolder->lastFileTimestamp . "]. Skipping.");
             if (isset($dropFolderFilesMap[$physicalFileName])) {
                 unset($dropFolderFilesMap[$physicalFileName]);
             }
             continue;
         }
         if ($this->validatePhysicalFile($physicalFileName)) {
             $maxModificationTime = $physicalFile->modificationTime > $maxModificationTime ? $physicalFile->modificationTime : $maxModificationTime;
             KalturaLog::info('Watch file [' . $physicalFileName . ']');
             if (!array_key_exists($physicalFileName, $dropFolderFilesMap)) {
                 try {
                     $lastModificationTime = $physicalFile->modificationTime;
                     $fileSize = $physicalFile->fileSize;
                     $this->handleFileAdded($physicalFileName, $fileSize, $lastModificationTime);
                 } catch (Exception $e) {
                     KalturaLog::err("Error handling drop folder file [{$physicalFileName}] " . $e->getMessage());
                 }
             } else {
                 $dropFolderFile = $dropFolderFilesMap[$physicalFileName];
                 //if file exist in the folder remove it from the map
                 //all the files that are left in a map will be marked as PURGED
                 unset($dropFolderFilesMap[$physicalFileName]);
                 $this->handleExistingDropFolderFile($dropFolderFile);
             }
         }
     }
     foreach ($dropFolderFilesMap as $dropFolderFile) {
         $this->handleFilePurged($dropFolderFile->id);
     }
     if ($this->dropFolder->incremental && $maxModificationTime > $this->dropFolder->lastFileTimestamp) {
         $updateDropFolder = new KalturaDropFolder();
         $updateDropFolder->lastFileTimestamp = $maxModificationTime;
         $this->dropFolderPlugin->dropFolder->update($this->dropFolder->id, $updateDropFolder);
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:60,代码来源:KDropFolderFileTransferEngine.php

示例2: parseAction

 /**
  * Parse content of caption asset and index it
  *
  * @action parse
  * @param string $captionAssetId
  * @throws KalturaCaptionErrors::CAPTION_ASSET_ID_NOT_FOUND
  */
 function parseAction($captionAssetId)
 {
     $captionAsset = assetPeer::retrieveById($captionAssetId);
     if (!$captionAsset) {
         throw new KalturaAPIException(KalturaCaptionErrors::CAPTION_ASSET_ID_NOT_FOUND, $captionAssetId);
     }
     $captionAssetItems = CaptionAssetItemPeer::retrieveByAssetId($captionAssetId);
     foreach ($captionAssetItems as $captionAssetItem) {
         /* @var $captionAssetItem CaptionAssetItem */
         $captionAssetItem->delete();
     }
     // make sure that all old items are deleted from the sphinx before creating the new ones
     kEventsManager::flushEvents();
     $syncKey = $captionAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $content = kFileSyncUtils::file_get_contents($syncKey, true, false);
     if (!$content) {
         return;
     }
     $captionsContentManager = kCaptionsContentManager::getCoreContentManager($captionAsset->getContainerFormat());
     if (!$captionsContentManager) {
         return;
     }
     $itemsData = $captionsContentManager->parse($content);
     foreach ($itemsData as $itemData) {
         $item = new CaptionAssetItem();
         $item->setCaptionAssetId($captionAsset->getId());
         $item->setEntryId($captionAsset->getEntryId());
         $item->setPartnerId($captionAsset->getPartnerId());
         $item->setStartTime($itemData['startTime']);
         $item->setEndTime($itemData['endTime']);
         $content = '';
         foreach ($itemData['content'] as $curChunk) {
             $content .= $curChunk['text'];
         }
         //Make sure there are no invalid chars in the caption asset items to avoid braking the search request by providing invalid XML
         $content = kString::stripUtf8InvalidChars($content);
         $content = kXml::stripXMLInvalidChars($content);
         $item->setContent($content);
         $item->save();
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:48,代码来源:CaptionAssetItemService.php

示例3: getServiceActionElement

 private function getServiceActionElement(KalturaActionReflector $actionReflector)
 {
     $outputTypeReflector = $actionReflector->getActionOutputType();
     $actionInfo = $actionReflector->getActionInfo();
     $actionParams = $actionReflector->getActionParams();
     $outputType = null;
     if ($outputTypeReflector) {
         $outputType = $outputTypeReflector->getType();
     }
     $actionElement = $this->_doc->createElement("action");
     $actionElement->setAttribute("name", $actionReflector->getActionName());
     foreach ($actionParams as $actionParam) {
         /* @var $actionParam KalturaParamInfo */
         $actionParamElement = $this->_doc->createElement("param");
         $actionParamElement->setAttribute("name", $actionParam->getName());
         if ($actionParam->isAssociativeArray()) {
             $actionParamElement->setAttribute("type", "map");
             $actionParamElement->setAttribute("arrayType", $actionParam->getArrayType());
         } elseif ($actionParam->isArray()) {
             $actionParamElement->setAttribute("type", "array");
             $actionParamElement->setAttribute("arrayType", $actionParam->getArrayType());
         } elseif ($actionParam->isEnum()) {
             $actionParamElement->setAttribute("type", "int");
             $actionParamElement->setAttribute("enumType", $actionParam->getType());
         } else {
             if ($actionParam->isStringEnum()) {
                 $actionParamElement->setAttribute("type", "string");
                 $actionParamElement->setAttribute("enumType", $actionParam->getType());
             } else {
                 $actionParamElement->setAttribute("type", $actionParam->getType());
             }
         }
         $actionParamElement->setAttribute("optional", $actionParam->isOptional() ? "1" : "0");
         if ($actionParam->isOptional()) {
             $defaultValue = $actionParam->getDefaultValue();
             if ($defaultValue === null) {
                 $defaultValue = "null";
             }
             switch ($actionParam->getType()) {
                 case "bool":
                     if ($defaultValue === true) {
                         $actionParamElement->setAttribute("default", "true");
                     } else {
                         if ($defaultValue === false) {
                             $actionParamElement->setAttribute("default", "false");
                         }
                     }
                     break;
                 case "bigint":
                 case "int":
                 case "float":
                 case "string":
                     $actionParamElement->setAttribute("default", $defaultValue);
                     break;
                 default:
                     if ($actionParam->isEnum()) {
                         $actionParamElement->setAttribute("default", $defaultValue);
                     } else {
                         $actionParamElement->setAttribute("default", "null");
                     }
             }
         }
         $description = $actionParam->getDescription();
         $description = $this->fixDescription($description);
         $actionParamElement->setAttribute("description", $description);
         $actionElement->appendChild($actionParamElement);
     }
     $resultElement = $this->_doc->createElement("result");
     $arrayType = null;
     if ($outputTypeReflector) {
         if ($outputTypeReflector->isAssociativeArray()) {
             $resultElement->setAttribute("type", "map");
             $arrayType = $outputTypeReflector->getArrayType();
             $resultElement->setAttribute("arrayType", $arrayType);
         } else {
             if ($outputTypeReflector->isArray()) {
                 $resultElement->setAttribute("type", "array");
                 $arrayType = $outputTypeReflector->getArrayType();
                 $resultElement->setAttribute("arrayType", $arrayType);
             } else {
                 $resultElement->setAttribute("type", $outputType);
             }
         }
     }
     $description = $actionInfo->description;
     $description = $this->fixDescription($description);
     $actionElement->setAttribute("description", kString::stripUtf8InvalidChars($description));
     $actionElement->setAttribute("enableInMultiRequest", $outputType === 'file' ? "0" : "1");
     $actionElement->appendChild($resultElement);
     return $actionElement;
 }
开发者ID:DBezemer,项目名称:server,代码行数:91,代码来源:XmlClientGenerator.php

示例4: castSimpleType

 private function castSimpleType($type, $var)
 {
     switch ($type) {
         case "int":
             return (int) $var;
         case "string":
             return kString::stripUtf8InvalidChars((string) $var);
         case "bool":
             if (strtolower($var) === "false") {
                 return false;
             } else {
                 return (bool) $var;
             }
         case "float":
             return (double) $var;
     }
     return null;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:18,代码来源:KalturaRequestDeserializer.php

示例5: castSimpleType

 private function castSimpleType($type, $var)
 {
     switch ($type) {
         case "int":
             return (int) $var;
         case "string":
             return kString::stripUtf8InvalidChars((string) $var);
         case "bool":
             if (strtolower($var) === "false") {
                 return false;
             } else {
                 return (bool) $var;
             }
         case "float":
             return (double) $var;
         case "bigint":
             return (double) $var;
         case "time":
             if (!$this->disableRelativeTime) {
                 $var = kTime::getRelativeTime($var);
             }
             return $var;
     }
     return null;
 }
开发者ID:GElkayam,项目名称:server,代码行数:25,代码来源:KalturaRequestDeserializer.php

示例6: doFromObject

 public function doFromObject($partner, KalturaDetachedResponseProfile $responseProfile = null)
 {
     parent::doFromObject($partner);
     $this->name = kString::stripUtf8InvalidChars($this->name);
     $this->description = kString::stripUtf8InvalidChars($this->description);
     $this->adminName = kString::stripUtf8InvalidChars($this->adminName);
     $this->additionalParams = KalturaKeyValueArray::fromKeyValueArray($partner->getAdditionalParams());
     if (!$this->host) {
         $this->host = null;
     }
     if (!$this->cdnHost) {
         $this->cdnHost = null;
     }
 }
开发者ID:GElkayam,项目名称:server,代码行数:14,代码来源:KalturaPartner.php

示例7: doFromObject

 public function doFromObject($source_object, KalturaDetachedResponseProfile $responseProfile = null)
 {
     parent::doFromObject($source_object, $responseProfile);
     $permissions = PermissionPeer::retrievePartnerLevelPermissions($source_object->getId());
     $this->permissions = KalturaPermissionArray::fromDbArray($permissions);
     $this->limits = KalturaSystemPartnerLimitArray::fromPartner($source_object);
     $this->restrictEntryByMetadata = $source_object->getShouldApplyAccessControlOnEntryMetadata();
     $dbAutoModerationEntryFilter = $source_object->getAutoModerateEntryFilter();
     if ($dbAutoModerationEntryFilter) {
         $this->autoModerateEntryFilter = new KalturaBaseEntryFilter();
         $this->autoModerateEntryFilter->fromObject($dbAutoModerationEntryFilter);
     }
     $this->partnerName = kString::stripUtf8InvalidChars($this->partnerName);
     $this->description = kString::stripUtf8InvalidChars($this->description);
     $this->adminName = kString::stripUtf8InvalidChars($this->adminName);
     if ($this->deliveryProfileIds) {
         $this->deliveryProfileIds = json_encode($this->deliveryProfileIds);
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:19,代码来源:KalturaSystemPartnerConfiguration.php

示例8: fromPartner

 public function fromPartner(Partner $partner)
 {
     parent::fromObject($partner);
     $this->name = kString::stripUtf8InvalidChars($this->name);
     $this->description = kString::stripUtf8InvalidChars($this->description);
     $this->adminName = kString::stripUtf8InvalidChars($this->adminName);
     $this->additionalParams = KalturaKeyValueArray::fromKeyValueArray($partner->getAdditionalParams());
     return $this;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:9,代码来源:KalturaPartner.php

示例9: fromObject

 public function fromObject($source_object)
 {
     parent::fromObject($source_object);
     $permissions = PermissionPeer::retrievePartnerLevelPermissions($source_object->getId());
     $this->permissions = KalturaPermissionArray::fromDbArray($permissions);
     $this->limits = KalturaSystemPartnerLimitArray::fromPartner($source_object);
     $dbAutoModerationEntryFilter = $source_object->getAutoModerateEntryFilter();
     if ($dbAutoModerationEntryFilter) {
         $this->autoModerateEntryFilter = new KalturaBaseEntryFilter();
         $this->autoModerateEntryFilter->fromObject($dbAutoModerationEntryFilter);
     }
     $this->partnerName = kString::stripUtf8InvalidChars($this->partnerName);
     $this->description = kString::stripUtf8InvalidChars($this->description);
     $this->adminName = kString::stripUtf8InvalidChars($this->adminName);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:15,代码来源:KalturaSystemPartnerConfiguration.php


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