/*
将数据列顺序保存至本地个性化存储
347227
function saveGridCompColumnArrToLocal() {
    if (!this.options.needLocalStorage) return null;
    var defData = this.getLocalData();
    defData["gridCompColumnArr"] = this.gridCompColumnArr.concat(this.gridCompColumnFixedArr);
    this.saveLocalData();
}
891834
function cachepath(location) {
    var uri = url.parse(location);
    if (!uri.protocol) {
        throw new Error('Invalid URL: ' + location);
    } else {
        var hash = crypto.createHash('md5')
            .update(location)
            .digest('hex')
            .substr(0,8) +
            '-' + path.basename(uri.pathname, path.extname(uri.pathname));
        var extname = path.extname(uri.pathname);
        return _(['.shp', '.zip', '']).include(extname.toLowerCase()) ?
            path.join(hash, hash + extname)
            : path.join(hash + extname);
    }
}
983711
function(wilddogRef) {
  /********************/
  /*  PUBLIC METHODS  */
  /********************/
  /**
   * 返回创建WildGeo实例的Wilddog实例
   * @return {Wilddog} 用来创建WildGeo实例的Wilddog实例
   */
  this.ref = function() {
    return _wilddogRef;
  };

  /*
   * 往Wilddog中写入key-location数据对。当写入成功后返回一个空的promise。
   * 如果要存入的key在WildGeo中已经存在，将被覆盖重写。
   * @param {string|Object} keyOrLocations 代表被增加的位置的key或者代表要被添加的key-location数据对。
   * @param {Array.<number>|undefined} location 要被添加的经纬坐标数组。
   * @return {Promise.<>} 写入成功后执行的Promise
   */
  this.set = function(keyOrLocations, location) {
    var locations;
    if (typeof keyOrLocations === "string" && keyOrLocations.length !== 0) {
      locations = {};
      locations[keyOrLocations] = location;
    } else if (typeof keyOrLocations === "object") {
      if (typeof location !== "undefined") {
        throw new Error("The location argument should not be used if you pass an object to set().");
      }
      locations = keyOrLocations;
    } else {
      throw new Error("keyOrLocations must be a string or a mapping of key - location pairs.");
    }

    var newData = {};

    Object.keys(locations).forEach(function(key) {
      validateKey(key);

      var location = locations[key];
      if (location === null) {
        newData[key] = null;
      } else {
        validateLocation(location);

        var geohash = encodeGeohash(location);
        newData[key] = encodeWildGeoObject(location, geohash);
      }
    });

    return new RSVP.Promise(function(resolve, reject) {
      function onComplete(error) {
        if (error !== null) {
          reject("Error: Wilddog synchronization failed: " + error);
        }
        else {
          resolve();
        }
      }

      _wilddogRef.update(newData, onComplete);
    });
  };

  /**
   * 返回key对应的一个包含地理位置信息的promise
   * 如果key参数在数据库中不存在，返回空的promise
   * @param {string} key 要检索的地理位置的key值
   * @return {Promise.<Array.<number>>} 包含根据key值检索到的位置信息的promise
   */
  this.get = function(key) {
    validateKey(key);
    return new RSVP.Promise(function(resolve, reject) {
      _wilddogRef.child(key).once("value", function(dataSnapshot) {
        if (dataSnapshot.val() === null) {
          resolve(null);
        } else {
          resolve(decodeWildGeoObject(dataSnapshot.val()));
        }
      }, function (error) {
        reject("Error: Wilddog synchronization failed: " + error);
      });
    });
  };

  /**
   * 删除WildGeo中的key，删除成功后返回一个空的promise
   * 如果参数key不在WildGeo中，promise仍能成功解析。
   * @param {string} key 被删除的地理位置的key值
   * @return {Promise.<string>} 输入的key被删除后返回的promise
   */
  this.remove = function(key) {
    return this.set(key, null);
  };

  /**
   * 根据查询条件返回一个新的WildGeo实例。
   * @param {Object} queryCriteria 指定了圆心坐标和半径的查询条件
   * @return {GeoQuery} 一个新的GeoQuery对象
   */
  this.query = function(queryCriteria) {
    return new GeoQuery(_wilddogRef, queryCriteria);
  };

  /*****************/
  /*  CONSTRUCTOR  */
  /*****************/
  if (Object.prototype.toString.call(wilddogRef) !== "[object Object]") {
    throw new Error("wilddogRef must be an instance of Wilddog");
  }

  var _wilddogRef = wilddogRef;
}
1204497
public void initContext(Context ctx)
	{
		// 模板静态文本部分
		ctx.staticTextArray = staticTextArray;
		// 模板各种缓存存放地

		// 临时标量所在空间
		ctx.tempVarStartIndex = tempVarStartIndex;
		// 分配变量空间,最后一个为模板的返回值
		ctx.vars = new Object[varIndexSize + 1];
		ctx.vars[varIndexSize] = Context.NOT_EXIST_OBJECT;

		// 将全局变量放到数组
		putGlobaToArray(ctx);

	}
320342
public function save()
    {
        if (!$this->url)
        {
            $response = $this->upload();
            $this->url = $response['url'];
            $this->name = $response['name'];
        }

        return true;
    }
1189743
function(){
      var src = this.installArray.shift(); 

      if(typeof src !== 'undefined'){
        var parts = src.split('/'); 
        var resourcePath = this.getResourcePath(parts[parts.length-2]); 
        var dest = this.basePath + resourcePath + '/' + parts[parts.length-1]; 
        
        if(typeof resourcePath !== 'undefined'){
          this._install(src, dest); 
        }else{
          this.triggerNext(); 
        }
         
      }else{
        this.log('all done, get ready to rock!  (╯°□°）╯︵ ┻━┻');
        rl.close(); 
      }
    }
897726
private static void fillReqAndRes(ServletRequest req, ServletResponse res){
		//-- 填充请求和响应对象到ActionContext本地线程
		Request.init((HttpServletRequest)req);
		Response.init((HttpServletResponse)res);
	}
146581
public function save()
    {
        /**
         * 使用PHP Sesion，Readonl，未启动 这3种情况下不需要保存
         */
        if ($this->use_php_session or !$this->isStart or $this->readonly)
        {
            return true;
        }
        //设置为Session关闭状态
        $this->isStart = false;
        $key = self::$cache_prefix . $this->sessID;
        return $this->cache->set($key, serialize($_SESSION), $this->session_lifetime);
    }
503199
function(url) {
		if (url.match(/^http/i)) {
			return url;
		}
		if (url.substr(0,2) === '//') {
			return window.location.protocol + url;
		}
		var root = window.location.protocol + '//' + window.location.host,
			reg  = /[^\/]+\/\.\.\//,
			ret;
		if (url.substr(0, 1) === '/') {
			ret = root + url;
		} else {
			ret = root + window.location.pathname.replace(/\/[^\/]+$/, '/') + url;
		}
		ret = ret.replace('/./', '/');
		while(reg.test(ret)) {
			ret = ret.replace(reg, '');
		}
		return ret;
	}
396323
function( url ) {
			var parts = this.path.split('/'),
				other_parts = url.split('/'),
				result = '';
			while ( parts.length > 0 && other_parts.length > 0 && parts[0] == other_parts[0] ) {
				parts.shift();
				other_parts.shift();
			}
			each(other_parts, function(){ result += '../'; })
			return result + parts.join('/');
		}
1022849
function save()
    {
        $dt = '';
        if (isset($_POST['dt'])) {
            $dt = base64_decode($_POST['dt']);
            $dt = utf8_encode($dt);
            $dt = json_decode($dt);
        }

        if (isset($dt->content)) {
            $media =    isset($dt->media) ? $dt->media : '{}';
            $category = isset($dt->category) ? $dt->category : 1;
            $link =     isset($dt->link) ? $dt->link : '';
            $tags =     isset($dt->tags) ? $dt->tags : '';
            $status =   isset($dt->status) ? $dt->status : 'R';

            $title =    isset($dt->title) ? $dt->title : 'Sem Título';
            $destaque = isset($dt->destaque) ? $dt->destaque : 'Nenhum destaque ...';

            $uID = isset($dt->info->user) ? $dt->info->user : 0;
            $aID = isset($dt->info->article) ? $dt->info->article : 0;

            $article = new Model\Article($aID);

            $article->set('author', $uID);
            $article->set('category', $category);
            $article->set('pubdate', date('Y-m-d H:i:s'));
            $article->set('editdate', date('Y-m-d H:i:s'));

            $article->set('link', $link);
            $article->set('tags', $tags);
            $article->set('status', $status);
            $article->set('media', json_encode($media));
            
            $article->set('title', $title);
            $article->set('content', str_replace(["--", "..."], ["&mdash;", "&hellip;"], $dt->content));
            $article->set('resume', $destaque);

            //Gravando...
            $article->save();

            //Send to client
            $this->send(['status'=>'ok', 'id'=>$article->get('id'), 'link'=>$article->get('link')]);
        }
        $this->sendError();
    }
581472
public function save()
	{
		$module=Yii::app()->controller->module;
		if($this->content===null)  // a directory
		{
			if(!is_dir($this->path))
			{
				$oldmask=@umask(0);
				$result=@mkdir($this->path,$module->newDirMode,true);
				@umask($oldmask);
				if(!$result)
				{
					$this->error="Unable to create the directory '{$this->path}'.";
					return false;
				}
			}
			return true;
		}

		if($this->operation===self::OP_NEW)
		{
			$dir=dirname($this->path);
			if(!is_dir($dir))
			{
				$oldmask=@umask(0);
				$result=@mkdir($dir,$module->newDirMode,true);
				@umask($oldmask);
				if(!$result)
				{
					$this->error="Unable to create the directory '$dir'.";
					return false;
				}
			}
		}
		if(@file_put_contents($this->path,$this->content)===false)
		{
			$this->error="Unable to write the file '{$this->path}'.";
			return false;
		}
		else
		{
			$oldmask=@umask(0);
			@chmod($this->path,$module->newFileMode);
			@umask($oldmask);
		}
		return true;
	}
634087
function save()
    {
        $dirty_props = $this->_dirty; 

        if ($this->_vars)
        {   
            $dirty_vars = $this->_vars->getDirtyVariables();
            if ($dirty_vars)
            {
                $dirty_props['vars'] = $dirty_vars;
            }
        }
        
        $this->_api->doRequest('POST', $this->getBaseApiPath(), $dirty_props);        
        $this->_dirty = array();
        
        if ($this->_vars)
        {
            $this->_vars->clearDirtyVariables();
        }
    }
1135510
static function saveAccessList($authId=null) {
        if(null===$authId)   $authId = $_SESSION[C('USER_AUTH_KEY')];
        // 如果使用普通权限模式，保存当前用户的访问权限列表
        // 对管理员开发所有权限
        if(C('USER_AUTH_TYPE') !=2 && !$_SESSION[C('ADMIN_AUTH_KEY')] )
            $_SESSION['_ACCESS_LIST']	=	self::getAccessList($authId);
        return ;
    }
609719
function(url, outFile, cb, persist, headers) {
    this.file.save(
      outFile,
      request.get(
        {
          url : url,
          headers : headers
        }
      ),
      persist,
      cb
    );
  }
966097
public function save()
    {
        parent::save();

        if ($this->_allowAdminEdit($this->getEditObjectId())) {
            $aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");
            $oAdress = oxNew(\OxidEsales\Eshop\Application\Model\Address::class);
            if (isset($aParams['oxaddress__oxid']) && $aParams['oxaddress__oxid'] == "-1") {
                $aParams['oxaddress__oxid'] = null;
            } else {
                $oAdress->load($aParams['oxaddress__oxid']);
            }

            $oAdress->assign($aParams);
            $oAdress->save();

            $this->sSavedOxid = $oAdress->getId();
        }
    }
111274
function saveResolvedLocalsInData() {
    var localNames = previousOrParentNode.tNode.localNames;
    if (localNames) {
        for (var i = 0; i < localNames.length; i += 2) {
            var index = localNames[i + 1];
            var value = index === -1 ? previousOrParentNode.native : directives[index];
            viewData.push(value);
        }
    }
}