Skip to content

Commit ae0b92a

Browse files
use parameter name 'vaction'
1 parent 0964be2 commit ae0b92a

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

classes/Visualizer/Module/Admin.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ public function registerAdminMenu() {
598598
__( 'Add New Chart', 'visualizer' ),
599599
__( 'Add New Chart', 'visualizer' ),
600600
'edit_posts',
601-
admin_url( 'admin.php?page=' . Visualizer_Plugin::NAME . '&addnew' )
601+
admin_url( 'admin.php?page=' . Visualizer_Plugin::NAME . '&vaction=addnew' )
602602
);
603603
add_submenu_page(
604604
Visualizer_Plugin::NAME,
@@ -760,22 +760,22 @@ public function renderLibraryPage() {
760760
'map_api_key' => get_option( 'visualizer-map-api-key' ),
761761
'charts' => $charts,
762762
'urls' => array(
763-
'base' => add_query_arg( array( 'vpage' => false, 'addnew' => false ) ),
763+
'base' => add_query_arg( array( 'vpage' => false, 'vaction' => false ) ),
764764
'create' => add_query_arg(
765765
array(
766766
'action' => Visualizer_Plugin::ACTION_CREATE_CHART,
767767
'library' => 'yes',
768768
'type' => isset( $_GET['type'] ) ? $_GET['type'] : '',
769769
'chart-library' => isset( $_GET['chart-library'] ) ? $_GET['chart-library'] : '',
770-
'addnew' => false,
770+
'vaction' => false,
771771
),
772772
$ajaxurl
773773
),
774774
'edit' => add_query_arg(
775775
array(
776776
'action' => Visualizer_Plugin::ACTION_EDIT_CHART,
777777
'library' => 'yes',
778-
'addnew' => false,
778+
'vaction' => false,
779779
),
780780
$ajaxurl
781781
),
@@ -792,7 +792,7 @@ public function renderLibraryPage() {
792792
$render->custom_css = $css;
793793
$render->pagination = paginate_links(
794794
array(
795-
'base' => add_query_arg( array( 'vpage' => '%#%', 'addnew' => false ) ),
795+
'base' => add_query_arg( array( 'vpage' => '%#%', 'vaction' => false ) ),
796796
'format' => '',
797797
'current' => $page,
798798
'total' => $query->max_num_pages,

classes/Visualizer/Module/Chart.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public function deleteChart() {
380380
)
381381
);
382382
}
383-
wp_redirect( remove_query_arg( 'addnew', wp_get_referer() ) );
383+
wp_redirect( remove_query_arg( 'vaction', wp_get_referer() ) );
384384
exit;
385385
}
386386

@@ -1040,7 +1040,7 @@ public function cloneChart() {
10401040
$success = $chart && $chart->post_type === Visualizer_Plugin::CPT_VISUALIZER;
10411041
}
10421042
}
1043-
$redirect = remove_query_arg( 'addnew', wp_get_referer() );
1043+
$redirect = remove_query_arg( 'vaction', wp_get_referer() );
10441044
if ( $success ) {
10451045
$new_chart_id = wp_insert_post(
10461046
array(
@@ -1061,7 +1061,7 @@ public function cloneChart() {
10611061
array(
10621062
'page' => 'visualizer',
10631063
'type' => filter_input( INPUT_GET, 'type' ),
1064-
'addnew' => false,
1064+
'vaction' => false,
10651065
),
10661066
admin_url( 'upload.php' )
10671067
);

js/library.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@
7575

7676
// remove the 'type' while refreshing the library page on creation of a new chart.
7777
// this is to avoid cases where users have filtered for chart type A and end up creating chart type B
78-
// remove 'addnew' as well so that the popup doesnt keep popping up.
78+
// remove 'vaction' as well so that additional actions are removed
7979
wnd.send_to_editor = function () {
80-
wnd.location.href = vu.base.replace(/type=[a-zA-Z]*/, '').replace(/addnew/, '');
80+
wnd.location.href = vu.base.replace(/type=[a-zA-Z]*/, '').replace(/vaction/, '');
8181
};
8282
view.open();
8383

@@ -89,7 +89,7 @@
8989
view = new vmv.Chart({action: vu.edit + '&chart=' + $(this).attr('data-chart')});
9090

9191
wnd.send_to_editor = function () {
92-
wnd.location.href = wnd.location.href.replace(/addnew/, '');
92+
wnd.location.href = wnd.location.href.replace(/vaction/, '');
9393
};
9494

9595
view.open();
@@ -118,8 +118,8 @@
118118
return false;
119119
});
120120

121-
// if addnew is found as a GET request parameter, show the modal.
122-
if(location.href.indexOf('addnew') !== -1){
121+
// if vaction=addnew is found as a GET request parameter, show the modal.
122+
if(location.href.indexOf('vaction=addnew') !== -1){
123123
$('.add-new-chart').trigger('click');
124124
}
125125

0 commit comments

Comments
 (0)