| 1 |
<?php |
| 2 |
/** @var \Gianism\Plugins\Bot $this */ |
| 3 |
/** @var \WP_Post $post */ |
| 4 |
/** @var \Gianism\Service\Twitter $twitter */ |
| 5 |
$twitter = \Gianism\Service\Twitter::get_instance(); |
| 6 |
?> |
| 7 |
|
| 8 |
<div class="gianism-post-container"> |
| 9 |
|
| 10 |
<div class="form-row"> |
| 11 |
<label for="content"><i |
| 12 |
class="lsf lsf-balloon"></i> <?php printf( $this->_( 'What do you tweet as <a href="https://twitter.com/%1$s" target="_blank">@%1$s</a>?' ), $twitter->tw_screen_name ); ?> |
| 13 |
</label> |
| 14 |
<textarea id="content" name="content" |
| 15 |
placeholder="<?php echo esc_attr( $this->_( 'Enter your tweet.' ) ); ?>"><?php echo esc_textarea( $post->post_content ); ?></textarea> |
| 16 |
<p class="description"> |
| 17 |
<?php $this->e( 'HTML tags are not allowed. But you can use short codes. Gianism original short codes are below.' ); ?> |
| 18 |
<?php printf( $this->_( 'And ofcourse You can register your own shortcode with <a href="%s">Shortcode API</a>.' ), 'http://codex.wordpress.org/Shortcode_API' ); ?> |
| 19 |
</p> |
| 20 |
<hr/> |
| 21 |
<h4>gianism_limit</h4> |
| 22 |
<p> |
| 23 |
<em><?php $this->e( 'Attributes' ); ?></em>: |
| 24 |
<code>limit</code> |
| 25 |
<small><?php $this->e( 'Date time. This will convert to rest time which is relative to current time.' ); ?> |
| 26 |
| |
| 27 |
<code>placeholder</code> |
| 28 |
<small><?php printf( $this->_( 'Place holder. Default is %s.' ), $this->_( '%s left' ) ); ?></small> |
| 29 |
</p> |
| 30 |
<?php |
| 31 |
$next_month = date_i18n( 'Y-m-d', strtotime( 'Next month' ) ); |
| 32 |
?> |
| 33 |
<pre> |
| 34 |
[gianism_limit limit='<?php echo $next_month; ?>'] => <?php echo do_shortcode( '[gianism_limit limit=\'' . $next_month . '\']' ); ?> |
| 35 |
</pre> |
| 36 |
<?php |
| 37 |
/** |
| 38 |
* Filter hook for bot documentation |
| 39 |
* |
| 40 |
* @action gianism_twitter_bot_documentation |
| 41 |
* @param WP_Post $post |
| 42 |
*/ |
| 43 |
do_action( 'gianism_twitter_bot_documentation', $post ) |
| 44 |
?> |
| 45 |
</div> |
| 46 |
|
| 47 |
<hr/> |
| 48 |
|
| 49 |
<div class="form-row"> |
| 50 |
<table class="date-table" id="gianism-bot-schedule"> |
| 51 |
<caption><i class="lsf lsf-time"></i> <?php $this->e( 'Schedule' ); ?></caption> |
| 52 |
<thead> |
| 53 |
<tr> |
| 54 |
<th> </th> |
| 55 |
<?php for ( $i = 0; $i < 7; $i++ ) : ?> |
| 56 |
<th scope="col"><?php echo date_i18n( 'D', strtotime( 'Last Monday', time() ) + 60 * 60 * 24 * $i ); ?></th> |
| 57 |
<?php endfor ?> |
| 58 |
<th> </th> |
| 59 |
</tr> |
| 60 |
</thead> |
| 61 |
<tfoot> |
| 62 |
<tr> |
| 63 |
<th> </th> |
| 64 |
<td colspan="8"> |
| 65 |
<select id="g-row-time"> |
| 66 |
<?php for ( $i = 0; $i < 24; $i++ ) : ?> |
| 67 |
<option><?php printf( '%02d', $i ); ?></option> |
| 68 |
<?php endfor; ?> |
| 69 |
</select>: |
| 70 |
<select id="g-row-minute"> |
| 71 |
<?php for ( $i = 0; $i < 6; $i++ ) : ?> |
| 72 |
<option><?php printf( '%02d', $i * 10 ); ?></option> |
| 73 |
<?php endfor; ?> |
| 74 |
</select> |
| 75 |
<a class="button add-row" href="#"><?php $this->e( 'Add Time Row' ); ?></a> |
| 76 |
</td> |
| 77 |
</tr> |
| 78 |
</tfoot> |
| 79 |
<tbody> |
| 80 |
<?php foreach ( $this->get_time_line( $post ) as $time => $dates ) : ?> |
| 81 |
<tr> |
| 82 |
<th><?php echo esc_html( substr( $time, 0, 5 ) ); ?></th> |
| 83 |
<?php for ( $i = 1; $i <= 7; $i++ ) : ?> |
| 84 |
<td><input type="checkbox" name="gianism_bot_schedule[<?php echo esc_attr( $time ); ?>][]" |
| 85 |
value="<?php echo $i; ?>"<?php checked( in_array( (string) $i, $dates, true ) ); ?> /> |
| 86 |
</td> |
| 87 |
<?php endfor ?> |
| 88 |
<td><a class="button row-delete" href="#">×</a></td> |
| 89 |
</tr> |
| 90 |
<?php endforeach; ?> |
| 91 |
</tbody> |
| 92 |
</table> |
| 93 |
<script type="text/javascript"> |
| 94 |
//<![CDATA[ |
| 95 |
window.GianismBotSchedule = <?php echo json_encode( $this->get_schedule( $post ) ); ?>; |
| 96 |
//]]> |
| 97 |
</script> |
| 98 |
</div> |
| 99 |
|
| 100 |
<?php |
| 101 |
$limit = $this->cron_limit( $post ); |
| 102 |
if ( ! empty( $limit ) && ! preg_match( '/[0-9]{4}-[0-9]{2}-[0-9]{2}/u', $limit ) ) : |
| 103 |
?> |
| 104 |
<div class="error"> |
| 105 |
<p><?php $this->e( 'End datetime is mal-formed: YYYY-MM-DD' ); ?></p> |
| 106 |
</div> |
| 107 |
<?php endif; ?> |
| 108 |
|
| 109 |
<hr/> |
| 110 |
|
| 111 |
<div class="form-row"> |
| 112 |
<label for="tweet_ends"><i class="lsf lsf-dailycalendar"></i> <?php $this->e( 'End Datetime' ); ?></label> |
| 113 |
<p> |
| 114 |
<input type="date" class="regular-text" name="tweet_ends" id="tweet_ends" |
| 115 |
value="<?php echo esc_html( $limit ); ?>" placeholder="ex. 2014-08-16" autocomplete="on"> |
| 116 |
</p> |
| 117 |
<p class="description"> |
| 118 |
<?php $this->e( 'Passing this limit, This bot will be private. Format is YYYY-MM-DD' ); ?> |
| 119 |
</p> |
| 120 |
</div> |
| 121 |
|
| 122 |
|
| 123 |
</div><!-- //.gianism-post-container --> |
| 124 |
|