Skip to content

Commit d2f1686

Browse files
author
Eugene Manuilov
committed
Fixed issue #6 which prevents the plugin working on SSL backend.
1 parent 0c4a83b commit d2f1686

File tree

7 files changed

+12
-93
lines changed

7 files changed

+12
-93
lines changed

classes/Visualizer/Module/Admin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function setupMediaViewStrings( $strings ) {
138138
'library' => array(
139139
'filters' => self::_getChartTypesLocalized(),
140140
),
141-
'nonce' => Visualizer_Security::createNonce(),
141+
'nonce' => wp_create_nonce(),
142142
'buildurl' => add_query_arg( 'action', Visualizer_Plugin::ACTION_CREATE_CHART, admin_url( 'admin-ajax.php' ) ),
143143
);
144144

classes/Visualizer/Module/Chart.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function deleteChart() {
165165
$input_method = $is_post ? INPUT_POST : INPUT_GET;
166166

167167
$chart_id = $success = false;
168-
$nonce = Visualizer_Security::verifyNonce( filter_input( $input_method, 'nonce' ) );
168+
$nonce = wp_verify_nonce( filter_input( $input_method, 'nonce' ) );
169169
$capable = current_user_can( 'delete_posts' );
170170
if ( $nonce && $capable ) {
171171
$chart_id = filter_input( $input_method, 'chart', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) );
@@ -261,7 +261,7 @@ public function renderChartPages() {
261261
*/
262262
private function _handleTypesPage() {
263263
// process post request
264-
if ( $_SERVER['REQUEST_METHOD'] == 'POST' && Visualizer_Security::verifyNonce( filter_input( INPUT_POST, 'nonce' ) ) ) {
264+
if ( $_SERVER['REQUEST_METHOD'] == 'POST' && wp_verify_nonce( filter_input( INPUT_POST, 'nonce' ) ) ) {
265265
$type = filter_input( INPUT_POST, 'type' );
266266
if ( in_array( $type, Visualizer_Plugin::getChartTypes() ) ) {
267267
// save new chart type
@@ -334,7 +334,7 @@ private function _handleDataPage() {
334334
* @access private
335335
*/
336336
private function _handleSettingsPage() {
337-
if ( $_SERVER['REQUEST_METHOD'] == 'POST' && Visualizer_Security::verifyNonce( filter_input( INPUT_GET, 'nonce' ) ) ) {
337+
if ( $_SERVER['REQUEST_METHOD'] == 'POST' && wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ) ) ) {
338338
if ( $this->_chart->post_status == 'auto-draft' ) {
339339
$this->_chart->post_status = 'publish';
340340
wp_update_post( $this->_chart->to_array() );
@@ -394,7 +394,7 @@ private function _handleSettingsPage() {
394394
*/
395395
public function uploadData() {
396396
// validate nonce
397-
if ( !Visualizer_Security::verifyNonce( filter_input( INPUT_GET, 'nonce' ) ) ) {
397+
if ( !wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ) ) ) {
398398
status_header( 403 );
399399
exit;
400400
}
@@ -445,7 +445,7 @@ public function uploadData() {
445445
*/
446446
public function cloneChart() {
447447
$chart_id = $success = false;
448-
$nonce = Visualizer_Security::verifyNonce( filter_input( INPUT_GET, 'nonce' ), Visualizer_Plugin::ACTION_CLONE_CHART );
448+
$nonce = wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ), Visualizer_Plugin::ACTION_CLONE_CHART );
449449
$capable = current_user_can( 'edit_posts' );
450450
if ( $nonce && $capable ) {
451451
$chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) );

classes/Visualizer/Render/Library.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ private function _renderChartBox( $placeholder_id, $chart_id ) {
4444

4545
$delete_url = add_query_arg( array(
4646
'action' => Visualizer_Plugin::ACTION_DELETE_CHART,
47-
'nonce' => Visualizer_Security::createNonce(),
47+
'nonce' => wp_create_nonce(),
4848
'chart' => $chart_id,
4949
), $ajax_url );
5050

5151
$clone_url = add_query_arg( array(
5252
'action' => Visualizer_Plugin::ACTION_CLONE_CHART,
53-
'nonce' => Visualizer_Security::createNonce( Visualizer_Plugin::ACTION_CLONE_CHART ),
53+
'nonce' => wp_create_nonce( Visualizer_Plugin::ACTION_CLONE_CHART ),
5454
'chart' => $chart_id,
5555
'type' => $this->type,
5656
), $ajax_url );

classes/Visualizer/Render/Page/Data.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected function _renderContent() {
5454
protected function _renderSidebarContent() {
5555
$upload_link = add_query_arg( array(
5656
'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA,
57-
'nonce' => Visualizer_Security::createNonce(),
57+
'nonce' => wp_create_nonce(),
5858
'chart' => $this->chart->ID,
5959
), admin_url( 'admin-ajax.php' ) );
6060

@@ -80,7 +80,7 @@ protected function _renderSidebarContent() {
8080
echo '<input type="file" id="csv-file" class="file" name="local_data">';
8181
esc_attr_e( 'From Computer', Visualizer_Plugin::NAME );
8282
echo '</div>';
83-
83+
8484
echo '<div>';
8585
echo '<a id="remote-file" class="button" href="javascript:;">', esc_html__( 'From Web', Visualizer_Plugin::NAME ), '</a>';
8686
echo '</div>';

classes/Visualizer/Render/Page/Settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected function _renderToolbar() {
6666
* @access protected
6767
*/
6868
protected function _toHTML() {
69-
echo '<form id="settings-form" action="', add_query_arg( 'nonce', Visualizer_Security::createNonce() ), '" method="post">';
69+
echo '<form id="settings-form" action="', add_query_arg( 'nonce', wp_create_nonce() ), '" method="post">';
7070
parent::_toHTML();
7171
echo '</form>';
7272
}

classes/Visualizer/Render/Page/Types.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Visualizer_Render_Page_Types extends Visualizer_Render_Page {
4040
*/
4141
protected function _toHTML() {
4242
echo '<form method="post">';
43-
echo '<input type="hidden" name="nonce" value="', Visualizer_Security::createNonce(), '">';
43+
echo '<input type="hidden" name="nonce" value="', wp_create_nonce(), '">';
4444
parent::_toHTML();
4545
echo '</form>';
4646
}

classes/Visualizer/Security.php

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)