本文整理汇总了PHP中requestUtils类的典型用法代码示例。如果您正苦于以下问题:PHP requestUtils类的具体用法?PHP requestUtils怎么用?PHP requestUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了requestUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: KalturaFrontController
private function KalturaFrontController()
{
$this->dispatcher = KalturaDispatcher::getInstance();
$this->params = requestUtils::getRequestParams();
$this->service = isset($this->params["service"]) ? $this->params["service"] : null;
$this->action = isset($this->params["action"]) ? $this->params["action"] : null;
}
示例2: array
/**
return array('status' => $status, 'message' => $message, 'objects' => $objects);
objects - array of
'thumb'
'title'
'description'
'id' - unique id to be passed to getMediaInfo
*/
public function searchMedia($media_type, $searchText, $page, $pageSize, $authData = null, $extraData = null)
{
$status = "ok";
$message = '';
$objects = array();
@(list($searchTerm, $requestedPageSize, $numResults, $repeatOldResults) = explode(",", $searchText));
if ($requestedPageSize > 0) {
$pageSize = $requestedPageSize;
}
$already_returned = ($page - 1) * $pageSize;
$num_of_entries_to_return = min($pageSize, $numResults - $already_returned);
$i = 0;
for ($i = 0; $i < $num_of_entries_to_return; ++$i) {
$host_num = 1 + $i % 7;
$host = requestUtils::getHost();
$url = "{$host}/qa/images.php?id=";
$id = ($page - 1) * $pageSize + $i;
if ($repeatOldResults > 0) {
$id = $id % $repeatOldResults;
}
$id = 1 + $id;
// do we want it to be 0-based or 1-based ??
$playback = $i % 2 ? "none" : "";
$object = array("id" => "id-{$id}", "thumb" => $url . $id, "tags" => "tags-{$id}, {$searchTerm}", "title" => "title-{$id}", "description" => "description-{$id}", "flash_playback_type" => $playback);
$objects[] = $object;
}
return array('status' => $status, 'message' => $message, 'objects' => $objects);
}
示例3: execute
public function execute()
{
$this->getResponse()->setHttpHeader("Content-Type", "application/x-javascript");
$kshow_id = $this->getRequestParameter('kshow_id', 0);
$uid = kuser::ANONYMOUS_PUSER_ID;
$kshow = kshowPeer::retrieveByPK($kshow_id);
if (!$kshow) {
return sfView::ERROR;
}
// kshow_id might be a string (something like "15483str") but it will be returned using retriveByPK anyways
// lets make sure we pass just the id to the contribution wizard
$kshow_id = $kshow->getId();
$partner_id = $kshow->getPartnerId();
$partner = PartnerPeer::retrieveByPK($partner_id);
$subp_id = $kshow->getSubpId();
$partner_secret = $partner->getSecret();
$partner_name = $partner->getPartnerName();
$kaltura_services = new startsessionAction();
$kaltura_services->setInputParams(array("format" => kalturaWebserviceRenderer::RESPONSE_TYPE_PHP_ARRAY, "partner_id" => $partner_id, "subp_id" => $subp_id, "uid" => $uid, "secret" => $partner_secret));
$result = $kaltura_services->internalExecute();
$this->ks = @$result["result"]["ks"];
$this->widget_host = requestUtils::getHost();
$this->kshow_id = $kshow_id;
$this->uid = $uid;
$this->partner_id = $partner_id;
$this->subp_id = $subp_id;
$this->partner_name = $partner_name;
return sfView::SUCCESS;
}
示例4: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$limit = $this->getP("page_size", 20);
$limit = min($limit, 100);
$page = $this->getP("page", 1);
$offset = ($page - 1) * $limit;
$c = new Criteria();
$c->addAnd(BatchJobPeer::PARTNER_ID, $partner_id);
$c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::BULKUPLOAD);
$c->addDescendingOrderByColumn(BatchJobPeer::ID);
$count = BatchJobPeer::doCount($c);
$c->setLimit($limit);
$c->setOffset($offset);
$jobs = BatchJobPeer::doSelect($c);
$obj = array();
foreach ($jobs as $job) {
$jobData = $job->getData();
if (!$jobData instanceof kBulkUploadJobData) {
continue;
}
$bulkResults = BulkUploadResultPeer::retrieveWithEntryByBulkUploadId($job->getId());
$obj[] = array("uploadedBy" => $jobData->getUploadedBy(), "uploadedOn" => $job->getCreatedAt(null), "numOfEntries" => count($bulkResults), "status" => $job->getStatus(), "error" => $job->getStatus() == BatchJob::BATCHJOB_STATUS_FAILED ? $job->getMessage() : '', "logFileUrl" => requestUtils::getCdnHost() . "/index.php/extwidget/bulkuploadfile/id/{$job->getId()}/pid/{$job->getPartnerId()}/type/log", "csvFileUrl" => requestUtils::getCdnHost() . "/index.php/extwidget/bulkuploadfile/id/{$job->getId()}/pid/{$job->getPartnerId()}/type/csv");
}
$this->addMsg("count", $count);
$this->addMsg("page_size", $limit);
$this->addMsg("page", $page);
$this->addMsg("bulk_uploads", $obj);
}
示例5: __construct
public function __construct()
{
$this->setIp(requestUtils::getRemoteAddress());
$this->setReferrer(isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : null);
$this->setUserAgent(isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null);
$this->setKs(kCurrentContext::$ks_object ? kCurrentContext::$ks_object : null);
}
示例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) {
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}");
}
示例7: 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}");
}
示例8: getLicenseAction
/**
* Get license for encrypted content playback
*
* @action getLicense
* @param string $flavorAssetId
* @param string $referrer 64base encoded
* @return string $response
*
*/
public function getLicenseAction($flavorAssetId, $referrer = null)
{
KalturaResponseCacher::disableCache();
KalturaLog::debug('get license for flavor asset: ' . $flavorAssetId);
try {
$requestParams = requestUtils::getRequestParams();
if (!array_key_exists(WidevineLicenseProxyUtils::ASSETID, $requestParams)) {
KalturaLog::err('assetid is missing on the request');
return WidevineLicenseProxyUtils::createErrorResponse(KalturaWidevineErrorCodes::WIDEVINE_ASSET_ID_CANNOT_BE_NULL, 0);
}
$wvAssetId = $requestParams[WidevineLicenseProxyUtils::ASSETID];
$this->validateLicenseRequest($flavorAssetId, $wvAssetId, $referrer);
$privileges = null;
$isAdmin = false;
if (kCurrentContext::$ks_object) {
$privileges = kCurrentContext::$ks_object->getPrivileges();
$isAdmin = kCurrentContext::$ks_object->isAdmin();
}
$response = WidevineLicenseProxyUtils::sendLicenseRequest($requestParams, $privileges, $isAdmin);
} catch (KalturaWidevineLicenseProxyException $e) {
KalturaLog::err($e);
$response = WidevineLicenseProxyUtils::createErrorResponse($e->getWvErrorCode(), $wvAssetId);
} catch (Exception $e) {
KalturaLog::err($e);
$response = WidevineLicenseProxyUtils::createErrorResponse(KalturaWidevineErrorCodes::GENERAL_ERROR, $wvAssetId);
}
WidevineLicenseProxyUtils::printLicenseResponseStatus($response);
return $response;
}
示例9: dieError
public static function dieError($errorCode, $message = null)
{
$description = self::$errorDescriptionMap[$errorCode];
$args = func_get_args();
if (count($args) > 1) {
array_shift($args);
$description = @call_user_func_array('sprintf', array_merge(array($description), $args));
}
if ($message) {
$description .= ", {$message}";
}
KalturaLog::err("exiting on error {$errorCode} - {$description}");
$headers = array();
if (self::$responseCode) {
$headers[] = self::$errorCodeMap[self::$responseCode];
}
$headers[] = "X-Kaltura-App: exiting on error {$errorCode} - {$description}";
foreach ($headers as $header) {
header($header);
}
header("X-Kaltura:error-{$errorCode}");
$headers[] = "X-Kaltura:cached-error-{$errorCode}";
self::terminateDispatch();
if ($errorCode != self::ACCESS_CONTROL_RESTRICTED && $errorCode != self::IP_COUNTRY_BLOCKED && $_SERVER["REQUEST_METHOD"] == "GET") {
requestUtils::sendCachingHeaders(self::CACHE_EXPIRY, true, time());
if (function_exists('apc_store')) {
$protocol = infraRequestUtils::getProtocol();
$host = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST'];
$uri = $_SERVER["REQUEST_URI"];
apc_store("exterror-{$protocol}://{$host}{$uri}", $headers, self::CACHE_EXPIRY);
}
}
die;
}
示例10: KalturaFrontController
private function KalturaFrontController()
{
$this->dispatcher = KalturaDispatcher::getInstance();
$this->params = requestUtils::getRequestParams();
$this->service = isset($this->params["service"]) ? (string) $this->params["service"] : null;
$this->action = isset($this->params["action"]) ? (string) $this->params["action"] : null;
kCurrentContext::$serializeCallback = array($this, 'serialize');
}
示例11: saveAsNewUploadToken
/**
* Set default values and save the new upload token
*/
public function saveAsNewUploadToken()
{
$this->_uploadToken->setStatus(UploadToken::UPLOAD_TOKEN_PENDING);
$this->_uploadToken->setUploadedFileSize(null);
$this->_uploadToken->setUploadTempPath(null);
$this->_uploadToken->setUserIp(requestUtils::getRemoteAddress());
$this->_uploadToken->setDc(kDataCenterMgr::getCurrentDcId());
$this->_uploadToken->save();
}
示例12: createSelect
function createSelect($id, $name, $default_value, $list_name)
{
$prefix = "partner_";
$host = requestUtils::getHost();
// TODO - all static lists should move out of this function !!
if (strpos($host, "localhost") != false) {
$limited = false;
} else {
if (strpos($host, "kaldev") !== false) {
$limited = false;
} else {
$limited = true;
}
}
//global $arrays;
$media_type_list = array("1" => "Video", "2" => "Image", "5" => "Audio");
$media_source_list = array("20" => "Kaltura", "21" => "MyClips", "23" => "KalturaPartner", "1" => "* File", "2" => "* Webcam", "3" => "Flickr", "4" => "YouTube", "5" => "* URL", "7" => "MySpace", "8" => "PhotoBucket", "9" => "Jamendo", "10" => "CCMixter", "11" => "NYPL", "12" => "Current", "13" => "MediaCommons", "22" => "Archive.org");
if ($limited) {
$format_list = array("1" => "JSON", "2" => "XML", "3" => "PHP");
if (strpos($host, "sandbox") !== false) {
$service_url_list = array("sandbox.kaltura.com" => "Sandbox", "www.kaltura.com" => "Kaltura");
} else {
$service_url_list = array("www.kaltura.com" => "Kaltura", "sandbox.kaltura.com" => "Sandbox");
}
$index_path_list = array("index.php" => "index");
} else {
$format_list = array("1" => "JSON", "2" => "XML", "3" => "PHP", "4" => "PHP_ARR", "5" => "PHP_OBJ");
$service_url_list = array("localhost" => "localhost", "kaldev.kaltura.com" => "kaldev", "www.kaltura.com" => "Kaltura", "sandbox.kaltura.com" => "Sandbox");
$index_path_list = array("index.php" => "index", "kaltura_dev.php" => "debug");
}
$clazz_list = array("kshow" => "kshow", "kuser" => "kuser", "entry" => "entry", "PuserKuser" => "PuserKuser");
$moderation_object_type = array("1" => "kshow", "2" => "entry", "3" => "kuser", "" => "none");
$notification_status = array("" => "All", "1" => "Pending", "2" => "Sent", "3" => "Error", "4" => "Should Resend");
$entry_type = array("" => "All", "1" => "Clip", "2" => "Roughcut");
$entry_media_type = array("" => "All", "1" => "Video", "2" => "Image", "5" => "Audio", "6" => "Roughcut");
$boolean_type = array("" => "", "true" => "true", "false" => "false");
$boolean_int_type = array("" => "", "1" => "true", "0" => "false");
$partner_status_int_type = array("1" => "Normal", "2" => "Content Blocked", "3" => "Fully Blocked", "0" => "Deleted");
$partner_group_int_type = array("1" => "Publisher", "2" => "VAR", "3" => "Group");
$arrays = array("format_list" => $format_list, "media_type" => $media_type_list, "media_source" => $media_source_list, "service_urls" => $service_url_list, "service_urls1" => array_merge(array("" => ""), $service_url_list), "index_paths" => $index_path_list, "clazz_list" => $clazz_list, "moderation_object_type" => $moderation_object_type, "boolean_type" => $boolean_type, "boolean_int_type" => $boolean_int_type, "notification_status" => $notification_status, "partner_status_int_type" => $partner_status_int_type, "partner_group_int_type" => $partner_group_int_type, "appear_in_saerch_list" => array("0" => "Not at all", "1" => "Partner only", "2" => "Kaltura network"), "net_storage_priority" => array(StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY => 'Kaltura DCs only', StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_FIRST => 'Kaltura first', StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_FIRST => 'External storages first', StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY => 'External storages only'));
$list = $arrays[$list_name];
//echo "createSelect: list_name:[$list_name] count:[" . count ( $list ) . "]<br>";
$str = "<select id='{$prefix}{$id}' style='font-family:arial; font-size:12px;' name='{$prefix}{$name}' onkeyup='updateSelect( this )' onchange='updateSelect( this )'>";
$default_value_selected = "";
foreach ($list as $value => $option) {
// not always the default value is found
if ($value == $default_value) {
$default_value_selected = $default_value;
}
$selected = $value == $default_value ? "selected='selected'" : "";
$str .= "<option value='{$value}' {$selected} >{$option}</option>\n";
}
$str .= "</select> <span style='color:blue;' id='{$prefix}{$id}_current_value'>{$default_value_selected}</span>\n";
return $str;
}
示例13: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
$uiconf_id = $this->getRequestParameter('uiconf_id');
if (!$uiconf_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'uiconf_id');
}
$uiConf = uiConfPeer::retrieveByPK($uiconf_id);
if (!$uiConf) {
KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND);
}
$partner_id = $this->getRequestParameter('partner_id', $uiConf->getPartnerId());
if (!$partner_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'partner_id');
}
$partner_host = myPartnerUtils::getHost($partner_id);
$partner_cdnHost = myPartnerUtils::getCdnHost($partner_id);
$use_cdn = $uiConf->getUseCdn();
$host = $use_cdn ? $partner_cdnHost : $partner_host;
$ui_conf_html5_url = $uiConf->getHtml5Url();
if (kConf::hasMap("optimized_playback")) {
$optimizedPlayback = kConf::getMap("optimized_playback");
if (array_key_exists($partner_id, $optimizedPlayback)) {
// force a specific kdp for the partner
$params = $optimizedPlayback[$partner_id];
if (array_key_exists('html5_url', $params)) {
$ui_conf_html5_url = $params['html5_url'];
}
}
}
if (kString::beginsWith($ui_conf_html5_url, "http")) {
$url = $ui_conf_html5_url;
// absolute URL
} else {
if ($ui_conf_html5_url) {
$url = $host . $ui_conf_html5_url;
} else {
$html5_version = kConf::get('html5_version');
$url = "{$host}/html5/html5lib/{$html5_version}/mwEmbedLoader.php";
}
}
// append uiconf_id and partner id for optimizing loading of html5 library. append them only for "standard" urls by looking for the mwEmbedLoader.php suffix
if (kString::endsWith($url, "mwEmbedLoader.php")) {
$url .= "/p/{$partner_id}/uiconf_id/{$uiconf_id}";
$entry_id = $this->getRequestParameter('entry_id');
if ($entry_id) {
$url .= "/entry_id/{$entry_id}";
}
}
requestUtils::sendCachingHeaders(60);
header("Pragma:");
kFile::cacheRedirect($url);
header("Location:{$url}");
die;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:57,代码来源:embedIframeJsAction.class.php
示例14: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
requestUtils::handleConditionalGet();
$file_sync_id = $this->getRequestParameter("id");
$hash = $this->getRequestParameter("hash");
$file_name = $this->getRequestParameter("fileName");
if ($file_name) {
$file_name = base64_decode($file_name);
}
kDataCenterMgr::serveFileToRemoteDataCenter($file_sync_id, $hash, $file_name);
die;
}
示例15: serialize
public function serialize($object)
{
if (is_object($object) && $object instanceof Exception) {
$assetid = 0;
$requestParams = requestUtils::getRequestParams();
if (array_key_exists(WidevineLicenseProxyUtils::ASSETID, $requestParams)) {
$assetid = $requestParams[WidevineLicenseProxyUtils::ASSETID];
}
$object = WidevineLicenseProxyUtils::createErrorResponse(KalturaWidevineErrorCodes::GENERAL_ERROR, $assetid);
}
return $object;
}