示例#1
0
 /**
  * Run the migration process
  *
  * @return string
  *
  * @access public
  */
 public function run()
 {
     @set_time_limit(300);
     ob_start();
     //prevent from any kind of notice, warning printout
     switch (aam_Core_Request::post('step')) {
         case 'collect':
             $response = $this->collect();
             break;
         case 'migrate':
             $response = $this->migrate();
             break;
         case 'cleanup':
             $response = $this->cleanup();
             break;
         case 'complete':
             $response = $this->complete();
             break;
         default:
             $response = array('status' => 'failure');
             break;
     }
     ob_end_clean();
     return json_encode($response);
 }
示例#2
0
文件: role.php 项目: dot2006/jobify
 /**
  *
  * @param type $delete_users
  * @return boolean
  */
 public function delete($delete_users = false)
 {
     $role = new WP_Roles();
     if ($this->getId() !== 'administrator') {
         if ($delete_users) {
             if (current_user_can('delete_users')) {
                 //delete users first
                 $users = new WP_User_Query(array('number' => '', 'blog_id' => get_current_blog_id(), 'role' => aam_Core_Request::post('role')));
                 foreach ($users->get_results() as $user) {
                     //user can not delete himself
                     if ($user->data->ID !== get_current_user_id()) {
                         wp_delete_user($user->data->ID);
                     }
                 }
                 $role->remove_role($this->getId());
                 $status = true;
             } else {
                 $status = false;
             }
         } else {
             $role->remove_role($this->getId());
             $status = true;
         }
     } else {
         $status = false;
     }
     return $status;
 }
示例#3
0
文件: role.php 项目: dot2006/jobify
 /**
  *
  * @return type
  */
 public function delete()
 {
     if ($this->getSubject()->delete(aam_Core_Request::post('delete_users'))) {
         $status = 'success';
     } else {
         $status = 'failure';
     }
     return json_encode(array('status' => $status));
 }
 /**
  * Remove extension
  *
  * @return string
  *
  * @access public
  */
 public function remove()
 {
     $license = aam_Core_Request::post('license');
     $ext = aam_Core_Request::post('extension');
     if ($this->getRepository()->remove($ext, $license)) {
         $response = array('status' => 'success');
     } else {
         $response = array('status' => 'failure', 'reasons' => $this->getRepository()->getErrors());
     }
     return json_encode($response);
 }
示例#5
0
 /**
  * Remove extension
  *
  * @return string
  *
  * @access public
  */
 public function remove()
 {
     $extension = new aam_Core_Extension();
     $license = aam_Core_Request::post('license');
     $ext = aam_Core_Request::post('extension');
     if ($extension && $extension->remove($ext, $license)) {
         $response = array('status' => 'success');
     } else {
         $response = array('status' => 'failure');
     }
     return json_encode($response);
 }
示例#6
0
 /**
  * 
  * @return type
  */
 public function processAjax()
 {
     switch (aam_Core_Request::post('sub_action')) {
         case 'map_data':
             $response = $this->getMapData();
             break;
         default:
             $response = json_encode(array('status' => 'failure'));
             break;
     }
     return $response;
 }
示例#7
0
 /**
  * Clear Default Access settings
  * 
  * @return string
  * 
  * @access public
  */
 public function clearDefaultAccess()
 {
     aam_Core_API::deleteBlogOption($this->getOptionName(aam_Core_Request::post('id')));
     return json_encode(array('status' => 'success'));
 }
示例#8
0
 /**
  * Save ConfigPress
  * 
  * @return string
  * 
  * @access protected
  */
 protected function saveConfigPress()
 {
     $result = aam_Core_ConfigPress::write(aam_Core_Request::post('config'));
     return json_encode(array('status' => $result === false ? 'failure' : 'success'));
 }
 protected function pinSite()
 {
     return json_encode(array('status' => aam_Core_API::updateBlogOption('aam_default_site', aam_Core_Request::post('blog'), 1) ? 'success' : 'failure'));
 }
示例#10
0
 /**
  * Save ConfigPress
  *
  * @return string
  *
  * @access public
  */
 public function saveConfigPress()
 {
     if (current_user_can(aam_Core_ConfigPress::getParam('aam.menu.configpress.capability', 'administrator'))) {
         $result = aam_Core_ConfigPress::write(aam_Core_Request::post('config'));
     } else {
         $result = false;
     }
     return json_encode(array('status' => $result === false ? 'failure' : 'success'));
 }
示例#11
0
 /**
  * Restore default access level for object
  *
  * @return string
  *
  * @access public
  */
 public function clearAccess()
 {
     $type = aam_Core_Request::post('type');
     $object_id = aam_Core_Request::post('id');
     if ($type === aam_Control_Object_Term::UID) {
         $object = $this->getSubject()->getObject(aam_Control_Object_Term::UID, $object_id);
     } else {
         $object = $this->getSubject()->getObject(aam_Control_Object_Post::UID, $object_id);
     }
     return json_encode(array('status' => $object->delete() ? 'success' : 'failure'));
 }
示例#12
0
 /**
  *
  * @return type
  */
 public function deleteCapability()
 {
     $roles = new WP_Roles();
     $capability = trim(aam_Core_Request::post('capability'));
     if ($capability) {
         foreach ($roles->role_objects as $role) {
             $role->remove_cap($capability);
         }
         $response = array('status' => 'success');
     } else {
         $response = array('status' => 'failure');
     }
     return json_encode($response);
 }
示例#13
0
 /**
  *
  * @return type
  */
 public function save()
 {
     $this->getSubject()->save($this->prepareSaveOptions(aam_Core_Request::post('aam')));
     return json_encode(array('status' => 'success'));
 }
示例#14
0
 /**
  *
  * @global type $wp_post_types
  * @return type
  */
 public function retrieveList()
 {
     global $wp_post_types;
     if (aam_Core_Request::post('refresh') == 1) {
         aam_Core_API::deleteBlogOption('aam_metabox_cache');
         $type_list = array_keys($wp_post_types);
         array_unshift($type_list, self::GROUP_WIDGETS);
         foreach ($type_list as $type) {
             if ($type == 'widgets') {
                 $url = add_query_arg('aam_meta_init', 1, admin_url('index.php'));
             } else {
                 $url = add_query_arg('aam_meta_init', 1, admin_url('post-new.php?post_type=' . $type));
             }
             //grab metaboxes
             aam_Core_API::cURL($url);
         }
     }
     return $this->buildMetaboxList();
 }