本文整理汇总了PHP中kString::removeNewLine方法的典型用法代码示例。如果您正苦于以下问题:PHP kString::removeNewLine方法的具体用法?PHP kString::removeNewLine怎么用?PHP kString::removeNewLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kString
的用法示例。
在下文中一共展示了kString::removeNewLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loginPubKey
/**
* Connect & authenticate on the given server, using the given given public key.
*
* @param $server Server's hostname or IP address
* @param $remoteUser remote username
* @param $pubKeyFile public key file
* @param $privKeyFile private key file
* @param $port server's listening port
* @param $passphrase if $privKeyFile is encrypted (which it should be), the passphrase must be provided
*
* @throws kFileTransferMgrException
*
* @return FILETRANSFERMGR_RES_OK / FILETRANSFERMGR_RES_ERR
*/
public function loginPubKey($server, $user, $pubKeyFile, $privKeyFile, $passphrase = null, $port = null)
{
KalturaLog::debug("Login to server [{$server}] port [{$port}] username [{$user}] public key file [{$pubKeyFile}] private key file [{$privKeyFile}]");
$this->connection_id = @$this->doConnect($server, $port);
if (!$this->connection_id) {
$last_error = error_get_last();
throw new kFileTransferMgrException("Can't connect [{$server}:{$port}] - " . $last_error['message'], kFileTransferMgrException::cantConnect);
}
if (@$this->doLoginPubKey($user, $pubKeyFile, $privKeyFile, $passphrase)) {
KalturaLog::debug("Logged in successfully");
} else {
$last_error = error_get_last();
throw new kFileTransferMgrException("Can't authenticate [{$user}] - " . $last_error['message'], kFileTransferMgrException::cantAuthenticate);
}
$this->start_dir = kString::removeNewLine($this->doPwd());
}
示例2: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
requestUtils::handleConditionalGet();
$entry_id = $this->getRequestParameter("entry_id");
$type = $this->getRequestParameter("type");
$ks = $this->getRequestParameter("ks");
$file_sync = null;
$ret_file_name = "name";
$referrer = $this->getRequestParameter("referrer");
$referrer = base64_decode($referrer);
if (!is_string($referrer)) {
// base64_decode can return binary data
$referrer = "";
}
$request_file_name = $this->getRequestParameter("file_name");
if ($request_file_name) {
$ret_file_name = $request_file_name;
}
$direct_serve = $this->getRequestParameter("direct_serve");
$entry = null;
if ($ks) {
try {
kCurrentContext::initKsPartnerUser($ks);
} catch (Exception $ex) {
KExternalErrors::dieError(KExternalErrors::INVALID_KS);
}
} else {
$entry = kCurrentContext::initPartnerByEntryId($entry_id);
if (!$entry) {
KExternalErrors::dieGracefully();
}
}
kEntitlementUtils::initEntitlementEnforcement();
if (!$entry) {
$entry = entryPeer::retrieveByPK($entry_id);
if (!$entry) {
KExternalErrors::dieGracefully();
}
} else {
if (!kEntitlementUtils::isEntryEntitled($entry)) {
KExternalErrors::dieGracefully();
}
}
KalturaMonitorClient::initApiMonitor(false, 'extwidget.raw', $entry->getPartnerId());
myPartnerUtils::blockInactivePartner($entry->getPartnerId());
$securyEntryHelper = new KSecureEntryHelper($entry, $ks, $referrer, ContextType::DOWNLOAD);
$securyEntryHelper->validateForDownload();
// relocate = did we use the redirect and added the extension to the name
$relocate = $this->getRequestParameter("relocate");
if ($ret_file_name == "name") {
$ret_file_name = $entry->getName();
}
if ($ret_file_name) {
//rawurlencode to content-disposition filename to handle spaces and other characters across different browsers
//$name = rawurlencode($ret_file_name);
// 19.04.2009 (Roman) - url encode is not needed when the filename in Content-Disposition header is in quotes
// IE6/FF3/Chrome - Will show the filename correctly
// IE7 - Will show the filename with underscores instead of spaces (this is better than showing %20)
$name = $ret_file_name;
if ($name) {
if ($relocate) {
// if we have a good file extension (from the first time) - use it in the content-disposition
// in some browsers it will be stronger than the URL's extension
$file_ext = pathinfo($relocate, PATHINFO_EXTENSION);
$name .= ".{$file_ext}";
}
$name = kString::removeNewLine($name);
if (!$direct_serve) {
$entry_data = $entry->getData();
if (strpos($name, ".") === false && !is_null($entry_data)) {
$file_ext = pathinfo($entry_data, PATHINFO_EXTENSION);
$image_extensions = kConf::get('image_file_ext');
if ($file_ext && in_array($file_ext, $image_extensions)) {
$name .= '.' . $file_ext;
}
}
header("Content-Disposition: attachment; filename=\"{$name}\"");
}
}
} else {
$ret_file_name = $entry_id;
$name = $ret_file_name;
}
$name = str_replace(array("\t", "\r", "\n"), array(' ', '', ' '), $name);
$format = $this->getRequestParameter("format");
if ($type == "download" && $format && $entry->getType() != entryType::DOCUMENT) {
// this is a video for a specifc extension - use the proper flavorAsset
$flavor_asset = $this->getAllowedFlavorAssets($securyEntryHelper, $entry_id, $format);
if ($flavor_asset && $flavor_asset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_READY) {
$file_sync = $this->redirectIfRemote($flavor_asset, flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET, null, true);
} else {
header('KalturaRaw: no flavor asset for extension');
header("HTTP/1.0 404 Not Found");
KExternalErrors::dieGracefully();
}
$archive_file = $file_sync->getFullPath();
$mime_type = kFile::mimeType($archive_file);
//.........这里部分代码省略.........