PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Dir : /home/trave494/asktraining.online/wp-content/plugins/mp-timetable/classes/ |
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 IP: 209.182.202.254 |
Dir : /home/trave494/asktraining.online/wp-content/plugins/mp-timetable/classes/class-permalinks.php |
<?php namespace mp_timetable\plugin_core\classes; class Permalinks { /** * Permalink settings. * * @var array */ private $permalinks = array(); /** * Hook in tabs. */ public function __construct() { $this->settings_init(); $this->settings_save(); } /** * Init our settings. */ public function settings_init() { add_settings_section( 'mp-timetable-permalinks', __( 'Timetable Permalinks', 'mp-timetable' ), array( $this, 'settings' ), 'permalink' ); add_settings_field( 'timetable_column_slug', __( 'Column base', 'mp-timetable' ), array( $this, 'timetable_column_slug_input' ), 'permalink', 'mp-timetable-permalinks' ); add_settings_field( 'timetable_event_slug', __( 'Event base', 'mp-timetable' ), array( $this, 'timetable_event_slug_input' ), 'permalink', 'mp-timetable-permalinks' ); add_settings_field( 'timetable_event_category_slug', __( 'Event Category base', 'mp-timetable' ), array( $this, 'timetable_event_category_slug_input' ), 'permalink', 'mp-timetable-permalinks' ); add_settings_field( 'timetable_event_tag_slug', __( 'Event Tag base', 'mp-timetable' ), array( $this, 'timetable_event_tag_slug_input' ), 'permalink', 'mp-timetable-permalinks' ); $this->permalinks = Core::get_instance()->get_permalink_structure(); } /** * Show a Column slug input box. */ public function timetable_column_slug_input() { ?> <input name="timetable_column_slug" type="text" class="regular-text" value="<?php echo esc_attr( $this->permalinks['column_base'] ); ?>" placeholder="timetable/column" /> <?php } /** * Show an Event slug input box. */ public function timetable_event_slug_input() { ?> <input name="timetable_event_slug" type="text" class="regular-text" value="<?php echo esc_attr( $this->permalinks['event_base'] ); ?>" placeholder="timetable/event" /> <?php } /** * Show an Event Category slug input box. */ public function timetable_event_category_slug_input() { ?> <input name="timetable_event_category_slug" type="text" class="regular-text" value="<?php echo esc_attr( $this->permalinks['event_category_base'] ); ?>" placeholder="timetable/category" /> <?php } /** * Show an Event Tag slug input box. */ public function timetable_event_tag_slug_input() { ?> <input name="timetable_event_tag_slug" type="text" class="regular-text" value="<?php echo esc_attr( $this->permalinks['event_tag_base'] ); ?>" placeholder="timetable/tag" /> <?php } /** * Show the settings. */ public function settings() { wp_nonce_field( 'timetable-permalinks', 'timetable-permalinks-nonce' ); } /** * Save the settings. */ public function settings_save() { if ( ! is_admin() ) { return; } // We need to save the options ourselves; settings api does not trigger save for the permalinks page. if ( isset( $_POST['permalink_structure'], $_POST['timetable-permalinks-nonce'], $_POST['timetable_column_slug'], $_POST['timetable_event_slug'], $_POST['timetable_event_category_slug'], $_POST['timetable_event_tag_slug'] ) && wp_verify_nonce( wp_unslash( $_POST['timetable-permalinks-nonce'] ), 'timetable-permalinks' ) ) { // WPCS: input var ok, sanitization ok. $permalinks = (array) get_option( 'mp_timetable_permalinks', array() ); $permalinks['column_base'] = $this->sanitize_permalink( wp_unslash( $_POST['timetable_column_slug'] ) ); // WPCS: input var ok, sanitization ok. $permalinks['event_base'] = $this->sanitize_permalink( wp_unslash( $_POST['timetable_event_slug'] ) ); // WPCS: input var ok, sanitization ok. $permalinks['event_category_base'] = $this->sanitize_permalink( wp_unslash( $_POST['timetable_event_category_slug'] ) ); // WPCS: input var ok, sanitization ok. $permalinks['event_tag_base'] = $this->sanitize_permalink( wp_unslash( $_POST['timetable_event_tag_slug'] ) ); // WPCS: input var ok, sanitization ok. update_option( 'mp_timetable_permalinks', $permalinks ); } } private function sanitize_permalink( $value ) { $value = esc_url_raw( trim( $value ) ); $value = str_replace( 'http://', '', $value ); return untrailingslashit( $value ); } }