ARI Adminer – WordPress Database Manager - Version 1.1.3

Version Description

  • Possible to select default connection
Download this release

Release Info

Developer arisoft
Plugin Icon 128x128 ARI Adminer – WordPress Database Manager
Version 1.1.3
Comparing to
See all releases

Code changes from version 1.1.2 to 1.1.3

ari-adminer.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: ARI Adminer
4
  Plugin URI: http://wp-quiz.ari-soft.com/plugins/wordpress-adminer.html
5
  Description: Powerful, compact and easy to use database manager plugin for WordPress.
6
- Version: 1.1.2
7
  Author: ARI Soft
8
  Author URI: http://www.ari-soft.com
9
  Text Domain: ari-adminer
3
  Plugin Name: ARI Adminer
4
  Plugin URI: http://wp-quiz.ari-soft.com/plugins/wordpress-adminer.html
5
  Description: Powerful, compact and easy to use database manager plugin for WordPress.
6
+ Version: 1.1.3
7
  Author: ARI Soft
8
  Author URI: http://www.ari-soft.com
9
  Text Domain: ari-adminer
assets/common/css/style.css CHANGED
@@ -80,7 +80,8 @@
80
  max-width: 300px;
81
  }
82
 
83
- .fixed .column-type {
 
84
  width: 10%;
85
  }
86
 
@@ -170,6 +171,29 @@ BODY .ui-tooltip {
170
  color: #21a539;
171
  }
172
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  /*!
174
  Pure v0.6.1
175
  Copyright 2013 Yahoo!
80
  max-width: 300px;
81
  }
82
 
83
+ .fixed .column-type,
84
+ .fixed .column-default {
85
  width: 10%;
86
  }
87
 
171
  color: #21a539;
172
  }
173
 
174
+ .adminer-icon {
175
+ font-family: Dashicons;
176
+ font-weight: 400;
177
+ font-variant: normal;
178
+ line-height: 1;
179
+ text-align: center;
180
+ font-size: 20px;
181
+ width: 24px;
182
+ height: 24px;
183
+ display: inline-block;
184
+ cursor: pointer;
185
+ text-decoration: none !important;
186
+ outline: none;
187
+ }
188
+
189
+ .adminer-icon-default::before {
190
+ content: "\f154";
191
+ }
192
+
193
+ .adminer-icon-default-selected::before {
194
+ content: "\f155";
195
+ }
196
+
197
  /*!
198
  Pure v0.6.1
199
  Copyright 2013 Yahoo!
assets/common/pages/connections.js CHANGED
@@ -1 +1 @@
1
- ;eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)<36?c.toString(36):String.fromCharCode(c+29))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'\\w{1,2}'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('N(document).h(\'app_ready\',1(e,2){4 $=N,l=$(\'#1b\'),D=$(\'#ddlConnectionDriver\'),s=$(\'.11-b-18\',\'#19\'),G=1(d){4 Q=\'conn-dbtype-\'+d;6 Q},o=1(d){d=d||D.m();4 E=l.v(\'3-db-k\');7(E){4 S=G(E);l.removeClass(S)}7(d){4 U=G(d);l.addClass(U)}l.v(\'3-db-k\',d||\'\')},F=1(q){q=q||8;7(q)2.g.q();$.14.open({items:{src:\'#1b\'},mainClass:\'i-form-modal\',k:\'inline\',closeOnBgClick:8},0)},P=1(){6 s.first().m()},R=1(){6 $(\'TBODY .18-item:checked\',\'#A\').length>0};2.g=a.createForm(l,{callbacks:{\'onInit\':1(){o()},\'onAfterReset\':1(){o()},\'onAfterPopulate\':1(){o()}}});D.h(\'13\',1(){o()});s.h(\'13\',1(){s.m($(j).m())});$(\'.n-11-b\',\'#19\').h(\'t\',1(){4 b=P();7(!b){a.c(2.5.9.selectAction);6 8}7(!R()){a.c(2.5.9.selectItem);6 8}4 C=1(b){a.M();2.L(b)};7(b==\'bulk_delete\'){a.12(2.5.9.bulkDeleteConfirm,1(){C(b)})}p{C(b)}6 8});$(\'#A\').h(\'t\',\'.n-i-10\',1(){4 Z=$(j).v(\'3-r\');a.12(2.5.9.deleteConfirm,1(){$(\'#hidConnectionId\').m(Z);2.L(\'10\')});6 8});$(\'#A\').h(\'t\',\'.i-edit\',1(){4 r=$(j).v(\'3-r\');3={\'B\':\'connections_get-i\',\'connection_id\':r};$.z({k:\'y\',x:2.5.K,3:3,J:\'I\'}).H(1(3){a.1a();7(3.f){2.g.populate(3.f,17);F()}p{}}).w(1(){a.1a()});a.M();6 8});$(\'#btnAddConnection\').h(\'t\',1(){F(17);6 8});$(\'#btnConnectionTest\').15({\'V\':1(){7(!2.g.T(\'test_connection\')){6 8}4 u=2.g.3(),3={\'B\':\'connections_test\',\'i\':u};4 n=j;j.W();$.z({k:\'y\',x:2.5.K,3:3,J:\'I\'}).H(1(3){7(3.f){7(3.f.f){c(2.5.9.connectionOk)}p{c(2.5.9.connectionFailed+\' \'+(3.f.error||\'\'))}}p{c(2.5.9.X)}}).w(1(){c(2.5.9.X)}).16(1(){n.O()});6 8}});$(\'#btnConnectionSave\').15({\'V\':1(){7(!2.g.T(\'i\')){6 8}4 u=2.g.3(),3={\'B\':\'connections_save\',\'i\':u};4 n=j;j.W();$.z({k:\'y\',x:2.5.K,3:3,J:\'I\'}).H(1(3){7(3.f){$.14.close();a.M();$(\'#ctrl_sub_action\').m(\'add\');2.L(\'reload\')}p{c(2.5.9.Y)}}).w(1(){c(2.5.9.Y)}).16(1(){n.O()});6 8}});o()});',[],74,'|function|app|data|var|options|return|if|false|messages|AppHelper|action|alert|dbType||result|connectionForm|on|connection|this|type|formContainer|val|btn|handleDbType|else|reset|id|bulkActionCtrlList|click|connectionParameters|attr|fail|url|POST|ajax|gridResults|ctrl|actionHandler|ctrlDbType|prevDbType|openConnectionPopup|getDbTypeClass|done|json|dataType|ajaxUrl|trigger|showLoading|jQuery|complete|getBulkAction|className|hasCheckedItems|prevDbTypeClass|validate|dbTypeClass|onClick|start|connectionTestFailed|connectionSaveFailed|connectionId|delete|bulk|confirm|change|magnificPopup|ariButton|always|true|select|ari_adminer_plugin|hideLoading|newConnectionForm'.split('|'),0,{}));
1
+ ;eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)<36?c.toString(36):String.fromCharCode(c+29))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'\\w{1,2}'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('O(document).h(\'app_ready\',1(e,2){4 $=O,m=$(\'#1b\'),C=$(\'#ddlConnectionDriver\'),w=$(\'.10-b-17\',\'#18\'),F=1(g){4 Q=\'conn-dbtype-\'+g;5 Q},n=1(g){g=g||C.j();4 D=m.s(\'3-db-p\');8(D){4 S=F(D);m.removeClass(S)}8(g){4 U=F(g);m.addClass(U)}m.s(\'3-db-p\',g||\'\')},E=1(t){t=t||7;8(t)2.i.t();$.12.open({items:{src:\'#1b\'},mainClass:\'d-form-modal\',p:\'inline\',closeOnBgClick:7},0)},P=1(){5 w.first().j()},R=1(){5 $(\'TBODY .17-item:checked\',\'#o\').length>0};2.i=9.createForm(m,{callbacks:{\'onInit\':1(){n()},\'onAfterReset\':1(){n()},\'onAfterPopulate\':1(){n()}}});C.h(\'13\',1(){n()});w.h(\'13\',1(){w.j($(c).j())});$(\'.k-10-b\',\'#18\').h(\'r\',1(){4 b=P();8(!b){9.f(2.6.a.selectAction);5 7}8(!R()){9.f(2.6.a.selectItem);5 7}4 N=1(b){9.y();2.z(b)};8(b==\'bulk_delete\'){9.1a(2.6.a.bulkDeleteConfirm,1(){N(b)})}u{N(b)}5 7});4 $o=$(\'#o\');$o.h(\'r\',\'.k-d-11\',1(){4 v=$(c).s(\'3-q\');9.1a(2.6.a.deleteConfirm,1(){$(\'#Y\').j(v);2.z(\'11\')});5 7});$o.h(\'r\',\'.d-edit\',1(){4 q=$(c).s(\'3-q\');3={\'B\':\'connections_get-d\',\'connection_id\':q};$.M({p:\'L\',K:2.6.J,3:3,I:\'H\'}).G(1(3){9.19();8(3.l){2.i.populate(3.l,16);E()}u{}}).A(1(){9.19()});9.y();5 7});$o.h(\'r\',\'.k-set-default\',1(){9.y();4 v=$(c).s(\'3-d-q\');$(\'#Y\').j(v);2.z(\'set_default\');5 7});$(\'#btnAddConnection\').h(\'r\',1(){E(16);5 7});$(\'#btnConnectionTest\').14({\'V\':1(){8(!2.i.T(\'test_connection\')){5 7}4 x=2.i.3(),3={\'B\':\'connections_test\',\'d\':x};4 k=c;c.W();$.M({p:\'L\',K:2.6.J,3:3,I:\'H\'}).G(1(3){8(3.l){8(3.l.l){f(2.6.a.connectionOk)}u{f(2.6.a.connectionFailed+\' \'+(3.l.error||\'\'))}}u{f(2.6.a.X)}}).A(1(){f(2.6.a.X)}).15(1(){k.1d()});5 7}});$(\'#btnConnectionSave\').14({\'V\':1(){8(!2.i.T(\'d\')){5 7}4 x=2.i.3(),3={\'B\':\'connections_save\',\'d\':x};4 k=c;c.W();$.M({p:\'L\',K:2.6.J,3:3,I:\'H\'}).G(1(3){8(3.l){$.12.close();9.y();$(\'#ctrl_sub_action\').j(\'add\');2.z(\'reload\')}u{f(2.6.a.Z)}}).A(1(){f(2.6.a.Z)}).15(1(){k.1d()});5 7}});n()});',[],76,'|function|app|data|var|return|options|false|if|AppHelper|messages|action|this|connection||alert|dbType|on|connectionForm|val|btn|result|formContainer|handleDbType|gridResults|type|id|click|attr|reset|else|connectionId|bulkActionCtrlList|connectionParameters|showLoading|trigger|fail|ctrl|ctrlDbType|prevDbType|openConnectionPopup|getDbTypeClass|done|json|dataType|ajaxUrl|url|POST|ajax|actionHandler|jQuery|getBulkAction|className|hasCheckedItems|prevDbTypeClass|validate|dbTypeClass|onClick|start|connectionTestFailed|hidConnectionId|connectionSaveFailed|bulk|delete|magnificPopup|change|ariButton|always|true|select|ari_adminer_plugin|hideLoading|confirm|newConnectionForm||complete'.split('|'),0,{}));
includes/controllers/connections/class-reset-default.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Ari_Adminer\Controllers\Connections;
3
+
4
+ use Ari\Controllers\Controller as Controller;
5
+ use Ari\Utils\Response as Response;
6
+ use Ari_Adminer\Helpers\Helper as Helper;
7
+
8
+ class Reset_Default extends Controller {
9
+ public function execute() {
10
+ $model = $this->model();
11
+
12
+ $params = array(
13
+ 'page' => 'ari-adminer-connections',
14
+
15
+ 'filter' => $model->encoded_filter_state(),
16
+ );
17
+
18
+ $result = false;
19
+ if ( Helper::has_access_to_adminer() ) {
20
+ $result = Helper::set_default_connection( 0 );
21
+ }
22
+
23
+ if ( $result ) {
24
+ $params['msg_type'] = ARIADMINER_MESSAGETYPE_SUCCESS;
25
+ $params['msg'] = __( 'Connection to WordPress database is set as default connection', 'ari-adminer' );
26
+ } else {
27
+ $params['msg_type'] = ARIADMINER_MESSAGETYPE_WARNING;
28
+ $params['msg'] = __( 'Connection could not be reset', 'ari-adminer' );
29
+ }
30
+
31
+ Response::redirect(
32
+ Helper::build_url(
33
+ $params
34
+ )
35
+ );
36
+ }
37
+ }
includes/controllers/connections/class-set-default.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Ari_Adminer\Controllers\Connections;
3
+
4
+ use Ari\Controllers\Controller as Controller;
5
+ use Ari\Utils\Response as Response;
6
+ use Ari\Utils\Request as Request;
7
+ use Ari_Adminer\Helpers\Helper as Helper;
8
+
9
+ class Set_Default extends Controller {
10
+ public function execute() {
11
+ $result = false;
12
+ $model = $this->model();
13
+
14
+ if ( Request::exists( 'action_connection_id' ) && Helper::has_access_to_adminer() ) {
15
+ $connection_id = (int) Request::get_var( 'action_connection_id', 0, 'num' );
16
+ if ( $connection_id > 0 ) {
17
+ $result = Helper::set_default_connection( $connection_id );
18
+ }
19
+ }
20
+
21
+ if ( $result ) {
22
+ Response::redirect(
23
+ Helper::build_url(
24
+ array(
25
+ 'page' => 'ari-adminer-connections',
26
+
27
+ 'filter' => $model->encoded_filter_state(),
28
+
29
+ 'msg' => __( 'Default connection is changed successfully', 'ari-adminer' ),
30
+
31
+ 'msg_type' => ARIADMINER_MESSAGETYPE_SUCCESS,
32
+ )
33
+ )
34
+ );
35
+ } else {
36
+ Response::redirect(
37
+ Helper::build_url(
38
+ array(
39
+ 'page' => 'ari-adminer-connections',
40
+
41
+ 'filter' => $model->encoded_filter_state(),
42
+
43
+ 'msg' => __( 'Default connection has not been changed', 'ari-adminer' ),
44
+
45
+ 'msg_type' => ARIADMINER_MESSAGETYPE_WARNING,
46
+ )
47
+ )
48
+ );
49
+ }
50
+ }
51
+ }
includes/defines.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
- define( 'ARIADMINER_VERSION', '1.1.2' );
3
  define( 'ARIADMINER_SLUG', 'ari-adminer' );
4
  define( 'ARIADMINER_ASSETS_URL', ARIADMINER_URL . 'assets/' );
5
  define( 'ARIADMINER_VERSION_OPTION', 'ari_adminer' );
 
6
  define( 'ARIADMINER_INSTALL_PATH', ARIADMINER_PATH . 'install/' );
7
  define( 'ARIADMINER_CAPABILITY_RUN', 'run_adminer' );
8
 
1
  <?php
2
+ define( 'ARIADMINER_VERSION', '1.1.3' );
3
  define( 'ARIADMINER_SLUG', 'ari-adminer' );
4
  define( 'ARIADMINER_ASSETS_URL', ARIADMINER_URL . 'assets/' );
5
  define( 'ARIADMINER_VERSION_OPTION', 'ari_adminer' );
6
+ define( 'ARIADMINER_DEFAULT_CONN_OPTION', 'ari_adminer_default_conn' );
7
  define( 'ARIADMINER_INSTALL_PATH', ARIADMINER_PATH . 'install/' );
8
  define( 'ARIADMINER_CAPABILITY_RUN', 'run_adminer' );
9
 
includes/helpers/class-helper.php CHANGED
@@ -162,4 +162,29 @@ class Helper {
162
 
163
  return $connections_model->re_crypt_passwords( $new_crypt_key, $old_crypt_key );
164
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  }
162
 
163
  return $connections_model->re_crypt_passwords( $new_crypt_key, $old_crypt_key );
164
  }
165
+
166
+ public static function set_default_connection( $connection_id, $reset_if_current = true ) {
167
+ $connection_id = intval( $connection_id, 10 );
168
+
169
+ if ( $connection_id < 0 )
170
+ return false;
171
+
172
+ if ( $reset_if_current ) {
173
+ $current_default_connetion_id = self::get_default_connection();
174
+
175
+ if ( $current_default_connetion_id == $connection_id )
176
+ $connection_id = 0;
177
+ }
178
+
179
+ return update_option( ARIADMINER_DEFAULT_CONN_OPTION, $connection_id );
180
+ }
181
+
182
+ public static function get_default_connection() {
183
+ $connection_id = intval( get_option( ARIADMINER_DEFAULT_CONN_OPTION, 0 ), 10 );
184
+
185
+ if ( $connection_id < 0 )
186
+ $connection_id = 0;
187
+
188
+ return $connection_id;
189
+ }
190
  }
includes/models/class-adminer-runner.php CHANGED
@@ -3,6 +3,8 @@ namespace Ari_Adminer\Models;
3
 
4
  use Ari\Models\Model as Model;
5
  use Ari_Adminer\Models\Connections as Connections_Model;
 
 
6
 
7
  class Adminer_Runner extends Model {
8
  public function data() {
@@ -16,8 +18,26 @@ class Adminer_Runner extends Model {
16
 
17
  $connections = $connections_model->items();
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  $data = array(
20
  'connections' => $connections,
 
 
21
  );
22
 
23
  return $data;
3
 
4
  use Ari\Models\Model as Model;
5
  use Ari_Adminer\Models\Connections as Connections_Model;
6
+ use Ari_Adminer\Models\Connection as Connection_Model;
7
+ use Ari_Adminer\Helpers\Helper as Helper;
8
 
9
  class Adminer_Runner extends Model {
10
  public function data() {
18
 
19
  $connections = $connections_model->items();
20
 
21
+ $default_connection_id = Helper::get_default_connection();
22
+ if ( $default_connection_id > 0 ) {
23
+ $connection_model = new Connection_Model(
24
+ array(
25
+ 'class_prefix' => $this->options->class_prefix,
26
+
27
+ 'disable_state_load' => true,
28
+ )
29
+ );
30
+
31
+ $default_connection = $connection_model->get_connection( $default_connection_id );
32
+ if ( false === $default_connection ) {
33
+ $default_connection_id = 0;
34
+ }
35
+ }
36
+
37
  $data = array(
38
  'connections' => $connections,
39
+
40
+ 'default_connection_id' => $default_connection_id,
41
  );
42
 
43
  return $data;
includes/models/class-connections.php CHANGED
@@ -54,7 +54,9 @@ class Connections extends Model {
54
 
55
  'filter' => $filter,
56
 
57
- 'filter_encoded' => $this->encoded_filter_state()
 
 
58
  );
59
 
60
  return $data;
54
 
55
  'filter' => $filter,
56
 
57
+ 'filter_encoded' => $this->encoded_filter_state(),
58
+
59
+ 'default_connection_id' => Helper::get_default_connection(),
60
  );
61
 
62
  return $data;
includes/views/adminer-runner/tmpl/default.php CHANGED
@@ -3,6 +3,8 @@ use Ari_Adminer\Helpers\Helper as Helper;
3
  use Ari_Adminer\Utils\Db_Driver as DB_Driver;
4
 
5
  $connections = $data['connections'];
 
 
6
  $run_url = Helper::build_url(
7
  array(
8
  'action' => 'run',
@@ -41,7 +43,7 @@ $run_url = Helper::build_url(
41
  <a href="http://wp-quiz.ari-soft.com" target="_blank" title="Viral Quiz Builder for WordPress"><strong>ARI Stream Quiz</strong><?php _e( ' is viral quiz builder', 'ari-adminer' ); ?></a>
42
  </li>
43
  <li>
44
- <a href="https://wordpress.org/plugins/ari-cf7-connector/" target="_blank" title="Contact From 7 Connector"><strong>Contact Form 7 Connector</strong><?php _e( ' integrates CF7 with MailChimp', 'ari-adminer' ); ?></a>
45
  </li>
46
  </ul>
47
  </div>
@@ -58,12 +60,12 @@ $run_url = Helper::build_url(
58
  <label for="ddlConnection"><?php _e( 'Connection', 'ari-adminer' ); ?></label>
59
  <select id="ddlConnection" name="connection_id" autocomplete="off">
60
  <option value="-1"><?php _e( '- Custom parameters -', 'ari-adminer' ); ?></option>
61
- <option value="0" selected="selected"><?php _e( '- WordPress database -', 'ari-adminer' ); ?></option>
62
  <?php
63
  if ( is_array( $connections ) ):
64
  foreach ( $connections as $connection ):
65
  ?>
66
- <option value="<?php echo $connection->connection_id; ?>"><?php echo $connection->title; ?></option>
67
  <?php
68
  endforeach;
69
  endif;
3
  use Ari_Adminer\Utils\Db_Driver as DB_Driver;
4
 
5
  $connections = $data['connections'];
6
+ $default_connection_id = $data['default_connection_id'];
7
+
8
  $run_url = Helper::build_url(
9
  array(
10
  'action' => 'run',
43
  <a href="http://wp-quiz.ari-soft.com" target="_blank" title="Viral Quiz Builder for WordPress"><strong>ARI Stream Quiz</strong><?php _e( ' is viral quiz builder', 'ari-adminer' ); ?></a>
44
  </li>
45
  <li>
46
+ <a href="https://wordpress.org/plugins/ari-cf7-connector/" target="_blank" title="Contact From 7 Connector"><strong>Contact Form 7 Connector</strong><?php _e( ' integrates CF7 with MailChimp, MailerLite, Zapier', 'ari-adminer' ); ?></a>
47
  </li>
48
  </ul>
49
  </div>
60
  <label for="ddlConnection"><?php _e( 'Connection', 'ari-adminer' ); ?></label>
61
  <select id="ddlConnection" name="connection_id" autocomplete="off">
62
  <option value="-1"><?php _e( '- Custom parameters -', 'ari-adminer' ); ?></option>
63
+ <option value="0"<?php if ( 0 === $default_connection_id ): ?> selected="selected"<?php endif; ?>><?php _e( '- WordPress database -', 'ari-adminer' ); ?></option>
64
  <?php
65
  if ( is_array( $connections ) ):
66
  foreach ( $connections as $connection ):
67
  ?>
68
+ <option value="<?php echo $connection->connection_id; ?>"<?php if ( $connection->connection_id == $default_connection_id ): ?> selected="selected"<?php endif; ?>><?php echo $connection->title; ?></option>
69
  <?php
70
  endforeach;
71
  endif;
includes/views/connections/class-html.php CHANGED
@@ -56,6 +56,10 @@ class Html extends Base {
56
  $order_by = $filter['order_by'];
57
  $order_dir = $filter['order_dir'];
58
 
 
 
 
 
59
  $delete_url = Helper::build_url(
60
  array(
61
  'action' => 'delete',
@@ -162,6 +166,28 @@ class Html extends Base {
162
  return Helper::db_type_to_label( $val );
163
  }
164
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  ),
166
  )
167
  );
56
  $order_by = $filter['order_by'];
57
  $order_dir = $filter['order_dir'];
58
 
59
+ $default_connection_id = Helper::get_default_connection();
60
+ $set_default_message = __( 'Set as default connection', 'ari-adminer' );
61
+ $reset_default_message = __( 'Reset default connection to WordPress database', 'ari-adminer' );
62
+
63
  $delete_url = Helper::build_url(
64
  array(
65
  'action' => 'delete',
166
  return Helper::db_type_to_label( $val );
167
  }
168
  ),
169
+
170
+ array(
171
+ 'key' => 'default',
172
+
173
+ 'header' => __( 'Default', 'ari-adminer' ),
174
+
175
+ 'header_class' => 'manage-column column-default',
176
+
177
+ 'class' => 'column-default',
178
+
179
+ 'virtual' => true,
180
+
181
+ 'column' => function( $val, $data ) use ( $default_connection_id, $set_default_message, $reset_default_message ) {
182
+ $connection_id = $data->connection_id;
183
+ $is_default_connection = $default_connection_id == $connection_id;
184
+ $title = $is_default_connection ? $reset_default_message : $set_default_message;
185
+
186
+ $css_class = $is_default_connection ? 'adminer-icon-default-selected' : 'adminer-icon-default';
187
+
188
+ return '<a href="#" title="' . esc_attr( $title ) . '" class="btn-set-default adminer-icon ' . $css_class . '" data-connection-id="' . $connection_id . '"></a>';
189
+ }
190
+ ),
191
  ),
192
  )
193
  );
includes/views/connections/tmpl/default.php CHANGED
@@ -8,12 +8,23 @@ $action_url = Helper::build_url(
8
  'noheader' => '1',
9
  ),
10
  array(
11
- 'filter'
 
 
 
 
 
 
 
 
12
  )
13
  );
14
  $tmpl_path = dirname( __FILE__ ) . '/';
15
  ?>
16
  <a href="#" class="<?php if ( ARI_WP_LEGACY ): ?>add-new-h2<?php else: ?>page-title-action<?php endif; ?>" id="btnAddConnection"><?php _e( 'Add New', 'ari-adminer' ); ?></a>
 
 
 
17
  <hr class="wp-header-end">
18
  <form action="<?php echo esc_url( $action_url ); ?>" method="POST">
19
  <div>
@@ -73,7 +84,7 @@ $tmpl_path = dirname( __FILE__ ) . '/';
73
  <a href="#" id="btnConnectionSave" class="button button-primary"><?php _e( 'Save', 'ari-adminer' ); ?></a>
74
  <a href="#" id="btnConnectionTest" class="button"><?php _e( 'Test Connection', 'ari-adminer' ); ?></a>
75
  </div>
76
- <input id="hidConnectionId" type="hidden" class="form-control" data-key="connection_id" value="0" autocomplete="off" />
77
  </fieldset>
78
  </div>
79
  </div>
8
  'noheader' => '1',
9
  ),
10
  array(
11
+ 'filter',
12
+ )
13
+ );
14
+ $reset_default_url = Helper::build_url(
15
+ array(
16
+ 'action' => 'reset_default',
17
+ ),
18
+ array(
19
+ 'filter',
20
  )
21
  );
22
  $tmpl_path = dirname( __FILE__ ) . '/';
23
  ?>
24
  <a href="#" class="<?php if ( ARI_WP_LEGACY ): ?>add-new-h2<?php else: ?>page-title-action<?php endif; ?>" id="btnAddConnection"><?php _e( 'Add New', 'ari-adminer' ); ?></a>
25
+ <?php if ( $data['default_connection_id'] > 0 ): ?>
26
+ <a href="<?php echo esc_url( $reset_default_url ); ?>" class="<?php if ( ARI_WP_LEGACY ): ?>add-new-h2<?php else: ?>page-title-action<?php endif; ?>"><?php _e( 'Reset Default Connection', 'ari-adminer' ); ?></a>
27
+ <?php endif; ?>
28
  <hr class="wp-header-end">
29
  <form action="<?php echo esc_url( $action_url ); ?>" method="POST">
30
  <div>
84
  <a href="#" id="btnConnectionSave" class="button button-primary"><?php _e( 'Save', 'ari-adminer' ); ?></a>
85
  <a href="#" id="btnConnectionTest" class="button"><?php _e( 'Test Connection', 'ari-adminer' ); ?></a>
86
  </div>
87
+ <input id="hidFormConnectionId" type="hidden" class="form-control" data-key="connection_id" value="0" autocomplete="off" />
88
  </fieldset>
89
  </div>
90
  </div>
languages/ari-adminer.pot CHANGED
@@ -5,9 +5,9 @@
5
  msgid ""
6
  msgstr ""
7
  "Project-Id-Version: ARI "
8
- "Adminer v 1.1.0\n"
9
  "POT-Creation-Date: "
10
- "2017-03-27 10:42+0300\n"
11
  "PO-Revision-Date: \n"
12
  "Last-Translator: Your "
13
  "Name <you@example.com>\n"
@@ -44,8 +44,7 @@ msgstr ""
44
  "_nc:4c,1,2\n"
45
  "X-Poedit-Basepath: ..\n"
46
  "Language: en_US\n"
47
- "X-Generator: Poedit "
48
- "1.8.11\n"
49
  "X-Poedit-"
50
  "SearchPath-0: .\n"
51
  "X-Poedit-"
@@ -179,6 +178,31 @@ msgid ""
179
  "successfully"
180
  msgstr ""
181
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  #: includes/controls/grid/class-grid.php:13
183
  msgid "No results found"
184
  msgstr ""
@@ -327,112 +351,119 @@ msgid ""
327
  "occurs: "
328
  msgstr ""
329
 
330
- #: includes/views/adminer-runner/tmpl/default.php:18
331
  msgid "How can I help?"
332
  msgstr ""
333
 
334
- #: includes/views/adminer-runner/tmpl/default.php:22
335
  msgid ""
336
  "Share feedback or idea"
337
  msgstr ""
338
 
339
- #: includes/views/adminer-runner/tmpl/default.php:25
340
  msgid ""
341
  "Write a review and give "
342
  "a rating"
343
  msgstr ""
344
 
345
- #: includes/views/adminer-runner/tmpl/default.php:28
346
  msgid ""
347
  "Follow us on Twitter"
348
  msgstr ""
349
 
350
- #: includes/views/adminer-runner/tmpl/default.php:34
351
  msgid "Other plugins"
352
  msgstr ""
353
 
354
- #: includes/views/adminer-runner/tmpl/default.php:38
355
  msgid ""
356
  " is the best lightbox "
357
  "plugin"
358
  msgstr ""
359
 
360
- #: includes/views/adminer-runner/tmpl/default.php:41
361
  msgid ""
362
  " is viral quiz builder"
363
  msgstr ""
364
 
365
- #: includes/views/adminer-runner/tmpl/default.php:50
366
  msgid ""
367
- "DB Connection parameters"
 
 
368
  msgstr ""
369
 
370
  #: includes/views/adminer-runner/tmpl/default.php:55
 
 
 
 
 
371
  msgid "Connection"
372
  msgstr ""
373
 
374
- #: includes/views/adminer-runner/tmpl/default.php:57
375
  msgid ""
376
  "- Custom parameters -"
377
  msgstr ""
378
 
379
- #: includes/views/adminer-runner/tmpl/default.php:58
380
  msgid ""
381
  "- WordPress database -"
382
  msgstr ""
383
 
384
- #: includes/views/adminer-runner/tmpl/default.php:73
385
- #: includes/views/connections/tmpl/default.php:43
386
  msgid "DB Type"
387
  msgstr ""
388
 
389
- #: includes/views/adminer-runner/tmpl/default.php:82
390
- #: includes/views/connections/tmpl/default.php:52
391
  msgid "Host"
392
  msgstr ""
393
 
394
- #: includes/views/adminer-runner/tmpl/default.php:83
395
- #: includes/views/connections/tmpl/default.php:53
396
  msgid "Eg. localhost"
397
  msgstr ""
398
 
399
- #: includes/views/adminer-runner/tmpl/default.php:87
400
- #: includes/views/connections/tmpl/default.php:57
401
  msgid "Path to DB file"
402
  msgstr ""
403
 
404
- #: includes/views/adminer-runner/tmpl/default.php:88
405
- #: includes/views/connections/tmpl/default.php:58
406
  msgid "DB name"
407
  msgstr ""
408
 
409
- #: includes/views/adminer-runner/tmpl/default.php:89
410
- #: includes/views/connections/tmpl/default.php:59
411
  msgid "Specify database"
412
  msgstr ""
413
 
414
- #: includes/views/adminer-runner/tmpl/default.php:93
415
- #: includes/views/connections/tmpl/default.php:63
416
  msgid "User"
417
  msgstr ""
418
 
419
- #: includes/views/adminer-runner/tmpl/default.php:98
420
- #: includes/views/connections/tmpl/default.php:68
421
  msgid "Password"
422
  msgstr ""
423
 
424
- #: includes/views/adminer-runner/tmpl/default.php:103
425
- #: includes/views/connections/tmpl/default.php:74
426
  msgid "Test Connection"
427
  msgstr ""
428
 
429
- #: includes/views/adminer-runner/tmpl/default.php:108
430
  msgid ""
431
  "Run Adminer in modal "
432
  "window"
433
  msgstr ""
434
 
435
- #: includes/views/adminer-runner/tmpl/default.php:109
436
  msgid ""
437
  "Run Adminer in a new "
438
  "window"
@@ -493,41 +524,61 @@ msgid ""
493
  "Select at least one item"
494
  msgstr ""
495
 
496
- #: includes/views/connections/class-html.php:114
497
- #: includes/views/connections/tmpl/default.php:38
 
 
 
 
 
 
 
 
 
 
 
498
  msgid "Title"
499
  msgstr ""
500
 
501
- #: includes/views/connections/class-html.php:129
502
  msgid "Edit"
503
  msgstr ""
504
 
505
- #: includes/views/connections/class-html.php:135
506
  #: includes/views/connections/tmpl/toolbar.php:9
507
  msgid "Delete"
508
  msgstr ""
509
 
510
- #: includes/views/connections/class-html.php:145
511
  msgid "Show more details"
512
  msgstr ""
513
 
514
- #: includes/views/connections/class-html.php:155
515
  msgid "Type"
516
  msgstr ""
517
 
518
- #: includes/views/connections/tmpl/default.php:16
 
 
 
 
519
  msgid "Add New"
520
  msgstr ""
521
 
522
- #: includes/views/connections/tmpl/default.php:34
 
 
 
 
 
523
  msgid "Connection settings"
524
  msgstr ""
525
 
526
- #: includes/views/connections/tmpl/default.php:39
527
  msgid "Specify title"
528
  msgstr ""
529
 
530
- #: includes/views/connections/tmpl/default.php:73
531
  msgid "Save"
532
  msgstr ""
533
 
5
  msgid ""
6
  msgstr ""
7
  "Project-Id-Version: ARI "
8
+ "Adminer v 1.1.3\n"
9
  "POT-Creation-Date: "
10
+ "2017-07-27 23:59+0300\n"
11
  "PO-Revision-Date: \n"
12
  "Last-Translator: Your "
13
  "Name <you@example.com>\n"
44
  "_nc:4c,1,2\n"
45
  "X-Poedit-Basepath: ..\n"
46
  "Language: en_US\n"
47
+ "X-Generator: Poedit 2.0\n"
 
48
  "X-Poedit-"
49
  "SearchPath-0: .\n"
50
  "X-Poedit-"
178
  "successfully"
179
  msgstr ""
180
 
181
+ #: includes/controllers/connections/class-reset-default.php:25
182
+ msgid ""
183
+ "Connection to WordPress "
184
+ "database is set as "
185
+ "default connection"
186
+ msgstr ""
187
+
188
+ #: includes/controllers/connections/class-reset-default.php:28
189
+ msgid ""
190
+ "Connection could not be "
191
+ "reset"
192
+ msgstr ""
193
+
194
+ #: includes/controllers/connections/class-set-default.php:29
195
+ msgid ""
196
+ "Default connection is "
197
+ "changed successfully"
198
+ msgstr ""
199
+
200
+ #: includes/controllers/connections/class-set-default.php:43
201
+ msgid ""
202
+ "Default connection has "
203
+ "not been changed"
204
+ msgstr ""
205
+
206
  #: includes/controls/grid/class-grid.php:13
207
  msgid "No results found"
208
  msgstr ""
351
  "occurs: "
352
  msgstr ""
353
 
354
+ #: includes/views/adminer-runner/tmpl/default.php:20
355
  msgid "How can I help?"
356
  msgstr ""
357
 
358
+ #: includes/views/adminer-runner/tmpl/default.php:24
359
  msgid ""
360
  "Share feedback or idea"
361
  msgstr ""
362
 
363
+ #: includes/views/adminer-runner/tmpl/default.php:27
364
  msgid ""
365
  "Write a review and give "
366
  "a rating"
367
  msgstr ""
368
 
369
+ #: includes/views/adminer-runner/tmpl/default.php:30
370
  msgid ""
371
  "Follow us on Twitter"
372
  msgstr ""
373
 
374
+ #: includes/views/adminer-runner/tmpl/default.php:36
375
  msgid "Other plugins"
376
  msgstr ""
377
 
378
+ #: includes/views/adminer-runner/tmpl/default.php:40
379
  msgid ""
380
  " is the best lightbox "
381
  "plugin"
382
  msgstr ""
383
 
384
+ #: includes/views/adminer-runner/tmpl/default.php:43
385
  msgid ""
386
  " is viral quiz builder"
387
  msgstr ""
388
 
389
+ #: includes/views/adminer-runner/tmpl/default.php:46
390
  msgid ""
391
+ " integrates CF7 with "
392
+ "MailChimp, MailerLite, "
393
+ "Zapier"
394
  msgstr ""
395
 
396
  #: includes/views/adminer-runner/tmpl/default.php:55
397
+ msgid ""
398
+ "DB Connection parameters"
399
+ msgstr ""
400
+
401
+ #: includes/views/adminer-runner/tmpl/default.php:60
402
  msgid "Connection"
403
  msgstr ""
404
 
405
+ #: includes/views/adminer-runner/tmpl/default.php:62
406
  msgid ""
407
  "- Custom parameters -"
408
  msgstr ""
409
 
410
+ #: includes/views/adminer-runner/tmpl/default.php:63
411
  msgid ""
412
  "- WordPress database -"
413
  msgstr ""
414
 
415
+ #: includes/views/adminer-runner/tmpl/default.php:78
416
+ #: includes/views/connections/tmpl/default.php:54
417
  msgid "DB Type"
418
  msgstr ""
419
 
420
+ #: includes/views/adminer-runner/tmpl/default.php:87
421
+ #: includes/views/connections/tmpl/default.php:63
422
  msgid "Host"
423
  msgstr ""
424
 
425
+ #: includes/views/adminer-runner/tmpl/default.php:88
426
+ #: includes/views/connections/tmpl/default.php:64
427
  msgid "Eg. localhost"
428
  msgstr ""
429
 
430
+ #: includes/views/adminer-runner/tmpl/default.php:92
431
+ #: includes/views/connections/tmpl/default.php:68
432
  msgid "Path to DB file"
433
  msgstr ""
434
 
435
+ #: includes/views/adminer-runner/tmpl/default.php:93
436
+ #: includes/views/connections/tmpl/default.php:69
437
  msgid "DB name"
438
  msgstr ""
439
 
440
+ #: includes/views/adminer-runner/tmpl/default.php:94
441
+ #: includes/views/connections/tmpl/default.php:70
442
  msgid "Specify database"
443
  msgstr ""
444
 
445
+ #: includes/views/adminer-runner/tmpl/default.php:98
446
+ #: includes/views/connections/tmpl/default.php:74
447
  msgid "User"
448
  msgstr ""
449
 
450
+ #: includes/views/adminer-runner/tmpl/default.php:103
451
+ #: includes/views/connections/tmpl/default.php:79
452
  msgid "Password"
453
  msgstr ""
454
 
455
+ #: includes/views/adminer-runner/tmpl/default.php:108
456
+ #: includes/views/connections/tmpl/default.php:85
457
  msgid "Test Connection"
458
  msgstr ""
459
 
460
+ #: includes/views/adminer-runner/tmpl/default.php:113
461
  msgid ""
462
  "Run Adminer in modal "
463
  "window"
464
  msgstr ""
465
 
466
+ #: includes/views/adminer-runner/tmpl/default.php:114
467
  msgid ""
468
  "Run Adminer in a new "
469
  "window"
524
  "Select at least one item"
525
  msgstr ""
526
 
527
+ #: includes/views/connections/class-html.php:60
528
+ msgid ""
529
+ "Set as default connection"
530
+ msgstr ""
531
+
532
+ #: includes/views/connections/class-html.php:61
533
+ msgid ""
534
+ "Reset default connection "
535
+ "to WordPress database"
536
+ msgstr ""
537
+
538
+ #: includes/views/connections/class-html.php:118
539
+ #: includes/views/connections/tmpl/default.php:49
540
  msgid "Title"
541
  msgstr ""
542
 
543
+ #: includes/views/connections/class-html.php:133
544
  msgid "Edit"
545
  msgstr ""
546
 
547
+ #: includes/views/connections/class-html.php:139
548
  #: includes/views/connections/tmpl/toolbar.php:9
549
  msgid "Delete"
550
  msgstr ""
551
 
552
+ #: includes/views/connections/class-html.php:149
553
  msgid "Show more details"
554
  msgstr ""
555
 
556
+ #: includes/views/connections/class-html.php:159
557
  msgid "Type"
558
  msgstr ""
559
 
560
+ #: includes/views/connections/class-html.php:173
561
+ msgid "Default"
562
+ msgstr ""
563
+
564
+ #: includes/views/connections/tmpl/default.php:24
565
  msgid "Add New"
566
  msgstr ""
567
 
568
+ #: includes/views/connections/tmpl/default.php:26
569
+ msgid ""
570
+ "Reset Default Connection"
571
+ msgstr ""
572
+
573
+ #: includes/views/connections/tmpl/default.php:45
574
  msgid "Connection settings"
575
  msgstr ""
576
 
577
+ #: includes/views/connections/tmpl/default.php:50
578
  msgid "Specify title"
579
  msgstr ""
580
 
581
+ #: includes/views/connections/tmpl/default.php:84
582
  msgid "Save"
583
  msgstr ""
584
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wp-quiz.ari-soft.com/plugins/wordpress-adminer.html
4
  Tags: adminer, sql, database, mysql, report, sqlite, table, postgresql, dump, backup, import, export, phpmyadmin
5
  Requires at least: 3.4
6
  Tested up to: 4.8.0
7
- Stable tag: 1.1.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -74,6 +74,9 @@ Sure, it is available [here](http://www.ari-soft.com/docs/wordpress/ari-adminer/
74
 
75
  == Changelog ==
76
 
 
 
 
77
  = 1.1.2 =
78
  * Update Adminer to v. 4.3.1
79
  * Check installed PHP extensions for PostgreSQL
@@ -114,6 +117,9 @@ Sure, it is available [here](http://www.ari-soft.com/docs/wordpress/ari-adminer/
114
 
115
  == Upgrade Notice ==
116
 
 
 
 
117
  = 1.1.2 =
118
  * Update Adminer to v. 4.3.1
119
  * Check installed PHP extensions for PostgreSQL
4
  Tags: adminer, sql, database, mysql, report, sqlite, table, postgresql, dump, backup, import, export, phpmyadmin
5
  Requires at least: 3.4
6
  Tested up to: 4.8.0
7
+ Stable tag: 1.1.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
74
 
75
  == Changelog ==
76
 
77
+ = 1.1.3 =
78
+ * Possible to select default connection
79
+
80
  = 1.1.2 =
81
  * Update Adminer to v. 4.3.1
82
  * Check installed PHP extensions for PostgreSQL
117
 
118
  == Upgrade Notice ==
119
 
120
+ = 1.1.3 =
121
+ * Possible to select default connection
122
+
123
  = 1.1.2 =
124
  * Update Adminer to v. 4.3.1
125
  * Check installed PHP extensions for PostgreSQL
uninstall.php CHANGED
@@ -29,6 +29,7 @@ if ( ! is_multisite() ) {
29
  execute_queries( $queries );
30
  delete_option( 'ari_adminer' );
31
  delete_option( 'ari_adminer_settings' );
 
32
  } else {
33
  global $wpdb;
34
 
@@ -41,6 +42,7 @@ if ( ! is_multisite() ) {
41
  execute_queries( $queries );
42
  delete_option( 'ari_adminer' );
43
  delete_option( 'ari_adminer_settings' );
 
44
  }
45
 
46
  switch_to_blog( $original_blog_id );
29
  execute_queries( $queries );
30
  delete_option( 'ari_adminer' );
31
  delete_option( 'ari_adminer_settings' );
32
+ delete_option( 'ari_adminer_default_conn' );
33
  } else {
34
  global $wpdb;
35
 
42
  execute_queries( $queries );
43
  delete_option( 'ari_adminer' );
44
  delete_option( 'ari_adminer_settings' );
45
+ delete_option( 'ari_adminer_default_conn' );
46
  }
47
 
48
  switch_to_blog( $original_blog_id );