PluginProbe
Button Generator – Easily Create Custom Buttons with Icons and Analytics / 2.3.3
Button Generator – Easily Create Custom Buttons with Icons and Analytics v2.3.3
trunk 1.1.1 2.0 2.1 2.2 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 3.0 3.0.1 3.0.2 3.0.3 3.1 3.1.1 3.1.2 3.1.3 3.2 3.2.1 3.2.2 3.2.3 All 28 releases
button-generation / includes / data-update.php

data-update.php in Button Generator – Easily Create Custom Buttons with Icons and Analytics 2.3.3, at includes/data-update.php

61 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Update Datatable
4 *
5 * @package Wow_Plugin
6 * @subpackage Update Database to version 2.0
7 * @author Wow-Company <support@wow-company.com>
8 * @copyright 2019 Wow-Company
9 * @license GNU Public License
10 * @version 1.0
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16 if ( get_option( 'wow_button_data' ) === false ) {
17 global $wpdb;
18 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
19 $table = $wpdb->prefix . 'wow_' . self::PREF;
20 $sql = "CREATE TABLE " . $table . " (
21 id mediumint(9) NOT NULL AUTO_INCREMENT,
22 title VARCHAR(200) NOT NULL,
23 param TEXT,
24 UNIQUE KEY id (id)
25 ) DEFAULT CHARSET=utf8;";
26 dbDelta( $sql );
27 $old_data = $wpdb->prefix . 'lg_tools';
28 $arrresult = $wpdb->get_results( "select * from " . $old_data );
29 $columns = count( $arrresult );
30 for ( $i = 0; $i < $columns; $i ++ ) {
31 $arr = array();
32 foreach ( $arrresult[ $i ] as $key => $val ) {
33 if ( $key == 'title' ) {
34 $title = $val;
35 } elseif ( $key == 'id' ) {
36 $id = $val;
37 } elseif ( $key == 'param' ) {
38 $param = $val;
39 }
40 }
41 $data = array(
42 'id' => $id,
43 'title' => $title,
44 'param' => $param,
45 );
46
47 $tool_view = get_option( '_lg_tool_button_view_counter_' . $id, '0' );
48 $tool_action = get_option( '_lg_tool_button_action_counter_' . $id, '0' );
49
50 $prefix = self::PREF;
51 $option_name_view = '_' . $prefix . '_view_counter_' . $id;
52 $option_name_action = '_' . $prefix . '_action_counter_' . $id;
53
54 update_option( $option_name_view, $tool_view );
55 update_option( $option_name_action, $tool_action );
56
57 $wpdb->insert( $table, $data );
58 }
59 update_option( 'wow_button_data', '2.0' );
60 }
61