Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ?>
- <?php
- function callAdmin() {
- include('form.php');
- }
- function AddToOptionPage() {
- add_options_page('One Crazy Plugin', 'One Crazy Plugin', 'manage_options', 'OSCommerceProductDisplay', 'callAdmin');
- }
- add_action('admin_menu', 'AddToOptionPage');
- function addHeaderCode() {
- echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/twitter-rss-social-stats/css/style.css" />' . "\n";
- }
- // Create table in database
- function my_plugin_create_table()
- {
- global $wpdb;
- if($wpdb->get_var("show tables like TRR_Stats") != 'TRR_Stats')
- {
- $sql = "CREATE TABLE TestTable (
- id mediumint(9) NOT NULL,
- Ime varchar(50) NOT NULL,
- prezime varchar(50) NOT NULL,
- datum datetime NOT NULL,
- UNIQUE KEY id (id)
- );";
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
- dbDelta($sql);
- }
- }
- // Delete table when deactivate
- function my_plugin_remove_database() {
- global $wpdb;
- $table_name = "NestoNovo";
- $sql = "DROP TABLE IF EXISTS $table_name;";
- $wpdb->query($sql);
- delete_option("my_plugin_db_version");
- }
- register_activation_hook( __FILE__, 'my_plugin_create_table' );
- register_uninstall_hook( __FILE__, 'my_plugin_remove_database' );
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement