11<?php
22
3- if ( !class_exists ( 'WPUF_WC_Vendors_Integration ' ) ) {
3+ if ( ! class_exists ( 'WPUF_WC_Vendors_Integration ' ) ) {
44
55 /**
66 * WC Vendors Integration Class
@@ -63,7 +63,7 @@ public function add_wpuf_options( $settings, $current_section ) {
6363 *
6464 * @return array $post_forms
6565 */
66- public function get_post_forms ( $ post_type= 'post ' ) {
66+ public function get_post_forms ( $ post_type = 'post ' ) {
6767 $ post_forms = [];
6868
6969 $ args = [
@@ -78,8 +78,8 @@ public function get_post_forms( $post_type='post' ) {
7878 $ form_settings = wpuf_get_form_settings ( $ form ->ID );
7979 $ form_post_type = isset ( $ form_settings ['post_type ' ] ) ? $ form_settings ['post_type ' ] : '' ;
8080
81- if ( $ form_post_type == $ post_type ) {
82- $ post_forms [$ form ->ID ] = $ form ->post_title ;
81+ if ( $ form_post_type === $ post_type ) {
82+ $ post_forms [ $ form ->ID ] = $ form ->post_title ;
8383 }
8484 }
8585
@@ -96,13 +96,15 @@ public function get_post_forms( $post_type='post' ) {
9696 * @return array
9797 */
9898 public function add_wpuf_posts_page () {
99- $ allow_wpuf_post = get_option ( 'allow_wcvendors_wpuf_post ' , 'no ' );
99+ $ allow_wpuf_post = get_option ( 'allow_wcvendors_wpuf_post ' , 'no ' );
100100
101- if ( $ allow_wpuf_post == 'yes ' ) {
101+ if ( $ allow_wpuf_post === 'yes ' ) {
102102 $ dashboard_url = get_permalink ( get_option ( 'wcvendors_vendor_dashboard_page_id ' ) );
103- $ post_page_url = add_query_arg ( [
104- 'action ' => 'post-listing ' ,
105- ], $ dashboard_url );
103+ $ post_page_url = add_query_arg (
104+ [
105+ 'action ' => 'post-listing ' ,
106+ ], $ dashboard_url
107+ );
106108
107109 $ output = '<a href=" ' . $ post_page_url . '" class="button"> ' ;
108110 $ output .= __ ( 'Posts ' , 'wp-user-frontend ' );
@@ -118,8 +120,8 @@ public function add_wpuf_posts_page() {
118120 public function after_dashboard () {
119121 $ action = isset ( $ _GET ['action ' ] ) ? sanitize_text_field ( wp_unslash ( $ _GET ['action ' ] ) ) : '' ;
120122
121- if ( $ action == 'post-listing ' || $ action == 'new-post ' || $ action == 'edit-post ' || $ action == 'del ' ) {
122- require_once WPUF_ROOT . ' /templates/ wc-vendors/posts.php ' ; ?>
123+ if ( $ action === 'post-listing ' || $ action === 'new-post ' || $ action === 'edit-post ' || $ action = == 'del ' ) {
124+ wpuf_load_template ( ' wc-vendors/posts.php ' ) ; ?>
123125 <script type="text/javascript">
124126 var WPUFContent = document.querySelector('.wpuf-wc-vendors-submit-post-page');
125127 var WCVendorArea = WPUFContent.parentElement;
@@ -160,7 +162,7 @@ public function after_dashboard() {
160162 background: #007acc;
161163 }
162164 </style>
163- <?php
165+ <?php
164166 }
165167 }
166168
@@ -199,7 +201,7 @@ public function update_edit_post_redirect_url( $response, $post_id, $form_id, $f
199201 $ role = (array ) $ user ->roles ;
200202 $ selected_form = get_option ( 'wcvendors_wpuf_allowed_post_form ' , '' );
201203
202- if ( $ role [0 ] == 'vendor ' && $ form_id == $ selected_form && $ form_settings ['edit_redirect_to ' ] == 'same ' ) {
204+ if ( $ role [0 ] === 'vendor ' && $ form_id === $ selected_form && $ form_settings ['edit_redirect_to ' ] = == 'same ' ) {
203205 $ post_page_url = get_permalink ( get_option ( 'wcvendors_vendor_dashboard_page_id ' ) );
204206
205207 $ redirect_url = add_query_arg (
0 commit comments