403Webshell
Server IP : 69.72.244.102  /  Your IP : 216.73.216.164
Web Server : LiteSpeed
System : Linux s3434.fra1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64
User : konzalta ( 1271)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/konzalta/www/wp-content/plugins/tutor/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/konzalta/www/wp-content/plugins/tutor/classes/Permalink.php
<?php
/**
 * Manage permalink update
 *
 * @package Tutor
 * @author Themeum <support@themeum.com>
 * @link https://themeum.com
 * @since 2.6.0
 */

namespace TUTOR;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Permalink Class
 *
 * @since 2.6.0
 */
class Permalink {

	const TRANS_KEY = 'tutor_permalink_update_required';

	/**
	 * Register hooks
	 *
	 * @since 2.6.0
	 *
	 * @return void
	 */
	public function __construct() {
		add_action( 'init', array( $this, 'update_permalink' ) );

		add_action( 'tutor_setup_finished', array( $this, 'set_permalink_flag' ) );

		add_action( 'tutor_option_course_permalink_base_changed', array( $this, 'listen_tutor_setting_changes' ), 10, 2 );
		add_action( 'tutor_option_lesson_permalink_base_changed', array( $this, 'listen_tutor_setting_changes' ), 10, 2 );
		add_action( 'tutor_option_quiz_permalink_base_changed', array( $this, 'listen_tutor_setting_changes' ), 10, 2 );
		add_action( 'tutor_option_assignment_permalink_base_changed', array( $this, 'listen_tutor_setting_changes' ), 10, 2 );
	}

	/**
	 * Check permalink update is required or not.
	 *
	 * @since 2.6.0
	 *
	 * @return bool
	 */
	public static function update_required() {
		return (bool) get_transient( self::TRANS_KEY );
	}

	/**
	 * Set permalink update required flag
	 *
	 * @since 2.6.0
	 *
	 * @return void
	 */
	public static function set_permalink_flag() {
		set_transient( self::TRANS_KEY, true, HOUR_IN_SECONDS );
	}

	/**
	 * Listen tutor settings changes to update permalink.
	 *
	 * @since 2.6.0
	 *
	 * @param mixed $from from.
	 * @param mixed $to to.
	 *
	 * @return void
	 */
	public function listen_tutor_setting_changes( $from, $to ) {
		if ( $from !== $to ) {
			self::set_permalink_flag();
		}
	}

	/**
	 * Update permalink when required.
	 *
	 * @since 2.6.0
	 *
	 * @return void
	 */
	public function update_permalink() {
		if ( ! self::update_required() ) {
			return;
		}

		update_option( 'permalink_structure', '/%postname%/' );
		flush_rewrite_rules();

		delete_transient( self::TRANS_KEY );
	}

}

Youez - 2016 - github.com/yon3zu
LinuXploit