prefix . SLIDER_TABLE; if($wpdb->get_var("show tables like '$table_name'") != $table_name) { $sql = "CREATE TABLE IF NOT EXISTS `" . $table_name ."` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `width` smallint(5) unsigned NOT NULL, `height` smallint(5) unsigned NOT NULL, `slider_effect` text, `show_navigation` tinyint(1) unsigned NOT NULL, `navigation_on_hover_state_only` tinyint(1) unsigned NOT NULL, `show_thumbnails` tinyint(1) unsigned NOT NULL, `deny_resize_img` tinyint(1) unsigned NOT NULL, `pause` smallint(5) unsigned NOT NULL, `transition_duration` smallint(5) unsigned NOT NULL, `content_before` longtext NOT NULL, `content_after` longtext NOT NULL, `status` tinyint(1) unsigned NOT NULL, `show_slide_caption` tinyint(1) NOT NULL, `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `thumb_width` smallint(5) unsigned NOT NULL, `thumb_height` smallint(5) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1"; dbDelta($sql); $wpdb->query('INSERT INTO `' . $table_name . '` (`id`, `name`, `width`, `height`, `slider_effect`, `show_navigation`, `navigation_on_hover_state_only`, `show_thumbnails`, `deny_resize_img`, `pause`, `transition_duration`, `content_before`, `content_after`, `status`, `show_slide_caption`, `updated`, `created`, `thumb_width`, `thumb_height`) VALUES (1, \'Slide 1\', 1024, 500, \'a:1:{i:0;s:4:"fade";}\', 0, 0, 1, 0, 4000, 1500, \'\', \'\', 1, 0, \'0000-00-00 00:00:00\', \'0000-00-00 00:00:00\', 150, 100);'); } $table_name = $wpdb->prefix . SLIDES_TABLE; if($wpdb->get_var("show tables like '$table_name'") != $table_name) { $sql = "CREATE TABLE IF NOT EXISTS `" . $table_name . "` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `slider_id` int(10) unsigned NOT NULL, `name` varchar(255) NOT NULL, `caption` text NOT NULL, `order_flag` tinyint(127) unsigned NOT NULL, `link` varchar(255) NOT NULL, `status` tinyint(1) unsigned NOT NULL DEFAULT '0', `picture` varchar(255) NOT NULL, `hotsposts` text NOT NULL, `order` tinyint(3) unsigned NOT NULL, `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1"; dbDelta($sql); } /** * Store defaults options */ foreach ($lookbook_settings_fields as $key=>$val) { $result = $wpdb->get_results( "SELECT option_id FROM `" . $wpdb->prefix . "options" . "` WHERE option_name = '$key'", ARRAY_A); if (empty($result)) { $wpdb->insert( $wpdb->prefix . 'options', array( 'option_name' => $key, 'option_value' => $val ), array( '%s', '%s' ) ); } } /** * Create default folder for picture */ $file = new alfw_manage_files(); $file->create_folder_recursive(FULL_UPLOAD_PATH); $file->create_folder_recursive(FULL_UPLOAD_PATH_THUMB); $file->create_folder_recursive(FULL_UPLOAD_PATH_ORIG); add_option('update2prof_notice', 0,0); } register_activation_hook(__FILE__, 'lookbook_install'); register_deactivation_hook(__FILE__, 'lookbook_deactivate'); function lookbook_add_menu() { add_menu_page(__('LookBookFree'), __('LookBookFree'), 'manage_options', 'lookbook', 'alfw_dashboard'); } function lookbook_deactivate() { if( !function_exists( 'the_field' )) { update_option( 'update2prof_notice', 0 ); } }