PluginProbe
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce / 1.2.6
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce v1.2.6
1.17.9 1.17.8 1.17.7 1.17.6 1.17.5 1.17.4 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.3.0 1.3.1 1.3.11 1.3.12 1.3.13 1.3.14 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 All 143 releases
erp / includes / framework / settings / license.php

license.php in ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce 1.2.6, at includes/framework/settings/license.php

119 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use WeDevs\ERP\Framework\ERP_Settings_Page;
4
5 /**
6 * Integration class
7 */
8 class ERP_License_Settings extends ERP_Settings_Page {
9 /**
10 * Class constructor
11 */
12 function __construct() {
13 $this->id = 'erp-license';
14 $this->label = __( 'Licenses', 'erp' );
15
16 add_action( 'erp_admin_field_licenses', [ $this, 'integrations' ] );
17 }
18
19 /**
20 * Get settings array.
21 *
22 * @return array
23 */
24 public function get_settings() {
25 $fields = [
26 [
27 'title' => __( 'License Manager', 'erp' ),
28 'desc' => sprintf( __( 'Enter your extension license keys here to receive updates for purchased extensions. Visit <a href="%s" target="_blank">your account</a> page.', 'erp' ), 'https://wperp.com/my-account/' ),
29 'type' => 'title',
30 'id' => 'integration_settings'
31 ],
32
33 [ 'type' => 'licenses' ],
34 [ 'type' => 'sectionend', 'id' => 'script_styling_options' ],
35
36 ]; // End general settings
37
38 return apply_filters( 'erp_integration_settings', $fields );
39 }
40
41 /**
42 * Display integrations settings.
43 *
44 * @return void
45 */
46 function integrations() {
47 $licenses = erp_addon_licenses();
48 ?>
49 <tr valign="top">
50 <td class="erp-settings-table-wrapper" colspan="2">
51 <table class="erp-settings-table widefat" cellspacing="0">
52 <thead>
53 <tr>
54 <?php
55 $columns = apply_filters( 'erp_license_setting_columns', array(
56 'name' => __( 'Extension', 'erp' ),
57 'version' => __( 'Version', 'erp' ),
58 'license' => __( 'License Key', 'erp' ),
59 ) );
60
61 foreach ( $columns as $key => $column ) {
62 echo '<th class="erp-settings-table-' . esc_attr( $key ) . '">' . esc_html( $column ) . '</th>';
63 }
64 ?>
65 </tr>
66 </thead>
67 <tbody>
68 <?php
69 foreach ( $licenses as $addon ) {
70 echo '<tr>';
71
72 foreach ( $columns as $key => $column ) {
73 switch ( $key ) {
74 case 'name' :
75 echo '<td class="erp-settings-table-' . esc_attr( $key ) . '">
76 <strong>' . $addon['name'] . '</strong>
77 </td>';
78 break;
79
80 case 'version':
81 echo '<td class="erp-settings-table-' . esc_attr( $key ) . '">
82 ' . $addon['version'] . '
83 </td>';
84 break;
85
86 case 'license':
87 echo '<td class="erp-settings-table-' . esc_attr( $key ) . '">
88 <input type="text" name="' . esc_attr( $addon['id'] ) .'" value="' . esc_attr( $addon['license'] ) .'" class="regular-text" />';
89 echo erp_get_license_status( $addon );
90 echo '</td>';
91 break;
92 }
93 }
94 }
95 ?>
96 </tbody>
97 </table>
98 </td>
99 </tr>
100 <style>
101 table.erp-settings-table th.erp-settings-table-name, table.erp-settings-table td.erp-settings-table-name {
102 width: 35%;
103 }
104 </style>
105 <?php
106 }
107
108 /**
109 * Save the settings.
110 *
111 * @param boolean $section (optional)
112 *
113 * @return void
114 */
115 function save( $section = false ) { }
116 }
117
118 return new ERP_License_Settings();
119