| 1 |
<?php |
| 2 |
/** |
| 3 |
* This template contains a preview of rules. |
| 4 |
* |
| 5 |
* @package Friends |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace Friends; |
| 9 |
|
| 10 |
/** |
| 11 |
* Render a preview row. |
| 12 |
* |
| 13 |
* @param \WP_Post $post The post. |
| 14 |
* @param array $args The arguments. |
| 15 |
*/ |
| 16 |
function preview_row( $post, $args ) { |
| 17 |
$modified_post = $args['feed']->apply_feed_rules( $post, null, $args['friend'] ); |
| 18 |
?> |
| 19 |
<tr> |
| 20 |
|
| 21 |
<td class="title column-title column-primary" data-colname="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_attr_e( 'Title' ); ?>"><a href="<?php the_permalink( $modified_post ? $modified_post : $post ); ?>" rel="noopener noreferrer"><?php echo esc_html( $modified_post ? $modified_post->post_title : $post->post_title ); ?></a></td> |
| 22 |
<td class="author column-author" data-colname="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_attr_e( 'Author' ); ?>"><?php echo esc_html( get_post_meta( $post->ID, 'author', true ) ); ?></td> |
| 23 |
<td class="date column-date" data-colname="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_attr_e( 'Date' ); ?>"><?php echo esc_html( date_i18n( __( 'F j, Y g:i a' ), strtotime( $post->post_date ) ) ); ?></td> |
| 24 |
<td class="action column-action" data-colname="<?php esc_attr_e( 'Action', 'friends' ); ?>"> |
| 25 |
<?php |
| 26 |
if ( ! $modified_post || $modified_post->_feed_rule_delete ) { |
| 27 |
echo esc_html( _x( 'Delete', 'verb', 'friends' ) ); |
| 28 |
?> |
| 29 |
</td><td class="view column-view" data-colname="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_attr_e( 'View' ); ?>"> |
| 30 |
<?php |
| 31 |
} else { |
| 32 |
if ( isset( $modified_post->_feed_rule_transform['post_status'] ) && 'trash' === $modified_post->_feed_rule_transform['post_status'] ) { |
| 33 |
echo esc_html( _x( 'Trash', 'verb' ) ); // phpcs:ignore WordPress.WP.I18n.MissingArgDomain |
| 34 |
} else { |
| 35 |
echo esc_html( _x( 'Accept', 'verb', 'friends' ) ); |
| 36 |
} |
| 37 |
?> |
| 38 |
</td> |
| 39 |
<td class="view column-view" data-colname="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_attr_e( 'View' ); ?>"> |
| 40 |
<a href="<?php echo esc_url( $args['friend']->get_local_friends_page_url( $post->ID ) ); ?>?show-hidden"><?php esc_html_e( 'View post', 'friends' ); ?></a> |
| 41 |
<?php |
| 42 |
} |
| 43 |
?> |
| 44 |
</td> |
| 45 |
</td> |
| 46 |
</tr> |
| 47 |
<?php |
| 48 |
} |
| 49 |
|
| 50 |
if ( $args['post'] ) : |
| 51 |
?> |
| 52 |
<h2><?php esc_html_e( 'Selected post', 'friends' ); ?></h2> |
| 53 |
|
| 54 |
<p> |
| 55 |
<?php |
| 56 |
esc_html_e( 'You chose muffle this post. To do this, use the rule section above to enter keywords that only match this or similar items. Remember to save your changes.', 'friends' ); |
| 57 |
?> |
| 58 |
</p> |
| 59 |
<table class="wp-list-table widefat fixed striped" style="margin-top: 2em; margin-bottom: 2em; margin-right: 1em"> |
| 60 |
<thead> |
| 61 |
<tr> |
| 62 |
<th class="column-primary column-title"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Title' ); ?></th> |
| 63 |
<th class="column-author"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Author' ); ?></th> |
| 64 |
<th class="column-date"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Date' ); ?></th> |
| 65 |
<th class="column-action"><?php esc_html_e( 'Action', 'friends' ); ?></th> |
| 66 |
<th class="column-view"><?php esc_html_e( 'Friends Page', 'friends' ); ?></th> |
| 67 |
</tr> |
| 68 |
</thead> |
| 69 |
<tbody> |
| 70 |
<?php preview_row( $args['post'], $args ); ?> |
| 71 |
<tr> |
| 72 |
<td colspan="5"><?php echo esc_html( get_the_excerpt( $args['post'] ) ); ?></td> |
| 73 |
</tr> |
| 74 |
</tbody> |
| 75 |
</table> |
| 76 |
<?php endif; ?> |
| 77 |
|
| 78 |
<h2><?php esc_html_e( 'Last feed items', 'friends' ); ?></h2> |
| 79 |
|
| 80 |
<table class="wp-list-table widefat fixed striped" style="margin-top: 2em; margin-bottom: 2em; margin-right: 1em"> |
| 81 |
<tbody> |
| 82 |
<tr> |
| 83 |
<th class="column-primary column-title"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Title', 'friends' ); ?></th> |
| 84 |
<th class="column-author"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Author' ); ?></th> |
| 85 |
<th class="column-date"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Date' ); ?></th> |
| 86 |
<th class="column-action"><?php esc_html_e( 'Action', 'friends' ); ?></th> |
| 87 |
<th class="column-view"><?php esc_html_e( 'Friends Page', 'friends' ); ?></th> |
| 88 |
</tr> |
| 89 |
<?php |
| 90 |
foreach ( $args['friend_posts']->get_posts() as $post ) { |
| 91 |
preview_row( $post, $args ); |
| 92 |
} |
| 93 |
?> |
| 94 |
</tbody> |
| 95 |
</table> |
| 96 |
|