* @author Christos Amyrotos @MashRoofa */ class Pressbooks_Metadata_General_Functions { function __construct() { } /** * A function that returns the active parent from the parent filter * @since 0.13 */ public static function get_active_parent(){ if(get_option('parent_filter_settings') == false){ $enabledParent = 'organization_properties'; }else{ $enabledParent = get_option('parent_filter_settings'); $enabledParent = $enabledParent['radio1']; } $parentNamespaces = structure::$allParents; foreach($parentNamespaces as $parent){ if($parent::type_name[1] == $enabledParent){ return $parent; } } } /** * Function used to remove null values from an array * @since 0.10 */ public static function remove_null($array) { $cleanArray = array(); foreach($array as $item){ if($item != NULL){ $cleanArray[]=$item; } } return $cleanArray; } /** * Function used to extract the name of the type from its settings * @since 0.10 */ static public function get_type_id($type) { foreach($type::$type_setting as $typeId => $details) { return $typeId; } } /** * A function that returns the correct metadata for the schemaTypes classes * If pressbooks is installed we return the metadata for the Book Info information * If pressbooks is not installed we return the Site Meta metadata * @since 0.9 */ public static function get_metadata(){ if(!site_cpt::pressbooks_identify()){ return site_cpt::get_site_meta_metadata(); }else{ return \Pressbooks\Book::getBookInformation(); } } /** * A function to retrieve the metatags we need for the Root level * of the website. In Pressbooks this is the catalog of the books. * * @since 0.8 */ public function get_root_level_metatags(){ $html = "\n" ."