<?php /** * Copyright: dtbaker 2012 * Licence: Please check CodeCanyon.net for licence details. * More licence clarification available here: http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca * Package Date: 2015-11-25 02:55:20 * IP Address: 67.79.165.254 */ if (!module_social::can_i('edit', 'Twitter', 'Social', 'social')) { die('No access to Twitter accounts'); } $social_twitter_id = isset($_REQUEST['social_twitter_id']) ? (int) $_REQUEST['social_twitter_id'] : 0; $twitter_account = new ucm_twitter_account($social_twitter_id); if ($twitter_account->get('social_twitter_id') && $twitter_account->get('social_twitter_id') == $social_twitter_id) { // do a quick oauth. require_once 'includes/plugin_social_twitter/includes/tmhOAuth.php'; class dtbaker_tmhOAuth extends tmhOAuth { public function __construct($config = array()) { $this->config = array_merge(array('consumer_key' => module_config::c('social_twitter_api_key', ''), 'consumer_secret' => module_config::c('social_twitter_api_secret', ''), 'user_agent' => 'UCM Twitter 0.1'), $config); parent::__construct($this->config); } } $tmhOAuth = new dtbaker_tmhOAuth(); function php_self($dropqs = true) { $protocol = 'http';
<?php /** * Copyright: dtbaker 2012 * Licence: Please check CodeCanyon.net for licence details. * More licence clarification available here: http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca * Package Date: 2015-11-25 02:55:20 * IP Address: 67.79.165.254 */ if (!module_social::can_i('view', 'Facebook', 'Social', 'social')) { die('No permissions to view Facebook accounts'); } $facebook_accounts = module_social_facebook::get_accounts(); $header_buttons = array(); $header_buttons[] = array('url' => module_social_facebook::link_open('new', false), 'title' => 'Add New Facebook Account', 'type' => 'add'); print_heading(array('main' => true, 'type' => 'h2', 'title' => 'Facebook Accounts', 'button' => $header_buttons)); ?> <table class="tableclass tableclass_full tableclass_rows"> <thead> <tr class="title"> <th><?php echo _l('Facebook Account Name'); ?> </th> <th><?php echo _l('Last Checked'); ?> </th>
public static function link_generate($social_id = false, $options = array(), $link_options = array()) { // we accept link options from a bubbled link call. // so we have to prepent our options to the start of the link_options array incase // anything bubbled up to this method. // build our options into the $options variable and array_unshift this onto the link_options at the end. $key = 'social_id'; // the key we look for in data arrays, on in _REQUEST variables. for sub link building. // we check if we're bubbling from a sub link, and find the item id from a sub link if (${$key} === false && $link_options) { foreach ($link_options as $link_option) { if (isset($link_option['data']) && isset($link_option['data'][$key])) { ${$key} = $link_option['data'][$key]; break; } } if (!${$key} && isset($_REQUEST[$key])) { ${$key} = $_REQUEST[$key]; } } if (!isset($options['page'])) { $options['page'] = 'social_settings'; } if (!isset($options['arguments'])) { $options['arguments'] = array(); } $options['arguments']['social_id'] = $social_id; $options['module'] = 'social'; $options['text'] = isset($options['text']) ? htmlspecialchars($options['text']) : ''; // generate the arguments for this link $options['arguments'] = array('social_id' => $social_id); // generate the path (module & page) for this link $options['module'] = 'social'; // append this to our link options array, which is eventually passed to the // global link generate function which takes all these arguments and builds a link out of them. if (!module_social::can_i('view', 'Social')) { if (!isset($options['full']) || !$options['full']) { return '#'; } else { return isset($options['text']) ? $options['text'] : _l('N/A'); } } // optionally bubble this link up to a parent link_generate() method, so we can nest modules easily // change this variable to the one we are going to bubble up to: $bubble_to_module = false; if (isset($options['config']) && $options['config']) { $bubble_to_module = array('module' => 'config', 'argument' => 'social_id'); } array_unshift($link_options, $options); if ($bubble_to_module) { global $plugins; return $plugins[$bubble_to_module['module']]->link_generate(false, array(), $link_options); } else { // return the link as-is, no more bubbling or anything. // pass this off to the global link_generate() function return link_generate($link_options); } }
?> <a href="<?php echo module_social_facebook::link_open_facebook_message($message['social_facebook_id'], $message['social_facebook_message_id']); ?> " class="socialfacebook_message_open social_modal btn btn-default btn-xs" data-modal-title="<?php echo htmlspecialchars($message['facebook_message']->get_summary()); ?> "><?php _e('Open'); ?> </a> <?php } ?> <?php if (module_social::can_i('edit', 'Facebook Comments', 'Social', 'social')) { ?> <?php if ($message['facebook_message']->get('status') == _SOCIAL_MESSAGE_STATUS_ANSWERED) { ?> <a href="#" class="socialfacebook_message_action btn btn-default btn-xs" data-action="set-unanswered" data-id="<?php echo (int) $message['facebook_message']->get('social_facebook_message_id'); ?> "><?php _e('Un-Archive'); ?> </a> <?php } else { ?>
<!-- show a list of tabs for all the different social methods, as menu hooks --> <?php /** * Copyright: dtbaker 2012 * Licence: Please check CodeCanyon.net for licence details. * More licence clarification available here: http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca * Package Date: 2015-11-25 02:55:20 * IP Address: 67.79.165.254 */ $module->page_title = _l('Social'); $links = array(); if (module_social::can_i('view', 'Combined Comments', 'Social', 'social')) { $links[] = array("name" => _l('Inbox'), 'm' => 'social', 'p' => 'social_messages', 'args' => array('combined' => 1, 'social_twitter_id' => false, 'social_facebook_id' => false), 'force_current_check' => true, 'order' => 1, 'menu_include_parent' => 0, 'allow_nesting' => 1); //if(isset($_GET['combined'])){ // include('social_messages.php'); //} }
public function output_row($message, $settings) { $twitter_message = new ucm_twitter_message(false, $message['social_twitter_message_id']); ?> <tr class="<?php echo isset($settings['row_class']) ? $settings['row_class'] : ''; ?> twitter_message_row <?php echo !isset($message['read_time']) || !$message['read_time'] ? ' message_row_unread' : ''; ?> " data-id="<?php echo (int) $message['social_twitter_message_id']; ?> " data-social_twitter_id="<?php echo (int) $message['social_twitter_id']; ?> "> <td class="social_column_social"> <img src="<?php echo _BASE_HREF; ?> includes/plugin_social_twitter/images/twitter-logo.png" class="twitter_icon"> <a href="<?php echo $twitter_message->get_link(); ?> " target="_blank"><?php echo htmlspecialchars($twitter_message->get('twitter_account')->get('account_name')); ?> </a> <br/> <?php echo htmlspecialchars($twitter_message->get_type_pretty()); ?> </td> <td class="social_column_time"><?php echo print_date($message['message_time'], true); ?> </td> <td class="social_column_from"> <?php // work out who this is from. $from = $twitter_message->get_from(); ?> <div class="social_from_holder social_twitter"> <div class="social_from_full"> <?php foreach ($from as $id => $from_data) { ?> <div> <a href="//twitter.com/<?php echo htmlspecialchars($from_data['screen_name']); ?> " target="_blank"><img src="<?php echo $from_data['image']; ?> " class="social_from_picture"></a> <?php echo htmlspecialchars($from_data['screen_name']); ?> </div> <?php } ?> </div> <?php reset($from); $current = current($from); echo '<a href="//twitter.com/' . htmlspecialchars($current['screen_name']) . '" target="_blank">' . '<img src="' . $current['image'] . '" class="social_from_picture"></a> '; echo '<span class="social_from_count">'; if (count($from) > 1) { echo '+' . (count($from) - 1); } echo '</span>'; ?> </div> </td> <td class="social_column_summary"> <div class="twitter_message_summary<?php echo !isset($message['read_time']) || !$message['read_time'] ? ' unread' : ''; ?> "> <?php echo $twitter_message->get_summary(); ?> </div> </td> <!--<td></td>--> <td nowrap> <?php if (module_social::can_i('view', 'Twitter Comments', 'Social', 'social')) { ?> <a href="<?php echo module_social_twitter::link_open_twitter_message($message['social_twitter_id'], $message['social_twitter_message_id']); ?> " class="socialtwitter_message_open social_modal btn btn-default btn-xs" data-modal-title="<?php echo _l('Tweet'); ?> "><?php _e('Open'); ?> </a> <?php } ?> <?php if (module_social::can_i('edit', 'Twitter Comments', 'Social', 'social')) { ?> <?php if ($twitter_message->get('status') == _SOCIAL_MESSAGE_STATUS_ANSWERED) { ?> <a href="#" class="socialtwitter_message_action btn btn-default btn-xs" data-action="set-unanswered" data-id="<?php echo (int) $twitter_message->get('social_twitter_message_id'); ?> " data-social_twitter_id="<?php echo (int) $twitter_message->get('social_twitter_id'); ?> "><?php _e('Un-Archive'); ?> </a> <?php } else { ?> <a href="#" class="socialtwitter_message_action btn btn-default btn-xs" data-action="set-answered" data-id="<?php echo (int) $twitter_message->get('social_twitter_message_id'); ?> " data-social_twitter_id="<?php echo (int) $twitter_message->get('social_twitter_id'); ?> "><?php _e('Archive'); ?> </a> <?php } ?> <?php } ?> </td> </tr> <?php }
<?php /** * Copyright: dtbaker 2012 * Licence: Please check CodeCanyon.net for licence details. * More licence clarification available here: http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca * Package Date: 2015-11-25 02:55:20 * IP Address: 67.79.165.254 */ if (!module_social::can_i('edit', 'Facebook', 'Social', 'social')) { die('No access to Facebook accounts'); } $social_facebook_id = isset($_REQUEST['social_facebook_id']) ? (int) $_REQUEST['social_facebook_id'] : 0; $facebook = new ucm_facebook_account($social_facebook_id); $facebook_page_id = isset($_REQUEST['facebook_page_id']) ? (int) $_REQUEST['facebook_page_id'] : 0; /* @var $pages ucm_facebook_page[] */ $pages = $facebook->get('pages'); if (!$facebook_page_id || !$pages || !isset($pages[$facebook_page_id])) { die('No pages found to refresh'); } ?> Manually refreshing page data... <?php $pages[$facebook_page_id]->graph_load_latest_page_data();
/** * Copyright: dtbaker 2012 * Licence: Please check CodeCanyon.net for licence details. * More licence clarification available here: http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca * Package Date: 2015-11-25 02:55:20 * IP Address: 67.79.165.254 */ if (!module_social::can_i('view', 'Comments', 'Social', 'social')) { die('No access'); } $module->page_title = _l('Inbox'); $header = array('title' => _l('Social Inbox'), 'type' => 'h2', 'main' => true, 'button' => array()); if (module_social::can_i('create', 'Facebook Comments', 'Social', 'social') || module_social::can_i('create', 'Twitter Comments', 'Social', 'social')) { $header['button'] = array('url' => module_social::link_open_compose(), 'title' => _l('Compose'), 'type' => 'add'); } print_heading($header); // grab a mysql resource from all available social plugins (hardcoded for now - todo: hook) $search = isset($_REQUEST['search']) && is_array($_REQUEST['search']) ? $_REQUEST['search'] : array(); if (!isset($search['status'])) { $search['status'] = _SOCIAL_MESSAGE_STATUS_UNANSWERED; } $order = array(); // retuin a combined copy of all available messages, based on search, as a MySQL resource // so we can loop through them on the global messages combined page. $message_managers = module_social::get_message_managers(); /* @var $message_manager ucm_facebook */ foreach ($message_managers as $message_id => $message_manager) { $message_manager->load_all_messages($search, $order);
<a href="<?php echo module_social_twitter::link_open_twitter_message($message['social_twitter_id'], $message['social_twitter_message_id']); ?> " class="socialtwitter_message_open social_modal btn btn-default btn-xs" data-modal-title="<?php echo _l('Tweet'); ?> "><?php _e('Open'); ?> </a> <?php } ?> <?php if (module_social::can_i('edit', 'Twitter Comments', 'Social', 'social')) { ?> <?php if ($message['twitter_message']->get('status') == _SOCIAL_MESSAGE_STATUS_ANSWERED) { ?> <a href="#" class="socialtwitter_message_action btn btn-default btn-xs" data-action="set-unanswered" data-id="<?php echo (int) $message['twitter_message']->get('social_twitter_message_id'); ?> " data-social_twitter_id="<?php echo (int) $message['twitter_message']->get('social_twitter_id'); ?> "><?php _e('Un-Archive'); ?> </a>
</strong> <?php echo htmlspecialchars($twitter_message->get_type_pretty()); ?> </div> <div id="twitter_message_holder"> <?php $twitter_message->full_message_output(module_social::can_i('create', 'Twitter Comments', 'Social', 'social')); ?> </div> </form> <?php } } } if ($social_twitter_id && !$social_twitter_message_id && module_social::can_i('create', 'Twitter Comments', 'Social', 'social')) { $twitter = new ucm_twitter_account($social_twitter_id); if ($social_twitter_id && $twitter->get('social_twitter_id') == $social_twitter_id) { $module->page_title = $twitter->get('twitter_name'); /* @var $pages ucm_twitter_page[] */ $pages = $twitter->get('pages'); //print_r($pages); ?> <form action="<?php echo module_social_twitter::link_open_message_view($social_twitter_id); ?> " method="post" enctype="multipart/form-data"> <input type="hidden" name="_process" value="send_twitter_message"> <?php module_form::print_form_auth();
$pages['fields'][] = '(<a href="' . module_social_facebook::link_open_facebook_page_refresh($social_facebook_id, $page_id, false, false) . '" target="_blank">manually re-load page data</a>)'; } $pages['fields'][] = '</div>'; } } else { $pages['fields'][] = 'No Facebook Pages Found to Manage'; } $fieldset_data['elements'][] = $pages; } else { } echo module_form::generate_fieldset($fieldset_data); $form_actions = array('class' => 'action_bar action_bar_center', 'elements' => array()); echo module_form::generate_form_actions($form_actions); if (!$facebook->is_active()) { // show a 'save' and button as normal $form_actions['elements'][] = array('type' => 'save_button', 'name' => 'butt_save_connect', 'value' => _l('Save & Connect to Facebook')); } else { $form_actions['elements'][] = array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save')); $form_actions['elements'][] = array('type' => 'submit', 'name' => 'butt_save_connect', 'value' => _l('Re-Connect to Facebook')); } if ($facebook->get('social_facebook_id')) { // show delete if we have an id. $form_actions['elements'][] = array('ignore' => !module_social::can_i('delete', 'Facebook', 'Social', 'social'), 'type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete')); } // always show a cancel button $form_actions['elements'][] = array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'class' => 'submit_button', 'onclick' => "window.location.href='" . $module->link_open(false) . "';"); echo module_form::generate_form_actions($form_actions); ?> </form>
public function output_row($message, $settings) { $facebook_message = new ucm_facebook_message(false, false, $message['social_facebook_message_id']); $comments = $facebook_message->get_comments(); ?> <tr class="<?php echo isset($settings['row_class']) ? $settings['row_class'] : ''; ?> facebook_message_row <?php echo !isset($message['read_time']) || !$message['read_time'] ? ' message_row_unread' : ''; ?> " data-id="<?php echo (int) $message['social_facebook_message_id']; ?> "> <td> <img src="<?php echo _BASE_HREF; ?> includes/plugin_social_facebook/images/facebook.png" class="facebook_icon"> <a href="<?php echo $facebook_message->get_link(); ?> " target="_blank"><?php echo htmlspecialchars($facebook_message->get('facebook_page')->get('page_name')); ?> </a> <br/> <?php echo htmlspecialchars($facebook_message->get_type_pretty()); ?> </td> <td class="social_column_time"><?php echo print_date($message['message_time'], true); ?> </td> <td class="social_column_from"> <?php // work out who this is from. $from = $facebook_message->get_from(); ?> <div class="social_from_holder social_facebook"> <div class="social_from_full"> <?php foreach ($from as $id => $name) { ?> <div> <a href="//facebook.com/<?php echo $id; ?> " target="_blank"><img src="//graph.facebook.com/<?php echo $id; ?> /picture" class="social_from_picture"></a> <?php echo htmlspecialchars($name); ?> </div> <?php } ?> </div> <?php reset($from); echo '<a href="//facebook.com/' . key($from) . '" target="_blank">' . '<img src="//graph.facebook.com/' . key($from) . '/picture" class="social_from_picture"></a> '; echo '<span class="social_from_count">'; if (count($from) > 1) { echo '+' . (count($from) - 1); } echo '</span>'; ?> </div> </td> <td class="social_column_summary"> <span style="float:right;"> <?php echo count($comments) > 0 ? '(' . count($comments) . ')' : ''; ?> </span> <div class="facebook_message_summary<?php echo !isset($message['read_time']) || !$message['read_time'] ? ' unread' : ''; ?> "> <?php $summary = $facebook_message->get_summary(); echo $summary; ?> </div> </td> <!--<td></td>--> <td nowrap> <?php if (module_social::can_i('view', 'Facebook Comments', 'Social', 'social')) { ?> <a href="<?php echo module_social_facebook::link_open_facebook_message($message['social_facebook_id'], $message['social_facebook_message_id']); ?> " class="socialfacebook_message_open social_modal btn btn-default btn-xs" data-modal-title="<?php echo htmlspecialchars($summary); ?> "><?php _e('Open'); ?> </a> <?php } ?> <?php if (module_social::can_i('edit', 'Facebook Comments', 'Social', 'social')) { ?> <?php if ($facebook_message->get('status') == _SOCIAL_MESSAGE_STATUS_ANSWERED) { ?> <a href="#" class="socialfacebook_message_action btn btn-default btn-xs" data-action="set-unanswered" data-id="<?php echo (int) $facebook_message->get('social_facebook_message_id'); ?> "><?php _e('Un-Archive'); ?> </a> <?php } else { ?> <a href="#" class="socialfacebook_message_action btn btn-default btn-xs" data-action="set-answered" data-id="<?php echo (int) $facebook_message->get('social_facebook_message_id'); ?> "><?php _e('Archive'); ?> </a> <?php } ?> <?php } ?> </td> </tr> <?php }
<?php /** * Copyright: dtbaker 2012 * Licence: Please check CodeCanyon.net for licence details. * More licence clarification available here: http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca * Package Date: 2015-11-25 02:55:20 * IP Address: 67.79.165.254 */ if (!module_social::can_i('view', 'Twitter', 'Social', 'social')) { die('No permissions to view Twitter accounts'); } $twitter_accounts = module_social_twitter::get_accounts(); $header_buttons = array(); $header_buttons[] = array('url' => module_social_twitter::link_open('new', false), 'title' => 'Add New Twitter Account', 'type' => 'add'); print_heading(array('type' => 'h2', 'title' => 'Twitter Accounts', 'button' => $header_buttons)); ?> <table class="tableclass tableclass_full tableclass_rows"> <thead> <tr class="title"> <th><?php echo _l('Twitter Account Name'); ?> </th> <th><?php echo _l('Last Checked'); ?> </th>
</strong> <?php echo htmlspecialchars($facebook_message->get_type_pretty()); ?> </div> <div id="facebook_message_holder"> <?php $facebook_message->full_message_output(module_social::can_i('create', 'Facebook Comments', 'Social', 'social')); ?> </div> </form> <?php } } } if ($social_facebook_id && !$social_facebook_message_id && module_social::can_i('create', 'Facebook Comments', 'Social', 'social')) { $facebook = new ucm_facebook_account($social_facebook_id); if ($social_facebook_id && $facebook->get('social_facebook_id') == $social_facebook_id) { $module->page_title = $facebook->get('facebook_name'); /* @var $pages ucm_facebook_page[] */ $pages = $facebook->get('pages'); //print_r($pages); ?> <form action="" method="post" enctype="multipart/form-data"> <input type="hidden" name="_process" value="send_facebook_message"> <?php module_form::print_form_auth(); ?> <?php $fieldset_data = array('heading' => isset($_REQUEST['display_mode']) && $_REQUEST['display_mode'] == 'ajax' ? false : array('type' => 'h3', 'title' => 'Compose Message'), 'class' => 'tableclass tableclass_form tableclass_full', 'elements' => array('facebook_page' => array('title' => _l('Facebook Page'), 'fields' => array()), 'message' => array('title' => _l('Message'), 'field' => array('type' => 'textarea', 'name' => 'message', 'id' => 'facebook_compose_message', 'value' => '')), 'type' => array('title' => _l('Type'), 'fields' => array('<input type="radio" name="post_type" id="post_type_wall" value="wall" checked> ', '<label for="post_type_wall">', _l('Wall Post'), '</label>', '<input type="radio" name="post_type" id="post_type_link" value="link"> ', '<label for="post_type_link">', _l('Link Post'), '</label>', '<input type="radio" name="post_type" id="post_type_picture" value="picture"> ', '<label for="post_type_picture">', _l('Picture Post'), '</label>')), 'link' => array('title' => _l('Link'), 'fields' => array(array('type' => 'text', 'name' => 'link', 'id' => 'message_link_url', 'value' => ''), '<div id="facebook_link_loading_message"></div>', '<span class="facebook-type-link facebook-type-option"></span>')), 'link_picture' => array('title' => _l('Link Picture'), 'fields' => array(array('type' => 'text', 'name' => 'link_picture', 'value' => ''), _hr('Full URL (eg: http://) to the picture to use for this link preview'), '<span class="facebook-type-link facebook-type-option"></span>')), 'link_name' => array('title' => _l('Link Title'), 'fields' => array(array('type' => 'text', 'name' => 'link_name', 'value' => ''), _hr('Title to use instead of the automatically generated one from the Link page'), '<span class="facebook-type-link facebook-type-option"></span>')), 'link_caption' => array('title' => _l('Link Caption'), 'fields' => array(array('type' => 'text', 'name' => 'link_caption', 'value' => ''), _hr('Caption to use instead of the automatically generated one from the Link page'), '<span class="facebook-type-link facebook-type-option"></span>')), 'link_description' => array('title' => _l('Link Description'), 'fields' => array(array('type' => 'text', 'name' => 'link_description', 'value' => ''), _hr('Description to use instead of the automatically generated one from the Link page'), '<span class="facebook-type-link facebook-type-option"></span>')), 'picture' => array('title' => _l('Picture'), 'fields' => array('<input type="file" name="picture" value="">', '<span class="facebook-type-picture facebook-type-option"></span>')), 'schedule' => array('title' => _l('Schedule'), 'fields' => array(array('type' => 'date', 'name' => 'schedule_date', 'value' => ''), array('type' => 'time', 'name' => 'schedule_time', 'value' => ''), ' ', _l('Currently: %s', date('c')), _hr('Leave blank to send now. Pick a date in the future to send this message.'))), 'debug' => array('title' => _l('Debug'), 'field' => array('type' => 'check', 'name' => 'debug', 'value' => '1', 'checked' => false, 'help' => 'Show debug output while posting the message')))); foreach ($pages as $facebook_page_id => $page) {