示例#1
0
文件: TagCloud.php 项目: Ogwang/sainp
 /**
  * build the epocLevel Array automatically by calculating an array of colors
  *
  * @param string $latestColor   color of latest epocLevel (usually dark)
  * @param string $earliestColor color of earliest epocLevel (usually light)
  * @param int    $thresholds    number of levels to generate colors for
  *
  * @return array epocLevel
  *
  * @since Method available since Release 0.2.0
  */
 private function _generateEpocLevel($latestColor, $earliestColor, $thresholds)
 {
     include_once 'Image/Color.php';
     $imageColor = new Image_Color();
     $imageColor->setWebSafe(false);
     $imageColor->setColors($latestColor, $earliestColor);
     $epocLevel = array();
     foreach ($imageColor->getRange($thresholds) as $key => $color) {
         $epocLevel[]['epocLevel' . $key] = array('link' => $color, 'visited' => $color);
     }
     return array_reverse($epocLevel);
 }
 /**
  * Get nearest colors between mask color and unmask color using
  * antialias factor.
  *
  * @return  array Colors range.
  * @access  private
  */
 function _getNearestColors()
 {
     $imcolor = new Image_Color();
     $imcolor->setColors($this->options['mask_color'], $this->options['unmask_color']);
     return $imcolor->getRange($this->options['antialias_factor']);
 }
示例#3
0
            return_ofc_day();
            break;
        case 'h24':
            return_ofc_24();
            break;
        case 'cc':
            return_ofc_cc();
            break;
    }
    exit;
}
// generate some colors for the activity bar
$colors = '';
if ($ps->conf['theme']['map']['google_key']) {
    $c = new Image_Color();
    $c->setColors('cc0000', '00cc00');
    $range = $c->getRange(100, 1);
    foreach ($range as $i => $col) {
        $colors .= sprintf("<span id='color-%s'>%s</span>\n", $i, $col);
    }
    $colors .= "<span id='color-100'>00CC00</span>\n";
}
// assign variables to the theme
$cms->theme->assign(array('page' => basename($PHP_SELF, '.php'), 'activity_colors' => $colors));
// display the output
$basename = basename(__FILE__, '.php');
if ($ps->conf['theme']['map']['google_key']) {
    $cms->theme->add_js('http://maps.google.com/maps?file=api&amp;v=2&amp;key=' . $ps->conf['theme']['map']['google_key']);
    //	$cms->theme->add_js('http://www.google.com/jsapi?key=' . $ps->conf['theme']['map']['google_key']);
    $cms->theme->add_js('js/map.js');
}
示例#4
0
function pct_bar($args = array())
{
    global $cms;
    require_once dirname(__FILE__) . "/class_Color.php";
    $args += array('pct' => 0, 'color1' => 'cc0000', 'color2' => '00cc00', 'degrees' => 1, 'width' => null, 'class' => 'pct-bar', 'styles' => '', 'title' => null);
    static $colors = array();
    if (!empty($args['width']) and (!is_numeric($args['width']) or $args['width'] < 1)) {
        $args['width'] = 100;
    }
    $w = $args['width'] ? $args['width'] : 100;
    //	$width = $args['pct'] / 100 * $w; 				// scaled width
    $key = $args['color1'] . ':' . $args['color2'];
    if (!$colors[$key]) {
        $c = new Image_Color();
        $c->setColors($args['color1'], $args['color2']);
        $colors[$key] = $c->getRange(100, $args['degrees']);
        // 100 colors, no matter the width
        /**
        		foreach ($colors[$key] as $col) {
        			printf("<div style='color: white; background-color: %s'>%s</div>", $col, $col);
        		}
        /**/
    }
    $styles = !empty($args['styles']) ? $args['styles'] : '';
    if (!empty($args['width'])) {
        $styles = " width: " . $args['width'] . "px;";
    }
    if (!empty($styles)) {
        $styles = " style='{$styles}'";
    }
    $out = sprintf("<span %s title='%s'%s><span style='width: %s; background-color: #%s'></span></span>", !empty($args['class']) ? "class='" . $args['class'] . "'" : "", !empty($args['title']) ? $args['title'] : (int) $args['pct'] . '%', $styles, (int) $args['pct'] . '%', $colors[$key][intval($args['pct']) - 1]);
    return $out;
}