src/HyyanAdminColorSchema.php
/**
     * Collect schema from wordpress active theme
     * 
     * @return boolean true on success false if color schema folder is not exists
     *                 in the active theme folder
     */
Collect schema from wordpress active theme

@return boolean true on success false if color schema folder is not exists
in the active theme folder
Collect schema from wordpress active theme @return boolean true on success false if color schema folder is not exists in the active theme folder
public function collectSchema() {
        $options = $this->getOptions();
        $path = get_template_directory() . $options['path'];
        if (!file_exists($path) || !is_dir($path)) {
            return; 
        }
        $contents = new \DirectoryIterator($path);
        foreach ($contents as $content) {
            if ($contents->isDot())
                continue;
            if ($contents->isDir()) {
                $name = $content->getFilename();
                $init = parse_ini_file($content->getPathname() . '/schema.ini');
                if (!is_array($init))
                    trigger_error('Unbale Admin Color Schema Config File', E_USER_ERROR);
                $suffix = is_rtl() ? '-rtl' : '';
                $url = get_template_directory_uri()
                        . $options['path']
                        . '/'
                        . $name
                        . "/colors{$suffix}.css";
                wp_admin_css_color(
                        $name
                        , __(
                                (isset($init['name']) && !empty($init['name'])) ?
                                        $init['name'] : $name
                                , isset($init['domain']) && !empty($init['domain']) ?
                                        $init['domain'] : 'default'
                        )
                        , $url
                        , isset($init['colors']) && is_array($init['colors']) ?
                                $init['colors'] : array()
                        , isset($init['icons']) && is_array($init['icons']) ?
                                $init['icons'] : array()
                );
            }
        }
    }
public function collectSchema ( ) { $ options = $ this -> getOptions ( ) ; $ path = get_template_directory ( ) . $ options [ 'path' ] ; if ( ! file_exists ( $ path ) || ! is_dir ( $ path ) ) { return ; } $ contents = new \ DirectoryIterator ( $ path ) ; foreach ( $ contents as $ content ) { if ( $ contents -> isDot ( ) ) continue ; if ( $ contents -> isDir ( ) ) { $ name = $ content -> getFilename ( ) ; $ init = parse_ini_file ( $ content -> getPathname ( ) . '/schema.ini' ) ; if ( ! is_array ( $ init ) ) trigger_error ( 'Unbale Admin Color Schema Config File' , E_USER_ERROR ) ; $ suffix = is_rtl ( ) ? '-rtl' : '' ; $ url = get_template_directory_uri ( ) . $ options [ 'path' ] . '/' . $ name . " /colors { $ suffix } .css " ; wp_admin_css_color ( $ name , __ ( ( isset ( $ init [ 'name' ] ) && ! empty ( $ init [ 'name' ] ) ) ? $ init [ 'name' ] : $ name , isset ( $ init [ 'domain' ] ) && ! empty ( $ init [ 'domain' ] ) ? $ init [ 'domain' ] : 'default' ) , $ url , isset ( $ init [ 'colors' ] ) && is_array ( $ init [ 'colors' ] ) ? $ init [ 'colors' ] : array ( ) , isset ( $ init [ 'icons' ] ) && is_array ( $ init [ 'icons' ] ) ? $ init [ 'icons' ] : array ( ) ) ; } } }
Collect schema from wordpress active theme
Collect schema from wordpress active theme
// make sure that the color schema folder exsists // just ignore  // register the new color schema