| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPDataAccess\Data_Apps; |
| 4 |
|
| 5 |
use WPDataAccess\Connection\WPDADB; |
| 6 |
use WPDataAccess\Utilities\WPDA_Message_Box; |
| 7 |
use WPDataAccess\Utilities\WPDA_Remote_Database; |
| 8 |
use WPDataAccess\WPDA; |
| 9 |
class WPDA_Data_Explorer extends WPDA_Container { |
| 10 |
private $dbs = null; |
| 11 |
|
| 12 |
private $pds = null; |
| 13 |
|
| 14 |
public function __construct( $args = array() ) { |
| 15 |
parent::__construct( $args ); |
| 16 |
$this->dbs = new WPDA_Remote_Database(); |
| 17 |
} |
| 18 |
|
| 19 |
public function show() { |
| 20 |
if ( !WPDA::current_user_is_admin() ) { |
| 21 |
if ( !is_admin() && !$this->send_feedback() ) { |
| 22 |
return; |
| 23 |
} |
| 24 |
$this->show_feedback( __( 'Not authorized', 'wp-data-access' ) ); |
| 25 |
return; |
| 26 |
} |
| 27 |
if ( is_admin() ) { |
| 28 |
$this->show_on_backend(); |
| 29 |
} else { |
| 30 |
$this->show_on_frontend(); |
| 31 |
} |
| 32 |
$this->add_client( 'de' ); |
| 33 |
} |
| 34 |
|
| 35 |
private function show_on_backend() { |
| 36 |
?> |
| 37 |
|
| 38 |
<div class="wrap wpda-explorer-backend"> |
| 39 |
|
| 40 |
<h1 class="wp-heading-inline" style="margin-bottom: 18px"> |
| 41 |
<?php |
| 42 |
?> |
| 43 |
Data Explorer |
| 44 |
</h1> |
| 45 |
|
| 46 |
<?php |
| 47 |
$this->dbs->show(); |
| 48 |
$this->show_on_frontend(); |
| 49 |
?> |
| 50 |
|
| 51 |
</div> |
| 52 |
|
| 53 |
<script> |
| 54 |
jQuery(function() { |
| 55 |
jQuery("#wpda_toolbar_icon_go_backup").on("click", function() { |
| 56 |
jQuery("#wpda_goto_backup").submit(); |
| 57 |
}); |
| 58 |
}); |
| 59 |
</script> |
| 60 |
|
| 61 |
<?php |
| 62 |
} |
| 63 |
|
| 64 |
private function show_on_frontend() { |
| 65 |
?> |
| 66 |
|
| 67 |
<div class="wpda-pp-container"> |
| 68 |
<div class="pp-container-explorer"></div> |
| 69 |
</div> |
| 70 |
|
| 71 |
<?php |
| 72 |
} |
| 73 |
|
| 74 |
private function js() { |
| 75 |
// Add pds event |
| 76 |
?> |
| 77 |
<script> |
| 78 |
jQuery(function() { |
| 79 |
jQuery("#wpda_pds_canvas .wpda_manage_databases_close").on("click", function() { |
| 80 |
jQuery('#wpda_pds_canvas').hide(); |
| 81 |
}); |
| 82 |
}); |
| 83 |
</script> |
| 84 |
<?php |
| 85 |
} |
| 86 |
|
| 87 |
private function css() { |
| 88 |
// Overwrite pds canvas styling |
| 89 |
?> |
| 90 |
<style> |
| 91 |
#wpda_pds_canvas, |
| 92 |
#wpda_pds_message_box { |
| 93 |
margin: 5px 0; |
| 94 |
position: relative; |
| 95 |
border-radius: 4px; |
| 96 |
background-color: #fff; |
| 97 |
color: rgba(0, 0, 0, 0.87); |
| 98 |
-webkit-transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; |
| 99 |
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; |
| 100 |
box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12); |
| 101 |
} |
| 102 |
#wpda_pds_canvas > div { |
| 103 |
margin: 0; |
| 104 |
border-radius: 4px; |
| 105 |
} |
| 106 |
#wpda_pds_canvas .container_pds { |
| 107 |
padding: 24px; |
| 108 |
margin: 0; |
| 109 |
border-radius: 4px; |
| 110 |
} |
| 111 |
#form_pds { |
| 112 |
margin-top: 30px; |
| 113 |
margin-bottom: -10px; |
| 114 |
} |
| 115 |
#wpda_pds_canvas .container_pds fieldset > div > label:first-of-type, |
| 116 |
#wpda_pds_canvas .container_pds .database_item_label{ |
| 117 |
font-weight: normal; |
| 118 |
width: 160px; |
| 119 |
text-align: right; |
| 120 |
} |
| 121 |
#wpda_pds_canvas .wpda_manage_databases_close { |
| 122 |
display: block !important; |
| 123 |
position: absolute; |
| 124 |
top: 22px; |
| 125 |
right: 22px; |
| 126 |
z-index: 9999999; |
| 127 |
font-size: 1rem; |
| 128 |
} |
| 129 |
#wpda_pds_canvas .wpda_manage_databases_close .fas { |
| 130 |
color: rgb(60, 67, 74); |
| 131 |
} |
| 132 |
#wpda_pds_message_box { |
| 133 |
padding: 24px; |
| 134 |
} |
| 135 |
#wpda_pds_message_box > div > strong { |
| 136 |
font-weight: 700; |
| 137 |
} |
| 138 |
</style> |
| 139 |
<?php |
| 140 |
} |
| 141 |
|
| 142 |
} |
| 143 |
|