| 1 |
<?php |
| 2 |
/** |
| 3 |
* Update plugin data to new version |
| 4 |
* |
| 5 |
* @package Wow_Plugin |
| 6 |
* @copyright Copyright (c) 2018, Dmytro Lobov |
| 7 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 8 |
* @since 1.0 |
| 9 |
*/ |
| 10 |
|
| 11 |
if ( ! defined( 'ABSPATH' ) ) { |
| 12 |
exit; |
| 13 |
} |
| 14 |
|
| 15 |
if ( get_option( 'wow_' . self::PREF . '_updater_3' ) === false ) { |
| 16 |
|
| 17 |
global $wpdb; |
| 18 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
| 19 |
$table = $wpdb->prefix . 'wow_' . self::PREF; |
| 20 |
$result = $wpdb->get_results( "SELECT * FROM " . $table . " order by id asc" ); |
| 21 |
if ( count( $result ) > 0 ) { |
| 22 |
foreach ( $result as $key => $val ) { |
| 23 |
$old = unserialize( $val->param ); |
| 24 |
$new = array(); |
| 25 |
$new['menu'] = !empty($old['menu']) ? $old['menu'] : 'wow-bmp-pos-t'; |
| 26 |
$new['shapes'] = ''; |
| 27 |
$new['animation'] = ''; |
| 28 |
$new['menu_icon'] = 'fas fa-bars'; |
| 29 |
$new['color'] = 'white'; |
| 30 |
$new['hcolor'] = 'black'; |
| 31 |
$new['main_id'] = ''; |
| 32 |
$new['main_class'] = ''; |
| 33 |
$new['show'] = 'all'; |
| 34 |
|
| 35 |
$count_i = ( ! empty( $old['item_link'] ) ) ? count( $old['item_link'] ) : '0'; |
| 36 |
if ( $count_i > 0 ) { |
| 37 |
for ( $i = 1; $i <= $count_i; $i ++ ) { |
| 38 |
$new_i = $i - 1; |
| 39 |
$new['item_type'][ $new_i ] = 'link'; |
| 40 |
|
| 41 |
$new['item_icon'][ $new_i ] = 'fas fa-info'; |
| 42 |
|
| 43 |
$new['item_link'][ $new_i ] = ! empty( $old['item_link'][ $i ] ) ? $old['item_link'][ $i ] : ''; |
| 44 |
|
| 45 |
$new['item_tooltip_include'][ $new_i ] = ! empty( $old['item_tooltip_include'][ $i ] ) |
| 46 |
? $old['item_tooltip_include'][ $i ] : ''; |
| 47 |
|
| 48 |
$new['item_tooltip'][ $new_i ] = ! empty( $old['item_tooltip'][ $i ] ) ? $old['item_tooltip'][ $i ] |
| 49 |
: ''; |
| 50 |
|
| 51 |
$new['item_tooltip_show'][ $new_i ] = '1'; |
| 52 |
$new['open_link'][ $new_i ] = '_self'; |
| 53 |
$new['item_color'][ $new_i ] = 'white'; |
| 54 |
$new['item_hcolor'][ $new_i ] = 'black'; |
| 55 |
$new['button_id'][ $new_i ] = ''; |
| 56 |
$new['button_class'][ $new_i ] = ''; |
| 57 |
} |
| 58 |
} |
| 59 |
$param = serialize( $new ); |
| 60 |
$wpdb->update( $table, array('param' => $param), array( 'id' => $val->id ) ); |
| 61 |
|
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
update_option( 'wow_' . self::PREF . '_updater_3', '3.0' ); |
| 66 |
} |
| 67 |
|