| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Display the plugin note as well as options to edit or delete it. |
| 5 |
* |
| 6 |
* This file is used to markup the admin-facing aspects of the plugin. |
| 7 |
* |
| 8 |
* @link https://jamiebergen.com/ |
| 9 |
* @since 1.0.0 |
| 10 |
* |
| 11 |
* @package Plugin_Notes_Plus |
| 12 |
* @subpackage Plugin_Notes_Plus/admin/partials |
| 13 |
*/ |
| 14 |
|
| 15 |
if ( current_user_can('activate_plugins') ) { |
| 16 |
?> |
| 17 |
<div class="pnp-wrapper" id="<?php echo $plugin_unique_id_sanitized; ?>" data-pluginfile="<?php echo $plugin_unique_id; ?>"> |
| 18 |
|
| 19 |
<?php |
| 20 |
if ( $the_plugin_notes ) { |
| 21 |
foreach ( $the_plugin_notes as $note_index => $the_plugin_note ) { ?> |
| 22 |
<div class="pnp-show-note-wrapper" id="<?php echo $plugin_unique_id_sanitized . '_' . $note_index; ?>"> |
| 23 |
<div class="pnp-plugin-note"> |
| 24 |
<span class="dashicons <?php echo $the_plugin_note['icon'] ?>"></span><?php echo nl2br( $the_plugin_note[ 'note' ] ); ?> |
| 25 |
<p class="pnp-note-meta"><?php echo $the_plugin_note['user'] ?> | <span class="pnp-note-time"></span></p> |
| 26 |
</div> |
| 27 |
<a href="#" class="pnp-edit-note"><?php esc_html_e( 'Edit', $this->plugin->get_plugin_name() ) ?></a> | |
| 28 |
<a href="#" class="pnp-delete-note"><?php esc_html_e( 'Delete', $this->plugin->get_plugin_name() ) ?></a> |
| 29 |
<span class="pnp-spin dashicons dashicons-update"></span> |
| 30 |
</div> |
| 31 |
<script> |
| 32 |
registerPluginNote( "<?php echo $plugin_unique_id_sanitized; ?>", |
| 33 |
"<?php echo $note_index; ?>", |
| 34 |
"<?php echo str_replace("\n", '\n', addslashes($the_plugin_note['note'])); ?>", |
| 35 |
"<?php echo $the_plugin_note['icon']; ?>", |
| 36 |
"<?php echo $the_plugin_note['time']; ?>", |
| 37 |
); |
| 38 |
|
| 39 |
</script> |
| 40 |
<?php |
| 41 |
} |
| 42 |
} |
| 43 |
?> |
| 44 |
<div class="pnp-add-note-wrapper"> |
| 45 |
<a href="#" class="pnp-add-note"><?php esc_html_e( '+ Add plugin note', $this->plugin->get_plugin_name() ) ?></a> |
| 46 |
<div class="pnp-note-form-wrapper"> |
| 47 |
|
| 48 |
<label> |
| 49 |
<?php esc_html_e( 'Note type:', $this->plugin->get_plugin_name() ) ?> |
| 50 |
<span class="view-icon"></span> |
| 51 |
<select id="<?php echo $plugin_unique_id_sanitized; ?>" class="select-dashicon-for-note"> |
| 52 |
<?php foreach ( $icon_options_array as $icon_class => $icon_name ) { |
| 53 |
echo '<option value="'. $icon_class . '">' . esc_html__( $icon_name, $this->plugin->get_plugin_name() ) . '</option>'; |
| 54 |
} ?> |
| 55 |
</select> |
| 56 |
</label> |
| 57 |
<textarea class="pnp-note-form"></textarea> |
| 58 |
<a href="#" class="pnp-save-note"><?php esc_html_e( 'Save note', $this->plugin->get_plugin_name() ) ?></a> |
| 59 |
<span class="pnp-spin dashicons dashicons-update"></span> |
| 60 |
<span class="pnp-divider"> | </span> |
| 61 |
<a href="#" class="pnp-cancel-note"><?php esc_html_e( 'Cancel', $this->plugin->get_plugin_name() ) ?></a> |
| 62 |
<div id="pnp_form_feedback"></div> |
| 63 |
</div> |
| 64 |
</div> |
| 65 |
|
| 66 |
</div> |
| 67 |
|
| 68 |
<?php |
| 69 |
} |
| 70 |
else { |
| 71 |
?> |
| 72 |
<p> <?php esc_html__( "You are not authorized to perform this operation.", $this->plugin->get_plugin_name() ) ?> </p> |
| 73 |
<?php |
| 74 |
} |
| 75 |
|