/** * Adds the skins from the directory provided, so * users can select them in the slider settings. * * @since 5.3.0 * @access public * @param string $path Path to directory that holds your skins. It's assumed to be a direct skin folder if it contains a skin.css file. * @return void */ public static function addSkins($path) { $skinsPath = $skins = array(); $path = rtrim($path, '/\\'); // It's a direct skin folder if (file_exists($path . '/skin.css')) { $skinsPath = array($path); } else { // Get all children if it's a parent directory $skinsPath = glob($path . '/*', GLOB_ONLYDIR); } // Iterate over the skins foreach ($skinsPath as $key => $path) { // Exclude non-valid skins if (!file_exists($path . '/skin.css')) { continue; } // Gather skin data $handle = strtolower(basename($path)); $skins[$handle] = array('name' => $handle, 'handle' => $handle, 'dir' => $path, 'file' => $path . DIRECTORY_SEPARATOR . 'skin.css'); // Get skin info (if any) if (file_exists($path . '/info.json')) { $skins[$handle]['info'] = json_decode(file_get_contents($path . '/info.json'), true); $skins[$handle]['name'] = $skins[$handle]['info']['name']; } } self::$skins = array_merge(self::$skins, $skins); ksort(self::$skins); }