Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

get_theme_headers()

Description

Return a list of theme headers, i.e. theme categories based on the higher selected levels provided.

Parameters

ColumnTypeDefaultDescription
$themes array array

Return

array

Location

include/collections_functions.php lines 1131 to 1173

Definition

 
function get_theme_headers($themes=array())
    {
    global 
$theme_category_levels;
    
# Work out which theme category level we are selecting 
    
$selecting="theme";

    
$theme_path "";    
    
$sql="";    
    if(
count($themes) > $theme_category_levels-1)
        {
        return array();
        }

    for (
$x=0;$x<count($themes);$x++){        
        if (
$x>0$theme_path .= "|";        
        
$theme_path .= $themes[$x];        
        if (isset(
$themes[$x])){
            
$selecting="theme".($x+2);
        }    
        if (isset(
$themes[$x]) && $themes[$x]!="" && $x==0) {
            
$sql.=" and theme LIKE '%" escape_check($themes[$x]) . "'";
        }
        else if (isset(
$themes[$x])&& $themes[$x]!=""&& $x!=0) {
            
$sql.=" and theme".($x+1)." LIKE '%" escape_check($themes[$x]) . "'";
        }
    }    
    
$return=array();
    
    
$themes=sql_query("select * from collection where public=1 and $selecting is not null and length($selecting)>0 $sql");
    for (
$n=0;$n<count($themes);$n++)
        {        
        if (
                (!
in_array($themes[$n][$selecting],$return)) &&                    # de-duplicate as there are multiple collections per theme category                
                
(checkperm("j*") || checkperm("j" $themes[$n]["theme"])) &&    # and we have permission to access then add to array                            
                
(!checkperm ("j-${theme_path}|" $themes[$n][$selecting]))        # path must not be in j-<path> exclusion                
            

            {                                            
                
$return[]=$themes[$n][$selecting];
            }
        }
    
usort($return,"themes_comparator");    
    return 
$return;
    }

This article was last updated 22nd October 2020 11:35 Europe/London time based on the source file dated 2nd October 2020 15:40 Europe/London time.