/** * * @global type $wp_meta_boxes * @param type $post_type */ public function run($post_type) { $this->_cache = aam_Core_API::getBlogOption('aam_metabox_cache', array()); if ($post_type === '') { $this->collectWidgets(); } else { $this->collectMetaboxes($post_type); } aam_Core_API::updateBlogOption('aam_metabox_cache', $this->_cache); }
/** * Write ConfigPres to file * * @param string $content * * @return boolean * * @access public * @static */ public static function write($content) { if (is_writable(AAM_TEMP_DIR)) { $filename = aam_Core_API::getBlogOption('aam_configpress', ''); if (!$filename) { //file already was created $filename = sha1(uniqid('aam')); aam_Core_API::updateBlogOption('aam_configpress', $filename); } $response = file_put_contents(AAM_TEMP_DIR . $filename, stripcslashes($content)); } else { $response = false; } return $response; }
/** * * @param type $config_press * @return boolean */ public function save($config_press = null) { if (is_writable(AAM_TEMP_DIR)) { $filename = $this->getOption(); if (!$filename) { //file already was created $filename = sha1(uniqid('aam')); aam_Core_API::updateBlogOption('aam_' . self::UID, $filename); } $response = file_put_contents(AAM_TEMP_DIR . $filename, stripcslashes($config_press)); } else { $response = false; } return $response; }
/** * Write ConfigPres to file * * @param string $content * * @return boolean * * @access public * @static */ public static function write($content) { if (is_writable(AAM_TEMP_DIR)) { $filename = aam_Core_API::getBlogOption('aam_configpress', ''); //file already was created and name is valid if (preg_match('/^[a-z0-9]{40}$/i', $filename) === 0) { $filename = sha1(uniqid('aam')); aam_Core_API::updateBlogOption('aam_configpress', $filename); } $response = file_put_contents(AAM_TEMP_DIR . $filename, stripcslashes($content)); } else { $response = false; } return $response; }
/** * Set Default Access settings * * @return string * * @access public */ public function setDefaultAccess() { aam_Core_API::updateBlogOption($this->getOptionName(aam_Core_Request::post('id')), aam_Core_Request::post('access')); return json_encode(array('status' => 'success')); }
/** * Change the Update flag * * This will stop to run the update again * * @return boolean * * @access public */ public function updateFlag() { return aam_Core_API::updateBlogOption('aam_updated', AAM_VERSION, 1); }
/** * * @param type $value * @param type $object * @param type $object_id * @return type */ public function updateOption($value, $object, $object_id = 0) { return aam_Core_API::updateBlogOption($this->getOptionName($object, $object_id), $value); }
protected function pinSite() { return json_encode(array('status' => aam_Core_API::updateBlogOption('aam_default_site', aam_Core_Request::post('blog'), 1) ? 'success' : 'failure')); }
/** * * @param type $errors * @param type $redirect_to */ public function loginFailure($errors, $redirect_to) { $this->_cache = aam_Core_API::getBlogOption('aam_security_login_cache', array()); $this->_cacheLimit = aam_Core_ConfigPress::getParam('security.login.cache_limit', 1000); if ($this->isGeoLookupOn()) { $this->_stats = aam_Core_API::getBlogOption('aam_security_login_stats', array()); $info = $this->retrieveGeoData(); if ($info instanceof stdClass) { if (!isset($this->_stats[$info->countryCode])) { $this->_stats[$info->countryCode] = array('failed' => 0); } $this->_stats[$info->countryCode]['failed']++; aam_Core_API::updateBlogOption('aam_security_login_stats', $this->_stats); } } if ($this->isLoginLockoutOn()) { $this->loginLockout(); } aam_Core_API::updateBlogOption('aam_security_login_cache', $this->_cache); return $errors; }
/** * Remove Extension from the repository * * @param string $extension * @param string $license * * @return boolean * * @access public */ public function remove($extension, $license) { global $wp_filesystem; $this->initFilesystem(); $repository = aam_Core_API::getBlogOption('aam_extensions', array(), 1); $response = false; if (isset($repository[$extension])) { $basedir = $repository[$extension]->basedir; if ($wp_filesystem->rmdir($basedir, true)) { $response = true; unset($repository[$extension]); aam_Core_API::updateBlogOption('aam_extensions', $repository, 1); } } return $response; }
/** * Save Post or Term access * * @return string * * @access public */ public function saveAccess() { $object_id = aam_Core_Request::post('id'); $limit_counter = apply_filters('wpaccess_restrict_limit', aam_Core_API::getBlogOption('aam_access_limit', 0)); if ($limit_counter == -1 || $limit_counter <= 10) { $access = aam_Core_Request::post('access'); if (aam_Core_Request::post('type') == 'term') { $object = $this->getSubject()->getObject(aam_Control_Object_Term::UID, $object_id); if ($limit_counter !== -1 && isset($access['post'])) { unset($access['post']); } } else { $object = $this->getSubject()->getObject(aam_Control_Object_Post::UID, $object_id); } $object->save($access); aam_Core_API::updateBlogOption('aam_access_limit', $limit_counter + 1); //clear cache $this->getSubject()->clearCache(); $response = array('status' => 'success'); } else { $response = array('status' => 'failure', 'reason' => 'limitation', 'extension' => 'AAM Unlimited Basic'); } return json_encode($response); }
/** * Remove Extension from the repository * * @param string $extension * * @return boolean * * @access public */ public function remove($extension) { global $wp_filesystem; $repository = aam_Core_API::getBlogOption('aam_extensions', array(), 1); //if extension has been downloaded as part of dev license, it'll be //not present in the repository list if (isset($repository[$extension])) { unset($repository[$extension]); aam_Core_API::updateBlogOption('aam_extensions', $repository, 1); } if ($this->hasExtension($extension)) { $this->initFilesystem(); $wp_filesystem->rmdir($this->_basedir . '/' . $this->prepareExtFName($extension), true); } return true; }
/** * Insert or Update Visitor's Cache * * @return boolean * * @access public */ public function updateCache() { return aam_Core_API::updateBlogOption('aam_visitor_cache', $this->getObjects()); }
protected function complete() { aam_Core_API::updateBlogOption('aam_migrated', 1, 1); return array('status' => 'success', 'stop' => 1); }
/** * @inheritdoc */ public function setFlag($flag, $value = true) { $option = 'aam_' . self::UID . '_' . $this->getId() . "_{$flag}"; if ($value === true) { aam_Core_API::updateBlogOption($option, $value); } else { aam_Core_API::deleteBlogOption($option); } }