File: color_palettes/index.php

Recommend this page to a friend!
  Classes of Joseph  >  JS Master Color Picker script  >  color_palettes/index.php  >  Download  
File: color_palettes/index.php
Role: Auxiliary data
Content type: text/plain
Description: internally used by server version
Class: JS Master Color Picker script
Pick colors from a palette
Author: By
Last change: file name was incorrect. (other file missing)
Date: 9 years ago
Size: 1,359 bytes


Class file image Download
<?php  /*

	dynamically creates a list of all the palettes in the folder

	You may modify how this processes the output.
	You may replace it with a script in another language
	You may replace it with a static text file (you will need to then keep it updated by hand)

	This script finds all the files in the given folder and it’s subfolders
	with filenames containing “.json_palette.”
	as the second-to-last filename extention.  Examples returned include:


	Example of files ignored:

if (!defined('DIR_SEP'))  {
	if (TRUE     //here we force the dir-sep because browser XMLHttpRequests require it that way………
	or  stripos(php_uname('s'), 'Win')===FALSE)    // Mac OS/LINUX/UNIX directory separator
		define('DIR_SEP', "/");
	else    // MS Windows directory separator
		define('DIR_SEP', "\\");  }

Function findAllPalettes($dir='../color_palettes', $match='/\.json_palette\.[^.]+$/i')  {
while ($F=readdir($D))  {
	if ($F==='.'  or  $F==='..')  continue;
	if (is_dir($F))  {findAllPalettes($dir.DIR_SEP.$F, $match);  continue;}
	if (preg_match($match, $F))  echo substr($dir, 3),DIR_SEP,$F, "\n";  }  }