本文整理汇总了PHP中Kurogo::arrayVal方法的典型用法代码示例。如果您正苦于以下问题:PHP Kurogo::arrayVal方法的具体用法?PHP Kurogo::arrayVal怎么用?PHP Kurogo::arrayVal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kurogo
的用法示例。
在下文中一共展示了Kurogo::arrayVal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init($args)
{
$args['ID'] = $this->id;
$this->title = Kurogo::arrayVal($args, 'TITLE', $this->id);
$this->description = Kurogo::arrayVal($args, 'DESCRIPTION');
$this->rule = UserContextRule::factory($args);
}
示例2: parseEntry
protected function parseEntry($entry)
{
switch ($this->response->getContext('retriever')) {
case 'feed':
$photo = new FlickrFeedPhotoObject();
$photo->setID($entry['guid']);
$photo->setAuthor($entry['author_name']);
$photo->setMimeType($entry['photo_mime']);
$photo->setURL($entry['photo_url']);
$photo->setHeight($entry['height']);
$photo->setWidth($entry['width']);
$photo->setThumbnailURL($entry['thumb_url']);
$published = new DateTime($entry['date_taken']);
$photo->setPublished($published);
$photo->setDescription($entry['description']);
break;
case 'api':
$photo = new FlickrAPIPhotoObject();
$photo->setUserID(Kurogo::arrayVal($entry, 'owner'));
$photo->setID($entry['id']);
$photo->setFarm($entry['farm']);
$photo->setServer($entry['server']);
$photo->setSecret($entry['secret']);
$photo->setDescription($entry['description']['_content']);
$photo->setAuthor($entry['ownername']);
$published = new DateTime($entry['datetaken']);
$photo->setPublished($published);
$photo->setThumbnailURL($photo->getFlickrUrl('s'));
$photo->setURL($photo->getFlickrUrl('z'));
break;
}
$photo->setTitle($entry['title']);
$photo->setTags($entry['tags']);
return $photo;
}
示例3: initializeForCommand
public function initializeForCommand()
{
switch ($this->command) {
case 'notice':
$response = null;
$responseVersion = 1;
if ($this->getOptionalModuleVar('BANNER_ALERT', false, 'notice')) {
$noticeData = $this->getOptionalModuleSection('notice');
if ($noticeData) {
$response = array('notice' => '', 'moduleID' => null, 'link' => $this->getOptionalModuleVar('BANNER_ALERT_MODULE_LINK', false, 'notice'));
// notice can either take a module or data model class or retriever class. The section is passed on. It must implement the HomeAlertInterface interface
if (isset($noticeData['BANNER_ALERT_MODULE'])) {
$moduleID = $noticeData['BANNER_ALERT_MODULE'];
$controller = WebModule::factory($moduleID);
$response['moduleID'] = $moduleID;
$string = "Module {$moduleID}";
} elseif (isset($noticeData['BANNER_ALERT_MODEL_CLASS'])) {
$controller = DataModel::factory($noticeData['BANNER_ALERT_MODEL_CLASS'], $noticeData);
$string = $noticeData['BANNER_ALERT_MODEL_CLASS'];
} elseif (isset($noticeData['BANNER_ALERT_RETRIEVER_CLASS'])) {
$controller = DataRetriever::factory($noticeData['BANNER_ALERT_RETRIEVER_CLASS'], $noticeData);
$string = $noticeData['BANNER_ALERT_RETRIEVER_CLASS'];
} else {
throw new KurogoConfigurationException("Banner alert not properly configured");
}
if (!$controller instanceof HomeAlertInterface) {
throw new KurogoConfigurationException("{$string} does not implement HomeAlertModule interface");
}
$response['notice'] = $controller->getHomeScreenAlert();
}
}
$this->setResponse($response);
$this->setResponseVersion($responseVersion);
break;
case 'modules':
if ($setcontext = $this->getArg('setcontext')) {
Kurogo::sharedInstance()->setUserContext($setcontext);
}
$responseVersion = 2;
$response = array('primary' => array(), 'secondary' => array(), 'customize' => $this->getOptionalModuleVar('ALLOW_CUSTOMIZE', true), 'displayType' => $this->getOptionalModuleVar('display_type', 'springboard'));
$allmodules = $this->getAllModules();
$navModules = Kurogo::getSiteSections('navigation', Config::APPLY_CONTEXTS_NAVIGATION);
foreach ($navModules as $moduleID => $moduleData) {
if ($module = Kurogo::arrayVal($allmodules, $moduleID)) {
$title = Kurogo::arrayVal($moduleData, 'title', $module->getModuleVar('title'));
$type = Kurogo::arrayVal($moduleData, 'type', 'primary');
$visible = Kurogo::arrayVal($moduleData, 'visible', 1);
$response[$type][] = array('tag' => $moduleID, 'title' => $title, 'visible' => (bool) $visible);
}
}
$this->setResponse($response);
$this->setResponseVersion($responseVersion);
break;
default:
$this->invalidCommand();
}
}
示例4: init
protected function init($args)
{
parent::init($args);
$this->pagetype = Kurogo::arrayVal($args, 'PAGETYPE', null);
$this->platform = Kurogo::arrayVal($args, 'PLATFORM', null);
$this->browser = Kurogo::arrayVal($args, 'BROWSER', null);
if (strlen($this->pagetype) == 0 && strlen($this->platform) == 0 && strlen($this->browser) == 0) {
throw new KurogoConfigurationException("PAGETYPE, PLATFORM or BROWSER must be specified in " . get_class($this));
}
}
示例5: getScheduleFeed
protected function getScheduleFeed($sport)
{
$scheduleData = $this->loadScheduleData();
if ($feedData = Kurogo::arrayVal($scheduleData, $sport)) {
$dataModel = Kurogo::arrayVal($feedData, 'MODEL_CLASS', self::$defaultEventModel);
$this->scheduleFeed = AthleticEventsDataModel::factory($dataModel, $feedData);
return $this->scheduleFeed;
}
return null;
}
示例6: init
protected function init($args)
{
parent::init($args);
$this->fieldMap = array('userid' => isset($args['KUROGO_USERID_FIELD']) ? $args['KUROGO_USERID_FIELD'] : 'uid', 'email' => isset($args['KUROGO_EMAIL_FIELD']) ? $args['KUROGO_EMAIL_FIELD'] : 'mail', 'fullname' => isset($args['KUROGO_FULLNAME_FIELD']) ? $args['KUROGO_FULLNAME_FIELD'] : '', 'firstname' => isset($args['KUROGO_FIRSTNAME_FIELD']) ? $args['KUROGO_FIRSTNAME_FIELD'] : 'givenname', 'lastname' => isset($args['KUROGO_LASTNAME_FIELD']) ? $args['KUROGO_LASTNAME_FIELD'] : 'sn', 'photodata' => isset($args['KUROGO_PHOTODATA_FIELD']) ? $args['KUROGO_PHOTODATA_FIELD'] : 'jpegphoto', 'phone' => isset($args['KUROGO_PHONE_FIELD']) ? $args['KUROGO_PHONE_FIELD'] : 'telephonenumber');
if (isset($args['SORTFIELDS']) && is_array($args['SORTFIELDS'])) {
$this->sortFields = $args['SORTFIELDS'];
}
if (isset($args['BASE_URL']) && $args['BASE_URL']) {
$this->peopleAPI = rtrim($args['BASE_URL'], '/');
}
$this->feed = Kurogo::arrayVal($args, 'FEED');
$this->setContext('fieldMap', $this->fieldMap);
}
示例7: factory
public static function factory($args)
{
if (!($class = Kurogo::arrayVal($args, 'RULE', 'CookieContextRule'))) {
throw new KurogoConfigurationException("Context class must be specified in RULE key");
}
if (!class_exists($class)) {
throw new KurogoConfigurationException("UserContextRule class {$class} not defined");
}
$rule = new $class();
if (!$rule instanceof UserContextRule) {
throw new KurogoConfigurationException(get_class($rule) . " is not a subclass of UserContextRule");
}
$rule->init($args);
return $rule;
}
示例8: setContext
public function setContext($bool)
{
if ($this->value == UserContext::CONTEXT_DEFAULT) {
if ($bool && isset($_COOKIE[$this->cookie])) {
$this->clearCookie();
}
return true;
}
if ($bool) {
Kurogo::log(LOG_DEBUG, "Setting CookieContext {$this->cookie} to {$this->value}", 'context');
$this->setCookie();
} elseif (Kurogo::arrayVal($_COOKIE, $this->cookie) == $this->value) {
Kurogo::log(LOG_DEBUG, "Clearing CookieContext {$this->cookie} by {$this->value}", 'context');
$this->clearCookie();
}
return true;
}
示例9: parseEntry
public function parseEntry($entry)
{
if (isset($entry['entryId'])) {
$video = new KalturaVideoObject();
$video->setID($entry['entryId']);
$video->setTitle($entry['title']);
$video->setDescription($entry['description']);
$ts = $entry['updatedAt'];
// there is also a 'createdAt' property that could be used instead
$video->setPublished(new DateTime("@{$ts}"));
$video->setStillFrameImage($entry['thumbnail']['url']);
$video->setImage($entry['thumbnailUrl']['url']);
$video->setDuration($entry['media']['duration'] / 1000);
// Need to convert to seconds
$tags = Kurogo::arrayVal($entry, 'tags', array());
$video->setTags(Kurogo::arrayVal($tags, 'tag', array()));
// currently an array of tags
$video->setVideoSources($entry['itemContent']);
$video->setSubtitleTracks($entry['subTitles']);
return $video;
}
}
示例10: parseEntry
protected function parseEntry($entry)
{
$video = new VimeoVideoObject();
$video->setURL($entry['url']);
if (isset($entry['mobile_url'])) {
$video->setMobileURL($entry['mobile_url']);
}
$video->setTitle($entry['title']);
$video->setDescription($entry['description']);
$video->setDuration($entry['duration']);
$video->setID($entry['id']);
$video->setImage($entry['thumbnail_small']);
$video->setStillFrameImage($entry['thumbnail_large']);
if (isset($entry['tags'])) {
$video->setTags($entry['tags']);
}
$video->setWidth(Kurogo::arrayVal($entry, 'width'));
$video->setHeight(Kurogo::arrayVal($entry, 'height'));
$video->setAuthor($entry['user_name']);
$published = new DateTime($entry['upload_date']);
$video->setPublished($published);
return $video;
}
示例11: loadSites
private function loadSites()
{
//load sites.ini file
$path = SITES_DIR . DIRECTORY_SEPARATOR . 'sites.ini';
$sitesConfig = $this->baseConfigStore->loadConfig($path, 'file', Config::OPTION_IGNORE_SHARED);
$sitesData = $sitesConfig->getSectionVars();
if (count($sitesData) == 0) {
throw new KurogoConfigurationException("No valid sites configured");
}
$sharedData = Kurogo::arrayVal($sitesData, 'shared', array());
unset($sitesData['shared']);
if (!defined('SERVER_KEY')) {
$serverKey = Kurogo::arrayVal($sharedData, 'SERVER_KEY', md5(SITES_DIR));
define('SERVER_KEY', $serverKey);
}
$sites = array();
$multiSite = null;
$default = null;
foreach ($sitesData as $siteName => $siteData) {
// [shared] section will be applied as common settings for all sites
$siteData = array_merge($sharedData, $siteData);
$site = new KurogoSite($siteName, $siteData);
if ($site->isDefault()) {
if (strlen($default)) {
throw new KurogoConfigurationException("Only 1 site can be labeled default, sites {$siteName} and {$default} set to default");
}
$default = $siteName;
}
$sites[$site->getName()] = $site;
}
$this->multiSite = count($sites) > 1;
return $sites;
}
示例12: getModuleCustomizeList
private function getModuleCustomizeList()
{
$navModules = $this->getAllModuleNavigationData(self::INCLUDE_HIDDEN_MODULES, 'customize');
$modules = Kurogo::arrayVal($navModules, 'primary', array());
return $modules;
}
示例13: parseEntry
protected function parseEntry($entry)
{
if (isset($entry['video']['id'])) {
$entry = array_merge($entry, $entry['video']);
}
$video = new YouTubeVideoObject();
$video->setURL($entry['player']['default']);
if (isset($entry['content'][6])) {
$video->setStreamingURL($entry['content'][6]);
}
if ($aspectRatio = Kurogo::arrayVal($entry, 'aspectRatio')) {
if ($aspectRatio == 'widescreen') {
$video->setAspectRatio(16 / 9);
}
}
$video->setMobileURL($entry['content']['1']);
$video->setTitle($entry['title']);
$video->setDescription(strip_tags($entry['description']));
$video->setDuration($entry['duration']);
$video->setID($entry['id']);
if (IS_SECURE) {
$video->setImage(str_replace('http://', 'https://', $entry['thumbnail']['sqDefault']));
$video->setStillFrameImage(str_replace('http://', 'https://', $entry['thumbnail']['hqDefault']));
} else {
$video->setImage($entry['thumbnail']['sqDefault']);
$video->setStillFrameImage($entry['thumbnail']['hqDefault']);
}
if (isset($entry['tags'])) {
$video->setTags($entry['tags']);
}
$video->setAuthor($entry['uploader']);
$published = new DateTime($entry['uploaded']);
$video->setPublished($published);
return $video;
}
示例14: messagingEnabled
public function messagingEnabled()
{
// if module doesn't specify messaging parameter, use site value
$siteConfig = Kurogo::getOptionalSiteSection('notifications');
$siteEnabled = Kurogo::arrayVal($siteConfig, 'ENABLED_BY_DEFAULT', false);
return $this->getOptionalModuleVar('messaging', $siteEnabled, null, 'module');
}
示例15: initializeForCommand
//.........这里部分代码省略.........
if (!$people) {
$people = array();
}
$hasError = $peopleController->getResponseError();
if ($hasError) {
// TODO decide on error title
$errorTitle = 'Warning';
$errorMsg = $peopleController->getResponseError();
$errorCode = $peopleController->getResponseCode();
$error = new KurogoError($errorCode, $errorTitle, $errorMsg);
}
$response[] = null;
if ($people !== false) {
$results = array();
$resultCount = count($people);
foreach ($people as $person) {
$results[] = $this->formatPerson($person, $output);
}
$response = array('total' => $resultCount, 'returned' => $resultCount, 'feed' => $feed, 'displayField' => 'name', 'results' => $results, 'requiresDetail' => (bool) $this->getOptionalModuleVar('API_REQUIRES_DETAIL'), 'error' => isset($error) ? $error : null);
}
$this->setResponse($response);
$this->setResponseVersion(2);
} else {
$this->invalidCommand();
$this->setResponseVersion(1);
}
break;
case 'detail':
if ($uid = $this->getArg(array('id', 'uid'))) {
$person = $peopleController->getUser($uid);
if ($person) {
$personDetails = $this->formatPerson($person, $output);
$response = array('person' => $personDetails);
$this->setResponse($response);
$this->setResponseVersion(1);
} else {
$hasError = $peopleController->getResponseError();
if ($hasError) {
// TODO decide on error title
$errorTitle = 'Warning';
$errorMsg = $peopleController->getResponseError();
$errorCode = $peopleController->getResponseCode();
$error = new KurogoError($errorCode, $errorTitle, $errorMsg);
$this->setResponseError($error);
}
}
} else {
$this->invalidCommand();
$this->setResponseVersion(1);
}
break;
case 'contacts':
$convertTags = array('class' => 'type', 'label' => 'title', 'value' => 'subtitle');
$group = $this->getArg('group');
if ($group) {
$results = $this->getContactsForGroup($group);
} else {
$results = $this->getModuleSections('api-contacts');
}
foreach ($results as &$aResult) {
if (isset($aResult['group'])) {
$groupData = $this->getContactGroup($aResult['group']);
if (isset($groupData['description'])) {
$aResult['subtitle'] = $groupData['description'];
}
}
foreach ($convertTags as $from => $to) {
if (isset($aResult[$from])) {
$aResult[$to] = $aResult[$from];
unset($aResult[$from]);
}
}
}
$response = array('total' => count($results), 'results' => $results);
$this->setResponse($response);
$this->setResponseVersion(1);
break;
case 'group':
$group = $this->getContactGroup($this->getArg('group'));
$response = array('total' => count($group), 'results' => $group);
$this->setResponse($response);
$this->setResponseVersion(1);
break;
case 'displayfields':
//break;
//break;
case 'feeds':
$feeds = array();
foreach ($this->feeds as $key => $feedData) {
$feeds[] = array('feed' => $key, 'title' => Kurogo::arrayVal($feedData, 'TITLE', $feed));
}
$response = $feeds;
$this->setResponse($response);
$this->setResponseVersion(1);
break;
default:
$this->invalidCommand();
break;
}
}