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


PHP kString类代码示例

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


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

示例1: stringToSafeXml

 /**
  * @param string $string
  * @return string
  */
 private static function stringToSafeXml($string)
 {
     $string = @iconv('utf-8', 'utf-8', $string);
     $partially_safe = kString::xmlEncode($string);
     $safe = str_replace(array('*', '/', '[', ']'), '', $partially_safe);
     return $safe;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:11,代码来源:kMrssManager.php

示例2: validateForSubmission

 public function validateForSubmission(EntryDistribution $entryDistribution, $action)
 {
     $validationErrors = parent::validateForSubmission($entryDistribution, $action);
     $maxLengthFields = array(YouTubeDistributionField::MEDIA_DESCRIPTION => self::MEDIA_DESCRIPTION_MAXIMUM_LENGTH, YouTubeDistributionField::MEDIA_TITLE => self::MEDIA_TITLE_MAXIMUM_LENGTH, YouTubeDistributionField::WEB_METADATA_CUSTOM_ID => self::METADATA_CUSTOM_ID_MAXIMUM_LENGTH, YouTubeDistributionField::MOVIE_METADATA_CUSTOM_ID => self::METADATA_CUSTOM_ID_MAXIMUM_LENGTH, YouTubeDistributionField::TV_METADATA_CUSTOM_ID => self::METADATA_CUSTOM_ID_MAXIMUM_LENGTH, YouTubeDistributionField::TV_METADATA_EPISODE => self::TV_METADATA_EPISODE_MAXIMUM_LENGTH, YouTubeDistributionField::TV_METADATA_EPISODE_TITLE => self::TV_METADATA_EPISODE_TITLE_MAXIMUM_LENGTH, YouTubeDistributionField::TV_METADATA_SEASON => self::TV_METADATA_SEASON_MAXIMUM_LENGTH, YouTubeDistributionField::TV_METADATA_SHOW_TITLE => self::TV_METADATA_SHOW_TITLE_MAXIMUM_LENGTH, YouTubeDistributionField::TV_METADATA_TMS_ID => self::TV_METADATA_TMS_ID_MAXIMUM_LENGTH, YouTubeDistributionField::MOVIE_METADATA_TITLE => self::MOVIE_METADATA_TITLE_MAXIMUM_LENGTH, YouTubeDistributionField::MOVIE_METADATA_TMS_ID => self::MOVIE_METADATA_TMS_ID_MAXIMUM_LENGTH);
     $inListOrNullFields = array(YouTubeDistributionField::MEDIA_RATING => explode(',', self::MEDIA_RATING_VALID_VALUES), YouTubeDistributionField::ALLOW_COMMENTS => explode(',', self::ALLOW_COMMENTS_VALID_VALUES), YouTubeDistributionField::ALLOW_EMBEDDING => explode(',', self::ALLOW_EMBEDDING_VALID_VALUES), YouTubeDistributionField::ALLOW_RATINGS => explode(',', self::ALLOW_RATINGS_VALID_VALUES), YouTubeDistributionField::ALLOW_RESPONSES => explode(',', self::ALLOW_RESPONSES_VALID_VALUES), YouTubeDistributionField::ADVERTISING_INVIDEO => explode(',', self::ADVERTISING_INVIDEO_VALID_VALUES), YouTubeDistributionField::ADVERTISING_ADSENSE_FOR_VIDEO => explode(',', self::ADVERTISING_ADSENSE_FOR_VIDEO_VALUES), YouTubeDistributionField::DISTRIBUTION_RESTRICTION_DISTRIBUTION_RULE => explode(',', self::DISTRIBUTION_RESTRICTION_DISTRIBUTION_RULE_VALUES), YouTubeDistributionField::URGENT_REFERENCE_FILE => explode(',', self::URGENT_REFERENCE_FILE_VALUES), YouTubeDistributionField::KEEP_FINGERPRINT => explode(',', self::KEEP_FINGERPRINT_VALUES));
     $allFieldValues = $this->getAllFieldValues($entryDistribution);
     if (!$allFieldValues || !is_array($allFieldValues)) {
         KalturaLog::err('Error getting field values from entry distribution id [' . $entryDistribution->getId() . '] profile id [' . $this->getId() . ']');
         return $validationErrors;
     }
     $validationErrors = array_merge($validationErrors, $this->validateMaxLength($maxLengthFields, $allFieldValues, $action));
     $validationErrors = array_merge($validationErrors, $this->validateInListOrNull($inListOrNullFields, $allFieldValues, $action));
     $fieldName = YouTubeDistributionField::NOTIFICATION_EMAIL;
     $value = $allFieldValues[$fieldName];
     //multiple email support
     $values = explode(' ', $value);
     foreach ($values as $val) {
         if (!is_null($val) && !kString::isEmailString($val)) {
             $errorMsg = $this->getUserFriendlyFieldName($fieldName) . ' value must be an email string [value:' . $val . ']';
             $validationError = $this->createValidationError($action, DistributionErrorType::INVALID_DATA, $this->getUserFriendlyFieldName($fieldName));
             $validationError->setValidationErrorType(DistributionValidationErrorType::CUSTOM_ERROR);
             $validationError->setValidationErrorParam($errorMsg);
             $validationErrors[] = $validationError;
         }
     }
     //TODO: check if MEDIA_CATEGORY is a valid YouTube category according to YouTube's XML.
     return $validationErrors;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:28,代码来源:YouTubeDistributionProfile.php

示例3: 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

示例4: execute

 /**
  * Will forward to the regular swf player according to the widget_id 
  */
 public function execute()
 {
     $ui_conf_id = $this->getRequestParameter("ui_conf_id");
     $uiConf = uiConfPeer::retrieveByPK($ui_conf_id);
     if (!$uiConf) {
         die;
     }
     $partner_id = $uiConf->getPartnerId();
     $subp_id = $uiConf->getSubpId();
     $host = myPartnerUtils::getHost($partner_id);
     $ui_conf_swf_url = $uiConf->getSwfUrl();
     if (!$ui_conf_swf_url) {
         $ui_conf_swf_url = "/swf/simpleeditor.swf";
     }
     if (kString::beginsWith($ui_conf_swf_url, "http")) {
         $swf_url = $ui_conf_swf_url;
         // absolute URL
     } else {
         $use_cdn = $uiConf->getUseCdn();
         $cdn_host = $use_cdn ? myPartnerUtils::getCdnHost($partner_id) : myPartnerUtils::getHost($partner_id);
         $swf_url = $cdn_host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . $ui_conf_swf_url;
         // relative to the current host
     }
     // handle buggy case for backward compatiblity
     $partner_host = $host;
     if ($partner_host == "http://www.kaltura.com") {
         $partner_host = 1;
     }
     // otherwise the kse will build a flawed url with [[IMPORT]]
     $params = "contentUrl=" . urlencode($swf_url) . "&host=" . str_replace("http://", "", str_replace("https://", "", $partner_host)) . "&cdnHost=" . str_replace("http://", "", str_replace("https://", "", myPartnerUtils::getCdnHost($partner_id))) . "&uiConfId=" . $ui_conf_id . "&disableurlhashing=" . kConf::get('disable_url_hashing');
     $wrapper_swf = myContentStorage::getFSFlashRootPath() . "/flexwrapper/" . kConf::get('editors_flex_wrapper_version') . "/FlexWrapper.swf";
     $this->redirect($host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . "{$wrapper_swf}?{$params}");
 }
开发者ID:DBezemer,项目名称:server,代码行数:36,代码来源:kseAction.class.php

示例5: contributeMetadataObject

 /**
  * @param SimpleXMLElement $mrss
  * @param SimpleXMLElement $metadata
  * @param kMrssParameters $mrssParams
  * @return SimpleXMLElement
  */
 public function contributeMetadataObject(SimpleXMLElement $mrss, SimpleXMLElement $metadata, kMrssParameters $mrssParams = null, $currentXPath)
 {
     $currentXPath .= "/*[local-name()='" . $metadata->getName() . "']";
     $metadataObject = $mrss->addChild($metadata->getName());
     foreach ($metadata->attributes() as $attributeField => $attributeValue) {
         $metadataObject->addAttribute($attributeField, $attributeValue);
     }
     foreach ($metadata as $metadataField => $metadataValue) {
         if ($metadataValue instanceof SimpleXMLElement && count($metadataValue)) {
             $this->contributeMetadataObject($metadataObject, $metadataValue, $mrssParams, $currentXPath);
         } else {
             $metadataObject->addChild($metadataField, kString::stringToSafeXml($metadataValue));
             $itemXPath = $currentXPath . "/*[local-name()='{$metadataField}']";
             if ($mrssParams && is_array($mrssParams->getItemXpathsToExtend()) && in_array($itemXPath, $mrssParams->getItemXpathsToExtend())) {
                 $relatedEntry = entryPeer::retrieveByPK((string) $metadataValue);
                 if ($relatedEntry) {
                     $relatedItemField = $metadataObject->addChild($metadataField . '_item');
                     $recursionMrssParams = null;
                     if ($mrssParams) {
                         $recursionMrssParams = clone $mrssParams;
                         $recursionMrssParams->setItemXpathsToExtend(array());
                         // stop the recursion
                     }
                     $relatedEntryMrss = kMrssManager::getEntryMrssXml($relatedEntry, $relatedItemField, $recursionMrssParams);
                 }
             }
         }
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:35,代码来源:kMetadataMrssManager.php

示例6: execute

 /**
  * Will forward to the uploader swf according to the ui_conf_id 
  */
 public function execute()
 {
     $ui_conf_id = $this->getRequestParameter("ui_conf_id");
     $uiConf = uiConfPeer::retrieveByPK($ui_conf_id);
     if (!$uiConf) {
         KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND, "UI conf not found");
     }
     $partner_id = $uiConf->getPartnerId();
     $subp_id = $uiConf->getSubpId();
     $host = requestUtils::getRequestHost();
     $ui_conf_swf_url = $uiConf->getSwfUrl();
     if (!$ui_conf_swf_url) {
         KExternalErrors::dieError(KExternalErrors::ILLEGAL_UI_CONF, "SWF URL not found in UI conf");
     }
     if (kString::beginsWith($ui_conf_swf_url, "http")) {
         $swf_url = $ui_conf_swf_url;
         // absolute URL
     } else {
         $use_cdn = $uiConf->getUseCdn();
         $cdn_host = $use_cdn ? myPartnerUtils::getCdnHost($partner_id) : myPartnerUtils::getHost($partner_id);
         $swf_url = $cdn_host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . $ui_conf_swf_url;
         // relative to the current host
     }
     $conf_vars = $uiConf->getConfVars();
     if ($conf_vars) {
         $conf_vars = "&" . $conf_vars;
     }
     $params = "host=" . $host . "&uiConfId=" . $ui_conf_id . $conf_vars;
     KExternalErrors::terminateDispatch();
     $this->redirect("{$swf_url}?{$params}");
 }
开发者ID:DBezemer,项目名称:server,代码行数:34,代码来源:kuploadAction.class.php

示例7: setValueFromHtmlFieldName

 public function setValueFromHtmlFieldName($prefix, $html_field_name, $value)
 {
     if (kString::beginsWith($html_field_name, $prefix)) {
         $field_name = substr($html_field_name, strlen($prefix));
         $this->setByName($field_name, $value);
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:7,代码来源:skinContainer.class.php

示例8: execute

 /**
  * Will forward to the uploader swf according to the ui_conf_id 
  */
 public function execute()
 {
     $ui_conf_id = $this->getRequestParameter("ui_conf_id");
     $uiConf = uiConfPeer::retrieveByPK($ui_conf_id);
     if (!$uiConf) {
         die;
     }
     $partner_id = $uiConf->getPartnerId();
     $subp_id = $uiConf->getSubpId();
     $host = requestUtils::getRequestHost();
     $ui_conf_swf_url = $uiConf->getSwfUrl();
     if (!$ui_conf_swf_url) {
         die;
     }
     if (kString::beginsWith($ui_conf_swf_url, "http")) {
         $swf_url = $ui_conf_swf_url;
         // absolute URL
     } else {
         $use_cdn = $uiConf->getUseCdn();
         $cdn_host = $use_cdn ? myPartnerUtils::getCdnHost($partner_id) : myPartnerUtils::getHost($partner_id);
         $swf_url = $cdn_host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . $ui_conf_swf_url;
         // relative to the current host
     }
     $conf_vars = $uiConf->getConfVars();
     if ($conf_vars) {
         $conf_vars = "&" . $conf_vars;
     }
     $params = "host=" . $host . "&uiConfId=" . $ui_conf_id . $conf_vars;
     $this->redirect("{$swf_url}?{$params}");
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:33,代码来源:kuploadAction.class.php

示例9: getAcl

 protected function getAcl($baseUrl, array $urls)
 {
     require_once dirname(__FILE__) . '/../../../../../../infra/general/kString.class.php';
     // strip the filenames of all urls
     foreach ($urls as &$url) {
         $slashPos = strrpos($url, '/');
         if ($slashPos !== false) {
             $url = substr($url, 0, $slashPos + 1);
         }
     }
     $acl = kString::getCommonPrefix($urls);
     // the first comma in csmil denotes the beginning of the non-common URL part
     $commaPos = strpos($acl, ',');
     if ($commaPos !== false) {
         $acl = substr($acl, 0, $commaPos);
     }
     // if the base url has a port, remove it
     $parsedUrl = parse_url($baseUrl);
     if (isset($parsedUrl['port'])) {
         $baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'];
         if (isset($parsedUrl['path'])) {
             $baseUrl .= $parsedUrl['path'];
         }
     }
     $acl = $baseUrl . $acl . '*';
     return $acl;
 }
开发者ID:DBezemer,项目名称:server,代码行数:27,代码来源:kCloudFrontUrlTokenizer.php

示例10: execute

 /**
  * Will forward to the regular swf player according to the widget_id 
  */
 public function execute()
 {
     $ui_conf_id = $this->getRequestParameter("ui_conf_id");
     $uiConf = uiConfPeer::retrieveByPK($ui_conf_id);
     if (!$uiConf) {
         die;
     }
     $partner_id = $uiConf->getPartnerId();
     $subp_id = $uiConf->getSubpId();
     if (!$subp_id) {
         $subp_id = 0;
     }
     $host = myPartnerUtils::getHost($partner_id);
     $ui_conf_swf_url = $uiConf->getSwfUrl();
     if (!$ui_conf_swf_url) {
         $ui_conf_swf_url = "/swf/ContributionWizard.swf";
     }
     if (kString::beginsWith($ui_conf_swf_url, "http")) {
         $swf_url = $ui_conf_swf_url;
         // absolute URL
     } else {
         $use_cdn = $uiConf->getUseCdn();
         $cdn_host = $use_cdn ? myPartnerUtils::getCdnHost($partner_id) : myPartnerUtils::getHost($partner_id);
         $swf_url = $cdn_host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . $ui_conf_swf_url;
         // relative to the current host
     }
     $params = "contentUrl=" . urlencode($swf_url) . "&host=" . str_replace("http://", "", str_replace("https://", "", $host)) . "&cdnHost=" . str_replace("http://", "", str_replace("https://", "", myPartnerUtils::getCdnHost($partner_id))) . "&uiConfId=" . $ui_conf_id;
     $wrapper_swf = myContentStorage::getFSFlashRootPath() . "/flexwrapper/" . kConf::get('kcw_flex_wrapper_version') . "/FlexWrapper.swf";
     $this->redirect($host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . "{$wrapper_swf}?{$params}");
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:33,代码来源:kcwAction.class.php

示例11: tokenToKey

 public function tokenToKey($matches)
 {
     $token = $matches[0];
     $key = "@K" . kString::generateStringId() . "K@";
     $this->tokensMap[$key] = $token;
     return $key;
 }
开发者ID:DBezemer,项目名称:server,代码行数:7,代码来源:kRegExTokenMapper.class.php

示例12: executeImpl

 /**
  * Executes addComment action, which returns a form enabling the insertion of a comment
  * The request may include 1 fields: entry id.
  */
 protected function executeImpl(kshow $kshow, entry &$entry)
 {
     $version = @$_REQUEST["version"];
     // it's a path on the disk
     if (kString::beginsWith($version, ".")) {
         // someone is trying to hack in the system
         return sfView::ERROR;
     }
     // in case we're making a roughcut out of a regular invite, we start from scratch
     if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_SHOW || $entry->getDataPath($version) === null) {
         $this->xml_content = "<xml></xml>";
         return;
     }
     // fetch content of file from disk - it should hold the XML
     $file_name = myContentStorage::getFSContentRootPath() . "/" . $entry->getDataPath($version);
     //echo "[$file_name]";
     if (kString::endsWith($file_name, "xml")) {
         if (file_exists($file_name)) {
             $this->xml_content = kFile::getFileContent($file_name);
             //	echo "[" . $this->xml_content . "]" ;
         } else {
             $this->xml_content = "<xml></xml>";
         }
         myMetadataUtils::updateEntryForPending($entry, $version, $this->xml_content);
     } else {
         return sfView::ERROR;
     }
     // this is NOT an xml file we are looking for !
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:33,代码来源:getMetadataAction.class.php

示例13: doGetFileSyncUrl

 /**
  * @param FileSync $fileSync
  * @return string
  */
 protected function doGetFileSyncUrl(FileSync $fileSync)
 {
     $url = parent::doGetFileSyncUrl($fileSync);
     if (in_array($fileSync->getPartnerId(), array(666132, 628012, 357521, 560751)) && kString::beginsWith($url, "mp4:")) {
         $url .= ".mp4";
     }
     return $url;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:12,代码来源:kLevel3UrlManager.php

示例14: toObject

 public function toObject($dbObject = null, $skip = array())
 {
     /** @var kObjectTask $dbObject */
     $dbObject = parent::toObject($dbObject, $skip);
     $flavorParamsIds = array_unique(kString::fromCommaSeparatedToArray($this->flavorParamsIds));
     $dbObject->setDataValue('flavorParamsIds', $flavorParamsIds);
     $dbObject->setDataValue('reconvert', $this->reconvert);
     return $dbObject;
 }
开发者ID:DBezemer,项目名称:server,代码行数:9,代码来源:KalturaConvertEntryFlavorsObjectTask.php

示例15: removeFiles

 protected function removeFiles($namePrefix)
 {
     $namePrefix = $this->normalizeSlashes($namePrefix);
     foreach ($this->_files as $name => $data) {
         if (kString::beginsWith($name, $namePrefix)) {
             unset($this->_files[$name]);
         }
     }
 }
开发者ID:kubrickfr,项目名称:server,代码行数:9,代码来源:AndroidClientGenerator.php


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