function dc_social_wall_shortcode($atts, $content = null) { extract(shortcode_atts(array('id' => '', 'twitterId' => '', 'limit' => 50, 'days' => 10, 'cols' => 4, 'max' => 'days', 'external' => 'true', 'speed' => 0.6, 'height' => 550, 'filter' => 'true', 'center' => 'false', 'controls' => 'true', 'remove' => '', 'order' => 'date', 'rotate_delay' => 8, 'rotate_direction' => 'up', 'cache' => 'true', 'iconPath' => '/images/dcwss-dark/', 'imagePath' => '/images/dcwss-dark/', 'debug' => 'false'), $atts)); $out = ''; $networks = array(); $options = array(); $defaults = array(); $options = get_option('dcwss_options'); $networks = dcwss_networks('networks'); $settings = dcwss_networks('settings'); $defaults = dcwss_networks('defaults'); $stream = array(); $stream = dcwss_get_stream($id); $i = 0; $t1 = 0; $f1 = 0; $feeds = 'feeds: {'; $params = ''; $opt = ''; if (isset($stream['remove'])) { $remove = $stream['remove']; } else { $remove = ''; } // print_r($stream); foreach ($networks as $function => $f) { if ($function != '' && $stream['feeds_' . $function . '_id'] != '' && $stream['feeds_' . $function . '_id'] != ' ') { $feeds .= $i > 0 ? ',' . $function . ': {' : $function . ': {'; if ($function == 'twitter' && $t1 == 0) { $url_p = '?1=' . trim($options['settings']['consumer_key']) . '&2=' . trim($options['settings']['consumer_secret']) . '&3=' . trim($options['settings']['access_token']) . '&4=' . trim($options['settings']['access_token_secret']); $feeds .= 'url: "' . plugins_url() . '/wordpress-social-stream/inc/dcwp_twitter.php' . $url_p . '",'; // multisite subdomain // $feeds .= 'url: "' . get_bloginfo('url') . '/wp-content/plugins/wordpress-social-stream/inc/dcwp_twitter.php'.$url_p.'",'; $t1 = 1; } if ($function == 'facebook' && $f1 == 0) { $feeds .= 'url: "' . plugins_url() . '/wordpress-social-stream/inc/dcwp_facebook.php",'; // multisite subdomain // $feeds .= 'url: "' . get_bloginfo('url') . '/wp-content/plugins/wordpress-social-stream/inc/dcwp_facebook.php",'; $f1 = 1; } $j = 0; foreach ($defaults[$function] as $k => $v) { if ($k == 'out') { $feeds .= ',' . $k . ': "intro'; $section = explode(',', $defaults[$function][$k]); $m = 1; foreach ($section as $s) { $idv = $stream['feeds_' . $function . '_' . $k . '_' . $s] != '' ? $stream['feeds_' . $function . '_' . $k . '_' . $s] : $def; $x = $m > 0 ? ',' : ''; if ($s != 'intro') { $feeds .= $stream['feeds_' . $function . '_' . $k . '_' . $s] == 'true' ? $x . $s : ''; } $m++; } $feeds .= '"'; } else { if ($k == 'feed' && $function != 'facebook') { $feeds .= ',' . $k . ': "'; $section = explode(',', $defaults[$function][$k]); $m = 0; foreach ($section as $s) { $idv = $stream['feeds_' . $function . '_' . $k . '_' . $s] != '' ? $stream['feeds_' . $function . '_' . $k . '_' . $s] : $def; $x = $m > 0 ? ',' : ''; $feeds .= $stream['feeds_' . $function . '_' . $k . '_' . $s] == 'true' ? $x . $s : ''; $m++; } $feeds .= '"'; } else { if (isset($stream['feeds_' . $function . '_' . $k])) { if ($function . '_' . $k == 'twitter_thumb' || $function . '_' . $k == 'twitter_retweets' || $function . '_' . $k == 'twitter_replies' || $function . '_' . $k == 'facebook_comments' || $function . '_' . $k == 'facebook_image_width' || $function . '_' . $k == 'facebook_thumb') { $feeds .= $j > 0 ? ',' . $k . ': ' . $stream['feeds_' . $function . '_' . $k] : $k . ': ' . $stream['feeds_' . $function . '_' . $k]; } else { $feeds .= $j > 0 ? ',' . $k . ': "' . $stream['feeds_' . $function . '_' . $k] . '"' : $k . ': "' . $stream['feeds_' . $function . '_' . $k] . '"'; } } } } $j++; } $feeds .= '}'; $i++; } } $feeds .= '}'; // remove specific posts if (isset($atts['remove'])) { $opt .= ',remove:"' . $atts['remove'] . '"'; } else { $opt .= ',remove:"' . $remove . '"'; } // get settings if (isset($options['settings'])) { foreach ($options['settings'] as $k => $v) { switch ($k) { case 'speed': $v = $v * 1000; $opt .= $v != $settings[$k] ? ',' . $k . ': ' . $v : ''; break; case 'controls': $opt .= $v != $settings[$k] ? ',controls: "false"' : ''; break; case 'max': if (isset($atts[$k])) { $opt .= ',max: "' . $atts[$k] . '"'; } else { $opt .= $v != $settings[$k] ? ',max: "' . $v . '"' : ''; } break; case 'order': if (isset($atts[$k])) { $opt .= ',order: "' . $atts[$k] . '"'; } else { $opt .= $v != $settings[$k] ? ',order: "' . $v . '"' : ''; } break; case 'results': $atts['max'] = isset($atts['max']) ? $atts['max'] : ''; if ($atts['max'] == '') { if (isset($atts[$k])) { $opt .= ',days: ' . $atts[$k]; $opt .= $options['settings']['max'] == 'limit' ? ',limit: ' . $atts[$k] : ',limit: 100'; } else { $opt .= ',days: ' . $v; $opt .= $options['settings']['max'] == 'limit' ? ',limit: ' . $v : ',limit: 100'; } } else { if ($atts['max'] == 'days') { $opt .= ',limit: 100'; $opt .= $atts[$k] != '' ? ',days: ' . $atts[$k] : ',days: ' . $options['settings']['results']; } else { if ($atts['max'] == 'limit') { $opt .= ',days: ' . $options['settings']['results']; $opt .= $atts[$k] != '' ? ',limit: ' . $atts[$k] : ',limit: ' . $options['settings']['results']; } } } break; case 'rotate_delay': break; case 'rotate_direction': break; case 'consumer_key': break; case 'consumer_secret': break; case 'access_token': break; case 'access_token_secret': break; case 'fb_app_id': break; case 'fb_app_secret': break; case 'cache': if (isset($atts[$k])) { $opt .= ',cache: ' . $atts[$k]; } else { $opt .= $v != $settings[$k] ? ',cache: ' . $v : ''; } break; case 'filter': if (isset($atts[$k])) { $opt .= ',filter: ' . $atts[$k]; } else { $opt .= $v != $settings[$k] ? ',filter: ' . $v : ''; } break; case 'center': if (isset($atts[$k])) { $opt .= ',center: ' . $atts[$k]; } else { $opt .= $v != $settings[$k] ? ',center: ' . $v : ''; } break; case 'twitterId': if (isset($atts[$k])) { $opt .= ',twitterId: "' . $atts[$k] . '"'; } else { $opt .= $v != $settings[$k] ? ',twitterId: "' . $v . '"' : ''; } break; default: if (isset($atts[$k])) { $opt .= ',' . $k . ': ' . $atts[$k]; } else { $opt .= $v != $settings[$k] ? ',' . $k . ': ' . $v : ''; } break; } } } $opt .= ',rotate: {delay: 0'; $opt .= ', direction: "'; if (isset($options['settings']['rotate_direction'])) { $opt .= $options['settings']['rotate_direction'] != $settings['rotate_direction'] ? $options['settings']['rotate_direction'] : $settings['rotate_direction']; } $opt .= '"}'; $config = '{' . $feeds . $opt; $config .= ',wall: true,container: "dcwss",cstream: "stream",content: "dcwss-content"'; $config .= ',imagePath: "' . plugins_url() . '/wordpress-social-stream' . $imagePath . '"'; $config .= ',iconPath: "' . plugins_url() . '/wordpress-social-stream' . $iconPath . '"}'; $out .= '<script type="text/javascript">jQuery(document).ready(function($){'; $out .= 'var config = ' . $config . ';'; $out .= 'if(!jQuery().dcSocialStream) { $.getScript("' . plugins_url() . '/wordpress-social-stream/js/jquery.social.stream.wall.1.6.js", function(){}); $.getScript("' . plugins_url() . '/wordpress-social-stream/js/jquery.social.stream.1.5.13.min.js", function(){$("#social-stream-' . $id . '").dcSocialStream(config);}); } else {'; $out .= '$("#social-stream-' . $id . '.dc-wall").dcSocialStream(config);}});</script>' . "\n"; $out .= '<div class="wall-outer"><div id="social-stream-' . $id . '" class="dc-wall col-' . $cols . '"></div></div>'; return $out; }
<h4>Saved Streams</h4> <p>This section lists all of your previously saved social network streams.</p> <h4>Edit Stream</h4> <p>Click the "edit" icon to display the stream settings in the lower box. Change the stream options and click the "Edit Stream" button to save the new settings.</p> <h4>Delete Stream</h4> <p>Click the "delete" icon to delete the social stream - this will remove the stream completely from the WordPress system.</p> <h4>Social Wall Shortcode</h4> <p>Use the social wall shortcode to add a network wall to your page. The default number of columns for a wall is 4 - if you want to change the number of columns add the "cols" option to the shortcode - e.g. [dc_social_wall id="XXX" cols="3"].</p> </div> <div id="dc-streams"> <?php $id = isset($_GET['stream']) ? $_GET['stream'] : ''; echo dcwss_streams($id); $results = array(); $results = dcwss_get_stream($id); if (isset($_GET['stream'])) { ?> <p></p> <a href="options-general.php?page=social-stream" class="button-secondary">New Stream</a> <?php } ?> </div> </div></div></div></div> <?php $header = !isset($_GET['stream']) ? 'Create New Stream' : 'Edit Stream'; ?> <div class="metabox-holder">