Exemplo n.º 1
0
$plugin = $plugin_slug . "/" . 'yop_poll' . ".php";
$upgrader = new Plugin_Upgrader(new Plugin_Upgrader_Skin(array('title' => 'Yop Poll 2.0 Plugin', 'plugin' => $plugin_slug . '/yop_poll.php')));
$options = get_option('yop_poll_options');
$options['vote_permisions_facebook'] = "no";
$options['vote_permisions_google'] = "no";
$options['vote_permisions_facebook_label'] = __yop_poll('Vote as Facebook User');
$options['vote_permisions_google_label'] = __yop_poll('Vote as G+ User');
$options['facebook_share_description'] = __yop_poll('Just casted an YOP Poll vote on ') . get_bloginfo('name');
$options['show_google_share_button'] = "no";
$options['facebook_share_after_vote'] = "no";
$options['google_integration'] = "no";
$options['facebook_integration'] = "no";
$options['user_interface_type'] = "beginner";
$options['is_default_other_answer'] = "no";
$options['facebook_show_comments_widget'] = "no";
update_option('yop_poll_options', $options);
$upgrader->init();
if (is_plugin_active($plugin)) {
    deactivate_plugins($plugin);
}
$result = @$upgrader->run(array('package' => $download_link, 'destination' => WP_PLUGIN_DIR . "/" . $plugin_slug . "/", 'clear_destination' => false, 'abort_if_destination_exists' => false, 'clear_working' => true, 'is_multi' => true, 'hook_extra' => array()));
if (!is_wp_error($result)) {
    if (!is_plugin_active($plugin)) {
        $pro_options = get_option("yop_poll_pro");
        unset($pro_options['rand_number']);
        update_option("yop_poll_pro", $pro_options);
        activate_plugins($plugin);
    }
}
Yop_Poll_DbSchema::add_defaults_to_database();
wp_die();
Exemplo n.º 2
0
 public function deactivatedelete($networkwide)
 {
     require_once YOP_POLL_INC . 'db_schema.php';
     Yop_Poll_DbSchema::delete_database_tables();
     $capObj = YOP_POLL_Capabilities::get_instance();
     $capObj->uninstall_capabilities();
     $this->uninstall_default_options();
 }
Exemplo n.º 3
0
 function yop_poll_uninstall()
 {
     global $wpdb;
     if (function_exists('is_multisite') && is_multisite()) {
         $old_blog = $wpdb->blogid;
         $blogids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
         foreach ($blogids as $blog_id) {
             switch_to_blog($blog_id);
             delete_option('yop_poll_version');
             delete_option('yop_poll_options');
             delete_option('yop_poll_first_install_date');
             delete_option('yop_poll_admin_notices_donate');
             delete_option('yop_poll_optin_box_modal_options');
             delete_option('yop_poll_pro_options');
             delete_option('yop_poll_pro');
             delete_option('yop_poll_optin_box_modal_options_yop');
             require_once YOP_POLL_INC . 'db_schema.php';
             Yop_Poll_DbSchema::delete_database_tables_2();
             $capObj = YOP_POLL_Capabilities::get_instance();
             $capObj->uninstall_capabilities();
             $poll_archive_page = get_page_by_path('yop-poll-archive', ARRAY_A);
             if ($poll_archive_page) {
                 $poll_archive_page_id = $poll_archive_page['ID'];
                 wp_delete_post($poll_archive_page_id, true);
             }
         }
         switch_to_blog($old_blog);
         return;
     }
     delete_option('yop_poll_version');
     delete_option('yop_poll_options');
     delete_option('yop_poll_first_install_date');
     delete_option('yop_poll_admin_notices_donate');
     delete_option('yop_poll_optin_box_modal_options');
     delete_option('yop_poll_pro_options');
     delete_option('yop_poll_pro');
     delete_option('yop_poll_optin_box_modal_options_yop');
     require_once YOP_POLL_INC . 'db_schema.php';
     Yop_Poll_DbSchema::delete_database_tables_2();
     $capObj = YOP_POLL_Capabilities::get_instance();
     $capObj->uninstall_capabilities();
     $poll_archive_page = get_page_by_path('yop-poll-archive', ARRAY_A);
     if ($poll_archive_page) {
         $poll_archive_page_id = $poll_archive_page['ID'];
         wp_delete_post($poll_archive_page_id, true);
     }
 }
Exemplo n.º 4
0
 function delete_blog($blog_id)
 {
     $old_blog = $GLOBALS['wpdb']->blogid;
     switch_to_blog($blog_id);
     yop_poll_create_table_names($GLOBALS['wpdb']->prefix);
     $this->deactivate(NULL);
     require_once YOP_POLL_INC . 'db_schema.php';
     Yop_Poll_DbSchema::delete_database_tables();
     $capObj = YOP_POLL_Capabilities::get_instance();
     $capObj->uninstall_capabilities();
     $this->uninstall_default_options();
     switch_to_blog($old_blog);
     yop_poll_create_table_names($GLOBALS['wpdb']->prefix);
 }