本文整理汇总了PHP中PBHelper::getValueFromArray方法的典型用法代码示例。如果您正苦于以下问题:PHP PBHelper::getValueFromArray方法的具体用法?PHP PBHelper::getValueFromArray怎么用?PHP PBHelper::getValueFromArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PBHelper
的用法示例。
在下文中一共展示了PBHelper::getValueFromArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processShortcodeTwitterUserTimeline
function processShortcodeTwitterUserTimeline($attribute, $content, $tag)
{
$attribute = $this->processAttribute($tag, $attribute);
$Easing = new PBEasing();
$Validation = new PBValidation();
$CarouFredSel = new PBCarouFredSel();
if ($Validation->isEmpty($attribute['twitter_username'])) {
return null;
}
if ($Validation->isEmpty($attribute['twitter_consumer_key'])) {
return null;
}
if ($Validation->isEmpty($attribute['twitter_consumer_key_secret'])) {
return null;
}
if ($Validation->isEmpty($attribute['twitter_access_token'])) {
return null;
}
if ($Validation->isEmpty($attribute['twitter_access_token_secret'])) {
return null;
}
if (!$Validation->isNumber($attribute['twitter_tweet_number'], 1, 200)) {
return null;
}
if (!$Validation->isBool($attribute['carousel_enable'])) {
return null;
}
if (!$Validation->isBool($attribute['carousel_autoplay_enable'])) {
return null;
}
if (!$Validation->isBool($attribute['carousel_circular_enable'])) {
return null;
}
if (!$Validation->isBool($attribute['carousel_infinite_enable'])) {
return null;
}
if (!$Validation->isBool($attribute['carousel_scroll_pause_hover'])) {
return null;
}
if (!array_key_exists($attribute['carousel_scroll_fx'], $CarouFredSel->scrollFX)) {
return null;
}
if (!array_key_exists($attribute['carousel_scroll_easing'], $Easing->easingType)) {
return null;
}
if (!$Validation->isNumber($attribute['carousel_scroll_duration'], 1, 99999)) {
return null;
}
$this->includeLibrary('twitteroauth/twitteroauth.php');
$connection = new TwitterOAuth($attribute['twitter_consumer_key'], $attribute['twitter_consumer_key_secret'], $attribute['twitter_access_token'], $attribute['twitter_access_token_secret']);
$tweet = $connection->get('https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=' . $attribute['twitter_username'] . '&count=' . $attribute['twitter_tweet_number']);
if (is_null($tweet)) {
return null;
}
if (is_wp_error($tweet)) {
return null;
}
if (array_key_exists('errors', $tweet)) {
if (count($tweet['errors'])) {
return;
}
}
$data = array();
$data['tweet'] = $tweet;
$data['attribute'] = $attribute;
$data['id'] = PBHelper::createId('pb_twitter_user_timeline');
$data['option'] = PBHelper::getValueFromArray($attribute, array('carousel_enable', 'carousel_autoplay_enable', 'carousel_circular_enable', 'carousel_infinite_enable', 'carousel_scroll_pause_hover', 'carousel_scroll_fx', 'carousel_scroll_easing', 'carousel_scroll_duration'));
$Template = new PBTemplate($data, $this->getTemplateFullPath('template'));
return $Template->output(true);
}