Guest User

Untitled

a guest
Jan 17th, 2025
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 65.14 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  
  5. * ThemeREX Addons: Panel with installation wizard, Theme Options and Support info
  6.  
  7. *
  8.  
  9. * @package ThemeREX Addons
  10.  
  11. * @since v1.6.48
  12.  
  13. */
  14.  
  15.  
  16.  
  17. // Don't load directly
  18.  
  19. if ( ! defined( 'TRX_ADDONS_VERSION' ) ) {
  20.  
  21. exit;
  22.  
  23. }
  24.  
  25.  
  26.  
  27. // Define component's subfolder
  28.  
  29. if ( !defined('TRX_ADDONS_PLUGIN_THEME_PANEL') ) define('TRX_ADDONS_PLUGIN_THEME_PANEL', TRX_ADDONS_PLUGIN_COMPONENTS . 'theme-panel/');
  30.  
  31. if ( !defined('TRX_ADDONS_PLUGIN_IMPORTER') ) define('TRX_ADDONS_PLUGIN_IMPORTER', TRX_ADDONS_PLUGIN_THEME_PANEL . 'importer/');
  32.  
  33. if ( !defined('TRX_ADDONS_PLUGIN_INSTALLER') ) define('TRX_ADDONS_PLUGIN_INSTALLER', TRX_ADDONS_PLUGIN_THEME_PANEL . 'installer/');
  34.  
  35.  
  36.  
  37. // Add Admin menu item to show Theme panel
  38.  
  39. if (!function_exists('trx_addons_theme_panel_admin_menu')) {
  40.  
  41. add_action( 'admin_menu', 'trx_addons_theme_panel_admin_menu' );
  42.  
  43. function trx_addons_theme_panel_admin_menu() {
  44.  
  45. // Add a separator before the menu item 'Theme Panel'
  46.  
  47. global $menu;
  48.  
  49. $menu['2.1'] = array( '', 'read', 'separator-theme-start', '', 'wp-menu-separator' ); // WPCS: override ok.
  50.  
  51.  
  52.  
  53. $theme_info = trx_addons_get_theme_info();
  54.  
  55. if (empty($theme_info['theme_pro_key'])) {
  56.  
  57. add_menu_page(
  58.  
  59. esc_html__('ThemeREX Addons', 'trx_addons'), //page_title
  60.  
  61. esc_html__('ThemeREX Addons', 'trx_addons'), //menu_title
  62.  
  63. 'manage_options', //capability
  64.  
  65. 'trx_addons_options', //menu_slug
  66.  
  67. 'trx_addons_options_page_builder', //callback
  68.  
  69. 'dashicons-welcome-widgets-menus', //icon
  70.  
  71. '2.2' //menu position (after Dashboard)
  72.  
  73. );
  74.  
  75. } else {
  76.  
  77. add_menu_page(
  78.  
  79. esc_html__('Theme Panel', 'trx_addons'), //page_title
  80.  
  81. esc_html__('Theme Panel', 'trx_addons'), //menu_title
  82.  
  83. 'manage_options', //capability
  84.  
  85. 'trx_addons_theme_panel', //menu_slug
  86.  
  87. 'trx_addons_theme_panel_page_builder', //callback
  88.  
  89. 'dashicons-welcome-widgets-menus', //icon
  90.  
  91. '2.2' //menu position (after Dashboard)
  92.  
  93. );
  94.  
  95. $submenu = apply_filters('trx_addons_filter_add_theme_panel_pages', array(
  96.  
  97. array(
  98.  
  99. esc_html__('Theme Dashboard', 'trx_addons'),//page_title
  100.  
  101. esc_html__('Theme Dashboard', 'trx_addons'),//menu_title
  102.  
  103. 'manage_options', //capability
  104.  
  105. 'trx_addons_theme_panel', //menu_slug
  106.  
  107. 'trx_addons_theme_panel_page_builder' //callback
  108.  
  109. )
  110.  
  111. )
  112.  
  113. );
  114.  
  115. if (is_array($submenu)) {
  116.  
  117. foreach($submenu as $item) {
  118.  
  119. add_submenu_page(
  120.  
  121. 'trx_addons_theme_panel', //parent menu slug
  122.  
  123. $item[0], //page_title
  124.  
  125. $item[1], //menu_title
  126.  
  127. $item[2], //capability
  128.  
  129. $item[3], //menu_slug
  130.  
  131. $item[4] //callback
  132.  
  133. );
  134.  
  135. }
  136.  
  137. }
  138.  
  139. }
  140.  
  141. }
  142.  
  143. }
  144.  
  145.  
  146.  
  147.  
  148.  
  149. // Load scripts and styles
  150.  
  151. if (!function_exists('trx_addons_theme_panel_load_scripts')) {
  152.  
  153. add_action("trx_addons_action_load_scripts_admin", 'trx_addons_theme_panel_load_scripts');
  154.  
  155. function trx_addons_theme_panel_load_scripts( $all = false ) {
  156.  
  157. if (isset($_REQUEST['page']) && $_REQUEST['page']=='trx_addons_theme_panel') {
  158.  
  159. trx_addons_enqueue_msgbox();
  160.  
  161. wp_enqueue_style( 'trx_addons-options', trx_addons_get_file_url('css/trx_addons.options.css'), array(), null );
  162.  
  163. wp_enqueue_style( 'trx_addons-theme_panel', trx_addons_get_file_url(TRX_ADDONS_PLUGIN_THEME_PANEL . 'theme-panel.css'), array(), null );
  164.  
  165. wp_enqueue_script( 'trx_addons-theme_panel', trx_addons_get_file_url(TRX_ADDONS_PLUGIN_THEME_PANEL . 'theme-panel.js'), array('jquery'), null, true );
  166.  
  167. }
  168.  
  169. }
  170.  
  171. }
  172.  
  173.  
  174.  
  175.  
  176.  
  177. // Load RTL styles
  178.  
  179. if (!function_exists('trx_addons_theme_panel_load_scripts_rtl')) {
  180.  
  181. add_action("trx_addons_action_load_scripts_admin", 'trx_addons_theme_panel_load_scripts_rtl', 100);
  182.  
  183. function trx_addons_theme_panel_load_scripts_rtl( $all = false ) {
  184.  
  185. if (isset($_REQUEST['page']) && $_REQUEST['page']=='trx_addons_theme_panel') {
  186.  
  187. if ( is_rtl() ) {
  188.  
  189. wp_enqueue_style( 'trx_addons-options-rtl', trx_addons_get_file_url('css/trx_addons.options-rtl.css'), array(), null );
  190.  
  191. wp_enqueue_style( 'trx_addons-theme_panel-rtl', trx_addons_get_file_url(TRX_ADDONS_PLUGIN_THEME_PANEL . 'theme-panel-rtl.css'), array(), null );
  192.  
  193. }
  194.  
  195. }
  196.  
  197. }
  198.  
  199. }
  200.  
  201.  
  202.  
  203.  
  204.  
  205. // Return true if current screen need to load options scripts and styles
  206.  
  207. if ( !function_exists( 'trx_addons_theme_panel_need_options' ) ) {
  208.  
  209. add_filter('trx_addons_filter_need_options', 'trx_addons_theme_panel_need_options');
  210.  
  211. function trx_addons_theme_panel_need_options($need = false) {
  212.  
  213. if (!$need) {
  214.  
  215. // If current screen is 'Theme Panel'
  216.  
  217. $need = isset($_REQUEST['page']) && $_REQUEST['page']=='trx_addons_theme_panel';
  218.  
  219. }
  220.  
  221. return $need;
  222.  
  223. }
  224.  
  225. }
  226.  
  227.  
  228.  
  229. // Get the upgrade server domain URL
  230.  
  231. if ( !function_exists( 'trx_addons_get_upgrade_domain_url' ) ) {
  232.  
  233. function trx_addons_get_upgrade_domain_url() {
  234.  
  235. return '//upgrade.themerex.net/';
  236.  
  237. }
  238.  
  239. }
  240.  
  241.  
  242.  
  243. // Get the upgrade server handler URL
  244.  
  245. if ( !function_exists( 'trx_addons_get_upgrade_url' ) ) {
  246.  
  247. function trx_addons_get_upgrade_url( $params=array() ) {
  248.  
  249. $url = trx_addons_get_upgrade_domain_url() . 'upgrade.php';
  250.  
  251. if ( count( $params ) > 0 ) {
  252.  
  253. $url = trx_addons_add_to_url( $url, $params );
  254.  
  255. }
  256.  
  257. return $url;
  258.  
  259. }
  260.  
  261. }
  262.  
  263.  
  264.  
  265. // Call the upgrade server
  266.  
  267. if ( !function_exists( 'trx_addons_get_upgrade_data' ) ) {
  268.  
  269. function trx_addons_get_upgrade_data( $params=array(), $info=array() ) {
  270.  
  271. $theme_info = trx_addons_array_merge( trx_addons_get_theme_info(false), $info );
  272.  
  273. $params = array_merge(
  274.  
  275. array(
  276.  
  277. 'action' => '',
  278.  
  279. 'key' => '',
  280.  
  281. 'src' => $theme_info['theme_pro_key'],
  282.  
  283. 'theme_slug' => $theme_info['theme_slug'],
  284.  
  285. 'theme_name' => $theme_info['theme_name'],
  286.  
  287. 'domain' => trx_addons_remove_protocol( home_url(), true ),
  288.  
  289. ),
  290.  
  291. $params
  292.  
  293. );
  294.  
  295. // Allow caching all info requests to reduce server load
  296.  
  297. if ( strpos( $params['action'], 'info_' ) === false ) {
  298.  
  299. $params['rnd'] = mt_rand();
  300.  
  301. }
  302.  
  303. $result = trx_addons_fgc( trx_addons_get_upgrade_url( $params ) );
  304.  
  305. if ( is_serialized( $result ) ) {
  306.  
  307. try {
  308.  
  309. $result = trx_addons_unserialize( $result );
  310.  
  311. } catch ( Exception $e ) {
  312.  
  313. }
  314.  
  315. }
  316.  
  317. if ( ! isset( $result['error'] ) || ! isset( $result['data'] ) ) {
  318.  
  319. global $TRX_ADDONS_STORAGE;
  320.  
  321. $result = array(
  322.  
  323. 'error' => esc_html__( 'Unrecognized server answer!', 'trx_addons' )
  324.  
  325. . ( ! empty( $TRX_ADDONS_STORAGE['last_remote_error'] )
  326.  
  327. ? ' ' . $TRX_ADDONS_STORAGE['last_remote_error']
  328.  
  329. : ''
  330.  
  331. ),
  332.  
  333. 'data' => ''
  334.  
  335. );
  336.  
  337. }
  338.  
  339. return $result;
  340.  
  341. }
  342.  
  343. }
  344.  
  345.  
  346.  
  347. // Check 'theme activated' status
  348.  
  349. if ( !function_exists( 'trx_addons_is_theme_activated' ) ) {
  350.  
  351. function trx_addons_is_theme_activated( $suppress_filters = false ) {
  352.  
  353. $template = get_template();
  354.  
  355. $activated = get_option( sprintf( 'trx_addons_theme_%s_activated', $template ) ) == 1
  356.  
  357. && get_option( sprintf( 'purchase_code_%s', $template ) ) != '';
  358.  
  359. return $suppress_filters
  360.  
  361. ? $activated
  362.  
  363. : apply_filters( 'trx_addons_filter_is_theme_activated', $activated );
  364.  
  365. }
  366.  
  367. }
  368.  
  369.  
  370.  
  371. // Set 'theme activated' status
  372.  
  373. if ( !function_exists( 'trx_addons_set_theme_activated' ) ) {
  374.  
  375. function trx_addons_set_theme_activated($code='', $pro_key='', $token='') {
  376.  
  377. $template = get_template();
  378.  
  379. update_option( sprintf( 'trx_addons_theme_%s_activated', $template ), 1);
  380.  
  381. if ( ! empty($code) ) {
  382.  
  383. update_option( sprintf( 'purchase_code_%s', $template ), $code );
  384.  
  385. update_option( sprintf( 'purchase_code_src_%s', $template ), $pro_key );
  386.  
  387. if ( ! empty($token) ) {
  388.  
  389. update_option( sprintf( 'access_token_%s', $template ), $token );
  390.  
  391. }
  392.  
  393. }
  394.  
  395. }
  396.  
  397. }
  398.  
  399.  
  400.  
  401. // Remove 'theme activated' status
  402.  
  403. if ( !function_exists( 'trx_addons_remove_theme_activated' ) ) {
  404.  
  405. function trx_addons_remove_theme_activated() {
  406.  
  407. $template = get_template();
  408.  
  409. delete_option( sprintf( 'trx_addons_theme_%s_activated', $template ) );
  410.  
  411. delete_option( sprintf( 'purchase_code_%s', $template ) );
  412.  
  413. delete_option( sprintf( 'purchase_code_src_%s', $template ) );
  414.  
  415. delete_option( sprintf( 'access_token_%s', $template ) );
  416.  
  417. }
  418.  
  419. }
  420.  
  421.  
  422.  
  423. // Return 'theme activated' status
  424.  
  425. if ( !function_exists( 'trx_addons_get_theme_activated_status' ) ) {
  426.  
  427. function trx_addons_get_theme_activated_status() {
  428.  
  429. return trx_addons_is_theme_activated() ? 'active' : 'inactive';
  430.  
  431. }
  432.  
  433. }
  434.  
  435.  
  436.  
  437. // Return theme activation code
  438.  
  439. if ( !function_exists( 'trx_addons_get_theme_activation_code' ) ) {
  440.  
  441. function trx_addons_get_theme_activation_code() {
  442.  
  443. $template = get_template();
  444.  
  445. return get_option( sprintf( 'trx_addons_theme_%s_activated', $template ) ) == 1
  446.  
  447. ? get_option( sprintf( 'purchase_code_%s', $template ) )
  448.  
  449. : '';
  450.  
  451. }
  452.  
  453. }
  454.  
  455.  
  456.  
  457. // Activate theme
  458.  
  459. if ( !function_exists( 'trx_addons_theme_panel_activate_theme' ) ) {
  460.  
  461. add_action('init', 'trx_addons_theme_panel_activate_theme', 9);
  462.  
  463.  
  464.  
  465. function trx_addons_theme_panel_activate_theme() {
  466.  
  467. if (is_admin() && isset($_REQUEST['page']) && $_REQUEST['page'] == 'trx_addons_theme_panel' && trx_addons_get_value_gp('trx_addons_deactivate_theme') == '') {
  468.  
  469.  
  470.  
  471. $nonce = trx_addons_get_value_gp('trx_addons_nonce');
  472.  
  473. $code = trx_addons_get_value_gp('trx_addons_activate_theme_code');
  474.  
  475.  
  476.  
  477. if ( !empty($nonce) ) {
  478.  
  479. // Check nonce
  480.  
  481. if ( ! wp_verify_nonce($nonce, admin_url()) ) {
  482.  
  483. trx_addons_set_admin_message(__('Security code is invalid! Theme is not activated!', 'trx_addons'), 'error');
  484.  
  485. } else if ( ! current_user_can('manage_options') ) {
  486.  
  487. trx_addons_set_admin_message(__('Activation theme is denied for the current user!', 'trx_addons'), 'error');
  488.  
  489. } else if ( empty($code) ) {
  490.  
  491. trx_addons_set_admin_message(__('Please, specify the purchase code!', 'trx_addons'), 'error');
  492.  
  493. } else {
  494.  
  495. // Save the purchase code
  496.  
  497. trx_addons_set_theme_activated($code, 'custom-key'); // Use a custom key
  498.  
  499.  
  500.  
  501. trx_addons_set_admin_message(
  502.  
  503. '<b>' . __('Congratulations! Your theme is activated successfully.', 'trx_addons') . '</b>',
  504.  
  505. 'success'
  506.  
  507. );
  508.  
  509. }
  510.  
  511. }
  512.  
  513. }
  514.  
  515. }
  516.  
  517. }
  518.  
  519.  
  520.  
  521.  
  522.  
  523. // Deactivate theme ( disconnect from current domain )
  524.  
  525. if ( !function_exists( 'trx_addons_theme_panel_deactivate_theme' ) ) {
  526.  
  527. add_action('init', 'trx_addons_theme_panel_deactivate_theme', 9);
  528.  
  529. function trx_addons_theme_panel_deactivate_theme() {
  530.  
  531. if (is_admin() && isset($_REQUEST['page']) && $_REQUEST['page']=='trx_addons_theme_panel') {
  532.  
  533. // If submit form with activation code
  534.  
  535. $nonce = trx_addons_get_value_gp('trx_addons_nonce');
  536.  
  537. $action = trx_addons_get_value_gp('trx_addons_deactivate_theme');
  538.  
  539. if ( $action == 'deactivate' && ! empty( $nonce ) ) {
  540.  
  541.  
  542.  
  543. $code = get_option( sprintf( 'purchase_code_%s', get_template() ) );
  544.  
  545.  
  546.  
  547. // Check nonce
  548.  
  549. if ( !wp_verify_nonce( $nonce, admin_url() ) ) {
  550.  
  551. trx_addons_set_admin_message(__('Security code is invalid! Theme is not deactivated!', 'trx_addons'), 'error');
  552.  
  553.  
  554.  
  555. // Check user
  556.  
  557. } else if (!current_user_can('manage_options')) {
  558.  
  559. trx_addons_set_admin_message(__('Deactivation theme is denied for the current user!', 'trx_addons'), 'error');
  560.  
  561.  
  562.  
  563. // Check code
  564.  
  565. } else if ( empty( $code ) ) {
  566.  
  567. trx_addons_set_admin_message(__('Purchase code is invalid! Theme is not deactivated!', 'trx_addons'), 'error');
  568.  
  569.  
  570.  
  571. // Deactivate
  572.  
  573. } else {
  574.  
  575. $result = trx_addons_get_upgrade_data( array(
  576.  
  577. 'action' => 'deactivate',
  578.  
  579. 'key' => $code,
  580.  
  581. ) );
  582.  
  583. if ( $result['data'] === 1 ) {
  584.  
  585. trx_addons_remove_theme_activated();
  586.  
  587. trx_addons_set_admin_message( __( 'Your theme is deactivated successfully.', 'trx_addons' ), 'success' );
  588.  
  589. } else {
  590.  
  591. trx_addons_set_admin_message( sprintf( __( "Sorry, the theme is not deactivated! Reason: %s", 'trx_addons' ),
  592.  
  593. ! empty( $result['error'] )
  594.  
  595. ? $result['error']
  596.  
  597. : __( "Your purchase code is invalid!", 'trx_addons' )
  598.  
  599. ),
  600.  
  601. 'error'
  602.  
  603. );
  604.  
  605. }
  606.  
  607. }
  608.  
  609. }
  610.  
  611. }
  612.  
  613. }
  614.  
  615. }
  616.  
  617.  
  618.  
  619.  
  620.  
  621. // Build Theme panel page
  622.  
  623. if (!function_exists('trx_addons_theme_panel_page_builder')) {
  624.  
  625. function trx_addons_theme_panel_page_builder() {
  626.  
  627. $tabs = trx_addons_theme_panel_get_tabs_list();
  628.  
  629. ?>
  630.  
  631. <span class="wp-header-end" style="display:none"></span>
  632.  
  633.  
  634.  
  635. <div id="trx_addons_theme_panel" class="trx_addons_theme_panel">
  636.  
  637.  
  638.  
  639. <?php do_action( 'trx_addons_action_theme_panel_start' ); ?>
  640.  
  641.  
  642.  
  643. <div class="trx_addons_result">
  644.  
  645. <?php
  646.  
  647. $result = trx_addons_get_admin_message();
  648.  
  649. $msg = $type = '';
  650.  
  651. if ( ! empty( $result['error'] ) ) {
  652.  
  653. $msg = $result['error'];
  654.  
  655. $type = 'error';
  656.  
  657. } else if ( ! empty( $result['success'] ) ) {
  658.  
  659. $msg = $result['success'];
  660.  
  661. $type = 'updated';
  662.  
  663. }
  664.  
  665. if ( ! empty( $msg ) ) {
  666.  
  667. // Standard WordPress message box
  668.  
  669. ?><div id="trx_addons_theme_panel_message" class="<?php echo esc_attr( $type ); ?>"><p><?php echo wp_kses( $msg, 'trx_addons_kses_content' ); ?></p></div><?php
  670.  
  671. // Popup message box
  672.  
  673. ?>
  674.  
  675. <script>
  676.  
  677. jQuery( document ).ready( function() {
  678.  
  679. <?php if ( $type == 'error' ) { ?>
  680.  
  681. trx_addons_msgbox_warning( '<?php echo addslashes( str_replace( "\n", '', nl2br( $msg ) ) ); ?>', '<?php echo addslashes( esc_html__( 'Theme Activation', 'trx_addons' ) ); ?>', 'delete', 0 );
  682.  
  683. <?php } else { ?>
  684.  
  685. trx_addons_msgbox_accept( '<?php echo addslashes( str_replace( "\n", '', nl2br( $msg ) ) ); ?>', '<?php echo addslashes( esc_html__( 'Theme Activation', 'trx_addons' ) ); ?>' );
  686.  
  687. <?php } ?>
  688.  
  689. } );
  690.  
  691. </script>
  692.  
  693. <?php
  694.  
  695. }
  696.  
  697. ?>
  698.  
  699. </div>
  700.  
  701.  
  702.  
  703. <?php do_action( 'trx_addons_action_theme_panel_before_tabs' ); ?>
  704.  
  705.  
  706.  
  707. <div class="trx_addons_tabs trx_addons_tabs_theme_panel">
  708.  
  709. <ul>
  710.  
  711. <?php
  712.  
  713. foreach($tabs as $tab_id => $tab_title) {
  714.  
  715. ?><li><a href="#trx_addons_theme_panel_section_<?php echo esc_attr($tab_id); ?>"><?php echo esc_html( $tab_title ); ?></a></li><?php
  716.  
  717. }
  718.  
  719. ?>
  720.  
  721. </ul>
  722.  
  723. <?php
  724.  
  725. $theme_info = trx_addons_get_theme_info();
  726.  
  727. foreach($tabs as $tab_id => $tab_title) {
  728.  
  729. do_action('trx_addons_action_theme_panel_section', $tab_id, $theme_info);
  730.  
  731. }
  732.  
  733. ?>
  734.  
  735. </div>
  736.  
  737.  
  738.  
  739. <?php do_action( 'trx_addons_action_theme_panel_after_tabs' ); ?>
  740.  
  741.  
  742.  
  743. <?php do_action( 'trx_addons_action_theme_panel_end' ); ?>
  744.  
  745.  
  746.  
  747. </div>
  748.  
  749. <?php
  750.  
  751. }
  752.  
  753. }
  754.  
  755.  
  756.  
  757.  
  758.  
  759. // Return a list of tabs for the Theme Panel
  760.  
  761. if (!function_exists('trx_addons_theme_panel_get_tabs_list')) {
  762.  
  763. function trx_addons_theme_panel_get_tabs_list() {
  764.  
  765. return apply_filters( 'trx_addons_filter_theme_panel_tabs', array(
  766.  
  767. 'general' => esc_html__( 'General', 'trx_addons' ),
  768.  
  769. 'plugins' => esc_html__( 'Plugins', 'trx_addons' ),
  770.  
  771. ) );
  772.  
  773. }
  774.  
  775. }
  776.  
  777.  
  778.  
  779.  
  780.  
  781. // Display 'General' section
  782.  
  783. if ( !function_exists( 'trx_addons_theme_panel_section_general' ) ) {
  784.  
  785. add_action('trx_addons_action_theme_panel_section', 'trx_addons_theme_panel_section_general', 10, 2);
  786.  
  787. function trx_addons_theme_panel_section_general($tab_id, $theme_info) {
  788.  
  789. if ($tab_id !== 'general') return;
  790.  
  791. $theme_status = trx_addons_get_theme_activated_status();
  792.  
  793. $need_child = get_template_directory() == get_stylesheet_directory() && ! is_multisite() && current_user_can( 'install_themes' );
  794.  
  795. ?>
  796.  
  797. <div id="trx_addons_theme_panel_section_<?php echo esc_attr($tab_id); ?>" class="trx_addons_tabs_section">
  798.  
  799.  
  800.  
  801. <?php do_action('trx_addons_action_theme_panel_section_start', $tab_id, $theme_info); ?>
  802.  
  803.  
  804.  
  805. <div class="trx_addons_theme_panel_section_content trx_addons_theme_panel_theme_<?php echo esc_attr($theme_status); ?>">
  806.  
  807.  
  808.  
  809. <?php do_action('trx_addons_action_theme_panel_before_section_title', $tab_id, $theme_info); ?>
  810.  
  811.  
  812.  
  813. <h1 class="trx_addons_theme_panel_section_title">
  814.  
  815. <?php
  816.  
  817. echo esc_html(
  818.  
  819. sprintf(
  820.  
  821. // Translators: Add theme name and version to the 'Welcome' message
  822.  
  823. __( 'Welcome to %1$s v.%2$s', 'trx_addons' ),
  824.  
  825. $theme_info['theme_name'],
  826.  
  827. $theme_info['theme_version']
  828.  
  829. )
  830.  
  831. );
  832.  
  833. ?>
  834.  
  835. <span class="trx_addons_theme_panel_section_title_label_<?php echo esc_attr($theme_status); ?>"><?php
  836.  
  837. if ($theme_status == 'active') {
  838.  
  839. esc_html_e('Activated', 'trx_addons');
  840.  
  841. } else {
  842.  
  843. esc_html_e('Not activated', 'trx_addons');
  844.  
  845. }
  846.  
  847. ?></span>
  848.  
  849. </h1><?php
  850.  
  851.  
  852.  
  853. do_action('trx_addons_action_theme_panel_after_section_title', $tab_id, $theme_info);
  854.  
  855.  
  856.  
  857. ?><div class="trx_addons_theme_panel_section_description">
  858.  
  859. <p><?php
  860.  
  861. if ( $theme_status == 'active' ) {
  862.  
  863. if ( $need_child ) {
  864.  
  865. // Main theme is active
  866.  
  867. esc_html_e('We strongly recommend installing a Child Theme on this step. It saves you from losing any changes you make to the theme files during updates. Even if you\'re not going to do that we still recommend it. If you want to skip the step - click "Start Setup" button.', 'trx_addons');
  868.  
  869. } else {
  870.  
  871. // Child theme is active
  872.  
  873. esc_html_e('Thank you for choosing our theme! In order to get started, you need to select a demo, install recommended plugins and import the demo data. You can do all these steps manually, or follow our setup wizard by clicking the "Start Setup" button below:', 'trx_addons');
  874.  
  875. }
  876.  
  877. } else {
  878.  
  879. esc_html_e('Thank you for choosing our theme! Please activate your copy of the theme in order to get access to plugins, demo content, support and updates.', 'trx_addons');
  880.  
  881. }
  882.  
  883. ?></p>
  884.  
  885. </div><?php
  886.  
  887. if ( $theme_status != 'active' ) {
  888.  
  889. do_action('trx_addons_action_theme_panel_activation_form', $tab_id, $theme_info);
  890.  
  891. }
  892.  
  893.  
  894.  
  895. do_action('trx_addons_action_theme_panel_after_section_description', $tab_id, $theme_info);
  896.  
  897.  
  898.  
  899. if ($theme_status == 'active') {
  900.  
  901. ?><div class="trx_addons_theme_panel_buttons"><?php
  902.  
  903. if ( $need_child ) {
  904.  
  905. $child_present = is_dir( get_template_directory() . '/../' . get_template() . '-child' );
  906.  
  907. ?>
  908.  
  909. <a href="<?php
  910.  
  911. echo esc_url( admin_url( $child_present ? 'themes.php' : 'theme-install.php' ) );
  912.  
  913. ?>" class="trx_addons_theme_panel_child_theme trx_addons_button"><?php echo esc_html( $child_present ? __('Activate Child Theme', 'trx_addons') : __('Install Child Theme', 'trx_addons') ); ?></a>
  914.  
  915. <a href="#" class="trx_addons_theme_panel_next_step trx_addons_button trx_addons_button_accent"><?php esc_html_e('Start Setup', 'trx_addons'); ?></a>
  916.  
  917. <?php
  918.  
  919. } else {
  920.  
  921. ?>
  922.  
  923. <a href="#" class="trx_addons_theme_panel_next_step trx_addons_button trx_addons_button_accent"><?php esc_html_e('Start Setup', 'trx_addons'); ?></a>
  924.  
  925. <?php
  926.  
  927. }
  928.  
  929. ?></div><?php
  930.  
  931. }
  932.  
  933.  
  934.  
  935. if ( $theme_status == 'active' && trx_addons_is_theme_activated(true) ) {
  936.  
  937.  
  938.  
  939. do_action('trx_addons_action_theme_panel_before_section_license', $tab_id, $theme_info);
  940.  
  941.  
  942.  
  943. ?><div class="trx_addons_theme_panel_section_license">
  944.  
  945. <h2 class="trx_addons_theme_panel_section_license_title"><?php esc_html_e( 'License information', 'trx_addons' ); ?></h2>
  946.  
  947. <div class="trx_addons_theme_panel_section_license_description">
  948.  
  949. <p class="trx_addons_theme_panel_section_license_info"><?php echo wp_kses_data( __( '1 theme license = 1 domain. In order to connect the license to a different domain, first click "Disconnect domain" and then re-enter the purchase key on a different WordPress installation.', 'trx_addons' ) ); ?></p>
  950.  
  951. <p class="trx_addons_theme_panel_section_license_note"><?php echo wp_kses_data( '<b>' . __( 'Please Note!', 'trx_addons' ) . '</b> ' . __( '<b>Reinstallation on the same domain still requires disconnection of the purchase key.</b> Before taking any action that requires another theme activation (WordPress re-installation, database cleaning, etc), you need to deactivate the theme by clicking the "Disconnect domain" button.', 'trx_addons' ) ); ?></p>
  952.  
  953. <p class="trx_addons_theme_panel_section_license_status">
  954.  
  955. <span class="trx_addons_theme_panel_section_license_status_label"><?php esc_html_e( 'Status:', 'trx_addons' ); ?></span>
  956.  
  957. <span class="trx_addons_theme_panel_section_license_status_state"><?php esc_html_e( 'Activated', 'trx_addons' ); ?></span>
  958.  
  959. </p>
  960.  
  961. <p class="trx_addons_theme_panel_section_license_domain">
  962.  
  963. <span class="trx_addons_theme_panel_section_license_domain_label"><?php esc_html_e( 'Domain:', 'trx_addons' ); ?></span>
  964.  
  965. <span class="trx_addons_theme_panel_section_license_domain_state"><?php echo esc_html( trx_addons_remove_protocol( home_url(), true ) ); ?></span>
  966.  
  967. </p>
  968.  
  969. </div>
  970.  
  971. <div class="trx_addons_theme_panel_section_license_buttons">
  972.  
  973. <form action="<?php echo esc_url(get_admin_url(null, 'admin.php?page=trx_addons_theme_panel')); ?>" name="trx_addons_theme_panel_deactivate_form" method="post">
  974.  
  975. <input type="hidden" name="trx_addons_nonce" value="<?php echo esc_attr(wp_create_nonce(admin_url())); ?>" />
  976.  
  977. <input type="hidden" name="trx_addons_deactivate_theme" value="deactivate" />
  978.  
  979. <a href="#" class="trx_addons_button trx_addons_theme_panel_license_disconnect"><?php esc_html_e('Disconnect domain', 'trx_addons'); ?></a>
  980.  
  981. </form>
  982.  
  983. </div>
  984.  
  985. </div><?php
  986.  
  987.  
  988.  
  989. do_action('trx_addons_action_theme_panel_after_section_license', $tab_id, $theme_info);
  990.  
  991. }
  992.  
  993.  
  994.  
  995. ?></div><?php
  996.  
  997.  
  998.  
  999. // Attention! This is inline-blocks and no spaces allow
  1000.  
  1001. ?><div class="trx_addons_theme_panel_featured_item_wrap"><?php
  1002.  
  1003.  
  1004.  
  1005. if ( $theme_status == 'active' ) {
  1006.  
  1007. trx_addons_theme_panel_featured_item( $tab_id, $theme_info );
  1008.  
  1009. trx_addons_theme_panel_show_sys_info( $tab_id, $theme_info );
  1010.  
  1011. }
  1012.  
  1013.  
  1014.  
  1015. ?></div><?php
  1016.  
  1017.  
  1018.  
  1019. do_action('trx_addons_action_theme_panel_section_end', $tab_id, $theme_info);
  1020.  
  1021.  
  1022.  
  1023. ?></div><?php
  1024.  
  1025. }
  1026.  
  1027. }
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033. // Display footer icons on the tab 'General'
  1034.  
  1035. if ( !function_exists( 'trx_addons_theme_panel_footer_icons' ) ) {
  1036.  
  1037. add_action('trx_addons_action_theme_panel_section_end', 'trx_addons_theme_panel_footer_icons', 100, 2);
  1038.  
  1039. function trx_addons_theme_panel_footer_icons($tab_id, $theme_info) {
  1040.  
  1041. if ( $tab_id == 'general' ) {
  1042.  
  1043. // Footer icons
  1044.  
  1045. ?>
  1046.  
  1047. <div class="trx_addons_theme_panel_footer">
  1048.  
  1049. <?php
  1050.  
  1051. if (count($theme_info['theme_actions']) > 0) {
  1052.  
  1053. ?>
  1054.  
  1055. <div class="trx_addons_theme_panel_links trx_addons_theme_panel_links_iconed">
  1056.  
  1057. <?php
  1058.  
  1059. foreach ($theme_info['theme_actions'] as $action=>$item) {
  1060.  
  1061. if ( empty( $item['button'] ) ) {
  1062.  
  1063. continue;
  1064.  
  1065. }
  1066.  
  1067. ?><div class="trx_addons_iconed_block"><div class="trx_addons_iconed_block_inner">
  1068.  
  1069. <?php
  1070.  
  1071. if (!empty($item['icon']) && trx_addons_is_url( $item['icon'] ) ) {
  1072.  
  1073. $item['image'] = $item['icon'];
  1074.  
  1075. $item['icon'] = '';
  1076.  
  1077. }
  1078.  
  1079. if (!empty($item['icon'])) {
  1080.  
  1081. ?><span class="trx_addons_iconed_block_icon <?php echo esc_attr($item['icon']); ?>"><?php
  1082.  
  1083. } else if (!empty($item['image'])) {
  1084.  
  1085. ?><img src="<?php echo esc_attr($item['image']); ?>" class="trx_addons_iconed_block_image"><?php
  1086.  
  1087. }
  1088.  
  1089. ?>
  1090.  
  1091. <h2 class="trx_addons_iconed_block_title"><?php
  1092.  
  1093. echo esc_html($item['title']);
  1094.  
  1095. ?></h2>
  1096.  
  1097. <div class="trx_addons_iconed_block_description"><?php
  1098.  
  1099. echo esc_html($item['description']);
  1100.  
  1101. ?></div>
  1102.  
  1103. <?php
  1104.  
  1105. $links = array(
  1106.  
  1107. array(
  1108.  
  1109. 'link' => $item['link'],
  1110.  
  1111. 'button' => $item['button']
  1112.  
  1113. )
  1114.  
  1115. );
  1116.  
  1117. if ( strpos( $item['link'], 'customize.php' ) !== false && function_exists('menu_page_url') ) {
  1118.  
  1119. $links[] = array(
  1120.  
  1121. 'link' => menu_page_url( 'theme_options', false ),
  1122.  
  1123. 'button' => esc_html__( 'Theme Options', 'trx_addons' )
  1124.  
  1125. );
  1126.  
  1127. }
  1128.  
  1129. $cnt = 0;
  1130.  
  1131. foreach( $links as $link ) {
  1132.  
  1133. $cnt++;
  1134.  
  1135. if ($cnt > 1) {
  1136.  
  1137. ?><span class="trx_addons_iconed_block_link_delimiter"></span><?php
  1138.  
  1139. }
  1140.  
  1141. ?>
  1142.  
  1143. <a href="<?php echo esc_url( $link['link'] ); ?>" class="trx_addons_iconed_block_link"<?php
  1144.  
  1145. if (strpos($link['link'], home_url()) === false) {
  1146.  
  1147. echo ' target="_blank"';
  1148.  
  1149. }
  1150.  
  1151. ?>>
  1152.  
  1153. <?php echo esc_html($link['button']); ?>
  1154.  
  1155. </a>
  1156.  
  1157. <?php
  1158.  
  1159. }
  1160.  
  1161. ?>
  1162.  
  1163. </div></div><?php
  1164.  
  1165. }
  1166.  
  1167. ?>
  1168.  
  1169. </div>
  1170.  
  1171. <?php
  1172.  
  1173. }
  1174.  
  1175. ?>
  1176.  
  1177. </div>
  1178.  
  1179. <?php
  1180.  
  1181. }
  1182.  
  1183. }
  1184.  
  1185. }
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191. // Display featured item (theme) from our server
  1192.  
  1193. if ( !function_exists( 'trx_addons_theme_panel_featured_item' ) ) {
  1194.  
  1195. function trx_addons_theme_panel_featured_item($tab_id, $theme_info) {
  1196.  
  1197. $banners = get_transient( 'trx_addons_welcome_banners' );
  1198.  
  1199. $banners_url = trailingslashit( dirname( esc_url( trx_addons_get_protocol() . ':' . trx_addons_get_theme_data( 'theme_demofiles_url' ) ) ) ) . '_welcome/';
  1200.  
  1201. if ( ! $banners ) {
  1202.  
  1203. $txt = trx_addons_fgc( $banners_url . 'welcome.json' );
  1204.  
  1205. if (!empty($txt) && substr($txt, 0, 1) == '[') {
  1206.  
  1207. $banners = json_decode($txt, true);
  1208.  
  1209. if ( is_array($banners) && count($banners) > 0 ) {
  1210.  
  1211. set_transient('trx_addons_welcome_banners', $banners, 4*60*60); //Save for 4 hours
  1212.  
  1213. }
  1214.  
  1215. }
  1216.  
  1217. }
  1218.  
  1219. $html = '';
  1220.  
  1221. if ( is_array($banners) && count($banners) > 0 ) {
  1222.  
  1223. $html .= '<div class="trx_addons_theme_panel_banners">';
  1224.  
  1225. foreach ($banners as $banner) {
  1226.  
  1227. // Prepare links
  1228.  
  1229. if (!empty($banner['image']) && ! trx_addons_is_url( $banner['image'] ) ) {
  1230.  
  1231. $banner['image'] = $banners_url . trim($banner['image']);
  1232.  
  1233. }
  1234.  
  1235. if (!empty($banner['icon']) && ! trx_addons_is_url( $banner['icon'] ) && strpos($banner['icon'], 'dashicons') === false && strpos($banner['icon'], 'trx_addons_icon') === false) {
  1236.  
  1237. $banner['icon'] = $banners_url . trim($banner['icon']);
  1238.  
  1239. }
  1240.  
  1241. if (!empty($banner['url']) && substr($banner['url'], 0, 1) === '#') {
  1242.  
  1243. $banner['url'] = trx_addons_get_theme_data( substr( $banner['url'], 1 ) );
  1244.  
  1245. }
  1246.  
  1247. if (!empty($banner['link_url']) && substr($banner['link_url'], 0, 1) === '#') {
  1248.  
  1249. $banner['link_url'] = trx_addons_get_theme_data( substr( $banner['link_url'], 1 ) );
  1250.  
  1251. }
  1252.  
  1253. // Build banner's layout
  1254.  
  1255. $html .= '<div class="trx_addons_theme_panel_banners_item' . ( count( $banners ) > 1 ? ' trx_banners_item' : '' ) . '"'
  1256.  
  1257. . (!empty($banner['duration'])
  1258.  
  1259. ? ' data-duration="' . esc_attr(max(1000, min(60000, $banner['duration']*($banner['duration']<1000 ? 1000 : 1)))) . '"'
  1260.  
  1261. : ''
  1262.  
  1263. )
  1264.  
  1265. . '>';
  1266.  
  1267. // Title
  1268.  
  1269. if (!empty($banner['title'])) {
  1270.  
  1271. $html .= '<div class="trx_addons_theme_panel_banners_item_header">'
  1272.  
  1273. . ( ! empty($banner['link_url'])
  1274.  
  1275. ? '<a class="trx_addons_theme_panel_banners_item_link" href="' . esc_url($banner['link_url']) . '" target="_blank">' . wp_kses($banner['link_text'], 'trx_addons_kses_content') . '</a>'
  1276.  
  1277. : ''
  1278.  
  1279. )
  1280.  
  1281. . ( ! empty($banner['icon'])
  1282.  
  1283. ? ( trx_addons_is_url( $banner['icon'] )
  1284.  
  1285. ? '<span class="trx_addons_theme_panel_banners_item_icon with_image"><img src="' . esc_url($banner['icon']) . '"></span>'
  1286.  
  1287. : '<span class="trx_addons_theme_panel_banners_item_icon ' . esc_attr($banner['icon']) . '"></span>'
  1288.  
  1289. )
  1290.  
  1291. : ''
  1292.  
  1293. )
  1294.  
  1295. . '<h2 class="trx_addons_theme_panel_banners_item_title">' . esc_html($banner['title']) . '</h2>'
  1296.  
  1297. . '</div>';
  1298.  
  1299. }
  1300.  
  1301. // Image
  1302.  
  1303. if (!empty($banner['image'])) {
  1304.  
  1305. $html .= '<div class="trx_addons_theme_panel_banners_item_image">'
  1306.  
  1307. . ( !empty($banner['url'])
  1308.  
  1309. ? '<a href="' . esc_url($banner['url']) . '" target="_blank">'
  1310.  
  1311. : ''
  1312.  
  1313. )
  1314.  
  1315. . '<img src="' . esc_url($banner['image']) . '">'
  1316.  
  1317. . ( !empty($banner['url'])
  1318.  
  1319. ? '<span class="trx_addons_theme_panel_banners_item_image_mask">' . ( ! empty($banner['url_text']) ? $banner['url_text'] : esc_html__( 'Live Preview', 'trx_addons' ) ) . '</span></a>'
  1320.  
  1321. : ''
  1322.  
  1323. )
  1324.  
  1325. . '</div>';
  1326.  
  1327. }
  1328.  
  1329. $html .= '</div>';
  1330.  
  1331. }
  1332.  
  1333. $html .= '</div>';
  1334.  
  1335. }
  1336.  
  1337. if ( ! empty( $html ) ) {
  1338.  
  1339. ?><div class="trx_addons_theme_panel_featured_item">
  1340.  
  1341. <?php trx_addons_show_layout( $html ); ?>
  1342.  
  1343. </div><?php
  1344.  
  1345. }
  1346.  
  1347. }
  1348.  
  1349. }
  1350.  
  1351.  
  1352.  
  1353. // Display system info
  1354.  
  1355. if ( ! function_exists( 'trx_addons_theme_panel_show_sys_info' ) ) {
  1356.  
  1357. function trx_addons_theme_panel_show_sys_info( $tab_id, $theme_info ) {
  1358.  
  1359. ?><div class="trx_addons_theme_panel_sys_info">
  1360.  
  1361. <table class="trx_addons_theme_panel_table" border="0" cellpadding="0" cellspacing="0" width="100%">
  1362.  
  1363. <tr>
  1364.  
  1365. <th class="trx_addons_theme_panel_info_param"><span class="dashicons dashicons-yes-alt"></span><?php esc_html_e('System Check', 'trx_addons'); ?></th>
  1366.  
  1367. <th class="trx_addons_theme_panel_info_value"><?php esc_html_e('Current', 'trx_addons'); ?></th>
  1368.  
  1369. <th class="trx_addons_theme_panel_info_advise"><?php esc_html_e('Suggested', 'trx_addons'); ?></th>
  1370.  
  1371. </tr>
  1372.  
  1373. <?php
  1374.  
  1375. $sys_info = trx_addons_get_sys_info();
  1376.  
  1377. $checked = true;
  1378.  
  1379. foreach ( $sys_info as $k => $item ) {
  1380.  
  1381. $checked = $checked && ( ! isset($item['checked']) || $item['checked'] );
  1382.  
  1383. ?>
  1384.  
  1385. <tr>
  1386.  
  1387. <td class="trx_addons_theme_panel_info_param<?php
  1388.  
  1389. if ( ! empty( $item['description'] ) ) {
  1390.  
  1391. echo ' trx_addons_tooltip_present';
  1392.  
  1393. }
  1394.  
  1395. ?>"><?php
  1396.  
  1397. if ( ! empty( $item['description'] ) ) {
  1398.  
  1399. ?><span class="trx_addons_tooltip" data-tooltip-text="<?php echo esc_attr( $item['description'] ); ?>"><?php
  1400.  
  1401. echo esc_html($item['title']);
  1402.  
  1403. ?></span><?php
  1404.  
  1405. } else {
  1406.  
  1407. echo esc_html($item['title']);
  1408.  
  1409. }
  1410.  
  1411. ?></td>
  1412.  
  1413. <td class="trx_addons_theme_panel_info_value<?php
  1414.  
  1415. if (isset($item['checked'])) {
  1416.  
  1417. echo ' trx_addons_theme_panel_info_param_' . ( $item['checked'] ? 'checked' : 'unchecked' );
  1418.  
  1419. }
  1420.  
  1421. ?>"><?php echo esc_html($item['value']); ?></td>
  1422.  
  1423. <td class="trx_addons_theme_panel_info_advise"><?php echo esc_html($item['recommended']); ?></td>
  1424.  
  1425. </tr>
  1426.  
  1427. <?php
  1428.  
  1429. }
  1430.  
  1431. ?>
  1432.  
  1433. </table>
  1434.  
  1435. <?php
  1436.  
  1437. if ( ! $checked ) {
  1438.  
  1439. ?>
  1440.  
  1441. <div class="trx_addons_theme_panel_sys_info_check_result trx_addons_info_box trx_addons_info_box_warning">
  1442.  
  1443. <p><?php
  1444.  
  1445. echo wp_kses_data(
  1446.  
  1447. __("It seems that your server doesn't comply with the theme requirements. You may encounter problems during the upload skins or addons or demo data installation.", 'trx_addons')
  1448.  
  1449. );
  1450.  
  1451. ?></p>
  1452.  
  1453. <p><?php
  1454.  
  1455. echo wp_kses(
  1456.  
  1457. sprintf(
  1458.  
  1459. __("You may want to check with your Hosting Provider if they can fix the issues for you. Or consider using %s that provides a 50%% discount for our customers.", 'trx_addons'),
  1460.  
  1461. '<a href="//www.siteground.com/themerex" target="_blank">' . esc_html__( 'Siteground Hosting', 'trx_addons' ) . '</a>'
  1462.  
  1463. ),
  1464.  
  1465. 'trx_addons_kses_content'
  1466.  
  1467. );
  1468.  
  1469. ?></p>
  1470.  
  1471. </div>
  1472.  
  1473. <?php
  1474.  
  1475. }
  1476.  
  1477. ?></div><?php
  1478.  
  1479. }
  1480.  
  1481. }
  1482.  
  1483.  
  1484.  
  1485. // Display the theme activation form
  1486.  
  1487. if ( !function_exists( 'trx_addons_theme_panel_activation_form' ) ) {
  1488.  
  1489. add_action('trx_addons_action_theme_panel_activation_form', 'trx_addons_theme_panel_activation_form');
  1490.  
  1491. function trx_addons_theme_panel_activation_form() {
  1492.  
  1493. $activation_methods = apply_filters( 'trx_addons_filter_activation_methods', array(
  1494.  
  1495. 'purchase_key' => true,
  1496.  
  1497. 'elements_key' => true
  1498.  
  1499. ) );
  1500.  
  1501. $activation_methods_total = ( ! empty( $activation_methods['purchase_key'] ) ? 1 : 0 )
  1502.  
  1503. + ( ! empty( $activation_methods['elements_key'] ) ? 1 : 0 );
  1504.  
  1505. if ( $activation_methods_total > 0 ) {
  1506.  
  1507. ?>
  1508.  
  1509. <div class="trx_addons_theme_panel_section_form_wrap">
  1510.  
  1511. <form action="<?php echo esc_url(get_admin_url(null, 'admin.php?page=trx_addons_theme_panel')); ?>" class="trx_addons_theme_panel_section_form" name="trx_addons_theme_panel_activate_form" method="post">
  1512.  
  1513. <input type="hidden" name="trx_addons_nonce" value="<?php echo esc_attr(wp_create_nonce(admin_url())); ?>" />
  1514.  
  1515. <h3 class="trx_addons_theme_panel_section_form_title"><?php esc_html_e('Activate Your Theme and Support Account', 'trx_addons'); ?></h3>
  1516.  
  1517. <div class="trx_addons_columns_wrap">
  1518.  
  1519. <div class="trx_addons_column-1_2">
  1520.  
  1521. <div class="trx_addons_theme_panel_section_form_field trx_addons_theme_panel_section_form_field_text">
  1522.  
  1523. <label>
  1524.  
  1525. <span class="trx_addons_theme_panel_section_form_field_label"><?php esc_attr_e('Name:', 'trx_addons'); ?></span>
  1526.  
  1527. <input type="text" name="trx_addons_user_name" placeholder="<?php esc_attr_e('Your name', 'trx_addons'); ?>">
  1528.  
  1529. </label>
  1530.  
  1531. </div>
  1532.  
  1533. </div><div class="trx_addons_column-1_2">
  1534.  
  1535. <div class="trx_addons_theme_panel_section_form_field trx_addons_theme_panel_section_form_field_text">
  1536.  
  1537. <label>
  1538.  
  1539. <span class="trx_addons_theme_panel_section_form_field_label"><?php esc_attr_e('E-mail:', 'trx_addons'); ?></span>
  1540.  
  1541. <input type="text" name="trx_addons_user_email" placeholder="<?php esc_attr_e('Your e-mail', 'trx_addons'); ?>">
  1542.  
  1543. </label>
  1544.  
  1545. </div>
  1546.  
  1547. </div><div class="trx_addons_column-1_1">
  1548.  
  1549. <div class="trx_addons_theme_panel_section_form_field trx_addons_theme_panel_section_form_field_text<?php if ( $activation_methods_total == 1 ) echo ' trx_addons_hidden'; ?>">
  1550.  
  1551. <?php
  1552.  
  1553. if ( ! empty( $activation_methods['purchase_key'] ) ) {
  1554.  
  1555. ?>
  1556.  
  1557. <label>
  1558.  
  1559. <input type="radio" name="trx_addons_activate_theme_source" value="code" checked="checked">
  1560.  
  1561. <span class="trx_addons_theme_panel_section_form_field_caption"><?php esc_attr_e('I have a purchase code', 'trx_addons'); ?></span>
  1562.  
  1563. </label>
  1564.  
  1565. <?php
  1566.  
  1567. }
  1568.  
  1569. if ( $activation_methods_total > 1 ) {
  1570.  
  1571. ?><br><?php
  1572.  
  1573. }
  1574.  
  1575. if ( ! empty( $activation_methods['elements_key'] ) ) {
  1576.  
  1577. ?>
  1578.  
  1579. <label>
  1580.  
  1581. <input type="radio" name="trx_addons_activate_theme_source" value="token"<?php if ( $activation_methods_total == 1 ) echo ' checked="checked"'; ?>>
  1582.  
  1583. <span class="trx_addons_theme_panel_section_form_field_caption"><?php esc_attr_e('I downloaded the theme from Envato Elements', 'trx_addons'); ?></span>
  1584.  
  1585. </label>
  1586.  
  1587. <?php
  1588.  
  1589. }
  1590.  
  1591. ?>
  1592.  
  1593. </div>
  1594.  
  1595. <?php
  1596.  
  1597. if ( ! empty( $activation_methods['purchase_key'] ) ) {
  1598.  
  1599. ?>
  1600.  
  1601. <div class="trx_addons_theme_panel_section_form_field trx_addons_theme_panel_section_form_field_text trx_addons_theme_panel_section_form_field_param_code">
  1602.  
  1603. <label>
  1604.  
  1605. <span class="trx_addons_theme_panel_section_form_field_label"><?php esc_attr_e('Purchase code', 'trx_addons'); ?> <sup class="required">*</sup></span>
  1606.  
  1607. <input type="text" name="trx_addons_activate_theme_code" placeholder="<?php esc_attr_e('Purchase code (required)', 'trx_addons'); ?>">
  1608.  
  1609. <span class="trx_addons_theme_panel_section_form_field_description"><?php
  1610.  
  1611. echo esc_html__( "Can't find the purchase code?", 'trx_addons' )
  1612.  
  1613. . ' '
  1614.  
  1615. . apply_filters( 'trx_addons_filter_get_purchase_code_link',
  1616.  
  1617. '<a href="https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code-" target="_blank">'
  1618.  
  1619. . esc_html__('Follow this guide.', 'trx_addons')
  1620.  
  1621. . '</a>'
  1622.  
  1623. );
  1624.  
  1625. ?></span>
  1626.  
  1627. </label>
  1628.  
  1629. </div>
  1630.  
  1631. <?php
  1632.  
  1633. }
  1634.  
  1635. if ( ! empty( $activation_methods['elements_key'] ) ) {
  1636.  
  1637. ?>
  1638.  
  1639. <div class="trx_addons_theme_panel_section_form_field trx_addons_theme_panel_section_form_field_text trx_addons_theme_panel_section_form_field_param_token trx_addons_hidden">
  1640.  
  1641. <label>
  1642.  
  1643. <span class="trx_addons_theme_panel_section_form_field_label"><?php esc_attr_e('Envato Elements Token', 'trx_addons'); ?> <sup class="required">*</sup></span>
  1644.  
  1645. <input type="text" name="trx_addons_activate_theme_token" placeholder="<?php esc_attr_e('Envato Elements Token (required)', 'trx_addons'); ?>">
  1646.  
  1647. <span class="trx_addons_theme_panel_section_form_field_description"><?php
  1648.  
  1649. echo sprintf(
  1650.  
  1651. esc_html__( '%1$s or try using %2$s to generate a new Envato Elements Token.', 'trx_addons' ),
  1652.  
  1653. apply_filters( 'trx_addons_filter_get_elements_token_link',
  1654.  
  1655. '<a href="'
  1656.  
  1657. . esc_url( 'https://api.extensions.envato.com/extensions/begin_activation'
  1658.  
  1659. . '?extension_id=bec21c4c-b621-4fef-9080-cf24c6415957'
  1660.  
  1661. . '&extension_type=envato-wordpress'
  1662.  
  1663. . '&extension_description=' . wp_get_theme()->get( 'Name' ) . ' (' . home_url() . ')'
  1664.  
  1665. . '&utm_content=settings'
  1666.  
  1667. )
  1668.  
  1669. . '" target="_blank">'
  1670.  
  1671. . esc_html__('Follow this link', 'trx_addons')
  1672.  
  1673. . '</a>'
  1674.  
  1675. ),
  1676.  
  1677. apply_filters( 'trx_addons_filter_get_elements_token_link_alter',
  1678.  
  1679. '<a href="'
  1680.  
  1681. . esc_url( 'https://api.extensions.envato.com/extensions/begin_activation'
  1682.  
  1683. . '?extension_id=7c7270f606fb77cc9c8b45ccad352290'
  1684.  
  1685. . '&extension_type=envato-wordpress'
  1686.  
  1687. . '&extension_description=' . wp_get_theme()->get( 'Name' ) . ' (' . home_url() . ')'
  1688.  
  1689. )
  1690.  
  1691. . '" target="_blank">'
  1692.  
  1693. . esc_html__('an alternative link', 'trx_addons')
  1694.  
  1695. . '</a>'
  1696.  
  1697. )
  1698.  
  1699. );
  1700.  
  1701. ?></span>
  1702.  
  1703. </label>
  1704.  
  1705. </div>
  1706.  
  1707. <?php
  1708.  
  1709. }
  1710.  
  1711. ?>
  1712.  
  1713. <div class="trx_addons_theme_panel_section_form_field trx_addons_theme_panel_section_form_field_checkbox">
  1714.  
  1715. <label>
  1716.  
  1717. <input type="checkbox" name="trx_addons_user_agree" value="1">
  1718.  
  1719. <?php
  1720.  
  1721. echo sprintf(
  1722.  
  1723. wp_kses( __('Your data is stored and processed in accordance with our %s.', 'trx_addons'), 'trx_addons_kses_content' ),
  1724.  
  1725. '<a href="' . apply_filters('trx_addons_filter_privacy_url', '//themerex.net/privacy-policy/') . '" target="_blank">' . esc_html__('Privacy Policy', 'trx_addons') . '</a>'
  1726.  
  1727. );
  1728.  
  1729. ?>
  1730.  
  1731. </label>
  1732.  
  1733. </div>
  1734.  
  1735. <div class="trx_addons_theme_panel_section_form_field trx_addons_theme_panel_section_form_field_submit">
  1736.  
  1737. <input type="submit" class="trx_addons_button trx_addons_button_large trx_addons_button_accent" value="<?php esc_attr_e('Submit', 'trx_addons'); ?>">
  1738.  
  1739. </div>
  1740.  
  1741. </div>
  1742.  
  1743. </div>
  1744.  
  1745. </form>
  1746.  
  1747. </div>
  1748.  
  1749. <?php
  1750.  
  1751. }
  1752.  
  1753. }
  1754.  
  1755. }
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761. // Display 'Plugins' section
  1762.  
  1763. if ( !function_exists( 'trx_addons_theme_panel_section_plugins' ) ) {
  1764.  
  1765. add_action('trx_addons_action_theme_panel_section', 'trx_addons_theme_panel_section_plugins', 10, 2);
  1766.  
  1767. function trx_addons_theme_panel_section_plugins($tab_id, $theme_info) {
  1768.  
  1769. if ($tab_id !== 'plugins') return;
  1770.  
  1771. ?>
  1772.  
  1773. <div id="trx_addons_theme_panel_section_<?php echo esc_attr($tab_id); ?>" class="trx_addons_tabs_section">
  1774.  
  1775.  
  1776.  
  1777. <?php
  1778.  
  1779. do_action('trx_addons_action_theme_panel_section_start', $tab_id, $theme_info);
  1780.  
  1781.  
  1782.  
  1783. if ( trx_addons_is_theme_activated() ) {
  1784.  
  1785. ?>
  1786.  
  1787. <div class="trx_addons_theme_panel_section_content trx_addons_theme_panel_plugins_installer">
  1788.  
  1789.  
  1790.  
  1791. <?php do_action('trx_addons_action_theme_panel_before_section_title', $tab_id, $theme_info); ?>
  1792.  
  1793.  
  1794.  
  1795. <h1 class="trx_addons_theme_panel_section_title">
  1796.  
  1797. <?php esc_html_e( 'Plugins', 'trx_addons' ); ?>
  1798.  
  1799. </h1>
  1800.  
  1801.  
  1802.  
  1803. <?php do_action('trx_addons_action_theme_panel_after_section_title', $tab_id, $theme_info); ?>
  1804.  
  1805.  
  1806.  
  1807. <div class="trx_addons_theme_panel_section_description">
  1808.  
  1809. <p><?php echo wp_kses_data( __( "Install and activate theme-related plugins. Select only those plugins that you're planning to use. You can also install plugins via \"Appearance - Install Plugins\".", 'trx_addons' ) ); ?></p>
  1810.  
  1811. </div>
  1812.  
  1813.  
  1814.  
  1815. <div class="trx_addons_info_box">
  1816.  
  1817. <p class="trx_addons_theme_panel_section_info_notice"><b><?php esc_html_e('Attention!', 'trx_addons'); ?></b> <?php echo wp_kses_data( __( "Sometimes, the activation of some plugins interferes with the process of other plugins' installation. If a plugin is still on the 'Activating' stage after 1 minute, just reload the page (by pressing F5) and then switch to the 'Plugins' tab; there you should check the required plugins that remained uninstalled and proceed with the installation ('Install & Activate' button below the list of plugins)", 'trx_addons' ) ); ?></p>
  1818.  
  1819. </div>
  1820.  
  1821.  
  1822.  
  1823. <?php do_action('trx_addons_action_theme_panel_before_section_buttons', $tab_id, $theme_info); ?>
  1824.  
  1825.  
  1826.  
  1827. <div class="trx_addons_theme_panel_plugins_buttons">
  1828.  
  1829. <a href="#" class="trx_addons_theme_panel_plugins_button_select trx_addons_button trx_addons_button_small"><?php esc_html_e('Select all', 'trx_addons'); ?></a>
  1830.  
  1831. <a href="#" class="trx_addons_theme_panel_plugins_button_deselect trx_addons_button trx_addons_button_small"><?php esc_html_e('Deselect all', 'trx_addons'); ?></a>
  1832.  
  1833. </div><?php
  1834.  
  1835.  
  1836.  
  1837. do_action('trx_addons_action_theme_panel_before_list_items', $tab_id, $theme_info);
  1838.  
  1839.  
  1840.  
  1841. // List of plugins
  1842.  
  1843. ?>
  1844.  
  1845. <div class="trx_addons_theme_panel_plugins_list"><?php
  1846.  
  1847. if ( is_array( $theme_info['theme_plugins'] ) ) {
  1848.  
  1849. foreach ($theme_info['theme_plugins'] as $plugin_slug => $plugin_data) {
  1850.  
  1851. if (isset($plugin_data['install']) && $plugin_data['install'] === false) {
  1852.  
  1853. continue;
  1854.  
  1855. }
  1856.  
  1857. $plugin_state = trx_addons_plugins_installer_check_plugin_state( $plugin_slug );
  1858.  
  1859. // Uncomment next line if you want to hide already activated plugins
  1860.  
  1861. //if ($plugin_state == 'deactivate') continue;
  1862.  
  1863. $plugin_link = trx_addons_plugins_installer_get_link( $plugin_slug, $plugin_state );
  1864.  
  1865. $plugin_image = !empty($plugin_data['logo'])
  1866.  
  1867. ? ( trx_addons_is_url( $plugin_data['logo'] )
  1868.  
  1869. ? $plugin_data['logo']
  1870.  
  1871. : apply_filters( 'trx_addons_filter_plugin_logo', trailingslashit( get_template_directory_uri() ) . 'plugins/' . sanitize_file_name($plugin_slug) . '/' . $plugin_data['logo'], $plugin_slug, $plugin_data )
  1872.  
  1873. )
  1874.  
  1875. : trx_addons_get_no_image();
  1876.  
  1877. ?><div class="trx_addons_theme_panel_plugins_list_item<?php
  1878.  
  1879. if ( !empty($plugin_data['required']) && $plugin_state != 'deactivate' ) echo ' trx_addons_theme_panel_plugins_list_item_checked';
  1880.  
  1881. ?>">
  1882.  
  1883. <a href="<?php echo esc_url($plugin_link); ?>"
  1884.  
  1885. class="trx_addons_theme_panel_plugins_list_item_link"
  1886.  
  1887. data-slug="<?php echo esc_attr( $plugin_slug ); ?>"
  1888.  
  1889. data-name="<?php echo esc_attr( $plugin_slug ); ?>"
  1890.  
  1891. data-required="<?php echo !empty($plugin_data['required']) ? '1' : '0'; ?>"
  1892.  
  1893. data-state="<?php echo esc_attr( $plugin_state ); ?>"
  1894.  
  1895. data-activate-nonce="<?php echo esc_url(trx_addons_plugins_installer_get_link( $plugin_slug, 'activate' )); ?>"
  1896.  
  1897. data-install-label="<?php esc_attr_e( 'Not installed', 'trx_addons' ); ?>"
  1898.  
  1899. data-install-label-selected="<?php esc_attr_e( 'Install', 'trx_addons' ); ?>"
  1900.  
  1901. data-install-progress="<?php esc_attr_e( 'Installing ...', 'trx_addons' ); ?>"
  1902.  
  1903. data-activate-label="<?php esc_attr_e( 'Not activated', 'trx_addons' ); ?>"
  1904.  
  1905. data-activate-label-selected="<?php esc_attr_e( 'Activate', 'trx_addons' ); ?>"
  1906.  
  1907. data-activate-progress="<?php esc_attr_e( 'Activating ...', 'trx_addons' ); ?>"
  1908.  
  1909. data-deactivate-label="<?php esc_attr_e( 'Active', 'trx_addons' ); ?>"
  1910.  
  1911. tabindex="<?php echo 'deactivate' == $plugin_state ? '-1' : '0'; ?>"
  1912.  
  1913. ><?php
  1914.  
  1915. // Check and state
  1916.  
  1917. ?><span class="trx_addons_theme_panel_plugins_list_item_status">
  1918.  
  1919. <span class="trx_addons_theme_panel_plugins_list_item_check"></span>
  1920.  
  1921. <span class="trx_addons_theme_panel_plugins_list_item_state"><?php
  1922.  
  1923. if ($plugin_state == 'install') {
  1924.  
  1925. // Unhovered text
  1926.  
  1927. ?><span class="trx_addons_theme_panel_plugins_list_item_state_label"><?php
  1928.  
  1929. esc_html_e('Not installed', 'trx_addons');
  1930.  
  1931. ?></span><?php
  1932.  
  1933. // Hovered text
  1934.  
  1935. ?><span class="trx_addons_theme_panel_plugins_list_item_state_label_selected"><?php
  1936.  
  1937. esc_html_e('Install', 'trx_addons');
  1938.  
  1939. ?></span><?php
  1940.  
  1941. } elseif ($plugin_state == 'activate') {
  1942.  
  1943. // Unhovered text
  1944.  
  1945. ?><span class="trx_addons_theme_panel_plugins_list_item_state_label"><?php
  1946.  
  1947. esc_html_e('Not activated', 'trx_addons');
  1948.  
  1949. ?></span><?php
  1950.  
  1951. // Hovered text
  1952.  
  1953. ?><span class="trx_addons_theme_panel_plugins_list_item_state_label_selected"><?php
  1954.  
  1955. esc_html_e('Activate', 'trx_addons');
  1956.  
  1957. ?></span><?php
  1958.  
  1959. } else {
  1960.  
  1961. // Unhovered text
  1962.  
  1963. ?><span class="trx_addons_theme_panel_plugins_list_item_state_label"><?php
  1964.  
  1965. esc_html_e('Active', 'trx_addons');
  1966.  
  1967. ?></span><?php
  1968.  
  1969. }
  1970.  
  1971. ?></span>
  1972.  
  1973. </span><?php
  1974.  
  1975. // Plugin's logo
  1976.  
  1977. ?><span class="trx_addons_theme_panel_plugins_list_item_image" style="background-image: url(<?php echo esc_url($plugin_image); ?>)"></span><?php
  1978.  
  1979. // Plugin's title
  1980.  
  1981. ?><span class="trx_addons_theme_panel_plugins_list_item_title"><?php echo esc_html( $plugin_data['title'] ); ?></span>
  1982.  
  1983. </a>
  1984.  
  1985. </div><?php
  1986.  
  1987. }
  1988.  
  1989. }
  1990.  
  1991. ?></div>
  1992.  
  1993.  
  1994.  
  1995. <?php do_action('trx_addons_action_theme_panel_after_list_items', $tab_id, $theme_info); ?>
  1996.  
  1997.  
  1998.  
  1999. <div class="trx_addons_theme_panel_plugins_buttons">
  2000.  
  2001. <a href="#" class="trx_addons_theme_panel_plugins_install trx_addons_button trx_addons_button_accent" disabled="disabled" data-need-reload="0"><?php
  2002.  
  2003. esc_html_e('Install & Activate', 'trx_addons');
  2004.  
  2005. ?></a>
  2006.  
  2007. <div class="trx_addons_percent_loader">
  2008.  
  2009. <div class="trx_addons_percent_loader_bg"></div>
  2010.  
  2011. <div class="trx_addons_percent_loader_value">0%</div>
  2012.  
  2013. </div>
  2014.  
  2015. </div>
  2016.  
  2017.  
  2018.  
  2019. </div>
  2020.  
  2021.  
  2022.  
  2023. <?php
  2024.  
  2025. do_action('trx_addons_action_theme_panel_after_section_data', $tab_id, $theme_info);
  2026.  
  2027.  
  2028.  
  2029. } else {
  2030.  
  2031. ?>
  2032.  
  2033. <div class="trx_addons_info_box trx_addons_info_box_warning"><p>
  2034.  
  2035. <?php esc_html_e( 'Activate your theme in order to be able to install additional plugins.', 'trx_addons' ); ?>
  2036.  
  2037. </p></div>
  2038.  
  2039. <?php
  2040.  
  2041. }
  2042.  
  2043.  
  2044.  
  2045. do_action('trx_addons_action_theme_panel_section_end', $tab_id, $theme_info);
  2046.  
  2047. ?>
  2048.  
  2049. </div>
  2050.  
  2051. <?php
  2052.  
  2053. }
  2054.  
  2055. }
  2056.  
  2057.  
  2058.  
  2059.  
  2060.  
  2061. // Display buttons after the section's data
  2062.  
  2063. if (!function_exists('trx_addons_theme_panel_after_section_data')) {
  2064.  
  2065. add_action('trx_addons_action_theme_panel_after_section_data', 'trx_addons_theme_panel_after_section_data', 10, 2);
  2066.  
  2067. function trx_addons_theme_panel_after_section_data($tab_id, $theme_info) {
  2068.  
  2069. $is_last_tab = array_key_last( trx_addons_theme_panel_get_tabs_list() ) == $tab_id;
  2070.  
  2071. ?>
  2072.  
  2073. <div class="trx_addons_theme_panel_buttons">
  2074.  
  2075. <a href="<?php
  2076.  
  2077. if ( $is_last_tab )
  2078.  
  2079. echo esc_url(admin_url());
  2080.  
  2081. else
  2082.  
  2083. echo '#';
  2084.  
  2085. ?>" class="trx_addons_theme_panel_next_step<?php if ( $is_last_tab ) { echo ' trx_addons_theme_panel_last_step trx_addons_button_accent'; } ?> trx_addons_button"><?php
  2086.  
  2087. if ( $is_last_tab )
  2088.  
  2089. esc_html_e('Return to Dashboard', 'trx_addons');
  2090.  
  2091. else
  2092.  
  2093. esc_html_e('Skip Step', 'trx_addons');
  2094.  
  2095. ?></a>
  2096.  
  2097. <a href="#" class="trx_addons_theme_panel_prev_step trx_addons_button"><?php
  2098.  
  2099. esc_html_e('Go Back', 'trx_addons');
  2100.  
  2101. ?></a>
  2102.  
  2103. </div>
  2104.  
  2105. <?php
  2106.  
  2107. }
  2108.  
  2109. }
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115. // Import demo data
  2116.  
  2117. if (!function_exists('trx_addons_theme_panel_load_importer')) {
  2118.  
  2119. add_action( 'after_setup_theme', 'trx_addons_theme_panel_load_importer' );
  2120.  
  2121. function trx_addons_theme_panel_load_importer() {
  2122.  
  2123. if (is_admin() && current_user_can('import') && file_exists(TRX_ADDONS_PLUGIN_DIR . TRX_ADDONS_PLUGIN_IMPORTER . 'class.importer.php')) {
  2124.  
  2125. require_once TRX_ADDONS_PLUGIN_DIR . TRX_ADDONS_PLUGIN_IMPORTER . 'class.importer.php';
  2126.  
  2127. new trx_addons_demo_data_importer();
  2128.  
  2129. }
  2130.  
  2131. }
  2132.  
  2133. }
  2134.  
  2135.  
  2136.  
  2137. // Plugins installer
  2138.  
  2139. require_once TRX_ADDONS_PLUGIN_DIR . TRX_ADDONS_PLUGIN_INSTALLER . 'installer.php';
Advertisement
Add Comment
Please, Sign In to add comment