PluginProbe ʕ •ᴥ•ʔ
Strong Testimonials / 3.3.2
Strong Testimonials v3.3.2
3.3.2 3.3.1 trunk 1.0.1 2.30.9 2.31.10 2.32 2.32.1 2.32.2 2.32.3 2.32.4 2.33 2.34 2.35 2.36 2.37 2.38 2.38.1 2.39 2.39.1 2.39.2 2.39.3 2.40.0 2.40.1 2.40.2 2.40.3 2.40.4 2.40.5 2.40.6 2.40.7 2.41.0 2.41.1 2.50.0 2.50.1 2.50.2 2.50.3 2.50.4 2.51.0 2.51.1 2.51.2 2.51.3 2.51.4 2.51.5 2.51.6 2.51.7 2.51.8 2.51.9 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.20 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.17 3.2.18 3.2.19 3.2.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0
strong-testimonials / admin / settings / class-strong-testimonials-forms.php
strong-testimonials / admin / settings Last commit date
partials 1 month ago class-strong-testimonials-forms.php 1 month ago class-strong-testimonials-general-settings-react.php 6 days ago class-strong-testimonials-settings-form.php 1 month ago
class-strong-testimonials-forms.php
107 lines
1 <?php
2 /**
3 * Class Strong_Testimonials_Settings
4 */
5 class Strong_Testimonials_Forms {
6
7 const DEFAULT_TAB = 'fields';
8
9 public static $callbacks;
10
11 /**
12 * Strong_Testimonials_Settings constructor.
13 */
14 public function __construct() {}
15
16 /**
17 * Initialize.
18 */
19 public static function init() {
20 self::add_actions();
21 }
22
23 /**
24 * Add actions and filters.
25 */
26 public static function add_actions() {
27 add_action( 'admin_init', array( __CLASS__, 'register_settings' ) );
28 }
29
30 /**
31 * Register settings
32 */
33 public static function register_settings() {
34 self::$callbacks = apply_filters( 'wpmtst_form_callbacks', array() );
35 }
36
37 /**
38 * Settings page
39 */
40 public static function settings_page() {
41 if ( ! current_user_can( 'strong_testimonials_options' ) ) {
42 wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'strong-testimonials' ) );
43 }
44 $tab = self::get_tab();
45 $url = admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-fields' );
46
47 if ( isset( $_GET['settings-updated'] ) ) {
48 $notice = array(
49 'title' => esc_html__( 'Settings saved', 'strong-testimonials' ),
50 'message' => esc_html__( 'Form settings successfully saved.', 'strong-testimonials' ),
51 'status' => 'success',
52 'source' => array(
53 'slug' => 'strong-testimonials',
54 'name' => 'Strong Testimonials',
55 ),
56 'timed' => 5000,
57 'dismiss' => true,
58 );
59
60 WPChill_Notifications::add_notification( 'wpmtst-form-settings-saved', $notice );
61 }
62 ?>
63 <div class="wrap wpmtst">
64
65 <h1><?php echo wp_kses_post( apply_filters( 'wpmtst_cpt_singular_name', esc_html__( 'Form', 'strong-testimonials' ) ) ); ?></h1>
66 <?php do_action( 'wpmtst_testimonials_settings' ); ?>
67 <h2 class="nav-tab-wrapper">
68 <?php do_action( 'wpmtst_form_tabs', $tab, $url ); ?>
69 </h2>
70 <?php if ( 'fields' !== $tab ) : ?>
71 <div class="wpmts-settings-columns">
72 <form id="<?php echo esc_attr( $tab ); ?>-form" method="post" action="options.php" enctype="multipart/form-data">
73 <?php
74 if ( isset( self::$callbacks[ $tab ] ) && wpmtst_callback_exists( self::$callbacks[ $tab ] ) ) {
75 call_user_func( self::$callbacks[ $tab ] );
76 } else {
77 call_user_func( self::$callbacks[ self::DEFAULT_TAB ] );
78 }
79
80 echo '<p class="submit-buttons">';
81 submit_button( '', 'primary', 'submit-form', false );
82 echo '</p>';
83 ?>
84 </form>
85 <?php do_action( 'wpmtst_admin_after_settings_form' ); ?>
86 </div>
87 <?php
88 else :
89 if ( isset( self::$callbacks[ $tab ] ) && wpmtst_callback_exists( self::$callbacks[ $tab ] ) ) {
90 call_user_func( self::$callbacks[ $tab ] );
91 } else {
92 call_user_func( self::$callbacks[ self::DEFAULT_TAB ] );
93 }
94 endif;
95 ?>
96
97 </div><!-- .wrap -->
98 <?php
99 }
100
101 private static function get_tab() {
102 return ( isset( $_GET['tab'] ) && sanitize_text_field( wp_unslash( $_GET['tab'] ) ) ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : self::DEFAULT_TAB;
103 }
104 }
105
106 Strong_Testimonials_Forms::init();
107