@param string      $v
@param string|null $cb

@return string
189977
private function e($v, $cb = null)
    {
        if (null !== $cb) {
            $v = $this->batch($v, $cb);
        }

        return htmlentities($v, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
    }
1167859
function(cb){
      this.toCanvas(function(canvas){
        var dataUrl = canvas.toDataURL().replace(/^data:image\/(png|jpg);base64,/, "");
        var byteString = atob(escape(dataUrl));
        // write the bytes of the string to an ArrayBuffer
        var ab = new ArrayBuffer(byteString.length);
        var ia = new Uint8Array(ab);
        for (var i = 0; i < byteString.length; i++) {
          ia[i] = byteString.charCodeAt(i);
        }
        var dataView = new DataView(ab);
        var blob = new Blob([dataView], {type: "image/png"});
        cb(blob);
      });
    }
1062002
protected function getCvParam($xml)
    {
        $cvParam = array();
        // Required fields

        $cvParam['cvRef'] = (string) $xml->attributes()->cvRef;
        $cvParam[PsiVerb::CV_ACCESSION] = (string) $xml->attributes()->accession;
        $cvParam[PsiVerb::CV_NAME] = (string) $xml->attributes()->name;

        if (! isset($this->cvParamIndex[$cvParam[PsiVerb::CV_ACCESSION]])) {
            $this->cvParamIndex[$cvParam[PsiVerb::CV_ACCESSION]] = $cvParam['name'];
        }

        // Optional fields
        if (isset($xml->attributes()->value)) {
            $cvParam[PsiVerb::CV_VALUE] = (string) $xml->attributes()->value;
        }

        if (isset($xml->attributes()->unitAccession)) {
            $cvParam[PsiVerb::CV_UNITACCESSION] = (string) $xml->attributes()->unitAccession;
        }

        if (isset($xml->attributes()->unitName)) {
            $cvParam['unitName'] = (string) $xml->attributes()->unitName;
        }

        if (isset($xml->attributes()->unitCvRef)) {
            $cvParam['unitCvRef'] = (string) $xml->attributes()->unitCvRef;
        }

        return $cvParam;
    }
285234
public function addPathListener($cb)
    {
        $this->pathListeners[] = $cb;
        end($this->pathListeners);
        return key($this->pathListeners);
    }
1290133
public function each($cb)
    {
        foreach ($this->rows as $index=>$row) {
            $result = $cb($row, $index);
            if (is_array($result)) {
                $this->rows[$index] = $result;
            } else if ($result===false) {
                break;
            }
        }
        return $this;
    }
592570
public function getTotalBlocksInArea($c = false)
    {
        if (!$c) {
            $c = $this->c;
        }

        // exclude the area layout proxy block from counting.
        $this->load($c);
        $db = Database::connection();
        $r = $db->fetchColumn(
            'select count(b.bID) from CollectionVersionBlocks cvb inner join Blocks b on cvb.bID = b.bID inner join BlockTypes bt on b.btID = bt.btID where cID = ? and cvID = ? and arHandle = ? and btHandle <> ?',
            array($c->getCollectionID(), $c->getVersionID(), $this->arHandle, BLOCK_HANDLE_LAYOUT_PROXY)
        );

        // now grab sub-blocks.
        // NOTE: this will only traverse one level. Deal with it.
        $arHandles = $db->GetCol('select arHandle from Areas where arParentID = ?', array($this->arID));
        if (is_array($arHandles) && count($arHandles) > 0) {
            $v = array($c->getCollectionID(), $c->getVersionID());
            $q = 'select count(bID) from CollectionVersionBlocks where cID = ? and cvID = ? and arHandle in (';
            for ($i = 0; $i < count($arHandles); ++$i) {
                $arHandle = $arHandles[$i];
                $v[] = $arHandle;
                $q .= '?';
                if (($i + 1) < count($arHandles)) {
                    $q .= ',';
                }
            }
            $q .= ')';
            $sr = $db->fetchColumn($q, $v);
            $r += $sr;
        }

        return (int) $r;
    }
734018
function(cb, settings) {
        if (!VK._apiId) {
          return false;
        }

        var url = VK._domain.main + VK._path.login + '?client_id='+VK._apiId+'&display=popup&redirect_uri=close.html&response_type=token';
        if (settings && parseInt(settings, 10) > 0) {
          url += '&scope=' + settings;
        }

        VK.Observer.unsubscribe('auth.onLogin');
        VK.Observer.subscribe('auth.onLogin', cb);

        VK.UI.popup({
          width: 665,
          height: 370,
          url: url
        });

        var authCallback = function() {
          VK.Auth.getLoginStatus(function(resp) {
            VK.Observer.publish('auth.onLogin', resp);
            VK.Observer.unsubscribe('auth.onLogin');
          }, true);
        }

        VK.UI.popupOpened = true;
        var popupCheck = function() {
          if (!VK.UI.popupOpened) {
            return false;
          }

          try {
            if (!VK.UI.active.top || VK.UI.active.closed) {
              VK.UI.popupOpened = false;
              authCallback();
              return true;
            }
          } catch(e) {
            VK.UI.popupOpened = false;
            authCallback();
            return true;
          }
          setTimeout(popupCheck, 100);
        };

        setTimeout(popupCheck, 100);
      }
107294
public static function forceWrap($cb, $timeout = null)
    {
        if ($cb instanceof CallbackWrapper) {
            return $cb;
        }
        if ($cb === null) {
            return null;
        }
        return new static($cb, $timeout, Daemon::$context);
    }
77674
protected function arraySort(callable $cb = null)
    {
        $ar = $this->toArray();
        if ($cb) {
            usort($ar, $cb);
        } else {
            sort($ar);
        }
        return static::fromArray($ar);
    }
48513
public function requestPlayers($cb)
    {
        $this->request('challenge', null, function ($conn, $result) use ($cb) {
            if (is_array($result)) {
                $cb($conn, $result);
                return;
            }
            $conn->request('players', $result, $cb);
        });
    }
840692
public function findAndModify($p, $cb)
    {
        $p['col'] = $this->name;
        $this->pool->findAndModify($p, $cb);
    }
250994
public function submitJob($params, $cb = null)
    {
        $closure = function () use (&$params, $cb) {
            $this->sendCommand(
                'SUBMIT_JOB'
                . (isset($params['pri']) ? '_ ' . strtoupper($params['pri']) : '')
                . (isset($params['bg']) && $params['bg'] ? '_BG' : ''),
                [$params['function'], $params['unique'], $params['payload']],
                $cb
            );
        };
        if (isset($params['unique'])) {
            $closure();
        } else {
            Crypt::randomString(
                10,
                '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
                function ($random) use ($closure) {
                    $params['unique'] = $random;
                    $closure();
                }
            );
        }
    }
352444
public function more($cb = null)
    {
        if ($cb !== null) {
            $this->more = $cb;
            $this->moreFirstFlag = true;
            return $this;
        }
        if ($this->more !== null) {
            if ($this->more instanceof \Iterator) {
                iterator:
                $it = $this->more;
                while (!$this->isQueueFull() && $it->valid()) {
                    if ($this->moreFirstFlag) {
                        $this->moreFirstFlag = false;
                    } else {
                        $it->next();
                        if (!$it->valid()) {
                            break;
                        }
                    }
                    $this->addJob($it->key(), $it->current());
                }
            } else {
                $func = $this->more;
                if (($r = $func($this)) instanceof \Iterator) {
                    $this->more = $r;
                    goto iterator;
                }
            }
        }
        return $this;
    }
981316
public function ViewBag($k=null, $v=null)
    {
		if($v !== null){
			$this->viewBag->$k = $v;
		}elseif($k !== null){
			return $this->viewBag->$k;
		}else{
			return $this->viewBag;
		}
		return $this;
	}
919453
public function statvfs($cb, $pri = EIO_PRI_DEFAULT)
    {
        $cb = CallbackWrapper::forceWrap($cb);
        if (!$this->fd) {
            if ($cb) {
                $cb($this, false);
            }
            return false;
        }
        if (!FileSystem::$supported) {
            if ($cb) {
                $cb($this, false);
            }
            return false;
        }
        if ($this->statvfs) {
            $cb($this, $this->statvfs);
            return true;
        }
        return eio_fstatvfs($this->fd, $pri, function ($file, $stat) use ($cb) {
            $file->statvfs = $stat;
            $cb($file, $stat);
        }, $this);
    }
1012376
public static function statvfs($path, $cb, $pri = EIO_PRI_DEFAULT)
    {
        $cb = CallbackWrapper::forceWrap($cb);
        if (!self::$supported) {
            $cb($path, false);
            return false;
        }
        return eio_statvfs($path, $pri, $cb, $path);
    }
1246281
public function last($cb=null)
    {
        if ($cb==null) {
            return $this->isNotEmpty()?$this->rows[$this->count()-1]:null;
        } else {
            //method returns the last element in the collection that passes a given truth test:
            $count = $this->count();
            for ($i=0;$i<$count;$i++) {
                if ($cb($this->rows[$count-$i], $count-$i)===true) {
                    return $this->rows[$count-$i];
                }
            }
        }
        return null;
    }