@@ -443,6 +443,7 @@ public function renderChartPages() {
443
443
add_post_meta ( $ chart_id , Visualizer_Plugin::CF_DEFAULT_DATA , 1 );
444
444
add_post_meta ( $ chart_id , Visualizer_Plugin::CF_SOURCE , $ source ->getSourceName () );
445
445
add_post_meta ( $ chart_id , Visualizer_Plugin::CF_SERIES , $ source ->getSeries () );
446
+ add_post_meta ( $ chart_id , Visualizer_Plugin::CF_CHART_LIBRARY , '' );
446
447
add_post_meta (
447
448
$ chart_id ,
448
449
Visualizer_Plugin::CF_SETTINGS ,
@@ -1022,19 +1023,10 @@ public function uploadData() {
1022
1023
*/
1023
1024
public function cloneChart () {
1024
1025
$ chart_id = $ success = false ;
1025
- $ nonce = wp_verify_nonce ( filter_input ( INPUT_GET , 'nonce ' ) , Visualizer_Plugin::ACTION_CLONE_CHART );
1026
+ $ nonce = isset ( $ _GET [ 'nonce ' ] ) && wp_verify_nonce ( $ _GET [ ' nonce ' ] , Visualizer_Plugin::ACTION_CLONE_CHART );
1026
1027
$ capable = current_user_can ( 'edit_posts ' );
1027
1028
if ( $ nonce && $ capable ) {
1028
- $ chart_id = filter_input (
1029
- INPUT_GET ,
1030
- 'chart ' ,
1031
- FILTER_VALIDATE_INT ,
1032
- array (
1033
- 'options ' => array (
1034
- 'min_range ' => 1 ,
1035
- ),
1036
- )
1037
- );
1029
+ $ chart_id = isset ( $ _GET ['chart ' ] ) ? filter_var ( $ _GET ['chart ' ], FILTER_VALIDATE_INT ) : '' ;
1038
1030
if ( $ chart_id ) {
1039
1031
$ chart = get_post ( $ chart_id );
1040
1032
$ success = $ chart && $ chart ->post_type === Visualizer_Plugin::CPT_VISUALIZER ;
@@ -1053,6 +1045,7 @@ public function cloneChart() {
1053
1045
);
1054
1046
if ( $ new_chart_id && ! is_wp_error ( $ new_chart_id ) ) {
1055
1047
add_post_meta ( $ new_chart_id , Visualizer_Plugin::CF_CHART_TYPE , get_post_meta ( $ chart_id , Visualizer_Plugin::CF_CHART_TYPE , true ) );
1048
+ add_post_meta ( $ new_chart_id , Visualizer_Plugin::CF_CHART_LIBRARY , get_post_meta ( $ chart_id , Visualizer_Plugin::CF_CHART_LIBRARY , true ) );
1056
1049
add_post_meta ( $ new_chart_id , Visualizer_Plugin::CF_DEFAULT_DATA , get_post_meta ( $ chart_id , Visualizer_Plugin::CF_DEFAULT_DATA , true ) );
1057
1050
add_post_meta ( $ new_chart_id , Visualizer_Plugin::CF_SOURCE , get_post_meta ( $ chart_id , Visualizer_Plugin::CF_SOURCE , true ) );
1058
1051
add_post_meta ( $ new_chart_id , Visualizer_Plugin::CF_SERIES , get_post_meta ( $ chart_id , Visualizer_Plugin::CF_SERIES , true ) );
@@ -1067,6 +1060,11 @@ public function cloneChart() {
1067
1060
);
1068
1061
}
1069
1062
}
1063
+
1064
+ if ( defined ( 'WP_TESTS_DOMAIN ' ) ) {
1065
+ wp_die ();
1066
+ }
1067
+
1070
1068
wp_redirect ( $ redirect );
1071
1069
exit ;
1072
1070
}
0 commit comments