public function recheck()
 {
     $time_key = $this->slug . '-plugin_updater_api_request_last_checked';
     $entity = new WPFront_User_Role_Editor_Entity_Options();
     $entity->update_option($time_key, 0);
     set_site_transient('update_plugins', null);
 }
 public function admin_init()
 {
     $option_key = 'attachment_capabilities_processed';
     $entity = new WPFront_User_Role_Editor_Entity_Options();
     $processed = $entity->get_option($option_key);
     if (!empty($processed)) {
         return;
     }
     global $wp_roles;
     foreach ($wp_roles->role_objects as $key => $role) {
         if ($role->has_cap('upload_files')) {
             foreach (self::$attachment_capabilities as $cap) {
                 $role->add_cap($cap);
             }
         }
     }
     $entity->update_option($option_key, TRUE);
 }
Ejemplo n.º 3
0
        foreach ($blogids as $blogid) {
            switch_to_blog($blogid);
            WPFront_User_Role_Editor_Entity_Options::uninstall();
            WPFront_User_Role_Editor_Entity_Menu_Editor::uninstall();
            WPFront_User_Role_Editor_Entity_Post_Type_Permissions::uninstall();
            WPFront_User_Role_Editor_Entity_Content_Shortcodes::uninstall();
            WPFront_User_Role_Editor_Entity_Login_Redirect::uninstall();
            WPFront_User_Role_Editor_Nav_Menu::uninstall();
        }
    }
    restore_current_blog();
} else {
    $entity = new WPFront_User_Role_Editor_Options(NULL);
    if ($entity->remove_data_on_uninstall()) {
        if (class_exists('WPFront_User_Role_Editor_Entity_Options')) {
            WPFront_User_Role_Editor_Entity_Options::uninstall();
        }
        if (class_exists('WPFront_User_Role_Editor_Entity_Menu_Editor')) {
            WPFront_User_Role_Editor_Entity_Menu_Editor::uninstall();
        }
        if (class_exists('WPFront_User_Role_Editor_Entity_Post_Type_Permissions')) {
            WPFront_User_Role_Editor_Entity_Post_Type_Permissions::uninstall();
        }
        if (class_exists('WPFront_User_Role_Editor_Entity_Content_Shortcodes')) {
            WPFront_User_Role_Editor_Entity_Content_Shortcodes::uninstall();
        }
        if (class_exists('WPFront_User_Role_Editor_Entity_Login_Redirect')) {
            WPFront_User_Role_Editor_Entity_Login_Redirect::uninstall();
        }
        if (class_exists('WPFront_User_Role_Editor_Nav_Menu')) {
            WPFront_User_Role_Editor_Nav_Menu::uninstall();
 public function edd_plugin_update()
 {
     $entity = new WPFront_User_Role_Editor_Entity_Options();
     $this->plugin_updater = new WPFront_User_Role_Editor_Plugin_Updater(self::$store_url, WPFRONT_USER_ROLE_EDITOR_PLUGIN_FILE, array('version' => WPFront_User_Role_Editor::VERSION, 'license' => $entity->get_option($this->license_key_k), 'item_name' => $this->product, 'author' => 'Syam Mohan'), $this->slug);
 }
 private function get_option($key, $ms = FALSE)
 {
     $prefix = '';
     if ($ms) {
         $prefix = 'ms_';
         switch_to_blog($this->ms_options_blog_id());
     }
     $entity = new WPFront_User_Role_Editor_Entity_Options();
     $value = $entity->get_option($prefix . $key);
     if ($value === NULL) {
         if ($ms === FALSE && is_multisite()) {
             return $this->get_option($key, TRUE);
         }
     }
     if ($ms) {
         restore_current_blog();
     }
     return $value;
 }
 private function add_role_permissions($post_type)
 {
     $settings_key = "add_role_permissions_{$post_type}_processed";
     $caps = $this->get_post_type_capabilities($post_type);
     $cap_key = $caps->edit_posts . '_role_permissions';
     new WPFront_User_Role_Editor_Custom_Post_Permissions($post_type, $this->main, $cap_key, $caps);
     if (!is_admin()) {
         return;
     }
     $this->main->add_role_capability($cap_key);
     $entity = new WPFront_User_Role_Editor_Entity_Options();
     if ($entity->get_option($settings_key) === '1') {
         return;
     }
     $role = get_role(self::ADMINISTRATOR_ROLE_KEY);
     if ($role->has_cap($cap_key)) {
         $entity->update_option($settings_key, '1');
         return;
     }
     $role->add_cap($cap_key);
     global $wp_roles;
     foreach ($wp_roles->role_objects as $role) {
         if ($role->has_cap($caps->edit_posts)) {
             $role->add_cap($cap_key);
         }
     }
     $entity->update_option($settings_key, '1');
 }
 public static function uninstall()
 {
     self::$UNINSTALL = TRUE;
     $entity = new WPFront_User_Role_Editor_Entity_Options();
     $entity->uninstall_action();
 }
 private function delete_disable_for_secondary_role($role)
 {
     $entity = new WPFront_User_Role_Editor_Entity_Options();
     $entity->delete_option(self::$disable_for_secondary_role_option_name . $role->name);
 }