PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.9.21
Shortcodes and extra features for Phlox theme v2.9.21
2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / classes / class-auxin-import.php
auxin-elements / includes / classes Last commit date
class-auxels-admin-assets.php 3 years ago class-auxels-archive-menu-links.php 3 years ago class-auxels-envato-elements.php 3 years ago class-auxels-import-parser.php 3 years ago class-auxels-import.php 3 years ago class-auxels-search-post-type.php 3 years ago class-auxels-wc-attribute-nav-menu.php 4 years ago class-auxin-admin-dashboard.php 3 years ago class-auxin-demo-importer.php 3 years ago class-auxin-dependency-sorting.php 3 years ago class-auxin-import.php 3 years ago class-auxin-install.php 3 years ago class-auxin-master-nav-menu-admin.php 3 years ago class-auxin-page-template.php 4 years ago class-auxin-permalink.php 3 years ago class-auxin-plugin-requirements.php 3 years ago class-auxin-post-type-base.php 3 years ago class-auxin-svg-support-allowedattributes.php 7 years ago class-auxin-svg-support-allowedtags.php 7 years ago class-auxin-svg-support.php 3 years ago class-auxin-walker-nav-menu-back.php 3 years ago class-auxin-welcome-sections.php 3 years ago class-auxin-welcome.php 3 years ago class-auxin-whitelabel.php 3 years ago class-auxin-widget-indie.php 3 years ago class-auxin-widget-shortcode-map.php 3 years ago class-auxin-widget.php 3 years ago
class-auxin-import.php
217 lines
1 <?php
2 /**
3 * Class for simplifying the demo import process
4 *
5 *
6 * @package Auxin
7 * @license LICENSE.txt
8 * @author averta
9 * @link http://phlox.pro/
10 * @copyright (c) 2010-2022 averta
11 */
12
13 // no direct access allowed
14 if ( ! defined('ABSPATH') ) {
15 die();
16 }
17
18
19 /**
20 * Master Slider Import/Export Class.
21 *
22 * @since 1.2.0
23 */
24 class Auxin_Import {
25
26
27 var $upload_baseurl = '';
28
29 var $upload_basedir = '';
30
31 /**
32 * The ID of this importer
33 * @var string
34 */
35 var $importer_id = '';
36
37 /**
38 * The link to welcome page in admin
39 * @var string
40 */
41 var $welcome_page_url = '';
42
43 /**
44 * The link to demos page in admin
45 * @var string
46 */
47 var $demo_page_url = '';
48
49 /**
50 * Instance of this class.
51 *
52 * @var object
53 */
54 protected static $instance = null;
55
56
57
58 public function __construct() {
59
60 $this->importer_id = 'auxin-importer';
61
62 $welcome_root_page = ( defined( 'THEME_PRO' ) && THEME_PRO ) ? 'admin.php' : 'themes.php';
63
64 $this->welcome_page_url = admin_url( $welcome_root_page . '?page=auxin-welcome' );
65 $this->demo_page_url = $this->welcome_page_url . '&tab=demos';
66
67 add_action( 'admin_init', array( $this, 'admin_init' ) );
68
69 // process and redirect the import page prior to rendering the header
70 add_action( 'load-importer-'. $this->importer_id, array( $this, 'process_before_header_output' ) );
71 }
72
73 /**
74 * Return an instance of this class.
75 *
76 * @return object A single instance of this class.
77 */
78 public static function get_instance() {
79
80 // If the single instance hasn't been set, set it now.
81 if ( null == self::$instance ) {
82 self::$instance = new self;
83 }
84
85 return self::$instance;
86 }
87
88
89 /**
90 * Print and process the output of auxin importer page
91 * @return string Importer page output
92 */
93 public function admin_init() {
94
95 $upload = wp_upload_dir();
96 $this->upload_baseurl = $upload['baseurl'];
97 $this->upload_basedir = $upload['basedir'];
98
99
100 register_importer( 'auxin-importer',
101 __( 'Auxin Importer', 'auxin-elements' ),
102 sprintf( __( 'Import demo data for %s theme.', 'auxin-elements' ), '<strong>' . THEME_NAME_I18N . '</strong>' ),
103 array( $this, 'render_importer_page' )
104 );
105 }
106
107 /**
108 * Check if the request for importer page is valid and authorized, otherwise redirect client to demos page
109 *
110 * @return void
111 */
112 public function process_before_header_output(){
113
114 // authorize the request and make sure it is from admin page, otherwise take the client back to demos page
115 if ( ! $this->is_valid_request() ) {
116 wp_redirect( $this->demo_page_url, 301 );
117 exit();
118 }
119
120 }
121
122 /**
123 * Outputs the custom import page for auxin
124 *
125 */
126 public function render_importer_page() {
127
128 $this->header();
129
130 $this->process_import_request();
131
132 $this->footer();
133 }
134
135
136 /**
137 * Display import page title
138 */
139 public function header() {
140 echo '<div class="wrap">';
141 echo '<h2>' . esc_html__( 'Importing Demo Data', 'auxin-elements' ) . '</h2><br />';
142 echo '<div class="aux-import-wrapper">';
143 }
144
145 /**
146 * Close div.wrap
147 */
148 public function footer() {
149 echo '</div></div>';
150 }
151
152
153 /**
154 * Process incoming requests for importing demo data
155 * @return void
156 */
157 public function process_import_request(){
158
159 // make sure the demo-id is specified
160 if( ! empty( $_GET['demo-id'] ) ) {
161 $demo_id = sanitize_key( $_GET['demo-id'] );
162 $demo_list = auxin_get_demo_info_list();
163
164 // if demo-id is valid, start importing the data
165 if( ! empty( $demo_list[ $demo_id ]['file'] ) ){
166 $file = $demo_list[ $demo_id ]['file'];
167
168 // if wordpress importer is not available, try to install it
169 if ( ! class_exists( 'WP_Importer' ) ) {
170
171 printf( esc_html__( 'In order to import the demo data, you need to have "WordPress Importer" plugin installed. Please %s install and activate "WordPress Importer"%s and then try importing the demo data again.', 'auxin-elements' ),
172 '<a href="'. esc_url( admin_url( 'plugin-install.php?s=WordPress+Importer+zourbuth&tab=search' ) ) .'&tab=plugins">',
173 '</a>'
174 );
175
176
177 // start parsing and importing the data
178 } else {
179 global $wp_import;
180 set_time_limit(0);
181 $wp_import->fetch_attachments = true;
182 $wp_import->import_file = $file;
183 $wp_import->import( $file );
184 }
185
186
187 } else {
188
189 printf( esc_html__( 'The demo that you have requested is not valid. Please try to %s select a demo %s to import.', 'auxin-elements' ),
190 '<a href="'. esc_url( $this->demo_page_url ) .'">',
191 '</a>'
192 );
193
194 }
195
196 } else {
197 printf( esc_html__( 'Please %s select a demo %s to import.', 'auxin-elements' ), '<a href="'. esc_url( $this->demo_page_url ) .'">', '</a>' );
198 }
199
200 }
201
202 /**
203 * Makes sure that a user was referred from another admin page.
204 *
205 * @return boolean True if user was referred from an admin page, false otherwise
206 */
207 private function is_valid_request(){
208 $adminurl = strtolower( admin_url() );
209 $referer = strtolower( wp_get_referer() );
210 $result = isset( $_REQUEST['_wpnonce'] ) ? wp_verify_nonce( $_REQUEST['_wpnonce'], 'auxin-import' ) : false;
211
212 return $result && ( strpos( $referer, $adminurl ) === 0 );
213 }
214
215 }
216
217