X7ROOT File Manager
Current Path:
/home/katmhsmi/public_html/wp-content/plugins/xagio/models
home
/
katmhsmi
/
public_html
/
wp-content
/
plugins
/
xagio
/
models
/
📁
..
📄
.htaccess
(420 B)
📄
wp_affiliate.php
(14.41 KB)
📄
wp_api.php
(131.08 KB)
📄
wp_batches.php
(3.67 KB)
📄
wp_bulk_image_converter.php
(2.25 KB)
📄
wp_captcha.php
(2.33 KB)
📄
wp_captcha_comment.php
(1.8 KB)
📄
wp_captcha_login.php
(976 B)
📄
wp_captcha_register.php
(819 B)
📄
wp_clone.php
(21.76 KB)
📄
wp_comments.php
(1.26 KB)
📄
wp_default.php
(6.98 KB)
📄
wp_exif.php
(11.1 KB)
📄
wp_extend_widgets.php
(4.21 KB)
📄
wp_freshstart.php
(16.03 KB)
📄
wp_groups.php
(30.02 KB)
📄
wp_keywords.php
(52.68 KB)
📄
wp_log404.php
(19.68 KB)
📄
wp_migration.php
(16.26 KB)
📄
wp_redirects.php
(5.16 KB)
📄
wp_rescue.php
(17.66 KB)
📄
wp_review.php
(3.2 KB)
📄
wp_reviewr.php
(3.76 KB)
📄
wp_reviews.php
(16.82 KB)
📄
wp_schema.php
(16.12 KB)
📄
wp_seo.php
(79.76 KB)
📄
wp_settings.php
(32.76 KB)
📄
wp_sync.php
(1.74 KB)
📄
wp_tinymce_buttons.php
(6.23 KB)
📄
wp_troubleshooting.php
(2.91 KB)
📄
wp_update.php
(7.9 KB)
Editing: wp_redirects.php
<?php if ( ! class_exists( 'MXAG_Redirects' ) ) { class MXAG_Redirects extends MXAG_Model { public static function initialize() { add_action('admin_post_xag_get_redirects', array('MXAG_Redirects', 'getRedirects')); add_action('admin_post_xag_add_redirect', array('MXAG_Redirects', 'addRedirect')); add_action('admin_post_xag_edit_redirect', array('MXAG_Redirects', 'editRedirect')); add_action('admin_post_xag_delete_redirect', array('MXAG_Redirects', 'deleteRedirect')); add_action('admin_post_xag_delete_all_redirects', array('MXAG_Redirects', 'deleteAllRedirects')); add_action('admin_post_xag_query_string_redirect', array('MXAG_Redirects', 'queryStringRedirect')); add_action( 'template_redirect', array('MXAG_Redirects', 'doRedirect') ); } public static function add($old, $new) { // Check if empty if (empty($old) || empty($new)) { return; } // Remove old data //self::removeData(array( 'new' => $new )); self::removeData(array( 'new' => $old )); $old = ltrim($old, '/'); $old = rtrim($old, '/'); $new = ltrim($new, '/'); $new = rtrim($new, '/'); $chkExistsUrl = self::checkExistsUrl($old); if (isset($chkExistsUrl['id']) && $chkExistsUrl['status'] === true) { self::updateData( array( 'old' => $old, 'new' => $new ), array( 'id' => $chkExistsUrl['id'] ) ); } else { self::insertData(array( 'old' => $old, 'new' => $new, 'date_created' => date('Y-m-d H:i:s') )); } } public static function addRedirect() { $oldURL = $_POST['oldURL']; $newURL = $_POST['newURL']; self::add($oldURL, $newURL); } public static function editRedirect() { $id = $_POST['id']; $oldURL = $_POST['oldURL']; $newURL = $_POST['newURL']; self::updateData( array( 'old' => $oldURL, 'new' => $newURL ), array( 'id' => $id ) ); } public static function doRedirect() { // This logic is in wp_seo.php so it will work only on auto generating redirects when post URL is changed // if (XAG_DISABLE_REDIRECTS === true) return; $redirects = self::getAllData(); $current_url = $_SERVER['REQUEST_URI']; foreach($redirects as $r) { if (isset($r['qry_str_url'])) { if($r['qry_str_url'] == 1) { $request_uri = rtrim(strtok($current_url, '?'), '/'); $request_uri_ltrim = ltrim($request_uri, '/'); $r['old'] = strtok($r['old'], '?'); } else { $request_uri = rtrim($current_url, '/'); $request_uri_ltrim = ltrim($request_uri, '/'); } } if ($request_uri === $r['old'] || $request_uri_ltrim === $r['old'] || ($r['old'] == false && (is_front_page() || is_home()))) { // Check if external if (strpos($r['new'], 'http') !== false) { wp_redirect($r['new'], 301); } else { wp_redirect(site_url('/' . $r['new'] . '/'), 301); } die(); } } } public static function deleteRedirect() { $ID = $_POST['id']; $RemoveIDs = explode(',' , $ID); foreach ($RemoveIDs as $i_d) { self::removeData(array('id'=>$i_d)); } } public static function deleteAllRedirects() { self::truncate('prs_redirects'); } public static function getRedirects() { global $wpdb; $result = $wpdb->get_row(sprintf("SELECT * FROM %s LIMIT 1",self::TABLE_NAME)); XAG_Init::json('success', 'Retrieved all redirects.', self::query("SELECT id, old, new, qry_str_url, DATE_FORMAT(date_created, '%b %D, %Y') as date_created FROM prs_redirects")); } public static function queryStringRedirect() { if(isset($_POST['id']) && isset($_POST['qsetting'])) { self::updateData( array( 'qry_str_url' => $_POST['qsetting'] ), array( 'id' => $_POST['id'] ), self::TABLE_NAME ); } } public static function checkExistsUrl($oldUrl) { if (isset($oldUrl)) { $redirects = self::getAllData(); foreach($redirects as $r) { $id = $r['id']; $slug = $r['old']; $slug = ltrim($slug, '/'); $slug = rtrim($slug, '/'); if ($slug === $oldUrl) { return array('id' => $id, 'status' => true); } } } return array('id' => '', 'status' => false); } protected static $TABLE_NAME; public function __construct(){ static::$TABLE_NAME = self::TABLE_NAME; } // MySQL const TABLE_NAME = 'prs_redirects'; public static function createTable() { global $wpdb; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); $charset_collate = $wpdb->get_charset_collate(); $creation_query = 'CREATE TABLE ' . self::TABLE_NAME . ' ( `id` int(11) NOT NULL AUTO_INCREMENT, `old` varchar(255), `new` varchar(255), `qry_str_url` int(11) NOT NULL DEFAULT 1, `date_created` datetime, PRIMARY KEY (`id`) ) ' .$charset_collate. ';'; @dbDelta( $creation_query ); } public static function removeTable() { global $wpdb; $query = 'DROP TABLE IF EXISTS ' . self::TABLE_NAME . ';'; $wpdb->query( $query ); } } }
Upload File
Create Folder