web/wp-content/plugins/social/views/wp-admin/post/meta/log/output.php
changeset 196 5e8dcbe22c24
equal deleted inserted replaced
195:c7c0fbc09788 196:5e8dcbe22c24
       
     1 <?php
       
     2 	if (empty($log)) {
       
     3 		echo '<p>'.__('Aggregation has not been run for this post yet.', 'social').'</p>';
       
     4 	}
       
     5 	else {
       
     6 		$i = 0;
       
     7 		$output = '';
       
     8 		$log = array_reverse($log, 1);
       
     9 		foreach ($log as $timestamp => $_log) {
       
    10 			++$i;
       
    11 
       
    12 			$output .= '<h5 id="log-'.$i.'">'.date(get_option('date_format').' '.get_option('time_format'), ($timestamp + (get_option('gmt_offset') * 3600))).' (';
       
    13 			if (isset($_log->manual) and $_log->manual) { // isset() check for legacy support
       
    14 				$output .= __('Manual Aggregation', 'social');
       
    15 			}
       
    16 			else {
       
    17 				$output .= __('Automatic Aggregation', 'social');
       
    18 			}
       
    19 			$output .= ')</h5><ul id="log-'.$i.'-output" class="parent">';
       
    20 
       
    21 			if (isset($_log->items) and count($_log->items)) {
       
    22 				foreach ($_log->items as $service => $items) {
       
    23 					if (isset($services[$service])) {
       
    24 						$service = $services[$service];
       
    25 
       
    26 						$output .= '<li>'.esc_html($service->title()).':<ul>';
       
    27 
       
    28 						if (count($items)) {
       
    29 							$_items = array();
       
    30 							foreach ($items as $item) {
       
    31 								if (!isset($_items[$item->type])) {
       
    32 									$_items[$item->type] = array();
       
    33 								}
       
    34 
       
    35 								$_items[$item->type][] = $item;
       
    36 							}
       
    37 
       
    38 							foreach ($_items as $type => $items) {
       
    39 								foreach ($items as $item) {
       
    40 									$username = '';
       
    41 									if (isset($item->data['username'])) {
       
    42 										$username = $item->data['username'];
       
    43 									}
       
    44 
       
    45 									$id = $item->id;
       
    46 									if (isset($item->data['parent_id'])) {
       
    47 										$id = $item->data['parent_id'];
       
    48 										$ids = explode('_', $item->data['parent_id']);
       
    49 										$item->id = $id.'#'.$ids[1];
       
    50 									}
       
    51 
       
    52 									$output .= '<li>';
       
    53 									$content = $service->aggregation_row($type, $item, $username, $id);
       
    54 									if (empty($content)) {
       
    55 										$link = $service->status_url($username, $id);
       
    56 										$output .= '<a href="'.esc_url($link).'" target="_blank">#'.$item->id.'</a>';
       
    57 										switch ($type) {
       
    58 											case 'reply':
       
    59 												$output .= ' ('.__('Reply Search', 'social').')';
       
    60 											break;
       
    61 											case 'url':
       
    62 												$output .= ' ('.__('URL Search', 'social').')';
       
    63 											break;
       
    64 											default:
       
    65 												$output .= ' ('.__(esc_html($type), 'social').')';
       
    66 											break;
       
    67 										}
       
    68 
       
    69 										if ($item->ignored) {
       
    70 											$output .= ' ('.__('Existing Comment', 'social').')';
       
    71 										}
       
    72 									}
       
    73 									else {
       
    74 										$output .= $content;
       
    75 									}
       
    76 
       
    77 									$output .= '</li>';
       
    78 								}
       
    79 							}
       
    80 						}
       
    81 
       
    82 						$output .= '</ul></li>';
       
    83 					}
       
    84 				}
       
    85 			}
       
    86 			else {
       
    87 				$output .= '<li style="list-style:none"><p>'.__('No results found.', 'social').'</p></li>';
       
    88 			}
       
    89 			$output .= '</ul>';
       
    90 		}
       
    91 
       
    92 		echo $output;
       
    93 	}