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); }
private function recheck_license() { $entity = new WPFront_User_Role_Editor_Entity_Options(); $entity->update_option($this->license_key_k . '-last-checked', 0); $this->plugin_updater->recheck(); }
private function update_option($key, $value, $clone = FALSE) { $prefix = ''; if ($this->multisite) { $prefix = 'ms_'; switch_to_blog($this->ms_options_blog_id()); } $entity = new WPFront_User_Role_Editor_Entity_Options(); $entity->update_option($prefix . $key, $value); if ($clone) { $entity->update_option($key, $value); } if ($this->multisite) { restore_current_blog(); } }
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'); }
private function activate_license($license) { if ($this->license_key_k === NULL) { return; } $this->license_key = $license; $result = $this->remote_get('activate_license', $license); if ($result === NULL) { return; } $entity = new WPFront_User_Role_Editor_Entity_Options(); $entity->delete_option($this->license_key_k); $entity->delete_option($this->license_key_k . '-expires'); $entity->delete_option($this->license_key_k . '-last-checked'); if ($result->license === 'valid' || $result->error === 'expired') { $entity->update_option($this->license_key_k, $license); $entity->update_option($this->license_key_k . '-status', $result->license === 'valid' ? 'valid' : 'expired'); $entity->update_option($this->license_key_k . '-expires', $result->expires); $entity->update_option($this->license_key_k . '-last-checked', time()); $this->set_license(); } elseif ($result->error === 'no_activations_left') { $this->error = $this->__('ERROR') . ': ' . $this->__('License key activation limit reached'); } else { $this->error = $this->__('ERROR') . ': ' . $this->__('Invalid license key'); } }
private function set_disable_for_secondary_role($role, $value) { $entity = new WPFront_User_Role_Editor_Entity_Options(); $entity->update_option(self::$disable_for_secondary_role_option_name . $role->name, $value); }