foreach($this->getOption() as $key => $value) { if (strpos($key, "{$segment}/") === 0) { $response[str_replace("{$segment}/", '', $key)] = $value; } } return $response; } /** * Merge visibility settings * * @param array $options * * @return array * * @since 6.1.0 Fixed bug with incorrectly merged settings for users with multiple * roles * @since 6.0.0 Initial implementation of the method * * @access public * @version 6.1.0 */ public function mergeOption($options) { $these_options = $this->getOption(); $keys = array_unique(array_merge( array_keys($options), array_keys($this->getOption()) )); $merged = array(); // Iterate over each unique key end merge settings accordingly foreach($keys as $key) { $merged[$key] = AAM::api()->mergeSettings( (isset($options[$key]) ? $options[$key] : array()), (isset($these_options[$key]) ? $these_options[$key] : array()), AAM_Core_Object_Post::OBJECT_TYPE ); } return $merged; } }