class-auxels-admin-assets.php
1 year ago
class-auxels-archive-menu-links.php
1 year ago
class-auxels-envato-elements.php
1 year ago
class-auxels-import-parser.php
3 years ago
class-auxels-import.php
3 years ago
class-auxels-search-post-type.php
6 months ago
class-auxels-wc-attribute-nav-menu.php
1 year ago
class-auxin-admin-dashboard.php
1 year ago
class-auxin-demo-importer.php
6 months ago
class-auxin-dependency-sorting.php
3 years ago
class-auxin-import.php
1 year ago
class-auxin-install.php
1 year ago
class-auxin-master-nav-menu-admin.php
1 year ago
class-auxin-page-template.php
1 year ago
class-auxin-permalink.php
1 year ago
class-auxin-plugin-requirements.php
3 years ago
class-auxin-post-type-base.php
1 year ago
class-auxin-svg-support-allowedattributes.php
7 years ago
class-auxin-svg-support-allowedtags.php
7 years ago
class-auxin-svg-support.php
1 year ago
class-auxin-walker-nav-menu-back.php
1 year ago
class-auxin-welcome-sections.php
1 year ago
class-auxin-welcome.php
6 months ago
class-auxin-whitelabel.php
3 years ago
class-auxin-widget-indie.php
1 year ago
class-auxin-widget-shortcode-map.php
11 months ago
class-auxin-widget.php
1 year ago
class-auxin-welcome-sections.php
565 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | class Auxin_Welcome_Sections { |
| 5 | |
| 6 | /** |
| 7 | * Instance of this class. |
| 8 | * |
| 9 | * @var object |
| 10 | */ |
| 11 | protected static $instance = null; |
| 12 | |
| 13 | /** |
| 14 | * Instance of main welcome class. |
| 15 | * |
| 16 | * @var object |
| 17 | */ |
| 18 | public $welcome = null; |
| 19 | |
| 20 | /** |
| 21 | * The slug name to refer to this menu |
| 22 | * |
| 23 | * @since 1.0 |
| 24 | * |
| 25 | * @var string |
| 26 | */ |
| 27 | public $page_slug; |
| 28 | |
| 29 | /** |
| 30 | * List of video tutorilas. |
| 31 | * |
| 32 | * @var array |
| 33 | */ |
| 34 | protected $tutorial_list = null; |
| 35 | |
| 36 | |
| 37 | public function __construct(){; |
| 38 | add_filter( 'auxin_admin_welcome_sections', array( $this, 'add_section_importer' ), 60 ); |
| 39 | add_filter( 'auxin_admin_welcome_sections', array( $this, 'add_section_templates'), 65 ); |
| 40 | add_filter( 'auxin_admin_welcome_sections', array( $this, 'add_section_plugins' ), 70 ); |
| 41 | add_filter( 'auxin_admin_welcome_sections', array( $this, 'add_section_feedback' ), 100 ); |
| 42 | add_filter( 'auxin_admin_welcome_sections', array( $this, 'add_section_status' ), 110 ); |
| 43 | add_filter( 'auxin_admin_welcome_sections', array( $this, 'add_section_updates' ), 120 ); |
| 44 | |
| 45 | if ( isset( $_GET['rate'] ) || get_option( 'auxin_show_rate_scale_notice', false ) ) { |
| 46 | add_action( 'all_admin_notices', array( $this, 'add_feedback_notice') ); |
| 47 | } |
| 48 | |
| 49 | add_action( 'auxin_admin_before_welcome_section_content', array( $this, 'maybe_add_dashboard_notice') ); |
| 50 | |
| 51 | if( ! defined('THEME_PRO') || ! THEME_PRO ) { |
| 52 | add_filter( 'auxin_admin_welcome_sections', array( $this, 'add_section_go_pro' ), 120 ); |
| 53 | } |
| 54 | |
| 55 | add_action( 'auxin_admin_after_welcome_section_content' , array( $this, 'append_changelog') ); |
| 56 | add_action( 'auxin_admin_after_welcome_section_content' , array( $this, 'append_tutorials') ); |
| 57 | |
| 58 | add_filter( 'auxin_admin_welcome_video_tutorial_list' , array( $this, 'add_video_tutorial_list' ) ); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Return an instance of this class. |
| 63 | * |
| 64 | * @return object A single instance of this class. |
| 65 | */ |
| 66 | public static function get_instance() { |
| 67 | |
| 68 | // If the single instance hasn't been set, set it now. |
| 69 | if ( null == self::$instance ) { |
| 70 | self::$instance = new self; |
| 71 | } |
| 72 | |
| 73 | return self::$instance; |
| 74 | } |
| 75 | |
| 76 | |
| 77 | /*-----------------------------------------------------------------------------------*/ |
| 78 | /* Adds demos tab in theme about (welcome) page |
| 79 | /*-----------------------------------------------------------------------------------*/ |
| 80 | |
| 81 | public function add_section_updates( $sections ){ |
| 82 | $total_updates = function_exists('auxin_get_total_updates') ? auxin_get_total_updates() : 0; |
| 83 | $update_count = $total_updates ? sprintf(' <span class = "update-plugins count-%1$s"><span class="update-count">%1$s</span></span>', $total_updates ) : ''; |
| 84 | |
| 85 | $sections['updates'] = array( |
| 86 | 'label' => esc_html__( 'Updates', 'auxin-elements' ) . $update_count, |
| 87 | 'description' => '', |
| 88 | 'callback' => 'setup_updates', |
| 89 | 'add_admin_menu' => $total_updates ? true : false |
| 90 | ); |
| 91 | |
| 92 | return $sections; |
| 93 | } |
| 94 | |
| 95 | public function add_section_templates( $sections ){ |
| 96 | |
| 97 | $sections['templates'] = array( |
| 98 | 'label' => esc_html__( 'Template Kits', 'auxin-elements' ), |
| 99 | 'description' => '', |
| 100 | 'callback' => 'setup_templates', |
| 101 | 'add_admin_menu' => true |
| 102 | ); |
| 103 | |
| 104 | return $sections; |
| 105 | } |
| 106 | |
| 107 | public function add_section_importer( $sections ){ |
| 108 | |
| 109 | if( ! empty( $sections['importer'] ) ){ |
| 110 | $sections['importer']['callback'] = 'setup_importer'; |
| 111 | $sections['importer']['add_admin_menu'] = true; |
| 112 | } |
| 113 | |
| 114 | return $sections; |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Adds a notice after dashboard navigation |
| 119 | * |
| 120 | * @param array $sections |
| 121 | */ |
| 122 | public function maybe_add_dashboard_notice( $sections ){ |
| 123 | $api_id = ( defined('THEME_PRO' ) && THEME_PRO ) ? '3' : '4'; |
| 124 | $style = array( 'display' => 'block !important' ); |
| 125 | Auxin_Notices::get_ads_notices( $api_id, $style, 'no-updated' ); |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Adds a new section to welcome page |
| 130 | * |
| 131 | * @param array $sections |
| 132 | */ |
| 133 | public function add_section_plugins( $sections ){ |
| 134 | |
| 135 | $sections['plugins'] = array( |
| 136 | 'label' => esc_html__( 'Plugins', 'auxin-elements' ), |
| 137 | 'description' => '', |
| 138 | 'callback' => 'setup_plugins', |
| 139 | 'add_admin_menu' => true |
| 140 | ); |
| 141 | |
| 142 | return $sections; |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * Adds a new section to welcome page |
| 147 | * |
| 148 | * @param array $sections |
| 149 | */ |
| 150 | public function add_section_feedback( $sections ){ |
| 151 | |
| 152 | $sections['feedback'] = array( |
| 153 | 'label' => __( 'Feedback', 'auxin-elements' ), |
| 154 | 'description' => '', |
| 155 | 'callback' => array( $this, 'render_feedback' ) |
| 156 | ); |
| 157 | |
| 158 | return $sections; |
| 159 | } |
| 160 | |
| 161 | /** |
| 162 | * Adds a new section to welcome page |
| 163 | * |
| 164 | * @param array $sections |
| 165 | */ |
| 166 | public function add_section_status( $sections ){ |
| 167 | |
| 168 | $system_notices = Auxels_System_Check::get_instance()->get_num_of_notices(); |
| 169 | $system_check = $system_notices ? sprintf(' <span class = "update-plugins count-%1$s"><span class="update-count">%1$s</span></span>', $system_notices ) : ''; |
| 170 | |
| 171 | $sections['status'] = array( |
| 172 | 'label' => __( 'System Status', 'auxin-elements' ) . $system_check, |
| 173 | 'description' => '', |
| 174 | 'url' => admin_url( 'site-health.php' ), // optional |
| 175 | ); |
| 176 | |
| 177 | return $sections; |
| 178 | } |
| 179 | |
| 180 | /** |
| 181 | * Adds a new section to welcome page |
| 182 | * |
| 183 | * @param array $sections |
| 184 | */ |
| 185 | public function add_section_go_pro( $sections ){ |
| 186 | |
| 187 | $sections['go_pro'] = array( |
| 188 | 'label' => esc_html__( 'Go Pro', 'auxin-elements' ), |
| 189 | 'description' => '', |
| 190 | 'url' => esc_url( 'https://phlox.pro/go/?utm_source=phlox-welcome&utm_medium=phlox-free&utm_campaign=phlox-go-pro&utm_content=welcome-tab' ), // optional |
| 191 | 'target' => '_blank', |
| 192 | 'image' => AUXELS_ADMIN_URL . '/assets/images/welcome/rocket-pro.gif', |
| 193 | 'add_admin_menu' => true |
| 194 | ); |
| 195 | |
| 196 | return $sections; |
| 197 | } |
| 198 | |
| 199 | public function render_feedback(){ |
| 200 | // the previous rate of the client |
| 201 | $previous_rate = auxin_get_option( 'user_rating' ); |
| 202 | |
| 203 | $support_tab_url = self_admin_url( 'admin.php?page=auxin-welcome&tab=help' ); |
| 204 | ?> |
| 205 | |
| 206 | <div class="feature-section aux-welcome-page-feedback"> |
| 207 | <div class="aux-section-content-box"> |
| 208 | |
| 209 | <div class="aux-columns-wrap"> |
| 210 | <div class="aux-image-wrap"></div> |
| 211 | <div class="aux-form-wrap"> |
| 212 | <form class="aux-feedback-form" action="<?php echo esc_url( admin_url( 'admin.php?page=auxin-welcome&tab=feedback') ); ?>" method="post" > |
| 213 | |
| 214 | <div class="aux-rating-section"> |
| 215 | <h3 class="aux-content-title"><?php echo wp_sprintf( esc_html__( 'How likely are you to recommend %s to a friend?', 'auxin-elements' ), THEME_NAME_I18N ); ?></h3> |
| 216 | <div class="aux-theme-ratings"> |
| 217 | <?php |
| 218 | for( $i = 1; $i <= 10; $i++ ){ |
| 219 | printf( |
| 220 | '<div class="aux-rate-cell"><input type="radio" name="theme_rate" id="theme-rating%1$s" value="%1$s" %2$s/><label class="rating" for="theme-rating%1$s">%1$s</label></div>', |
| 221 | $i, checked( $previous_rate, $i, false ) |
| 222 | ); |
| 223 | } |
| 224 | ?> |
| 225 | |
| 226 | </div> |
| 227 | <div class="aux-ratings-measure"> |
| 228 | <p><?php esc_html_e( "Don't like it", 'auxin-elements' ); ?></p> |
| 229 | <p><?php esc_html_e( "Like it so much", 'auxin-elements' ); ?></p> |
| 230 | </div> |
| 231 | </div> |
| 232 | |
| 233 | <div class="aux-feedback-section aux-hide"> |
| 234 | <div class="aux-notice-box aux-notice-blue aux-rate-us-offer aux-hide"> |
| 235 | <img src="<?php echo esc_url( AUXELS_ADMIN_URL.'/assets/images/welcome/rate-like.svg' ); ?>" /> |
| 236 | <p><?php printf( |
| 237 | esc_html__('Thanks for using Phlox theme. If you are enjoying this theme, please support us by %s submitting 5 star rate here%s. That would be a huge help for us to continue developing this theme.', 'auxin-elements'), |
| 238 | '<a href="' . esc_url( 'http://phlox.pro/rate/' .THEME_ID ) . '" target="_black">', |
| 239 | '</a>' |
| 240 | ); ?> |
| 241 | </p> |
| 242 | </div> |
| 243 | <h3 class="aux-feedback-form-title aux-content-title"><?php esc_html_e('Please explain why you gave this score (optional)', 'auxin-elements'); ?></h3> |
| 244 | <h4 class="aux-feedback-form-subtitle"> |
| 245 | <?php |
| 246 | printf( esc_html__( 'Please do not use this form to get support, in this case please check the %s help section %s', 'auxin-elements' ), |
| 247 | '<a href="' . esc_url( $this->welcome->get_tab_link('help') ) . '">', '</a>' ); ?> |
| 248 | </h4> |
| 249 | <textarea placeholder="Enter your feedback here" rows="10" name="feedback" class="large-text"></textarea> |
| 250 | <input type="text" placeholder="Email address (Optional)" name="email" class="text-input" /> |
| 251 | <?php wp_nonce_field( 'phlox_feedback' ); ?> |
| 252 | |
| 253 | <input type="submit" class="aux-wl-button aux-round aux-blue aux-wide" value="<?php esc_attr_e( 'Submit', 'auxin-elements' ); ?>" /> |
| 254 | |
| 255 | <div class="aux-sending-status"> |
| 256 | <img class="ajax-progress aux-hide" src="<?php echo esc_url( AUXIN_URL . '/css/images/elements/saving.gif' ); ?>" /> |
| 257 | <span class="ajax-response aux-hide" ><?php esc_html_e( 'Submitting your feedback ..', 'auxin-elements' ); ?></span> |
| 258 | </div> |
| 259 | |
| 260 | </div> |
| 261 | |
| 262 | <?php $this->send_feedback_mail(); ?> |
| 263 | </form> |
| 264 | </div> |
| 265 | </div> |
| 266 | </div> |
| 267 | </div> |
| 268 | |
| 269 | <?php |
| 270 | } |
| 271 | |
| 272 | |
| 273 | private function send_feedback_mail(){ |
| 274 | if ( ! ( ! isset( $_POST['phlox_feedback'] ) || ! wp_verify_nonce( $_POST['phlox_feedback'], 'feedback_send') ) ) { |
| 275 | |
| 276 | $email = ! empty( $_POST["email"] ) ? sanitize_email( $_POST["email"] ) : 'Empty'; |
| 277 | $feedback = ! empty( $_POST["feedback"] ) ? sanitize_text_field( $_POST["feedback"] ) : ''; |
| 278 | |
| 279 | if( $feedback ){ |
| 280 | wp_mail( 'info@averta.net', 'feedback from phlox dashboard', $feedback . chr(0x0D).chr(0x0A) . 'Email: ' . $email ); |
| 281 | $text = __( 'Thanks for your feedback', 'auxin-elements' ); |
| 282 | } else{ |
| 283 | $text = __('Please try again and fill up at least the feedback field.', 'auxin-elements'); |
| 284 | } |
| 285 | |
| 286 | printf('<p class="notification">%s</p>', esc_html( $text )); |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | |
| 291 | /** |
| 292 | * Display changelogs on welcome page |
| 293 | * |
| 294 | * @param string $tab The tab that we intent to append this section to. |
| 295 | * @return void |
| 296 | */ |
| 297 | public function append_changelog( $tab ){ |
| 298 | |
| 299 | if( 'dashboard' !== $tab ){ |
| 300 | return; |
| 301 | } |
| 302 | |
| 303 | // sanitize the theme id |
| 304 | $theme_id = sanitize_key( THEME_ID ); |
| 305 | |
| 306 | $changelog_cache_id = "auxin_cache_remote_changelog__{$theme_id}"; |
| 307 | |
| 308 | // get remote changelog |
| 309 | if( ( false === $changelog_info = get_transient( $changelog_cache_id ) ) || isset( $_GET['flush_transient'] ) ){ |
| 310 | |
| 311 | $changelog_remote = $this->get_remote_changelog( $theme_id ); |
| 312 | |
| 313 | if( is_wp_error( $changelog_remote ) ){ |
| 314 | echo wp_kses_post( $changelog_remote->get_error_message() ); |
| 315 | return; |
| 316 | } else { |
| 317 | $changelog_info = $changelog_remote; |
| 318 | set_transient( $changelog_cache_id, $changelog_remote, 2 * HOUR_IN_SECONDS ); |
| 319 | } |
| 320 | |
| 321 | } |
| 322 | |
| 323 | // print the changelog |
| 324 | if( $changelog_info ){ ?> |
| 325 | <div class="aux-changelog-wrap"> |
| 326 | <div class="aux-changelog-header"> |
| 327 | <h2><?php esc_html_e( 'Changelog', 'auxin-elements' ); ?></h2> |
| 328 | <div class="aux-welcome-socials"> |
| 329 | <span><?php esc_html_e('Follow Us', 'auxin-elements' ); ?></span> |
| 330 | <div class="aux-welcome-social-items"> |
| 331 | <a href="http://www.twitter.com/averta_ltd" class="aux-social-item aux-social-twitter" target="_blank" title="<?php esc_html_e('Follow us on Twitter', 'auxin-elements' ); ?>"></a> |
| 332 | <a href="http://www.facebook.com/averta" class="aux-social-item aux-social-facebook" target="_blank" title="<?php esc_html_e('Follow us on Facebook', 'auxin-elements' ); ?>"></a> |
| 333 | <a href="https://www.instagram.com/averta.co/" class="aux-social-item aux-social-instagram"target="_blank" title="<?php esc_html_e('Follow us on Instagram', 'auxin-elements' ); ?>"></a> |
| 334 | <a href="https://themeforest.net/user/averta" class="aux-social-item aux-social-envato" target="_blank" title="<?php esc_html_e('Follow us on Envato', 'auxin-elements' ); ?>"></a> |
| 335 | <a href="https://www.youtube.com/playlist?list=PL7X-1Jmy1jcdekHe6adxB81SBcrHOmLRS" class="aux-social-item aux-social-youtube" target="_blank" title="<?php esc_html_e('Subscribe to Phlox YouTube channel', 'auxin-elements' ); ?>"></a> |
| 336 | </div> |
| 337 | <ul> |
| 338 | |
| 339 | </ul> |
| 340 | </div> |
| 341 | </div> |
| 342 | <div class="aux-changelog-content"> |
| 343 | <div class="aux-changelog-list"><?php echo wp_kses_post( $changelog_info ); ?></div> |
| 344 | </div> |
| 345 | </div> |
| 346 | <?php |
| 347 | } |
| 348 | |
| 349 | } |
| 350 | |
| 351 | |
| 352 | /** |
| 353 | * Display video tutorials on welcome page |
| 354 | * |
| 355 | * @param string $tab The tab that we intent to append this section to. |
| 356 | * @return void |
| 357 | */ |
| 358 | public function append_tutorials( $tab ){ |
| 359 | |
| 360 | if( 'help' !== $tab ){ return; } |
| 361 | $video_list = $this->get_video_tutorial_list(); |
| 362 | ?> |
| 363 | <div class="aux-setup-content"> |
| 364 | <div class="aux-video-list aux-grid-list aux-isotope-list" > |
| 365 | |
| 366 | <?php foreach ( $video_list as $video_id => $video_title ) { ?> |
| 367 | <div class="aux-grid-item aux-iso-item grid_4" > |
| 368 | <div class="aux-grid-item-inner"> |
| 369 | <div class="aux-grid-item-media"> |
| 370 | <iframe width="440" height="248" src="https://www.youtube-nocookie.com/embed/<?php echo esc_url( $video_id ); ?>?rel=0&showinfo=0" |
| 371 | frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> |
| 372 | </div> |
| 373 | <div class="aux-grid-item-footer"> |
| 374 | <a class="aux-grid-footer-text-link" href="<?php echo esc_url( 'https://youtu.be/'. $video_id ); ?>" target="_blank"><h3><?php echo esc_html( $video_title ); ?><span class="dashicons dashicons-external"></span></h3></a> |
| 375 | </div> |
| 376 | </div> |
| 377 | </div> |
| 378 | <?php } ?> |
| 379 | |
| 380 | </div> |
| 381 | </div> |
| 382 | <?php |
| 383 | } |
| 384 | |
| 385 | /** |
| 386 | * Collect the plugin filters |
| 387 | * |
| 388 | * @return array plugin filters |
| 389 | */ |
| 390 | private function get_video_tutorial_list(){ |
| 391 | if( empty( $this->tutorial_list ) ){ |
| 392 | $this->tutorial_list = apply_filters( 'auxin_admin_welcome_video_tutorial_list', array() ); |
| 393 | } |
| 394 | |
| 395 | return $this->tutorial_list; |
| 396 | } |
| 397 | |
| 398 | /** |
| 399 | * Collect the video tutorilas |
| 400 | * |
| 401 | * @return array video tutorilas list |
| 402 | */ |
| 403 | public function add_video_tutorial_list( $list ){ |
| 404 | |
| 405 | $new_list = array( |
| 406 | 'W8jkMN7EEdo' => 'Installing Phlox Pro', |
| 407 | 'porrf6QgjuU' => 'Configuring Menu General Options', |
| 408 | 'irSajN7JXQQ' => 'Customizing Header Menu', |
| 409 | 'AU6qT84scSY' => 'Adding a Burger Menu', |
| 410 | 'gVm9EJ6BrAI' => 'Customizing Post Formats', |
| 411 | 'YkXKxgWruDk' => 'Customizing Post Options', |
| 412 | 'UIVE7ZWbSoI' => 'Displaying Blog Slider', |
| 413 | 'b37PUx76ejc' => 'Customizing Blog Page Options', |
| 414 | '09pnnTaYAto' => 'Organizing Blog with Category', |
| 415 | 'NJDnhbI23P4' => 'Displaying About Author Box', |
| 416 | 'W-nqEKUk0Ss' => 'Displaying Related Posts on Blog', |
| 417 | 'qNVie3fELr4' => 'Customizing Page Options', |
| 418 | 'QutPg4W642A' => 'Creating Different Pages with Custom Pages', |
| 419 | '8GiqLqtsWrU' => 'Configuring Layout and Design Options', |
| 420 | 'IWj6vbnjrUE' => 'Specifying Content and Titles Typography', |
| 421 | 'hNU85eRLCQg' => 'Customizing Header Section', |
| 422 | 'mo7hiMIQvv0' => 'Adding a Scroll to Top Button', |
| 423 | 'SefEG3KOYcI' => 'Customizing the Background', |
| 424 | 'RzVFT4UxXtw' => 'Customizing Audio and Video Player', |
| 425 | 'J3GO3Lt22dw' => 'Adding a Frame for Your Website', |
| 426 | 'DueARmwq1q4' => 'Customizing Footer Area', |
| 427 | 'w65-HRbMvMo' => 'Displaying Subfooter', |
| 428 | 'SOcYs6wJsao' => 'Displaying Subfooter Bar', |
| 429 | 'bcQS7iol000' => 'Customizing your Website Login Page', |
| 430 | 'Pi9121CAGgY' => 'Adding Custom CSS and JavaScript', |
| 431 | //'A96MVeK1RCc' => 'Installing Phlox Pro', |
| 432 | 'kYh0z4jo6jM' => 'Creating Audio with Elementor', |
| 433 | 'DiiVuwhNwnU' => 'Creating Button with Elementor', |
| 434 | 'oi7R8iLRvCo' => 'Creating Video with Elementor', |
| 435 | 'gveFqSpfcQQ' => 'Creating Contact Form with Elementor', |
| 436 | 'ZKMypryYnto' => 'Creating Map with Elementor', |
| 437 | 'sOVsUu-2DHw' => 'Contact Box with Elementor' |
| 438 | ); |
| 439 | |
| 440 | return array_merge( $list, $new_list ); |
| 441 | } |
| 442 | |
| 443 | /** |
| 444 | * Retrieves the changelog remotely |
| 445 | * |
| 446 | * @param string $item_name The name of the project that we intend to get the info of |
| 447 | * @return string The changelog context |
| 448 | */ |
| 449 | private function get_remote_changelog( $item_name = '' ){ |
| 450 | |
| 451 | if( empty( $item_name ) ){ |
| 452 | $item_name = THEME_ID; |
| 453 | } |
| 454 | |
| 455 | global $wp_version; |
| 456 | |
| 457 | $args = array( |
| 458 | 'user-agent' => 'WordPress/'. $wp_version.'; '. get_site_url(), |
| 459 | 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 10 ), |
| 460 | 'body' => array( |
| 461 | 'action' => 'text', |
| 462 | 'cat' => 'changelog', |
| 463 | 'item-name' => $item_name, |
| 464 | 'content' => 'list', |
| 465 | 'view' => 'html', |
| 466 | 'limit' => 5 |
| 467 | ) |
| 468 | ); |
| 469 | |
| 470 | $request = wp_remote_get( 'https://api.averta.net/envato/items/', $args ); |
| 471 | |
| 472 | if ( is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) !== 200 ) { |
| 473 | return new WP_Error( 'no_response', 'Error while receiving remote data' ); |
| 474 | } |
| 475 | |
| 476 | $response = $request['body']; |
| 477 | |
| 478 | return $response; |
| 479 | } |
| 480 | |
| 481 | /** |
| 482 | * Add feedback popup to all admin pages |
| 483 | */ |
| 484 | public function add_feedback_notice() { |
| 485 | |
| 486 | $previous_rate = auxin_get_option( 'user_rating', '' ); |
| 487 | |
| 488 | ?> |
| 489 | <div class="aux-feedback-notice aux-welcome-page-feedback aux-not-animated <?php echo esc_attr( THEME_ID ); ?>"> |
| 490 | <div class="aux-section-content-box"> |
| 491 | |
| 492 | <div class="aux-columns-wrap"> |
| 493 | <div class="aux-form-wrap"> |
| 494 | <form class="aux-popup-feedback-form" action="<?php echo esc_url( admin_url( 'admin.php?page=auxin-welcome&tab=feedback') ); ?>" method="post" > |
| 495 | |
| 496 | <div class="aux-rating-section"> |
| 497 | <h3 class="aux-content-title"><?php echo wp_sprintf( esc_html__( 'How likely are you to recommend %s to a friend?', 'auxin-elements' ), THEME_NAME_I18N ); ?></h3> |
| 498 | <div class="aux-ratings-measure"> |
| 499 | <p><?php esc_html_e( "Don't like it", 'auxin-elements' ); ?></p> |
| 500 | <p><?php esc_html_e( "Neither likely nor unlikely", 'auxin-elements' ); ?></p> |
| 501 | <p><?php esc_html_e( "Like it so much", 'auxin-elements' ); ?></p> |
| 502 | </div> |
| 503 | <div class="aux-theme-ratings"> |
| 504 | <?php |
| 505 | for( $i = 0; $i <= 10; $i++ ){ |
| 506 | printf( |
| 507 | '<div class="aux-rate-cell %3$s"><input type="radio" name="theme_rate" id="theme-rating%1$s" value="%1$s" %2$s/><label class="rating" for="theme-rating%1$s">%1$s</label></div>', |
| 508 | $i, checked( $previous_rate, $i, false ), ( $previous_rate == $i ? 'checked' : '' ) |
| 509 | ); |
| 510 | } |
| 511 | ?> |
| 512 | |
| 513 | </div> |
| 514 | </div> |
| 515 | |
| 516 | <div class="aux-feedback-section"> |
| 517 | <div class="aux-rate-on-market aux-conditional-section aux-disappear"> |
| 518 | <a class='aux-close-form aux-button aux-medium aux-curve aux-rate-market' href="<?php echo esc_url( 'http://phlox.pro/rate/'.THEME_ID ); ?>" target="_blank"> |
| 519 | <span class="aux-overlay"></span> |
| 520 | <span class="aux-text"> |
| 521 | <?php esc_html_e( 'Support by rating 5 stars', 'auxin-elements');?> |
| 522 | </span> |
| 523 | </a> |
| 524 | <a class='aux-close-form aux-button aux-medium aux-curve aux-outline aux-white' href="#"> |
| 525 | <span class="aux-overlay"></span> |
| 526 | <span class="aux-text"> |
| 527 | <?php esc_html_e( 'I already did :)', 'auxin-elements');?> |
| 528 | </span> |
| 529 | </a> |
| 530 | <?php if( THEME_ID === 'phlox' ){ ?> |
| 531 | <a class='aux-more-info' href="https://phlox.pro/go/" target="_blank"><?php printf( 'Have you heard about %s?', '<strong>'. esc_html__( 'Phlox Pro', 'auxin-elements' ) .'</strong>' ); ?></a> |
| 532 | <?php } ?> |
| 533 | </div> |
| 534 | |
| 535 | <div class="aux-feedback-detail aux-conditional-section aux-disappear"> |
| 536 | <h3 class="aux-content-title"><?php esc_html_e('Please explain why you gave this score (optional)', 'auxin-elements'); ?></h3> |
| 537 | <textarea placeholder="<?php echo esc_attr( 'Enter your feedback here' ); ?>" rows="10" name="feedback" class="large-text"></textarea> |
| 538 | <?php wp_nonce_field( 'phlox_feedback' ); ?> |
| 539 | <a class='aux-close-form aux-button aux-medium aux-curve aux-outline btn-submit' href="#"> |
| 540 | <span class="aux-overlay"></span> |
| 541 | <span class="aux-text"> |
| 542 | <?php esc_html_e( 'Submit', 'auxin-elements');?> |
| 543 | </span> |
| 544 | </a> |
| 545 | </div> |
| 546 | |
| 547 | <div class="aux-feedback-more aux-conditional-section"> |
| 548 | <a class="aux-remind-later" href="#"><?php esc_html_e( 'Remind Me Later', 'auxin-elements' ); ?></a> |
| 549 | </div> |
| 550 | |
| 551 | <div class="aux-sending-status aux-hide"> |
| 552 | <img class="ajax-progress" src="<?php echo esc_url( AUXIN_URL . '/css/images/elements/saving.gif' ); ?>" /> |
| 553 | </div> |
| 554 | |
| 555 | </div> |
| 556 | </form> |
| 557 | |
| 558 | </div> |
| 559 | </div> |
| 560 | </div> |
| 561 | </div> |
| 562 | <?php |
| 563 | } |
| 564 | } |
| 565 |