set-general.php

File Type: php File Location: monofiles/ File name: set-general.php
<?php

// LOAD SETTINGS
function load_settings() {
    
    
    global 
$rot;
    
    
$set_file $rot.'monofiles/filesinfo/settings.xml';
    
    
    
    if (
is_file($set_file)) 
        
$set simplexml_load_file($set_file);
    else
        exit(
'Error loading settings.');
    
    
    
    if (
$set !== false
        
$page_settings = array( "title" => $set->general->title ,
                                
"description" => $set->general->description,
                                
"default_title" => $set->general->defaulttitle,
                                
"results-per-page" => $set->general->indexposts->results,
                                
"lastmodified" => $set->general->indexposts->lastmod,
                                
"dates" => $set->general->dateshow,
                                
"tags" => $set->general->tagshow,
                                
"ownername" => $set->general->ownername,
                                
"ownerid" => $set->general->ownerid,
                                
"makenote" => $set->general->makenote,
                                
"note" => $set->general->note
                                
);
    return 
$page_settings;
}



// LOAD THEME SETTINGS
function load_theme() {
    
    
    global 
$rot;
    
    
    
$set_file $rot.'monofiles/filesinfo/theme.xml';
    
    
    if (
is_file($set_file)) 
        
$set simplexml_load_file($set_file);
    else
        exit(
'Error loading settings.');
    
    
    
    if (
$set !== false
        
$theme_settings = array("titleshow" => $set->theme->titleshow ,
                                
"descriptionshow" => $set->theme->descriptionshow,
                                
"default_title" => $set->theme->defaulttitle,
                                
"default_description" => $set->theme->defaultdescription,
                                
"navigation" => $set->theme->navigation,
                                
"background" => $set->theme->background,
                                
"monoback" => $set->theme->monoback,
                                
"centered" => $set->theme->centered,
                                
"fixedmenu" => $set->theme->fixedmenu,
                                
"layouthead" => $set->theme->layouthead,
                                
"layoutbody" => $set->theme->layoutbody,
                                
"layoutfoot" => $set->theme->layoutfoot,
                                
"darktheme" => $set->theme->darktheme
                                
);
    return 
$theme_settings;
}




// LOAD META DESCRIPTION

function load_meta_description($des) {
        
        if (
strlen($des) > 0) {
            
            
$strip strip_tags($des);
            
$strip htmlspecialchars($strip,ENT_COMPAT);
        
        }
        
        
        if ((isset(
$strip)) && (strlen($strip) > 260)) {
            
            
$offset = (260 3) - strlen($strip);
            
$strip substr($strip0strrpos($strip' '$offset)).'&#8230;';
        
        }
        
        return 
$strip;
}



// LOAD STING FROM XML
    
function load_xml($str) {
        
        if (
strlen($str) > )
            
$str htmlspecialchars($str,ENT_COMPAT);
        
        return 
$str;
}



// LOAD CONTENT FROM HTM

function load_htm($file) {
        
        if (
file_exists($file)) {
            
            
$file_contents file_get_contents($file);
            
$str htmlspecialchars($file_contents,ENT_COMPAT);
            return 
$str;
        
        }
    }
    

    
// LOAD ENCODED HTML

function loadhtml($str) {
    
        if (
strlen($str) > )
            
$str str_replace('&','&amp;',htmlspecialchars_decode($str,ENT_COMPAT));
        
        return 
$str;
}



// REMOVE TAGS FROM HTML STRING

function remove_tags($str) {
        
        if (
strlen($str) > 0)
            
$str strip_tags($str);
        
        return 
$str;
    }
?>