This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ if ( ! isset($GLOBALS['ALKIVIA']) ) { // Create the global ALKIVIA. This holds all objects and settings. $GLOBALS['ALKIVIA'] = array(); } /** * Gets an object stored in the ALKIVIA global. * * @param string $name Object name. * @return object|false Returns the requested object reference. If not found, or not an object, returns false. */ function & ak_get_object ( $name ) { if ( is_object($GLOBALS['ALKIVIA'][$name]) ) { return $GLOBALS['ALKIVIA'][$name]; } else { return false; } } /** * Stores an object in the ALKIVIA global. * Can be called at the same time we create the object: ak_store_object( 'obj_name', new objectName() ); * * @param string $name Internal object name. * @param object $object The object reference to store in the global. * @return object The newly stored object reference. */ function & ak_store_object ( $name, & $object ) { $GLOBALS['ALKIVIA'][$name] =& $object; return $object; } /** * Stores the current theme in the ALKIVIA global. * Can be called at the same time we create the object: ak_store_theme(new themeName() ); * * @param object $theme The theme reference to store in the global. * @return object The newly stored theme reference. */ function & ak_store_theme ( & $theme ) { return ak_store_object('theme', $theme); } /** * Checks if an object exists in the ALKIVIA global. * * @param string $name Object name to check. * @return boolean If the object exists or not. */ function ak_object_exists ( $name ) { global $ALKIVIA; if ( isset($ALKIVIA[$name]) && is_object($ALKIVIA[$name]) ) { return true; } else { return false; } } /** * Returns the 'settings' object reference. * * @return object|false Returns the object reference, or false if not found. */ function & ak_settings_object () { return ak_get_object('settings'); } /** * Returns an object option/setting. * * @param string $object Object name to get options from. * @param string $option Option name to return. * @param mixed $default Default value if option not found. * @return mixed The option value. */ function ak_get_option ( $object, $option = '', $default = false ) { if ( is_object($GLOBALS['ALKIVIA'][$object]) && method_exists($GLOBALS['ALKIVIA'][$object], 'getOption') ) { return $GLOBALS['ALKIVIA'][$object]->getOption($option, $default); } else { return $default; } } /** * Returns a theme option/setting. * * @param string $option Option name to return. * @param mixed $default Default value if option not found. * @return mixed The option value. */ function ak_theme_option ( $option = '', $default = false ) { return ak_get_option ( 'theme', $option, $default ); } /** * Returns parent theme data from style.css file. * * @param string $name Data name to return. * @return mixed Data value. */ function ak_theme_data ( $name = '' ) { if ( is_object($GLOBALS['ALKIVIA']['theme']) && method_exists($GLOBALS['ALKIVIA']['theme'], 'getThemeData') ) { return $GLOBALS['ALKIVIA']['theme']->getThemeData($name); } else { return false; } } /** * Returns child theme data from style.css file. * * @param string $name Data name to return. * @return mixed Data value. */ function ak_child_theme_data ( $name = '' ) { if ( is_object($GLOBALS['ALKIVIA']['theme']) && method_exists($GLOBALS['ALKIVIA']['theme'], 'getChildData') ) { return $GLOBALS['ALKIVIA']['theme']->getChildData($name); } else { return false; } }