| 1 |
<?php |
| 2 |
|
| 3 |
class MainWP_Notes { |
| 4 |
|
| 5 |
public static function getClassName() { |
| 6 |
return __CLASS__; |
| 7 |
} |
| 8 |
|
| 9 |
public static function render() { |
| 10 |
$current_wpid = MainWP_Utility::get_current_wpid(); |
| 11 |
|
| 12 |
if ( !MainWP_Utility::ctype_digit( $current_wpid ) ) { |
| 13 |
return; |
| 14 |
} |
| 15 |
|
| 16 |
$website = MainWP_DB::Instance()->getWebsiteById( $current_wpid, true ); |
| 17 |
$note = html_entity_decode( $website->note ); // to compatible |
| 18 |
$esc_note = MainWP_Utility::esc_content( $note ); |
| 19 |
|
| 20 |
|
| 21 |
?> |
| 22 |
|
| 23 |
<h3 class="ui header handle-drag"> |
| 24 |
<?php esc_html_e('Notes', 'mainwp'); ?> |
| 25 |
<div class="sub header"><?php esc_html_e( 'Child site notes', 'mainwp' ); ?></div> |
| 26 |
</h3> |
| 27 |
|
| 28 |
<div class="ui section hidden divider"></div> |
| 29 |
|
| 30 |
<div> |
| 31 |
<?php |
| 32 |
if ( $website->note == '' ) { |
| 33 |
?> |
| 34 |
<h2 class="ui icon header"> |
| 35 |
<i class="info circle icon"></i> |
| 36 |
<div class="content"> |
| 37 |
<?php _e( 'No saved notes!', 'mainwp' ); ?> |
| 38 |
<div class="sub header"><?php esc_html_e( 'No saved notes for the child site. ', 'mainwp' ); ?><?php echo '<a href="javascript:void(0)" class="mainwp-edit-site-note" id="mainwp-notes-' . $website->id . '">' . __( 'Click here to add a note.', 'mainwp' ) . '</a>'; ?></div> |
| 39 |
</div> |
| 40 |
</h2> |
| 41 |
<?php |
| 42 |
} else { |
| 43 |
echo $esc_note; |
| 44 |
?> |
| 45 |
<div class="ui section hidden divider"></div> |
| 46 |
<a href="javascript:void(0)" class="ui button green mainwp-edit-site-note" id="mainwp-notes-<?php echo $website->id; ?>"><?php esc_html_e( 'Edit Notes', 'mainwp' ); ?></a> |
| 47 |
<?php |
| 48 |
} |
| 49 |
?> |
| 50 |
</div> |
| 51 |
<span style="display: none" id="mainwp-notes-<?php echo intval($current_wpid); ?>-note"><?php echo $esc_note; ?></span> |
| 52 |
<?php |
| 53 |
MainWP_UI::render_modal_edit_notes(); |
| 54 |
} |
| 55 |
|
| 56 |
} |
| 57 |
|