return; } $ids = array(); foreach( $this->option_page_data as $data ) { if( ! isset( $data['id'] ) ) { continue; } if( ! in_array( $data['id'], $ids ) ) { $ids[] = $data['id']; continue; } error_log( 'Warning: In Theme Options Pages following element id is not unique: ' . $data['id'] . ' ( element type: ' . $data['type'] . ' )' ); } } /** * Reset the options */ public function reset_options() { unset( $this->options, $this->subpages, $this->option_page_data, $this->option_pages ); $this->options = null; $this->subpages = array(); $this->option_pages = array(); $this->option_page_data = array(); $this->_create_option_arrays(); } /** * Extracts the default values from the option_page_data array in case no database savings were done yet * The functions calls itself recursive with a subset of elements if groups are encountered within that array * * @param array $elements * @param array $page * @param array $subpages * @return array */ public function extract_default_values( $elements, $page, $subpages ) { $values = array(); foreach( $elements as $element ) { if( in_array( $element['slug'], $subpages[ $page['parent'] ] ) ) { if( $element['type'] == 'group' ) { $values[0][ $element['id'] ] = $this->extract_default_values( $element['subelements'], $page, $subpages ); } else if( isset( $element['id'] ) ) { if( ! isset( $element['std'] ) ) { $element['std'] = ''; } $values[$element['id']] = $element['std']; } } } return $values; } /** * This function is executed when the admin header is printed and will add the avia_framework_globals to javascript * The avia_framework_globals object contains information about the framework */ function set_javascript_framework_url() { echo "\n \n \n "; } /** * Scan option keys for global scope * * @since 4.8 */ protected function get_global_option_keys() { foreach( $this->option_pages as $key => $option_page ) { $this->page_ref[ $option_page['slug'] ] = $option_page['parent']; } foreach( $this->option_page_data as $info ) { if( ! isset( $info['global'] ) || ! isset( $info['id'] ) || true !== $info['global'] ) { continue; } if( ! in_array( $info['id'], $this->global_keys ) ) { $this->global_keys[ $info['id']] = isset( $this->page_ref[ $info['slug'] ] ) ? $this->page_ref[ $info['slug'] ] : $this->option_pages[0]['parent']; } } } /** * Checks if the option key is a global scope option * * @since 4.8 * @param string $key * @return boolean */ public function is_global_option( $key ) { return isset( $this->global_keys[ $key ] ); } /** * Returns the amount of global option keys * * @since 4.8 * @return int */ public function global_options_count() { return count( $this->global_keys ); } /** * Returns the global option keys array * * @since 4.8 * @return array */ public function global_option_keys() { return $this->global_keys; } } /** * Returns the main instance of avia_superobject to prevent the need to use globals * * @since 4.3 * @param array|null $base_data * @return avia_superobject */ function AviaSuperobject( $base_data = null ) { return avia_superobject::instance( $base_data ); } }