Esempio n. 1
1
 function cmdRepo()
 {
     $file = new File('/home/billy/1.tar.bz2', true);
     $target = new Dir('/home/billy/temp/1.unpack/includes', true);
     //Packer::unpack($file, $target);
     Packer::pack($target, new File(dirname(__FILE__) . '/2.tbz', true));
     return;
     $pm = new PM();
     $pm->startup();
     $rb = PM::getRollback();
     $rb->push('delete', dirname(__FILE__) . '/_files/source', dirname(__FILE__) . '/_files/target/includes/Controller.php');
     //$rb->push('delete', './_files/source', '_files/target/includes/Controller.php' );
     //$r = $rb->pop();
     $r = $rb->stepBack();
     print_r($r);
     return;
     $ps = PM::getPackageSequence();
     print_r($ps->get());
     print_r($ps->getAfter('news', '2.3'));
     //print_pre($ps->addPackage('news', '2.8'));
     print_pre($ps->removePackage('news', '2.8'));
     return;
     Autoload::addDir(Dir::get($this->root, true)->getDir('repo'));
     $rl = new RepositoryList($this->dataDir->getFile('source.list'));
     $r = $rl->search(explode(' ', 'qt package'));
     print_pre($r);
     $pm->shutdown();
 }
Esempio n. 2
0
 public function send(Packer $packerCollection)
 {
     $packs = $packerCollection->getPackages();
     foreach ($packs as $pack) {
         echo "Successfully sent to " . $pack->getTo()->getName() . ' - ' . $pack->getTo()->getAddress() . " from " . $pack->getFrom()->getName() . " - " . $pack->getFrom()->getAddress() . "\n";
     }
 }
Esempio n. 3
0
 public function main()
 {
     App::import('vendor', 'inc/packer');
     $js_pack = Configure::read("Asset.filter.js");
     $time = date('YmdHis', time());
     $p = new Packer();
     $js_out = $css_out = '';
     //delete old file
     $old = nforum_cache_read('asset_pack');
     if (is_array($old)) {
         @unlink(APP . 'www/js/' . $old['js']);
         @unlink(APP . 'www/css/' . $old['css']);
     }
     /* handle js*/
     $js = array('jquery-1.7.2.min.js', 'jquery-ui-1.8.20.min.js', 'jquery-ui-timepicker-addon.js', 'underscore-min.js', 'backbone-min.js', 'plupload.min.js', 'jquery.tools.min.js', 'jquery.placeholder.min.js', 'jquery.cookie.js', 'jquery.simpletree.js', 'jquery.jplayer.min.js', 'jquery.xslider.min.js', 'forum.config.js', 'forum.lib.js', 'forum.xwidget.js', 'forum.xubb.js', 'forum.keyboard.js');
     foreach ($js as $v) {
         $js_out .= $js_pack && !strstr($v, 'min.js') ? $p->pack(APP . 'www/js/' . $v, 'js', false) : file_get_contents(APP . 'www/js/' . $v);
     }
     $js_file = 'pack_' . $this->_hash($js_out) . '.js';
     file_put_contents(APP . 'www/js/' . $js_file, $js_out);
     /* handle js end */
     /* handle css */
     $css = array('common.css', 'jquery-ui-1.8.20.css', 'jplayer.blue.monday.css', 'ansi.css', 'ubb.css', 'keyboard.css');
     foreach ($css as $v) {
         $css_out .= $p->pack(APP . 'www/css/' . $v, 'css', false);
     }
     $css_file = 'pack_' . $this->_hash($css_out) . '.css';
     file_put_contents(APP . 'www/css/' . $css_file, $css_out);
     /* handle css end */
     $asset = array('js' => $js_file, 'css' => $css_file);
     nforum_cache_write('asset_pack', $asset);
 }
 /**
  * Run the scrapers.
  */
 public function scrape()
 {
     // TODO: This should be read from the ``shelter_pages'' table
     $mhsDog = new MhsDogScraper("http://montanapets.org/mhs/residentdog.html");
     $mhsCat = new MhsCatScraper("http://montanapets.org/mhs/residentcat.html");
     $packer = new Packer();
     $packer->pack($mhsDog->scrape());
     $packer->pack($mhsCat->scrape());
     $loader = new Loader($packer->getPackedPets());
     $loader->checkActive();
     $loader->load();
     // temporary fix for the slashes in some breeds
     // @todo: this should be done in the scraper
     $db = new Database(Site::getInstance()->getDbConf());
     $db->execute("update animals set breed = replace(breed, '/', '-')");
 }
Esempio n. 5
0
 private function getDecoder()
 {
     // returns a pattern used for fast decoding of the packed script
     $trim = new RegGrp(array('(\\d)(\\|\\d)+\\|(\\d)' => '$1-$3', '([a-z])(\\|[a-z])+\\|([a-z])' => '$1-$3', '([A-Z])(\\|[A-Z])+\\|([A-Z])' => '$1-$3', '\\|' => ''));
     $pattern = $trim->exec(implode('|', array_slice($this->words->map(array(&$this, '_word_replacement')), 0, 62)));
     if ($pattern == '') {
         return '^$';
     }
     $pattern = '[' . $pattern . ']';
     $size = $this->words->size();
     if ($size > 62) {
         $pattern = '(' . $pattern . '|';
         $encoded = Packer::encode62($size);
         $c = $encoded[0];
         if ($c > '9') {
             $pattern .= '[\\\\d';
             if ($c >= 'a') {
                 $pattern .= 'a';
                 if ($c >= 'z') {
                     $pattern .= '-z';
                     if ($c >= 'A') {
                         $pattern .= 'A';
                         if ($c > 'A') {
                             $pattern .= '-' . $c;
                         }
                     }
                 } else {
                     if ($c == 'b') {
                         $pattern .= '-' . $c;
                     }
                 }
             }
             $pattern .= ']';
         } else {
             if ($c == 9) {
                 $pattern .= '\\\\d';
             } else {
                 if ($c == 2) {
                     $pattern .= '[12]';
                 } else {
                     if ($c == 1) {
                         $pattern .= '1';
                     } else {
                         $pattern .= '[1-' . $c . ']';
                     }
                 }
             }
         }
         $pattern .= "\\\\w)";
     }
     return $pattern;
 }
Esempio n. 6
0
 public function testIssue20()
 {
     $packer = new Packer();
     $packer->addBox(new TestBox('Le grande box', 100, 100, 300, 1, 100, 100, 300, 1500));
     $packer->addItem(new TestItem('Item 1', 150, 50, 50, 20, false));
     $packedBoxes = $packer->pack();
     self::assertEquals(1, $packedBoxes->count());
 }
Esempio n. 7
0
 private function _bootStrap($packed, $keywords)
 {
     $ENCODE = $this->_safeRegExp('$encode\\($count\\)');
     // $packed: the packed script
     $packed = "'" . $this->_escape($packed) . "'";
     // $ascii: base for encoding
     $ascii = min(count($keywords['sorted']), $this->_encoding);
     if ($ascii == 0) {
         $ascii = 1;
     }
     // $count: number of words contained in the script
     $count = count($keywords['sorted']);
     // $keywords: list of words contained in the script
     foreach ($keywords['protected'] as $i => $value) {
         $keywords['sorted'][$i] = '';
     }
     // convert from a string to an array
     ksort($keywords['sorted']);
     $keywords = "'" . implode('|', $keywords['sorted']) . "'.split('|')";
     $encode = $this->_encoding > 62 ? '_encode95' : $this->_getEncoder($ascii);
     $encode = $this->_getJSFunction($encode);
     $encode = preg_replace('/_encoding/', '$ascii', $encode);
     $encode = preg_replace('/arguments\\.callee/', '$encode', $encode);
     $inline = '\\$count' . ($ascii > 10 ? '.toString(\\$ascii)' : '');
     // $decode: code snippet to speed up decoding
     if ($this->_fastDecode) {
         // create the decoder
         $decode = $this->_getJSFunction('_decodeBody');
         if ($this->_encoding > 62) {
             $decode = preg_replace('/\\\\w/', '[\\xa1-\\xff]', $decode);
         } elseif ($ascii < 36) {
             $decode = preg_replace($ENCODE, $inline, $decode);
         }
         // special case: when $count==0 there are no keywords. I want to keep
         //  the basic shape of the unpacking funcion so i'll frig the code...
         if ($count == 0) {
             $decode = preg_replace($this->_safeRegExp('($count)\\s*=\\s*1'), '$1=0', $decode, 1);
         }
     }
     // boot function
     $unpack = $this->_getJSFunction('_unpack');
     if ($this->_fastDecode) {
         // insert the decoder
         $this->buffer = $decode;
         $unpack = preg_replace_callback('/\\{/', array(&$this, '_insertFastDecode'), $unpack, 1);
     }
     $unpack = preg_replace('/"/', "'", $unpack);
     if ($this->_encoding > 62) {
         // high-ascii
         // get rid of the word-boundaries for regexp matches
         $unpack = preg_replace('/\'\\\\\\\\b\'\\s*\\+|\\+\\s*\'\\\\\\\\b\'/', '', $unpack);
     }
     if ($ascii > 36 || $this->_encoding > 62 || $this->_fastDecode) {
         // insert the encode function
         $this->buffer = $encode;
         $unpack = preg_replace_callback('/\\{/', array(&$this, '_insertFastEncode'), $unpack, 1);
     } else {
         // perform the encoding inline
         $unpack = preg_replace($ENCODE, $inline, $unpack);
     }
     // pack the boot function too
     $unpackPacker = new Packer($unpack, 0, false, true);
     $unpack = $unpackPacker->pack();
     // arguments
     $params = array($packed, $ascii, $count, $keywords);
     if ($this->_fastDecode) {
         $params[] = 0;
         $params[] = '{}';
     }
     $params = implode(',', $params);
     // the whole thing
     return 'eval(' . $unpack . '(' . $params . "))\n";
 }
Esempio n. 8
0
<?php

include 'classes.php';
if ($argc > 1) {
    $options = $argc > 2 ? $argv[2] : 's';
    // options
    $base62 = preg_match('/e/', $options);
    $shrink = preg_match('/s/', $options);
    $privates = preg_match('/p/', $options);
    $script = file_get_contents($argv[1]);
    $packer = new Packer();
    $output = $packer->pack($script, $base62, $shrink, $privates);
    fwrite(STDOUT, $output);
} else {
    fwrite(STDOUT, '
Compress a JavaScript source file using Dean Edwards\' Packer.
Version : 3.1
Syntax  : /path/to/php.exe pack.php -esp
Options :
    e: base62 encode
    s: shrink variables
    p: encode _private variables
');
}
Esempio n. 9
0
 /**
  * Given a solution set of packed boxes, repack them to achieve optimum weight distribution
  *
  * @param ArtatusPackedBoxList $aPackedBoxes
  * @return ArtatusPackedBoxList
  */
 public function redistributeWeight(ArtatusPackedBoxList $aPackedBoxes)
 {
     $targetWeight = $aPackedBoxes->getMeanWeight();
     if ($this->debug) {
         echo "repacking for weight distribution, weight variance {$aPackedBoxes->getWeightVariance()}, target weight {$targetWeight}";
     }
     $packedBoxes = new ArtatusPackedBoxList();
     $overWeightBoxes = array();
     $underWeightBoxes = array();
     foreach ($aPackedBoxes as $packedBox) {
         $boxWeight = $packedBox->getWeight();
         if ($boxWeight > $targetWeight) {
             $overWeightBoxes[] = $packedBox;
         } else {
             if ($boxWeight < $targetWeight) {
                 $underWeightBoxes[] = $packedBox;
             } else {
                 $packedBoxes->insert($packedBox);
                 //target weight, so we'll keep these
             }
         }
     }
     do {
         //Keep moving items from most overweight box to most underweight box
         $tryRepack = false;
         if ($this->debug) {
             echo 'boxes under/over target: ' . count($underWeightBoxes) . '/' . count($overWeightBoxes);
         }
         foreach ($underWeightBoxes as $u => $underWeightBox) {
             foreach ($overWeightBoxes as $o => $overWeightBox) {
                 $overWeightBoxItems = $overWeightBox->getItems()->asArray();
                 //For each item in the heavier box, try and move it to the lighter one
                 foreach ($overWeightBoxItems as $oi => $overWeightBoxItem) {
                     if ($underWeightBox->getWeight() + $overWeightBoxItem->getWeight() > $targetWeight) {
                         continue;
                         //skip if moving this item would hinder rather than help weight distribution
                     }
                     $newItemsForLighterBox = clone $underWeightBox->getItems();
                     $newItemsForLighterBox->insert($overWeightBoxItem);
                     $newLighterBoxPacker = new Packer();
                     //we may need a bigger box
                     $newLighterBoxPacker->setBoxes($this->boxes);
                     $newLighterBoxPacker->setItems($newItemsForLighterBox);
                     $newLighterBox = $newLighterBoxPacker->doVolumePacking()->extract();
                     if ($newLighterBox->getItems()->count() === $newItemsForLighterBox->count()) {
                         //new item fits
                         unset($overWeightBoxItems[$oi]);
                         //now packed in different box
                         $newHeavierBoxPacker = new Packer();
                         //we may be able to use a smaller box
                         $newHeavierBoxPacker->setBoxes($this->boxes);
                         $newHeavierBoxPacker->setItems($overWeightBoxItems);
                         $overWeightBoxes[$o] = $newHeavierBoxPacker->doVolumePacking()->extract();
                         $underWeightBoxes[$u] = $newLighterBox;
                         $tryRepack = true;
                         //we did some work, so see if we can do even better
                         usort($overWeightBoxes, array($packedBoxes, 'reverseCompare'));
                         usort($underWeightBoxes, array($packedBoxes, 'reverseCompare'));
                         break 3;
                     }
                 }
             }
         }
     } while ($tryRepack);
     //Combine back into a single list
     $packedBoxes->insertFromArray($overWeightBoxes);
     $packedBoxes->insertFromArray($underWeightBoxes);
     return $packedBoxes;
 }
Esempio n. 10
0
$encoding = Configure::read("App.encoding");
if ($type === "css") {
    header("Content-Type: text/css;charset={$encoding}");
} else {
    if ($type === "js") {
        header("Content-Type: text/javascript;charset={$encoding}");
    }
}
foreach ($filter as $v) {
    if (strpos($file, $v) !== false) {
        echo file_get_contents($file);
        exit;
    }
}
APP::import('vendor', 'inc/packer');
$p = new Packer();
echo $p->pack($file, $type);
function make_cache($switch = false, $modified = 0, $expires = null)
{
    if ($switch) {
        if (is_null($expires)) {
            $expires = 300;
        }
        if (!is_int($modified)) {
            $modified = 0;
        }
        @($oldmodified = $_SERVER["HTTP_IF_MODIFIED_SINCE"]);
        if ($oldmodified != "") {
            if (($pos = strpos($oldmodified, ';')) !== false) {
                $oldmodified = substr($oldmodified, 0, $pos);
            }
Esempio n. 11
0
 public function _varEncoder()
 {
     // find the next free short name
     do {
         $shortId = Packer::encode52($this->count++);
     } while (preg_match('/[^\\w$.]' . $shortId . '[^\\w$:]/', $this->script));
     return $shortId;
 }
Esempio n. 12
0
 /**
  * @param int $int
  * @param int $bytes
  * @param int $endian
  * @return ByteBuffer
  */
 public function writeInt($int, $bytes = 1, $endian = null)
 {
     if ($bytes > 8) {
         throw new \LengthException("Can't write integer larger 64 bit.");
     }
     if ($bytes > 4 && !$this->can64()) {
         throw new \LengthException('Your system not support 64 bit integers.');
     }
     if ($endian === null) {
         $endian = $this->getEndian();
     }
     $str = Packer::pack(Packer::getFormat('int', $bytes * 8, false, $endian), $int);
     return $this->write($str);
 }
Esempio n. 13
0
 /**
  * Размещение пакета
  *
  * @throws Exception if one of deploy task throws an exception
  */
 function deploy()
 {
     // распаковть в buildpad
     $bp = PackageManager::getBuildpadDir()->getDir($this->name . '_' . $this->version);
     PackageManager::getRollback()->push('delete', $bp);
     Packer::unpack($this->file, $bp);
     // Вырезать нужный кусок их Package.xml
     $rp = new DOMXPath($this->xml);
     $nodes = $rp->query('//deploy');
     if ($nodes->length == 0) {
         return io::out('Nothing to deploy') | 0;
     }
     $tasks = $nodes->item(0)->childNodes;
     // создать deployer
     $d = new Deployer($bp);
     $d->setTaskList($tasks);
     $d->executeTasks();
     // удалить директорию в билдпаде
     $bp->delete();
 }
Esempio n. 14
0
 /**
  * 单纯发头部命令
  **/
 public function sendHeader($mid, $port)
 {
     if (!($mid = Helper::uint($mid)) || empty($port)) {
         return false;
     }
     $body = array(array($mid, API_INT));
     $buffer = '';
     //获得BODY长度
     $this->_head = "";
     $this->_body = "";
     $this->setBody($body);
     $len = $this->getBodyLen($body);
     //设置头部HEADER
     $this->setHeader($len, CLIENT_COMMAND_PHP_SEND_GIFE);
     $checkcode = $this->encryptData($len);
     //设置校验码
     $this->setCheckcode($checkcode);
     //获得全部数据
     $string = Packer::factory()->getPackage();
     //发起socket
     //if(!Socket::factory()->isConnect()){
     Socket::factory()->set_server(Core_Game::$serverIP, $port);
     Socket::factory()->connect();
     Logs::factory()->debug('packer/socketheader', Socket::factory()->get_errmsg(), Core_Game::$serverIP, $port);
     //}
     //发送内容
     $ret = Socket::factory()->write_line($string);
     $buffer = Socket::factory()->read_line_str(JW_HEADER_LEN + $len);
     Socket::factory()->close();
     $decrypt = $this->decryptData($buffer, JW_SOCKET_BACK_LEN, 'back');
     Logs::factory()->debug('packer/header', $decrypt);
     return $decrypt;
 }
Esempio n. 15
0
        return $left . $right;
    }
    private $minifier;
    private $shrinker;
    private $privates;
    private $base62;
    public function __construct()
    {
        $this->minifier = new Minifier();
        $this->shrinker = new Shrinker();
        $this->privates = new Privates();
        $this->base62 = new Base62();
    }
    public function pack($script = '', $base62 = false, $shrink = true, $privates = false)
    {
        $script = $this->minifier->minify($script);
        if ($shrink) {
            $script = $this->shrinker->shrink($script);
        }
        if ($privates) {
            $script = $this->privates->encode($script);
        }
        if ($base62) {
            $script = $this->base62->encode($script);
        }
        return $script;
    }
}
// initialise static object properties
Packer::$data = new Parser(Packer::$data);
Esempio n. 16
0
        $deliver .= "/**\n";
        $deliver .= "  * Chico-UI\n";
        $deliver .= "  * Packer-o-matic\n";
        $deliver .= "  * Like the pizza delivery service: \"Les than 100 milisecons delivery guarantee!\"\n";
        $deliver .= "  * @components: " . ($this->type == "css" ? $this->components : implode(", ", $this->files)) . "\n";
        $deliver .= "  * @version " . $this->version . "\n";
        $deliver .= "  * @autor " . $this->autor . "\n";
        $deliver .= "  *\n";
        $deliver .= "  * @based on:\n";
        if ($this->type == "css") {
            $deliver .= "  * CssMin\n";
            $deliver .= "  * @copyright Stoyan Stefanov on DataURI: \n";
            $deliver .= "  * @link http://www.phpied.com/data-urls-what-are-they-and-how-to-use/ \n";
            $deliver .= "  */\n";
            $deliver .= $print;
        } else {
            $deliver .= "  * JSMin\n";
            $deliver .= "  * @author Ryan Grove <*****@*****.**> \n";
            $deliver .= "  * @copyright 2002 Douglas Crockford <*****@*****.**> (jsmin.c) \n";
            $deliver .= "  * @copyright 2008 Ryan Grove <*****@*****.**> (PHP port) \n";
            $deliver .= "  * @link http://code.google.com/p/jsmin-php/ \n";
            $deliver .= "  */\n";
            //$deliver .= ";(function($){\n".$print."\nch.init();\n})(jQuery);"; // Add ch.init() instruction to the end
            $deliver .= "\n" . $print . "\nch.init();\n";
            // Add ch.init() instruction to the end
        }
        return utf8_encode($deliver);
    }
}
$packer = new Packer();
echo $packer->deliver();
Esempio n. 17
0
 protected function _initAsset()
 {
     App::import('vendor', 'inc/packer');
     $p = new Packer();
     $js_out = $css_out = '';
     $js_pack = Configure::read("Asset.filter.js");
     $css_pack = Configure::read("Asset.filter.css");
     /* handle js*/
     $js_filter = array('js/plupload.min.js');
     //get relative path with WWW_ROOT
     foreach ($this->js as $k => $v) {
         if ($k === "plugin") {
             foreach ($v as $pl => $_v) {
                 foreach ($_v as $js) {
                     $this->js[] = "plugins/{$pl}/js/{$js}";
                 }
             }
             unset($this->js['plugin']);
         } else {
             $this->js[$k] = "js/{$v}";
         }
     }
     //check for direct output
     foreach ($this->js as $k => $v) {
         if (!in_array($v, $js_filter)) {
             $js_out .= $js_pack ? $p->pack(WWW_ROOT . $v, 'js') : file_get_contents(WWW_ROOT . $v);
             unset($this->js[$k]);
         }
     }
     if ($js_pack) {
         foreach ($this->js as &$js) {
             $js = str_replace("js/", "cjs/", $js);
         }
     }
     /* handle js end*/
     /* handle css*/
     $css_filter = array('css/xwidget.css');
     //get relative path with WWW_ROOT
     foreach ($this->css as $k => $v) {
         if ($k === "plugin") {
             foreach ($v as $pl => $_v) {
                 foreach ($_v as $css) {
                     $this->css[] = "plugins/{$pl}/css/{$css}";
                     //filter plugin css
                     $css_filter[] = "plugins/{$pl}/css/{$css}";
                 }
             }
             unset($this->css['plugin']);
         } else {
             $this->css[$k] = "css/{$v}";
         }
     }
     /**
      * sometime css can output with html to reduce http request
      * but if css has image referrence, the image will hard to find
      * so I keep css file as a link
      */
     //check for direct output
     foreach ($this->css as $k => $v) {
         if (!in_array($v, $css_filter)) {
             $css_out .= $css_pack ? $p->pack(WWW_ROOT . $v, 'css') : file_get_contents(WWW_ROOT . $v);
             unset($this->css[$k]);
         }
     }
     if ($css_pack) {
         foreach ($this->css as &$css) {
             $css = str_replace("css/", "ccss/", $css);
         }
     }
     /* handle css end*/
     $this->set("js", $this->js);
     $this->set("js_out", $js_out);
     $this->set("css", $this->css);
     $this->set("css_out", $css_out);
 }
Esempio n. 18
0
 /**
  * @dataProvider getSamples
  */
 public function testCanPackRepresentativeLargerSamples($test, $boxes, $items, $expectedBoxes, $expectedWeightVariance)
 {
     $expectedItemCount = 0;
     $packedItemCount = 0;
     $packer = new Packer();
     foreach ($boxes as $box) {
         $packer->addBox($box);
     }
     foreach ($items as $item) {
         $packer->addItem(new TestItem($item['name'], $item['width'], $item['length'], $item['depth'], $item['weight']), $item['qty']);
         $expectedItemCount += $item['qty'];
     }
     $packedBoxes = $packer->pack();
     foreach (clone $packedBoxes as $packedBox) {
         $packedItemCount += $packedBox->getItems()->count();
     }
     self::assertEquals($expectedBoxes, $packedBoxes->count());
     self::assertEquals($expectedItemCount, $packedItemCount);
     self::assertEquals($expectedWeightVariance, (int) $packedBoxes->getWeightVariance());
 }
Esempio n. 19
0
 public static function _encoder($index)
 {
     return '_' . Packer::encode62($index);
 }
Esempio n. 20
0
<?php

extract($_POST);
if (isset($pack)) {
    require 'classes.php';
    $packer = new Packer();
    $output = $packer->pack($input, isset($base62), isset($shrink), isset($privates));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
 <title>Packer: Test Page</title>
 <meta name="copyright" content="&copy; copyright 2004-2008, Dean Edwards"/>
 <meta name="description" content="A Javascript compressor."/>
 <meta name="keywords" content="packer,javascript,compressor,obfuscator"/>
 <link rel="stylesheet" href="../packer.css" type="text/css" media="screen, projection"/>
 <script type="text/javascript">
  var packer = {
    clear: function() {
      var form = document.forms[0];
      form.input.value = "";
      form.output.value = "";
      form.decode.disabled = true;
      form.input.focus();
      this.showMessage("ready");
    },

    decode: function() {
      var form = document.forms[0];
      try {
Esempio n. 21
0
 /**
  * @param int $type See Ganglia::TYPE_*
  * @return Packer
  */
 protected function getPacker($type)
 {
     $packer = new Packer();
     $packer->uint32($type);
     // Packet type (metadata or value)
     $packer->string($this->host);
     // Host name
     $packer->string($this->name);
     // Metric name
     $packer->uint32((int) $this->spoof);
     // Spoofing enabled?
     return $packer;
 }