@@ -68,8 +68,7 @@ public function __construct( Visualizer_Plugin $plugin ) {
6868 $ this ->_addFilter ( Visualizer_Plugin::FILTER_HANDLE_REVISIONS , 'handleExistingRevisions ' , 10 , 2 );
6969 $ this ->_addFilter ( Visualizer_Plugin::FILTER_GET_CHART_DATA_AS , 'getDataAs ' , 10 , 3 );
7070 $ this ->_addAction ( 'pre_get_posts ' , 'PreGetPosts ' );
71- register_shutdown_function ( array ($ this , 'onShutdown ' ) );
72-
71+ register_shutdown_function ( array ( $ this , 'onShutdown ' ) );
7372 }
7473
7574 /**
@@ -114,16 +113,16 @@ protected function _addAction( $tag, $method, $methodClass = null, $priority = 1
114113 * @param string $tag The name of the AJAX action to which the $method is hooked.
115114 * @param string $method Optional. The name of the method to be called. If the name of the method is not provided, tag name will be used as method name.
116115 * @param bool $methodClass The root of the method.
117- * @param boolean $private Optional. Determines if we should register hook for logged in users.
118- * @param boolean $public Optional. Determines if we should register hook for not logged in users.
116+ * @param boolean $logged_in Optional. Determines if we should register hook for logged in users.
117+ * @param boolean $logged_out Optional. Determines if we should register hook for not logged in users.
119118 * @return Visualizer_Module
120119 */
121- protected function _addAjaxAction ( $ tag , $ method = '' , $ methodClass = null , $ private = true , $ public = false ) {
122- if ( $ private ) {
120+ protected function _addAjaxAction ( $ tag , $ method = '' , $ methodClass = null , $ logged_in = true , $ logged_out = false ) {
121+ if ( $ logged_in ) {
123122 $ this ->_addAction ( 'wp_ajax_ ' . $ tag , $ method , $ methodClass );
124123 }
125124
126- if ( $ public ) {
125+ if ( $ logged_out ) {
127126 $ this ->_addAction ( 'wp_ajax_nopriv_ ' . $ tag , $ method , $ methodClass );
128127 }
129128
@@ -169,7 +168,7 @@ protected function _addShortcode( $tag, $method ) {
169168 *
170169 * @since 3.2.0
171170 */
172- public function getDataAs ( $ final , $ chart_id , $ type ) {
171+ public function getDataAs ( $ data , $ chart_id , $ type ) {
173172 return $ this ->_getDataAs ( $ chart_id , $ type );
174173 }
175174
@@ -290,8 +289,8 @@ private function _getCSV( $rows, $filename, $enclose ) {
290289 }
291290 rewind ( $ fp );
292291 $ csv = '' ;
293- // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
294- while ( ( $ array = fgetcsv ( $ fp ) ) !== false ) {
292+ $ array = fgetcsv ( $ fp );
293+ while ( $ array !== false ) {
295294 if ( strlen ( $ csv ) > 0 ) {
296295 $ csv .= PHP_EOL ;
297296 }
@@ -307,7 +306,8 @@ private function _getCSV( $rows, $filename, $enclose ) {
307306 }
308307 $ array = $ temp_array ;
309308 }
310- $ csv .= implode ( ', ' , $ array );
309+ $ csv .= implode ( ', ' , $ array );
310+ $ array = fgetcsv ( $ fp );
311311 }
312312 fclose ( $ fp );
313313
@@ -333,7 +333,7 @@ private function _getExcel( $rows, $filename ) {
333333 unset( $ rows [1 ] );
334334 $ rows = array_values ( $ rows );
335335 $ rows = array_map (
336- function ( $ r ) {
336+ function ( $ r ) {
337337 return array_map ( 'strval ' , $ r );
338338 },
339339 $ rows
@@ -405,7 +405,7 @@ private function _getHTML( $rows ) {
405405 foreach ( $ rows as $ row ) {
406406 // skip the data type row.
407407 if ( 1 === $ index ) {
408- $ index ++ ;
408+ ++ $ index ;
409409 continue ;
410410 }
411411
@@ -418,7 +418,7 @@ private function _getHTML( $rows ) {
418418 }
419419 }
420420 $ table .= '</tr> ' ;
421- $ index ++ ;
421+ ++ $ index ;
422422 }
423423 $ table .= '</table> ' ;
424424
@@ -433,9 +433,9 @@ private function _getHTML( $rows ) {
433433 /**
434434 * Disable revisions temporarily for visualizer post type.
435435 */
436- protected final function disableRevisionsTemporarily () {
436+ final protected function disableRevisionsTemporarily () {
437437 add_filter (
438- 'wp_revisions_to_keep ' , function ( $ num , $ post ) {
438+ 'wp_revisions_to_keep ' , function ( $ num , $ post ) {
439439 if ( $ post ->post_type === Visualizer_Plugin::CPT_VISUALIZER ) {
440440 return 0 ;
441441 }
@@ -449,7 +449,7 @@ protected final function disableRevisionsTemporarily() {
449449 *
450450 * @return bool If any revisions were found.
451451 */
452- public final function undoRevisions ( $ chart_id , $ restore = false ) {
452+ final public function undoRevisions ( $ chart_id , $ restore = false ) {
453453 do_action ( 'themeisle_log_event ' , Visualizer_Plugin::NAME , sprintf ( 'undoRevisions for %d with%s restore ' , $ chart_id , ( $ restore ? '' : 'out ' ) ), 'debug ' , __FILE__ , __LINE__ );
454454 if ( get_post_type ( $ chart_id ) !== Visualizer_Plugin::CPT_VISUALIZER ) {
455455 return false ;
@@ -481,7 +481,7 @@ public final function undoRevisions( $chart_id, $restore = false ) {
481481 /**
482482 * If existing revisions exist for the chart, restore the earliest version and then create a new revision to initiate editing.
483483 */
484- public final function handleExistingRevisions ( $ chart_id , $ chart ) {
484+ final public function handleExistingRevisions ( $ chart_id , $ chart ) {
485485
486486 do_action ( 'themeisle_log_event ' , Visualizer_Plugin::NAME , sprintf ( 'handleExistingRevisions for %d ' , $ chart_id ), 'debug ' , __FILE__ , __LINE__ );
487487 if ( get_post_type ( $ chart_id ) !== Visualizer_Plugin::CPT_VISUALIZER ) {
@@ -533,7 +533,7 @@ protected function get_user_customization_js() {
533533 }
534534
535535 try {
536- require_once ( ABSPATH . 'wp-admin/includes/file.php ' ) ;
536+ require_once ABSPATH . 'wp-admin/includes/file.php ' ;
537537 WP_Filesystem ();
538538 global $ wp_filesystem ;
539539 if ( ! is_a ( $ wp_filesystem , 'WP_Filesystem_Base ' ) ) {
@@ -558,18 +558,18 @@ protected function get_user_customization_js() {
558558 }
559559
560560 if ( ! $ wp_filesystem ->exists ( $ dir ) ) {
561- // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.Found
562- if ( ( $ done = $ wp_filesystem -> mkdir ( $ dir ) ) === false ) {
561+ $ done = $ wp_filesystem -> mkdir ( $ dir );
562+ if ( $ done === false ) {
563563 do_action ( 'themeisle_log_event ' , Visualizer_Plugin::NAME , sprintf ( 'Unable to create directory %s ' , $ dir ), 'error ' , __FILE__ , __LINE__ );
564564 return $ default ;
565565 }
566566 }
567567
568568 // if file does not exist, copy.
569569 if ( ! $ wp_filesystem ->exists ( $ file ) ) {
570- $ src = str_replace ( ABSPATH , $ wp_filesystem ->abspath (), VISUALIZER_ABSPATH . '/js/customization.js ' );
571- // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.Found
572- if ( ( $ done = $ wp_filesystem -> copy ( $ src , $ file ) ) === false ) {
570+ $ src = str_replace ( ABSPATH , $ wp_filesystem ->abspath (), VISUALIZER_ABSPATH . '/js/customization.js ' );
571+ $ done = $ wp_filesystem -> copy ( $ src , $ file );
572+ if ( $ done === false ) {
573573 do_action ( 'themeisle_log_event ' , Visualizer_Plugin::NAME , sprintf ( 'Unable to copy file %s to %s ' , $ src , $ file ), 'error ' , __FILE__ , __LINE__ );
574574 return $ default ;
575575 }
@@ -591,7 +591,7 @@ protected function load_chart_type( $chart_id ) {
591591 if ( 'Visualizer_Render_Sidebar_Type_DataTable_DataTable ' === $ name ) {
592592 $ name = 'Visualizer_Render_Sidebar_Type_DataTable_Tabular ' ;
593593 }
594- $ class = new $ name ;
594+ $ class = new $ name() ;
595595 }
596596
597597 if ( is_null ( $ class ) && Visualizer_Module::is_pro () ) {
@@ -752,7 +752,7 @@ public static function can_show_feature( $feature ) {
752752 /**
753753 * Gets the features for the provided license type.
754754 */
755- public static final function get_features_for_license ( $ plan ) {
755+ final public static function get_features_for_license ( $ plan ) {
756756 $ is_new_personal = apply_filters ( 'visualizer_is_new_personal ' , false );
757757 switch ( $ plan ) {
758758 case 1 :
0 commit comments