jquery_social_stream.module in jQuery social stream 7
Same filename and directory in other branches
Code for the Campaign social media module.
File
jquery_social_stream.moduleView source
<?php
/**
* @file
* Code for the Campaign social media module.
*/
define('JQUERY_SOCIAL_STREAM_TWITTER_PATH', 'twitter');
/**
* Implements hook_ctools_plugin_directory().
*/
function jquery_social_stream_ctools_plugin_directory($owner, $plugin_type) {
if ($owner == 'ctools' && $plugin_type == 'content_types') {
return 'plugins/' . $plugin_type;
}
}
/**
* Implements hook_menu().
*/
function jquery_social_stream_menu() {
$items = array();
$items['admin/config/services/jquery-social-stream'] = array(
'title' => 'jQuery social stream',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'jquery_social_stream_admin_form',
),
'access arguments' => array(
'administer site configuration',
),
'file' => 'jquery_social_stream.admin.inc',
);
$items['js/jquery_social_stream/' . JQUERY_SOCIAL_STREAM_TWITTER_PATH] = array(
'page callback' => 'jquery_social_stream_twitter_callback',
'file' => 'jquery_social_stream.js.inc',
'access callback' => TRUE,
);
return $items;
}
/**
* Implements hook_js().
*/
function jquery_social_stream_js() {
return array(
JQUERY_SOCIAL_STREAM_TWITTER_PATH => array(
'callback' => 'jquery_social_stream_twitter_callback',
'page arguments' => array(),
'includes' => array(),
'dependencies' => array(),
'file' => 'jquery_social_stream.js.inc',
'bootstrap' => DRUPAL_BOOTSTRAP_DATABASE,
'skip_hook_init' => TRUE,
'i18n' => FALSE,
),
);
}
/**
* Implements hook_theme().
*/
function jquery_social_stream_theme() {
return array(
'jquery_social_stream' => array(
'variables' => array(
'content_id' => '',
'content' => '',
'header' => '',
'footer' => '',
),
'template' => 'jquery_social_stream',
),
);
}
/**
* Implements hook_block_info().
*/
function jquery_social_stream_block_info() {
$blocks = array();
$blocks['jquery_social_stream'] = array(
'info' => t('jQuery social stream'),
);
return $blocks;
}
/**
* Implements hook_block_view().
*/
function jquery_social_stream_block_view($delta = '') {
switch ($delta) {
case 'jquery_social_stream':
$conf = variable_get('jquery_social_stream_block', array());
return jquery_social_stream_block_content($conf);
}
}
/**
* Implements hook_block_configure().
*/
function jquery_social_stream_block_configure($delta = '') {
switch ($delta) {
case 'jquery_social_stream':
$conf = variable_get('jquery_social_stream_block', array());
if (empty($conf['id'])) {
$conf['id'] = 'block-jquery-social-stream';
}
return jquery_social_stream_settings_form($conf);
}
}
/**
* Implements hook_block_save().
*/
function jquery_social_stream_block_save($delta = '', $edit = array()) {
switch ($delta) {
case 'jquery_social_stream':
variable_set('jquery_social_stream_block', $edit);
break;
}
}
/**
* Implements hook_bean_types_api_info().
*/
function jquery_social_stream_bean_types_api_info() {
return array(
'api' => 4,
);
}
/**
* Implements hook_bean_types().
*/
function jquery_social_stream_bean_types() {
$plugins = array();
$plugins['jquery_social_stream'] = array(
'label' => t('jQuery social stream'),
'handler' => array(
'class' => 'JquerySocialStreamBean',
'parent' => 'bean',
'path' => drupal_get_path('module', 'jquery_social_stream') . '/plugins/bean',
'file' => 'jquery_social_stream.inc',
),
);
return $plugins;
}
/**
* Returns content of feed block.
*/
function jquery_social_stream_block_content($conf, $content = '') {
global $base_path;
$block = array();
$content_id = $conf['id'];
unset($conf['id']);
$header = $conf['header'];
unset($conf['header']);
$footer = $conf['footer'];
unset($conf['footer']);
if (isset($conf['general']) && is_array($conf['general'])) {
$conf += $conf['general'];
}
unset($conf['general']);
// Twitter callback path.
$conf['feeds']['twitter']['url'] = $base_path . 'js/jquery_social_stream/' . JQUERY_SOCIAL_STREAM_TWITTER_PATH;
// Google+ API key.
$conf['feeds']['google']['api_key'] = variable_get('jquery_social_stream_google_key', '');
// Instagram API info.
$conf['feeds']['instagram']['accessToken'] = variable_get('jquery_social_stream_instagram_access_token', '');
$conf['feeds']['instagram']['redirectUrl'] = variable_get('jquery_social_stream_instagram_redirect_url', '');
$conf['feeds']['instagram']['clientId'] = variable_get('jquery_social_stream_instagram_client_id', '');
if (!empty($conf['wall'])) {
$conf['theme'] = 'dark_1';
$conf['rotate'] = array(
'delay' => 0,
);
}
if (!empty($conf['theme'])) {
$styles = jquery_social_stream_styles();
$style = $styles[$conf['theme']];
$conf['iconPath'] = $GLOBALS['base_path'] . $style['iconPath'];
$conf['imagePath'] = $GLOBALS['base_path'] . $style['imagePath'];
$css = $style['css'];
foreach ($style['classes'] as $key => $val) {
$conf[$key] = $val;
}
}
$block['subject'] = '';
$block['content'] = array(
'#theme' => 'jquery_social_stream',
'#content_id' => $content_id,
'#content' => $content,
'#header' => $header,
'#footer' => $footer,
'#attached' => array(
'js' => array(),
),
);
if (empty($conf['wall'])) {
if (isset($css)) {
$block['content']['#attached']['css'] = array(
$css,
);
}
}
else {
// Plugin wall js.
$block['content']['#attached']['js'][] = array(
'data' => libraries_get_path('jquery-social-stream') . '/js/jquery.social.stream.wall.js',
'type' => 'file',
);
$block['content']['#attached']['css'] = array(
libraries_get_path('jquery-social-stream') . '/css/dcsns_wall.css',
);
}
// Plugin stream js.
$block['content']['#attached']['js'][] = array(
'data' => libraries_get_path('jquery-social-stream') . '/js/jquery.social.stream.min.js',
'type' => 'file',
);
// Module's js.
$block['content']['#attached']['js'][] = array(
'data' => drupal_get_path('module', 'jquery_social_stream') . '/jquery_social_stream.js',
'type' => 'file',
);
// Settings.
$block['content']['#attached']['js'][] = array(
'data' => array(
'jQuerySocialStream' => array(
$content_id => $conf,
),
),
'type' => 'setting',
);
return $block;
}
/**
* Returns textfield form element.
*/
function _jquery_social_stream_settings_text(&$form, $conf, $name, $title, $description, $default = '', $maxlength = 128) {
$form[$name] = array(
'#type' => 'textfield',
'#title' => t($title),
'#description' => t($description),
'#default_value' => isset($conf[$name]) ? $conf[$name] : $default,
'#maxlength' => $maxlength,
);
}
/**
* Returns textfield form element.
*/
function _jquery_social_stream_settings_select(&$form, $conf, $name, $title, $description, $options, $default) {
$form[$name] = array(
'#type' => 'select',
'#title' => t($title),
'#description' => t($description),
'#options' => $options,
'#default_value' => isset($conf[$name]) ? $conf[$name] : $default,
);
}
/**
* Available plugin styles.
*/
function jquery_social_stream_styles() {
return array(
'light_1' => array(
'title' => t('Light 1'),
'css' => libraries_get_path('jquery-social-stream') . '/css/dcsns_light.css',
'iconPath' => libraries_get_path('jquery-social-stream') . '/images/dcsns-light/',
'imagePath' => libraries_get_path('jquery-social-stream') . '/images/dcsns-light/',
'classes' => array(
'container' => 'dcsns',
'cstream' => 'stream',
'content' => 'dcsns-content',
),
),
'light_2' => array(
'title' => t('Light 2'),
'css' => libraries_get_path('jquery-social-stream') . '/css/dcsns_light.css',
'iconPath' => libraries_get_path('jquery-social-stream') . '/images/dcsns-light-1/',
'imagePath' => libraries_get_path('jquery-social-stream') . '/images/dcsns-light-1/',
'classes' => array(
'container' => 'dcsns',
'cstream' => 'stream',
'content' => 'dcsns-content',
),
),
'dark_1' => array(
'title' => t('Dark 1'),
'css' => libraries_get_path('jquery-social-stream') . '/css/dcsns_dark.css',
'iconPath' => libraries_get_path('jquery-social-stream') . '/images/dcsns-dark/',
'imagePath' => libraries_get_path('jquery-social-stream') . '/images/dcsns-dark/',
'classes' => array(
'container' => 'dcsns',
'cstream' => 'stream',
'content' => 'dcsns-content',
),
),
'dark_2' => array(
'title' => t('Dark 2'),
'css' => libraries_get_path('jquery-social-stream') . '/css/dcsns_dark.css',
'iconPath' => libraries_get_path('jquery-social-stream') . '/images/dcsns-dark-1/',
'imagePath' => libraries_get_path('jquery-social-stream') . '/images/dcsns-dark-1/',
'classes' => array(
'container' => 'dcsns',
'cstream' => 'stream',
'content' => 'dcsns-content',
),
),
);
}
/**
* General stream settings.
*/
function jquery_social_stream_settings_form($conf) {
$form = array();
$general_form = jquery_social_stream_common_form(!empty($conf['general']) ? $conf['general'] : array());
$general_form['#type'] = 'fieldset';
$general_form['#title'] = 'General settings';
$general_form['#tree'] = TRUE;
$general_form['#collapsible'] = TRUE;
$general_form['#collapsed'] = TRUE;
$form['id'] = array(
'#type' => 'textfield',
'#title' => 'Feed ID',
'#description' => 'Feed container <em>id</em> attribute.',
'#required' => TRUE,
'#default_value' => isset($conf['id']) ? $conf['id'] : '',
);
$form['header'] = array(
'#type' => 'textfield',
'#title' => t('Header text'),
'#description' => 'Text right above the feed.',
'#default_value' => isset($conf['header']) ? $conf['header'] : '',
);
$form['footer'] = array(
'#type' => 'textfield',
'#title' => t('Footer text'),
'#description' => 'Text right below the feed.',
'#default_value' => isset($conf['footer']) ? $conf['footer'] : '',
);
$form['general'] = $general_form;
$form['feeds'] = array(
'#type' => 'fieldset',
'#title' => t('Feeds'),
'#tree' => TRUE,
);
$types = array(
'facebook' => t('Facebook'),
'twitter' => t('Twitter'),
'google' => t('Google +1'),
'youtube' => t('YouTube'),
'flickr' => t('Flickr'),
'delicious' => t('Delicious'),
'pinterest' => t('Pinterest'),
'rss' => t('RSS feed'),
'lastfm' => t('Last.fm'),
'dribbble' => t('Dribbble'),
'vimeo' => t('Vimeo'),
'stumbleupon' => t('Stumbleupon'),
'deviantart' => t('Deviantart'),
'tumblr' => t('Tumblr'),
'instagram' => t('Instagram'),
);
foreach ($types as $type => $type_name) {
$function = "jquery_social_stream_{$type}_form";
if (function_exists($function)) {
$type_form = $function(!empty($conf['feeds'][$type]) ? $conf['feeds'][$type] : array());
$type_form['#type'] = 'fieldset';
$type_form['#title'] = $type_name;
$type_form['#collapsible'] = TRUE;
$type_form['#collapsed'] = TRUE;
$form['feeds'][$type] = $type_form;
}
}
return $form;
}
/**
* Common stream settings.
*/
function jquery_social_stream_common_form($conf) {
$form = array();
_jquery_social_stream_settings_text($form, $conf, 'remove', 'Removed posts', 'This option allows you to remove specific posts from the stream. To remove posts enter the URL of the post. To remove multiple posts enter each URL separated by a comma (e.g <em>https://twitter.com/designchemical/status/364012915533164544</em>)');
_jquery_social_stream_settings_text($form, $conf, 'twitterId', 'Twitter ID', 'Enter your twitter username to be used when sharing posts via twitter - this will be added to the tweets as "via @username".');
_jquery_social_stream_settings_select($form, $conf, 'max', 'Feed size mode', 'Set whether to create the feed based on maximum days or number of results per network.', array(
'days' => t('Age'),
'limit' => t('Limit'),
), 'days');
_jquery_social_stream_settings_text($form, $conf, 'days', 'Age', 'Maximum age of stream items in days.', 30);
$form['days']['#states'] = array(
'visible' => array(
':input[name$="[max]"]' => array(
'value' => 'days',
),
),
);
_jquery_social_stream_settings_text($form, $conf, 'limit', 'Limit', 'Maximum number of results to check/return for each social network.', 50);
$form['limit']['#states'] = array(
'visible' => array(
':input[name$="[max]"]' => array(
'value' => 'limit',
),
),
);
_jquery_social_stream_settings_select($form, $conf, 'external', 'External links', 'Select whether to open all links in new browser window.', array(
1 => t('Yes'),
0 => t('No'),
), 0);
_jquery_social_stream_settings_text($form, $conf, 'speed', 'Speed', 'Speed (in milliseconds) of animation.', '600');
_jquery_social_stream_settings_text($form, $conf, 'height', 'Height', 'Height in pixels of stream container.', '520');
_jquery_social_stream_settings_select($form, $conf, 'wall', 'Wall', 'Select whether to output the social stream as an isotope powered social network wall.', array(
1 => t('Yes'),
0 => t('No'),
), 0);
_jquery_social_stream_settings_select($form, $conf, 'order', 'Order', 'Set to <em>Random</em> to order wall feed items randomly as opposed to by <em>Date</em>.', array(
'date' => 'Date',
'random' => t('Random'),
), 'date');
_jquery_social_stream_settings_select($form, $conf, 'filter', 'Filter', 'Select whether to include a filter navigation allowing the user to filter specific social networks.', array(
1 => t('Yes'),
0 => t('No'),
), 1);
_jquery_social_stream_settings_select($form, $conf, 'controls', 'Controls', 'Select whether to include links for controlling feed rotator.', array(
1 => t('Yes'),
0 => t('No'),
), 1);
$form['rotate'] = array(
'#type' => 'fieldset',
'#title' => t('Rotate'),
'#tree' => TRUE,
'#description' => t('Feed rotator options.'),
'#states' => array(
'visible' => array(
':input[name$="[wall]"]' => array(
'value' => 0,
),
),
),
);
if (!isset($conf['rotate'])) {
$conf['rotate'] = array();
}
_jquery_social_stream_settings_select($form['rotate'], $conf['rotate'], 'direction', 'Direction', 'Direction for content rotation', array(
'up' => t('Up'),
'down' => t('Down'),
), 'up');
_jquery_social_stream_settings_text($form['rotate'], $conf['rotate'], 'delay', 'Delay', 'Delay in milliseconds between rotations - if set to 0 the automatic rotation effect is disabled.', '8000');
_jquery_social_stream_settings_select($form, $conf, 'cache', 'Cache', 'Select whether to cache AJAX response, set to false to force response not to be cached by the browser.', array(
1 => t('Yes'),
0 => t('No'),
), 0);
$styles = jquery_social_stream_styles();
foreach ($styles as &$style) {
$style = $style['title'];
}
$styles[NULL] = t('Custom');
$form['theme'] = array(
'#type' => 'select',
'#title' => t('Stream style'),
'#description' => t('Select one of pre-defined themes, or <em>Custom</em> to define custom styling.'),
'#options' => $styles,
'#default_value' => isset($conf['theme']) ? $conf['theme'] : reset($styles),
'#states' => array(
'visible' => array(
':input[name$="[wall]"]' => array(
'value' => 0,
),
),
),
);
_jquery_social_stream_settings_text($form, $conf, 'container', 'Container class', 'CSS class of main element', 'dcsns');
_jquery_social_stream_settings_text($form, $conf, 'cstream', 'Stream list class', 'CSS class of stream ul tag.', 'stream');
_jquery_social_stream_settings_text($form, $conf, 'content', 'Content class', 'CSS class of main content wrapper.', 'dcsns-content');
_jquery_social_stream_settings_text($form, $conf, 'iconPath', 'Icon path', '', $GLOBALS['base_path'] . libraries_get_path('jquery-social-stream') . '/images/dcsns-dark/');
_jquery_social_stream_settings_text($form, $conf, 'imagePath', 'Image path', '', $GLOBALS['base_path'] . libraries_get_path('jquery-social-stream') . '/images/dcsns-dark/');
$form['iconPath']['#states'] = $form['imagePath']['#states'] = $form['container']['#states'] = $form['cstream']['#states'] = $form['content']['#states'] = array(
'visible' => array(
':input[name$="[theme]"]' => array(
'value' => '',
),
),
);
_jquery_social_stream_settings_select($form, $conf, 'debug', 'Debug', 'Select whether to include returned error messages in feed items', array(
1 => t('Yes'),
0 => t('No'),
), 0);
return $form;
}
/**
* Twitter settings form.
*/
function jquery_social_stream_twitter_form($conf) {
$form = array();
$api_key = variable_get('jquery_social_stream_twitter_api_key', '');
if (!$api_key) {
$form['#description'] = t('Please note you must enter Twitter API keys at <a href="/admin/config/services/jquery-social-stream">admin/config/services/jquery-social-stream</a> to display Twitter feed');
}
$id_description = '<p>Twitter has 3 different feed options:</p>
<dl>
<dt>Tweets from a specific user name</dt>
<dd>Enter the required user name (minus the "@" symbol) (e.g. <em>designchemical</em>)</dd>
<dt>Tweets from a list</dt>
<dd>To show a list enter "/" followed by the list ID you want to display (e.g. <em>/9927875</em>)</dd>
<dt>Tweets from a search</dt>
<dd>Enter "#" followed by the search term (e.g. <em>#designchemical</em>)</dd></dl>';
_jquery_social_stream_settings_text($form, $conf, 'id', 'Twitter ID', $id_description, '', 512);
_jquery_social_stream_settings_select($form, $conf, 'retweets', 'Retweets', 'Select whether to to include retweets.', array(
1 => t('Yes'),
0 => t('No'),
), 0);
_jquery_social_stream_settings_select($form, $conf, 'replies', 'Replies', 'Select whether to to include replies.', array(
1 => t('Yes'),
0 => t('No'),
), 0);
_jquery_social_stream_settings_text($form, $conf, 'intro', 'Intro', 'Feed item intro text.', t('Tweeted'));
_jquery_social_stream_settings_text($form, $conf, 'search', 'Search', 'Search item intro text.', t('Tweeted'));
_jquery_social_stream_settings_text($form, $conf, 'out', 'Output', 'Stream item output: content blocks & order. Available options: intro, text, user, share.', 'intro,text,user,share');
$images_options = array(
'' => 'None',
'thumb' => 'Thumb (150x150 px)',
'small' => 'Small (340x150 px)',
'medium' => 'Medium (600x264 px)',
'large' => 'Large (768x346 px)',
);
_jquery_social_stream_settings_select($form, $conf, 'images', 'Images', 'Option to show twitter images. Select one of the sizes to include the image when available or <em>None</em> to exclude images.', $images_options, '');
$form['icon'] = array(
'#type' => 'value',
'#value' => 'twitter.png',
);
$form['url'] = array(
'#type' => 'value',
'#value' => 'js/jquery_social_stream/' . JQUERY_SOCIAL_STREAM_TWITTER_PATH,
);
return $form;
}
/**
* Facebook settings form.
*/
function jquery_social_stream_facebook_form($conf) {
$form = array();
$id_description = '<p>Facebook has 2 different ID options:</p>
<dl>
<dt>Facebook page wall posts</dt>
<dd>Enter the page ID. For facebook page posts the ID of your facebook page must be used -
this should be a numerical value, not the actual name of your facebook page (e.g. <em>157969574262873</em>).
To get the ID from your username you can use the following tool from facebook - replace "[username]" with the
name of your Facebook page profile: https://graph.facebook.com/[username]</dd>
<dt>Facebook page gallery images</dt>
<dd>Enter the text you would like to show for the facebook gallery name followed by "/" followed by the page gallery ID (e.g. <em>Facebook Timeline/376995711728</em>)</dd></dl>';
_jquery_social_stream_settings_text($form, $conf, 'id', 'Facebook ID', $id_description, '', 512);
_jquery_social_stream_settings_text($form, $conf, 'intro', 'Intro', 'Feed item intro text.', t('Posted to wall'));
_jquery_social_stream_settings_text($form, $conf, 'out', 'Output', 'Stream item output: content blocks & order. Available options: intro, title, text, user, share.', 'intro,title,text,user,share');
$text_options = array(
'content' => 'Content',
'contentSnippet' => 'Content snippet',
);
_jquery_social_stream_settings_select($form, $conf, 'text', 'Text', 'Select the RSS element to use in the feed output. <em>Content</em> (default) will output complete wall post text including any images. <em>Content snippet</em> shows brief introduction.', $text_options, 'content');
$comments_options = range(0, 25);
$comments_options = array_combine($comments_options, $comments_options);
_jquery_social_stream_settings_select($form, $conf, 'comments', 'Comments', 'the maximum number of comments to display for facebook page gallery images.', $comments_options, 3);
$width_options = array(
3 => '600px',
4 => '480px',
5 => '320px',
6 => '180px',
);
_jquery_social_stream_settings_select($form, $conf, 'image_width', 'Image width', 'Select the image size for facebook gallery images.', $width_options, 6);
$form['icon'] = array(
'#type' => 'value',
'#value' => 'facebook.png',
);
return $form;
}
/**
* Google +1 settings form.
*/
function jquery_social_stream_google_form($conf) {
$form = array();
$api_key = variable_get('jquery_social_stream_google_key', '');
if (!$api_key) {
$form['#description'] = t('Please note you must enter Google +1 API key at <a href="/admin/config/services/jquery-social-stream">admin/config/services/jquery-social-stream</a> to display Google +1 feed');
}
_jquery_social_stream_settings_text($form, $conf, 'id', 'Google +1 profile IDs', '', '', 512);
_jquery_social_stream_settings_text($form, $conf, 'intro', 'Feed item intro text', '', 'Shared');
_jquery_social_stream_settings_text($form, $conf, 'out', 'Output', 'Stream item output: content blocks & order. Available options are: intro, thumb, title, text, share', 'intro,thumb,title,text,share');
_jquery_social_stream_settings_text($form, $conf, 'image_height', 'Google +1 Thumbnail height', '', '90');
_jquery_social_stream_settings_text($form, $conf, 'image_width', 'Google +1 Thumbnail width', '', '90');
_jquery_social_stream_settings_select($form, $conf, 'shares', 'Include share stats', '', array(
1 => t('Yes'),
0 => t('No'),
), 1);
return $form;
}
/**
* YouTube settings form.
*/
function jquery_social_stream_youtube_form($conf) {
$form = array();
_jquery_social_stream_settings_text($form, $conf, 'id', 'YouTube ID', '<p>YouTube has 2 different ID options:</p>
<dl><dt>Videos from a specific user name</dt><dd>Enter the required user name (e.g. <em>designchemical</em>)</dd>
<dt>Videos from a search</dt><dd>Enter "#" followed by the search term (e.g. <em>#designchemical</em>)</dd>
<dt>Videos from a playlist</dt><dd>Enter the text you would like to show for the playlist name followed by "/" then the playlist ID (e.g. <em>Playlist Title/8BCDD04DE8F771B2</em>)</dd></dl>
<p>Note: The maximum limit for each youtube feed is 50 - if the limit option is set higher than 50 the plugin will automatically use 50 for youtube feeds.</p>', '', 512);
_jquery_social_stream_settings_text($form, $conf, 'intro', 'Feed item intro text', '', 'Uploaded,Favorite,New Video');
_jquery_social_stream_settings_text($form, $conf, 'search', 'Search item intro text', '', 'Search');
_jquery_social_stream_settings_text($form, $conf, 'out', 'Output', 'Stream item output: content blocks & order. Available options: intro, thumb, title, text, user, share', 'intro,thumb,title,text,share');
_jquery_social_stream_settings_text($form, $conf, 'feed', 'Feed options', 'Availavle options: uploads, favorites, newsubscriptionvideos. Only applies to user names.', 'uploads,favorites,newsubscriptionvideos');
_jquery_social_stream_settings_select($form, $conf, 'thumb', 'Size of thumbnail image', '', array(
'default' => '120px',
0 => '480px',
), 'default');
return $form;
}
/**
* Flickr settings form.
*/
function jquery_social_stream_flickr_form($conf) {
$form = array();
_jquery_social_stream_settings_text($form, $conf, 'id', 'Flickr ID ', '<p>Flickr has 2 different ID options:</p>
<dl><dt>Uploads from a specific user name</dt><dd>Enter the required user name</dd><dt>Images from a group</dt><dd>Enter "/" followed by the flickr group ID</dd></dl>', '', 512);
_jquery_social_stream_settings_text($form, $conf, 'out', 'Output', 'Stream item output: content blocks & order. Available options: intro, thumb, title, text, share', 'intro,thumb,title,text,share');
_jquery_social_stream_settings_text($form, $conf, 'lang', 'Language', '', 'en-us');
return $form;
}
/**
* Delicious settings form.
*/
function jquery_social_stream_delicious_form($conf) {
$form = array();
_jquery_social_stream_settings_text($form, $conf, 'id', 'Delicious usernames', 'You can enter multiple usernames separated by comma.', '', 512);
_jquery_social_stream_settings_text($form, $conf, 'intro', 'Feed item intro text', '', 'Bookmarked');
_jquery_social_stream_settings_text($form, $conf, 'out', 'Output', 'Stream item output: content blocks & order. Available options: intro, thumb, title, text, user, share', 'intro,thumb,title,text,user,share');
return $form;
}
/**
* Pinterest settings form.
*/
function jquery_social_stream_pinterest_form($conf) {
$form = array();
_jquery_social_stream_settings_text($form, $conf, 'id', 'Pinterest ID', '<p>Pinterest has 2 different ID options:</p>
<dl><dt>Posts for a user name</dt><dd>Enter the required user name</dd><dt>Posts for a specific user board</dt><dd>Enter the user name followed by "/" and then the board name (e.g. <em>designchemical/design-ideas</em>)</dd></dl>', '', 512);
_jquery_social_stream_settings_text($form, $conf, 'intro', 'Pinned', 'Feed item intro text');
_jquery_social_stream_settings_text($form, $conf, 'out', 'Output', 'Stream item output: content blocks & order. Available options: intro, thumb, title, text, user, share', 'intro,thumb,title,text,user,share');
return $form;
}
/**
* RSS feed settings form.
*/
function jquery_social_stream_rss_form($conf) {
$form = array();
_jquery_social_stream_settings_text($form, $conf, 'id', 'RSS feed URLs', 'You can enter multiple URLs separated by comma.', '', 1024);
_jquery_social_stream_settings_text($form, $conf, 'intro', 'Feed item intro text', '', 'Posted');
_jquery_social_stream_settings_text($form, $conf, 'out', 'Output', 'Stream item output: content blocks & order. Available options: intro, title, text, share', 'intro,thumb,title,text,share');
_jquery_social_stream_settings_select($form, $conf, 'text', 'RSS element', 'Select the RSS element to use in the feed output. <em>Content</em> will output complete wall post text including any images, <em>Сontent snippet</em> (default) shows brief introduction.', array(
'contentSnippet' => t('Content snippet'),
'content' => t('Content'),
), 'contentSnippet');
return $form;
}
/**
* Last.fm settings form.
*/
function jquery_social_stream_lastfm_form($conf) {
$form = array();
_jquery_social_stream_settings_text($form, $conf, 'id', 'Last.fm usernames', 'You can enter multiple usernames separated by comma.', '', 512);
_jquery_social_stream_settings_text($form, $conf, 'intro', 'Feed item intro text', 'Listened to,Loved,Replied');
_jquery_social_stream_settings_text($form, $conf, 'out', 'Output', 'Stream item output: content blocks & order. Available options: intro, thumb, title, text, user, share', 'intro,thumb,title,text,user,share');
_jquery_social_stream_settings_text($form, $conf, 'feed', 'Feed type', '<p>Options include</p><dl>
<dt>lovedtracks</dt><dd>A feed of tracks a user has loved</dd>
<dt>recenttracks</dt><dd>10 recently played tracks for this profile</dd>
<dt>replytracker</dt><dd>A feed of replies to a user\'s forum posts and journal comments</dd>', 'recenttracks,lovedtracks,replytracker');
return $form;
}
/**
* Dribbble settings form.
*/
function jquery_social_stream_dribbble_form($conf) {
$form = array();
_jquery_social_stream_settings_text($form, $conf, 'id', 'Dribbble ID', '');
_jquery_social_stream_settings_text($form, $conf, 'intro', 'Feed item intro text', 'Posted shot,Liked');
_jquery_social_stream_settings_text($form, $conf, 'out', 'Output', 'Stream item output: content blocks & order. Available options: intro, thumb, title, text, user, share', 'intro,thumb,title,text,user,share');
_jquery_social_stream_settings_text($form, $conf, 'feed', 'Feed type', 'Options available: shots, likes', 'shots,likes');
return $form;
}
/**
* Vimeo settings form.
*/
function jquery_social_stream_vimeo_form($conf) {
$form = array();
_jquery_social_stream_settings_text($form, $conf, 'id', 'Vimeo ID', '');
_jquery_social_stream_settings_text($form, $conf, 'intro', 'Feed item intro text', 'Liked,Video,Appeared In,Video,Album,Channel,Group');
_jquery_social_stream_settings_text($form, $conf, 'out', 'Output', 'Stream item output: content blocks & order. Available options: intro, thumb, title, text, user, share', 'intro,thumb,title,text,user,share');
_jquery_social_stream_settings_text($form, $conf, 'feed', 'Feed', '<p>Options available:</p><dl><dt>likes</dt><dd>Most recent likes</dd>
<dt>videos</dt><dd>Videos created by user</dd>
<dt>appears_in</dt><dd>Videos that the user appears in</dd>
<dt>all_videos</dt><dd>Videos that the user appears in and created</dd>
<dt>albums</dt><dd>Albums the user has created</dd>
<dt>channels</dt><dd>Channels the user has created and subscribed to</dd>
<dt>groups</dt><dd>Groups the user has created and joined</dd></dl>', 'likes,videos,appears_in,all_videos,albums,channels,groups');
_jquery_social_stream_settings_select($form, $conf, 'thumb', 'Size of thumbnail image', '', array(
'small' => t('100px wide'),
'medium' => t('200px wide'),
'large' => t('640px wide'),
), 'medium');
_jquery_social_stream_settings_select($form, $conf, 'stats', 'Stats', 'If selected the feed will include statistics (e.g. number of likes, views, comments, etc)', array(
1 => t('Yes'),
0 => t('No'),
), 1);
return $form;
}
/**
* Stumbleupon settings form.
*/
function jquery_social_stream_stumbleupon_form($conf) {
$form = array();
_jquery_social_stream_settings_text($form, $conf, 'id', 'Stumbleupon usernames', 'You can enter multiple usernames separated by comma.', '', 512);
_jquery_social_stream_settings_text($form, $conf, 'intro', 'Feed item intro text', 'Shared,Reviewed');
_jquery_social_stream_settings_text($form, $conf, 'out', 'Output', 'Stream item output: content blocks & order. Available options: intro, thumb, title, text, user, share', 'intro,thumb,title,text,user,share');
_jquery_social_stream_settings_text($form, $conf, 'feed', 'Feed', '<p>Options available:</p><dl><dt>favorites</dt><dd>The sites you thumbed up</dd><dt>reviews</dt><dd>Reviews you have written</dd>', 'favorites,reviews');
return $form;
}
/**
* Deviantart settings form.
*/
function jquery_social_stream_deviantart_form($conf) {
$form = array();
_jquery_social_stream_settings_text($form, $conf, 'id', 'Deviantart usernames', 'You can enter multiple usernames separated by comma.', '', 512);
_jquery_social_stream_settings_text($form, $conf, 'intro', 'Feed item intro text', 'Deviation');
_jquery_social_stream_settings_text($form, $conf, 'out', 'Output', 'Stream item output: content blocks & order. Available options: intro, thumb, title, text, user, share', 'intro,thumb,title,text,user,share');
return $form;
}
/**
* Tumblr settings form.
*/
function jquery_social_stream_tumblr_form($conf) {
$form = array();
_jquery_social_stream_settings_text($form, $conf, 'id', 'Tumblr usernames', 'You can enter multiple usernames separated by comma.', '', 512);
_jquery_social_stream_settings_text($form, $conf, 'intro', 'Feed item intro text', 'Posted');
_jquery_social_stream_settings_text($form, $conf, 'out', 'Output', 'Stream item output: content blocks & order. Available options: intro, title, text, user, share', 'intro,title,text,user,share');
_jquery_social_stream_settings_select($form, $conf, 'thumb', 'Width of thumbnail image', '', array(
'75' => t('75px'),
'100' => t('100px'),
'250' => t('250px'),
'400' => t('400px'),
'500' => t('500px'),
'1280' => t('1280px'),
), '100');
_jquery_social_stream_settings_select($form, $conf, 'video', 'Width of video player', 'For video type posts.', array(
'250' => t('250px'),
'400' => t('400px'),
'500' => t('500px'),
), '250');
return $form;
}
/**
* Instagram settings form.
*/
function jquery_social_stream_instagram_form($conf) {
$form = array();
$access_token = variable_get('jquery_social_stream_instagram_access_token', '');
if (!$access_token) {
$form['#description'] = t('Please note you must enter Instagram API info at <a href="/admin/config/services/jquery-social-stream">admin/config/services/jquery-social-stream</a> to display Instagram feed');
}
_jquery_social_stream_settings_text($form, $conf, 'id', 'Instagram ID', '<p>Instagram can handle 4 different types of network feed ID - search, tags, user ID and a location ID:</p>
<dl>
<dt>Search</dt><dd>This will return Instagram posts based on a geographical location, which is defined by a latitude & longitude plus a distance. To enter a search ID start with the character "?" followed by the latitude, longitude and distance in meters (up to a maximum of 5000) all separated by a "/" (e.g. <em>?55.5/0/20</em>)</dd>
<dt>Tags</dt><dd>To search by tag start with the character "#" followed by the tag (e.g. <em>#london</em>)</dd>
<dt>User ID</dt><dd>To show latest posts by user start the ID with a "!" followed by the user\'s profile ID (e.g. <em>!12345</em>)</dd>
<dt>Location ID</dt><dd>To show latest posts by a location ID start with a "@" followed by the ID (e.g. <em>@12345</em>)</dd>
</dl>
<p>As with all networks multiple feeds can be entered by separating each feed ID with a comma: e.g. id: <em>?50.3/40.8/10,#london,!12345,@12345</em></p>', '', 512);
_jquery_social_stream_settings_text($form, $conf, 'intro', 'Feed item intro text', '', 'Posted');
_jquery_social_stream_settings_text($form, $conf, 'search', 'Search item intro text', '', 'Search');
_jquery_social_stream_settings_text($form, $conf, 'out', 'Output', 'Stream item output: content blocks & order. Available options: intro, thumb, text, user, share, meta', 'intro,thumb,text,user,share,meta');
_jquery_social_stream_settings_text($form, $conf, 'comments', 'Number of comments to display', 'Enter the maximum number of comments to display for each instagram image. Set to zero to disable comments.', '0');
_jquery_social_stream_settings_text($form, $conf, 'likes', 'Number of likes to display', 'Enter the maximum number of profile thumbnails to display for users who have liked a post. Set to zero to disable likes.', '0');
_jquery_social_stream_settings_select($form, $conf, 'thumb', 'Width & Height of image', '', array(
'thumbnail' => t('Thumbnail (150 px)'),
'low_resolution' => t('Low resolution (306 px)'),
'standard_resolution' => t('Standard resolution (612 px)'),
), 'low_resolution');
return $form;
}
Functions
Constants
Name | Description |
---|---|
JQUERY_SOCIAL_STREAM_TWITTER_PATH | @file Code for the Campaign social media module. |