iOS 10.2+ SVG SMIL アニメーションが 2回目以降動かない問題の対策 data:image/svg+xml;<cache bust string>;base64,... とすることで data-url にも cache busting が有効になる
422843
function refresh($target) {
                var PREFIX = ["-webkit-", ""];
                var valid = function (prop) {
                    return (prop && "none" !== prop);
                };
                var dataUrl;
                for (var i = 0, n = PREFIX.length; i < n; i++) {
                    if (!valid(dataUrl)) {
                        dataUrl = $target.css(PREFIX[i] + "mask-image");
                        if (valid(dataUrl)) {
                            // iOS では url(data***); 内に '"' は入らない
                            var match = dataUrl.match(/(url\(data:image\/svg\+xml;)([\s\S]*)?(base64,[\s\S]*\))/);
                            if (match) {
                                dataUrl = match[1] + "bust=" + Date.now().toString(36) + ";" + match[3];
                            }
                            else {
                                dataUrl = null;
                            }
                        }
                    }
                    if (valid(dataUrl)) {
                        $target.css(PREFIX[i] + "mask-image", dataUrl);
                    }
                }
                return $target;
            }
118954
function convert ({ prefix, base, svg }) {
  const data = process(svg, { prefix })

  return dedent`
    @function ${prefix}-${base}-image($color: #000000) {
      @return url(${JSON.stringify(data)});
    }

    @mixin ${prefix}-${base}($size: 16px, $color: #000000) {
      @include ${prefix}-base;
      background: ${prefix}-${base}-image($color) center center / $size $size no-repeat;
      height: $size;
      width: $size;
    }
  `
}
393475
function(){
		// this.bodyが空の場合はEncode.jsの仕様により対象外
		// カンペンには以下のパズルは存在しないのでURL_KANPENPも対象外
		if(!this.body || (this.type!==URL_PZPRV3 && this.type!==URL_PZPRAPP)){ return;}
		
		switch(this.pid){
		case 'ichimaga':
			if     (this.pflag.indexOf('m')>=0){ this.pid = 'ichimagam';}
			else if(this.pflag.indexOf('x')>=0){ this.pid = 'ichimagax';}
			else                               { this.pid = 'ichimaga'; }
			break;
		case 'icelom':
			if(this.pflag.indexOf('a')<0){ this.pid = 'icelom2';}
			break;
		case 'pipelink':
			if(this.body.match(/[0-9]/)){ this.pid = 'pipelinkr';}
			break;
		case 'bonsan':
			if(this.pflag.indexOf('c')<0){
				var col = this.cols, row = this.rows;
				if(this.body.substr(0,((((col-1)*row+4)/5)|0)+(((col*(row-1)+4)/5)|0)||0).match(/[^0]/)){
					this.pid = 'heyabon';
				}
			}
			break;
		case 'kramma':
			if(this.pflag.indexOf('c')<0){
				var len=(this.cols-1)*(this.rows-1), cc=0;
				for(var i=0;i<this.body.length;i++){
					var ca = this.body.charAt(i);
					if(ca.match(/\w/)){
						cc += parseInt(ca,36);
						if(cc<len){ this.pid = 'kramman'; break;}
					}
					else if(ca === '.'){ cc+=36;}
					if(cc>=len){ break;}
				}
			}
			break;
		}
	}
395008
def svg_asset_data_uri(asset)
      svg = asset.source.dup
      optimize_svg_for_uri_escaping!(svg)
      data = Rack::Utils.escape(svg)
      optimize_quoted_uri_escapes!(data)
      "\"data:#{asset.content_type};charset=utf-8,#{data}\""
    end
572710
function processNodeRule (nodeRule, imageReplaces, coll2x, coll3x) {
    var img, imgKey, __url
    _.each(nodeRule.declarations, function(e){
        if(e.property == 'background-image'){
            __url = __getURL(e.value)
            img = img || imageReplaces[__url]
            imgKey = img? __url: imgKey
        }
    })
    if(!img) return
    // 修改节点
    updateNodeByMerge(nodeRule, __generatorCSSObj(img))
    // 更新2x 3x 收集器
    updateCollectMX(imgKey, imageReplaces, nodeRule.selectors, coll2x, coll3x)

    function __getURL(bgURL){
        return _.trim(bgURL.split('url').join(''), '()"\'')
    }
    function __generatorCSSObj(img){
        return {
            "background-image": "url("+img.sprite+")",
            "background-position":  "-"+img.x+"px -"+img.y+"px"
        }
    }
}
437630
function(){
		// とりあえず盤面全部の対応だけ
		var d0 = this.area, d = {x1:d0.x1,y1:d0.y1,x2:d0.x2,y2:d0.y2};
		var key_undo = this.board.exec.boardtype[this.old][0];
		if(key_undo & this.TURN){ var tmp=d.x1;d.x1=d.y1;d.y1=tmp;}
		this.exec(key_undo,d);
	}
1070994
function ensureImageLoaded(url) {
            var img = new Image();
            var destroy = function () {
                if (img) {
                    img.src = ""; // 読み込み停止
                    img = null;
                }
            };
            return new Promise(function (resolve, reject) {
                img.onload = function (event) {
                    destroy();
                    resolve(url);
                };
                img.onerror = function (event) {
                    destroy();
                    reject(CDP.makeErrorInfo(CDP.RESULT_CODE.ERROR_CDP_TOOLS_IMAGE_LOAD_FAILED, TAG, "image load failed. [url: " + url + "]"));
                };
                img.src = url;
            }, destroy);
        }
541817
function process (svg, { prefix }) {
  // Inject a <style> in the SVG document to allow changing colors
  svg = svg.replace(/<(path|circle) /gi, (_, tag) => `<${tag} fill="__COLOR__" `)

  // Since this is a data: URI, we want to encode it with %23 and such
  svg = encodeURIComponent(svg)

  // We want the #{...} interpolation to be outside the URI encoding
  svg = svg.replace(/__COLOR__/g, '#{' + prefix + '-fix-color($color)}')

  svg = 'data:image/svg+xml;charset=utf-8,' + svg

  return svg
}
215590
function (targetFile, configItems) {
        var infoPlist = plist.parse(fs.readFileSync(targetFile, 'utf-8')),
            tempInfoPlist;

        configItems.forEach(function (item) {
            var key = item.parent;
            var plistXml = '<plist><dict><key>' + key + '</key>';
            plistXml += lib.eltreeToXmlString(item.data) + '</dict></plist>';

            var configPlistObj = plist.parse(plistXml);
            infoPlist[key] = configPlistObj[key];
        });

        tempInfoPlist = plist.build(infoPlist);
        tempInfoPlist = tempInfoPlist.replace(/<string>[\s\r\n]*<\/string>/g, '<string></string>');
        fs.writeFileSync(targetFile, tempInfoPlist, 'utf-8');
        console.log("* wrote iOS Plist: " + targetFile);
    }
187368
def mkcache(result_page, number)
      mkcache_dir

      @logger.info("Download #{result_page.uri.path}")

      # ランナーデータエラー（存在しない）でもキャッシュを作成する
      if File.basename(result_page.uri.path) == 'number_error.html'
        number_file = File.join(@cache_dir, "#{number}_error.html")
        @agent.download(result_page.uri.path, number_file)
        return nil
      end

      number_file = File.join(@cache_dir, "#{number}.html")
      @agent.download(result_page.uri.path, number_file)
      return result_page
    end
36496
function loadByURL(url) {
    /* Load the icon from embedded data URL. */
    function loadByDataUrl(url) {
      var results = dataUrlRegex.exec(url);
      var isBase64 = /base64/i.test(url);
      var data = isBase64 ? window.atob(results[2]) : results[2];

      return $q.when(angular.element(data)[0]);
    }

    /* Load the icon by URL using HTTP. */
    function loadByHttpUrl(url) {
      return $q(function(resolve, reject) {
        // Catch HTTP or generic errors not related to incorrect icon IDs.
        var announceAndReject = function(err) {
            var msg = angular.isString(err) ? err : (err.message || err.data || err.statusText);
            $log.warn(msg);
            reject(err);
          },
          extractSvg = function(response) {
            if (!svgCache[url]) {
              svgCache[url] = angular.element('<div>').append(response)[0].querySelector('svg');
            }
            resolve(svgCache[url]);
          };

        $templateRequest(url, true).then(extractSvg, announceAndReject);
      });
    }

    return dataUrlRegex.test(url)
      ? loadByDataUrl(url)
      : loadByHttpUrl(url);
  }
457642
function (svg) {
		return svg
			.replace(/zIndex="[^"]+"/g, '')
			.replace(/isShadow="[^"]+"/g, '')
			.replace(/symbolName="[^"]+"/g, '')
			.replace(/jQuery[0-9]+="[^"]+"/g, '')
			.replace(/url\([^#]+#/g, 'url(#')
			.replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ')
			.replace(/ (NS[0-9]+\:)?href=/g, ' xlink:href=') // #3567
			.replace(/\n/, ' ')
			// Any HTML added to the container after the SVG (#894)
			.replace(/<\/svg>.*?$/, '</svg>') 
			// Batik doesn't support rgba fills and strokes (#3095)
			.replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g, '$1="rgb($2)" $1-opacity="$3"')
			/* This fails in IE < 8
			.replace(/([0-9]+)\.([0-9]+)/g, function(s1, s2, s3) { // round off to save weight
				return s2 +'.'+ s3[0];
			})*/

			// Replace HTML entities, issue #347
			.replace(/&nbsp;/g, '\u00A0') // no-break space
			.replace(/&shy;/g,  '\u00AD') // soft hyphen

			// IE specific
			.replace(/<IMG /g, '<image ')
			.replace(/height=([^" ]+)/g, 'height="$1"')
			.replace(/width=([^" ]+)/g, 'width="$1"')
			.replace(/hc-svg-href="([^"]+)">/g, 'xlink:href="$1"/>')
			.replace(/ id=([^" >]+)/g, 'id="$1"') // #4003
			.replace(/class=([^" >]+)/g, 'class="$1"')
			.replace(/ transform /g, ' ')
			.replace(/:(path|rect)/g, '$1')
			.replace(/style="([^"]+)"/g, function (s) {
				return s.toLowerCase();
			});
	}
519616
function(){
		this.list = {};

		/* 盤面表示設定 */
		this.add('font', 1, {option:[1,2]});					/* 文字の描画 1:ゴシック 2:明朝 */
		this.add('cursor', true);								/* カーソルの表示 */
		this.add('irowake', false);								/* 線の色分け */
		this.add('irowakeblk', false);							/* 黒マスの色分け */

		this.add('dispmove', true);								/* 線で動かすパズルで実際に動いたように描画 */
		this.add('disptype_yajilin',   1, {option:[1,2]});		/* yajilin: 表示形式 */
		this.add('disptype_pipelinkr', 1, {option:[1,2]});		/* pipelinkr: 表示形式 */
		this.add('disptype_bosanowa',  1, {option:[1,2,3]});	/* bosanowa: 表示形式 */
		this.add('snakebd', false);								/* hebi: へびの境界線を表示する */
		this.add('dispqnumbg', false);							/* yinyang: 問題のまるに背景色をつける */
		this.add('undefcell', true);							/* shugaku: 未確定マスはグレー表示にする */

		this.add('squarecell', true);							/* セルは正方形にする */

		/* 表示色の設定 */
		this.add('color_shadecolor', "");						/* 黒マスの表示色の表示 */
		this.add('color_bgcolor', "white");						/* 背景色の設定 */

		/* 入力方法設定 */
		this.add('use', (!pzpr.env.API.touchevent?1:2), {option:[1,2]});	/* 黒マスの入力方法 */
		this.add('use_tri', 1, {option:[1,2,3]});				/* shakashaka: 三角形の入力方法 */

		this.add('bgcolor', false);			/* slither 背景色入力 */
		this.add('singlenum', (!pzpr.env.API.touchevent));	/* hanare: 部屋に回答数字を一つだけ入力 */
		this.add('enline', true);			/* kouchoku: 線は点の間のみ引ける */
		this.add('lattice', true);			/* kouchoku: 格子点チェック */

		/* 回答お助け機能 */
		this.add('autocmp', true,  {variety:true});	/* 数字 or kouchokuの正解の点をグレーにする */
		this.add('autoerr', false, {variety:true});	/* hitori:ひとくれの重複した数字を表示, gokigen,wagiri:斜線の色分け */

		/* 正解判定 */
		this.add('multierr', false);		/* エラー判定で複数エラーを出力する */
		this.add('allowempty', false);		/* 盤面に線や黒マスがなくても正解と判定する */
		this.add('forceallcell', false);	/* fillomino: すべての数字が入っている時のみ正解とする */
		this.add('passallcell', true);		/* arukone: すべてのセルに線が通っている時のみ正解とする */

		/* EDITORのみ */
		this.add('bdpadding', true);		/* goishi: URL出力で1マス余裕を持って出力する */
		this.add('discolor', false);		/* tentaisho: 色分け無効化 */

		/* その他の特殊項目(保存なし) */
		this.add('uramashu', false, {volatile:true});		/* 裏ましゅにする */
	}
266448
def AsCGI(nsdict={}, typesmodule=None, rpc=False, modules=None):
    '''
    '''
    if os.environ.get('REQUEST_METHOD') != 'POST':
        _CGISendFault(Fault(Fault.Client, 'Must use POST'))
        return
    ct = os.environ['CONTENT_TYPE']
    try:
        if ct.startswith('multipart/'):
            cid = resolvers.MIMEResolver(ct, sys.stdin)
            xml = cid.GetSOAPPart()
            ps = ParsedSoap(xml, resolver=cid.Resolve)
        else:
            length = int(os.environ['CONTENT_LENGTH'])
            ps = ParsedSoap(sys.stdin.read(length))
    except ParseException, e:
        _CGISendFault(FaultFromZSIException(e))
        return
    _Dispatch(ps, modules, _CGISendXML, _CGISendFault, nsdict=nsdict,
              typesmodule=typesmodule, rpc=rpc)
569236
public function gpi($data){
		// var_dump($data);

		if( !preg_match('/^[a-zA-Z0-9\_]+$/s', $data['api']) ){
			return false;
		}

		// API をロードして実行
		if( is_file(__DIR__.'/gpis/'.urlencode($data['api']).'.php') ){
			$Api = include(__DIR__.'/gpis/'.urlencode($data['api']).'.php');
			$result = $Api($this->px2me, $data);
			return $result;
		}

		return false;
	}
1265758
public static function FilesDetectiveSessionFixation () {
		//==============================================
		//変数初期化
		//==============================================
		$save_path = static::SavePath();

		//==============================================
		//ディレクトリ
		//==============================================
		//ディレクトリ存在確認
		if (!file_exists($save_path)) {
			if (!mkdir($save_path, 0700, true)) {
				throw CoreException::RaiseSystemError('セッションセーブディレクトリがありません。dir:%s', [$save_path]);
			}
		}

		//対象確認
		if (!is_dir($save_path)) {
			throw CoreException::RaiseSystemError('セッションセーブディレクトリがファイルです。dir:%s', [$save_path]);
		}

		//書き込み権確認
		if (!is_writable($save_path)) {
			throw CoreException::RaiseSystemError('セッションセーブディレクトリに書き込めません。dir:%s', [$save_path]);
		}

		//読み込み権確認
		if (!is_readable($save_path)) {
			throw CoreException::RaiseSystemError('セッションセーブディレクトリから読み込みできません。dir:%s', [$save_path]);
		}

		//==============================================
		//ファイル：セッションフィクセーション対策
		//==============================================
		//セッション取得元検証
		$session_name = session_name();
		if (isset($_POST[$session_name]) || isset($_GET[$session_name])) {
			throw CoreException::RaiseSystemError('クッキー以外の経路でセッションを指定されました。session_id:%s', [$session_id]);
		}

		//セッションIDがあった場合の検証
		$session_id = (isset($_COOKIE[$session_name])) ? $_COOKIE[$session_name] : session_id();
		if ($session_id !== '') {
			//不正な文字列がないか検証
			if (strpos($session_id, '.') !== false || strpos($session_id, '/') !== false || strpos($session_id, "\\") !== false) {
				throw CoreException::RaiseSystemError('セッションIDに不正な文字列が存在します。session_id:%s', [$session_id]);
			}

			//セッションファイルパスの作成
			$session_file_path = sprintf('%s/%s%s', str_replace("\\", '/', $save_path), static::SESSION_FILE_NAME_PREFIX, $session_id);

			//ファイル存在確認
			if (!file_exists($session_file_path)) {
				static::DeleteSessionCookie();
				throw CoreException::RaiseSystemError('セッションファイルがありません。セッションフィクセーションの疑いがあります。file:%s', [$session_file_path]);
			}

			//対象確認
			if (!is_file($session_file_path)) {
				throw CoreException::RaiseSystemError('セッションファイルがファイルではありません。file:%s', [$session_file_path]);
			}

			//書き込み権確認
			if (!is_writable($session_file_path)) {
				throw CoreException::RaiseSystemError('セッションファイルに書き込めません。file:%s', [$session_file_path]);
			}

			//読み込み権確認
			if (!is_readable($session_file_path)) {
				throw CoreException::RaiseSystemError('セッションファイルから読み込みできません。file:%s', [$session_file_path]);
			}
		}

		//==============================================
		//処理の終了
		//==============================================
		return true;
	}
262635
function zipSVG(libs, svgContent, src) {
    svgContent = svgContent
    // Remove space between two tags.
        .replace(/>[ \t\n\r]+</g, '><')
    // Replace double quotes with single quotes.
        .replace(/"/g, "'")
    // Replace many spaces by one single space.
        .replace(/[ \t\n\r]+/g, ' ');

    var svgTree = libs.parseHTML(svgContent);
    // We want to remove unused `id`attributes.
    // Such an attribute is used as long as there is a `xlink:href` attribute referencing it.
    var idsToKeep = {};
    // Remove Inkscape tags and <image>.
    libs.Tree.walk(svgTree, function(node) {
        if (node.type !== libs.Tree.TAG) return;
        var name = node.name.toLowerCase();
        if (name == 'flowroot') {
            libs.warning(
                "Please don't use <flowRoot> nor <flowRegion> in your SVG (\"" + src + "\")!\n"
                    + "If it was created with Inkscape, convert it in SVG 1.1 by opening the `Text` menu\n"
                    + "and selecting \"Convert to Text\".",
                src,
                svgContent,
                node.pos
            );
        }
        var nodeToDelete = startsWith(
            name,
            "metadata", "inkscape:", "sodipodi:", "image", "dc:", "cc:", "rdf:",
            "flowroot", "flowregion"
        );
        if (nodeToDelete) {
            node.type = libs.Tree.VOID;
            delete node.children;
        } else if (node.attribs) {
            var attribsToDelete = [];
            var attribName, attribValue;
            for (attribName in node.attribs) {
                if (
                    startsWith(
                        attribName,
                        'inkscape:', 'sodipodi:', 'xmlns:inkscape', 'xmlns:sodipodi',
                        'xmlns:dc', 'xmlns:cc', 'xmlns:rdf'
                    )
                ) {
                    // This is an attribute to delete.
                    attribsToDelete.push(attribName);
                } else {
                    // Look for references (`xlink:href`).
                    attribValue = node.attribs[attribName].trim();
                    if (attribName.toLowerCase() == 'xlink:href') {
                        if (attribValue.charAt(0) == '#') {
                            // Remember that this ID must not be deleted.
                            idsToKeep[attribValue.substr(1)] = 1;
                        }
                    } else {
                        // Look for local URLs: `url(#idToKeep)`.
                        var match;
                        while ((match = RX_LOCAL_URL.exec(attribValue))) {
                            idsToKeep[match[1]] = 1;
                        }
                    }
                }
            }
            attribsToDelete.forEach(function (attribName) {
                delete node.attribs[attribName];
            });
        }
    });

    // Removing emtpy <g> and <defs>.
    libs.Tree.walk(svgTree, function(node) {
        if (node.type != libs.Tree.TAG) return;
        var name = node.name.toLowerCase();
        if (node.attribs && node.attribs.id) {
            // Try to remove unused ID.
            if (!idsToKeep[node.attribs.id]) {
                delete node.attribs.id;
            }
        }
        if (['g', 'defs'].indexOf(name) > -1) {
            // If this tag has no child, we must delete it.
            var childrenCount = 0;
            (node.children || []).forEach(function (child) {
                if (child.type == libs.Tree.TEXT || child.type == libs.Tree.TAG) {
                    childrenCount++;
                }
            });
            if (childrenCount == 0) {
                // This tag is empty, remove it.
                delete node.children;
                node.type = libs.Tree.VOID;
            }
        }
    });

    var svg = libs.Tree.toString(svgTree);
    return svg;
    // The following code was used when we embeded the SVG in Data URI form.
    /*
     console.log(svg);
     console.log();
     console.log("Base64: " + (new Buffer(svg)).toString('base64').length);
     console.log("UTF-8:  " + encodeURIComponent(svg).length);
     console.log();
     var encodedSVG_base64 = (new Buffer(svg)).toString('base64');
     var encodedSVG_utf8 = encodeURIComponent(svg);
     if (encodedSVG_base64 < encodedSVG_utf8) {
     return '"data:image/svg+xml;base64,' + encodedSVG_base64 + '"';
     } else {
     return '"data:image/svg+xml;utf8,' + encodedSVG_utf8 + '"';
     }
     */
}