插件生效，加载主题和插件安装器。
762293
public function activate(Composer $composer, IOInterface $io) {
        $manager = $composer->getInstallationManager();
        $manager->addInstaller(new Installer($io, $composer, 'witpact-theme'));
        $manager->addInstaller(new Installer($io, $composer, 'witpact-plugin'));
    }
431601
function libPkgPre() {
    var obj = {
            name: '',
            version: config.version,
            spm: config.spm
        },
        libCon, libsjs = '',
        key,
        libDir = dist_dir.js + '';
    obj.spm.main = 'libs.js';
    obj.spm.buildArgs = '--idleading {{name}} --include all';

    libCon = JSON.stringify(obj);
    fs.renameSync('package.json', 'package_bak.json');
    fs.writeFileSync('package.json', libCon); //生成库文件pkg配置
    var packages = [];
    for (key in obj.spm.dependencies) {
        if (obj.spm.inside[key]) {
            packages.push(obj.spm.inside[key]);
        } else {
            packages.push(key);
        }
    }
    for (var i = 0; i < packages.length; i++) {
        libsjs += "require('" + packages[i] + "');";
    }


    fs.writeFileSync('libs.js', libsjs); //写入口文件
    return libDir;
}
1127797
private function createStatic()
    {
        // 主题里面的静态文件
        $files = $this->fileSys->getFiles($this->themes_dir . DIRECTORY_SEPARATOR . 'static');
        // 文件拷贝
        array_walk($files, function ($file)
        {
            $search_str = $this->themes_dir . DIRECTORY_SEPARATOR . 'static';
            $replace_str = $this->public_dir . DIRECTORY_SEPARATOR . 'static';
            $to_path = str_replace($search_str, $replace_str, $file['file_path']);
            $this->fileSys->copy($file['file_path'], $to_path);
        });
    }
1174550
function (menuString) {
                console.log("正在渲染" + menutpl + "模板...");
                var info = fs.readFileSync(menutpl).toString();
                var files = info.replace("/**includeMenu**/", menuString);
                fs.writeFileSync(menuJs, files);
                console.log(menuJs + "生成成功！");
            }
1066773
public static function init()
    {
        $agents = SmsConfig::getAgents();
        if (!empty($agents)) {
            $ext_agent_namespace = SmsConfig::getAgentExtNamespace();
            foreach ($agents as $name => $config) {
                //优先注册扩展代理器
                if ($ext_agent_namespace != '') {
                    $ext_agent_classname = $ext_agent_namespace . $name;
                    if (class_exists($ext_agent_classname)) {
                        self::register($name, new $ext_agent_classname($config));
                        continue;
                    }
                }
                $agent_classname = 'Daijulong\\Sms\\Agents\\' . $name;
                if (class_exists($agent_classname)) {
                    self::register($name, new $agent_classname($config));
                }
            }
        }
    }
488110
function (cb) {
            debuglog('start load plugin [%s]', name);
            var realFactory = factory[factory.length - 1];
            // 将defaultConf转移至真实factory
            realFactory.defaultConf = factory.defaultConf;
            runFactory(realFactory, function () {
                clearTimeout(depsLoadTimeout);
                depsLoadTimeout = null;
                cb && cb();
            });
        }
322746
public function injectProps()
    {
        $className = $this->refClass->getParentClass()->getName();
        list($injects, $configs) = static::getInjects($className);

        // @inject()和@requestInject()注入
        foreach($injects as $propName => $annotations)
        {
            $annotation = reset($annotations);
            $propRef = $this->refClass->getProperty($propName);
            $propRef->setAccessible(true);
            $propRef->setValue($this->object, $annotation->getRealValue());
        }

        // 配置注入
        foreach($configs as $name => $value)
        {
            $propRef = $this->refClass->getProperty($name);
            if(null === $propRef)
            {
                continue;
            }
            $propRef->setAccessible(true);
            $propRef->setValue($this->object, $value);
        }
    }
1279644
function entry(args) {
    // 序列化请求参数，使之成为一个对象
    // https://www.npmjs.com/package/minimist
    args = minimist(process.argv.slice(2));

    // 初始化 Matman
    const matman = new Matman(args);
    const log = matman.log;

    // 校验
    if (!check(matman)) {
        process.exit(2);
    }

    // 初始化
    return matman.init([
        internalPluginConsole,
        internalPluginBuild,
        internalPluginInit
    ])
        .then(function () {
            let cmd = args._.shift();

            if (args.v || args.version) {
                cmd = 'version';
            } else if (args.h || args.help) {
                cmd = 'help';
            } else if (args.i || args.info) {
                cmd = 'info';
            } else if (!cmd) {
                cmd = 'info';
            } else if (!matman.cmd.get(cmd)) {
                cmd = 'help';
            }

            return matman.call(cmd, args)
                .then(function () {
                })
                .catch(function (err) {
                    console.log(err);
                });
        })
        .catch((err) => {
            if (err) {
                log.fatal(err);
            }

            process.exit(2);
        });
}
1116677
public function CreateUnimartB2CReturnOrder()
        {

            // 參數初始化
            $ParamList = [
                'MerchantID' => '',
                'AllPayLogisticsID' => '',
                'ServerReplyURL' => '',
                'GoodsName' => '',
                'GoodsAmount' => 0,
                'SenderName' => '',
                'SenderPhone' => '',
                'Remark' => '',
                'PlatformID' => '',
            ];
            $this->PostParams = $this->GetPostParams($this->Send, $ParamList);
            $this->PostParams['CollectionAmount'] = 0;
            $this->PostParams['ServiceType'] = 4; // 退貨不付款

            // 參數檢查
            $this->ValidateHashKey();
            $this->ValidateHashIV();
            $this->ValidateID('MerchantID', $this->PostParams['MerchantID'], 10);
            $this->ServiceURL = $this->GetURL('UNIMART_RETURN_ORDER');
            $this->ValidateID('AllPayLogisticsID', $this->PostParams['AllPayLogisticsID'], 20, true);
            $this->ValidateURL('ServerReplyURL', $this->PostParams['ServerReplyURL']);
            $this->ValidateString('GoodsName', $this->PostParams['GoodsName'], 60, true);
            $this->ValidateAmount('GoodsAmount', $this->PostParams['GoodsAmount']);
            $this->ValidateString('SenderName', $this->PostParams['SenderName'], 50);
            $this->ValidatePhoneNumber('SenderPhone', $this->PostParams['SenderPhone'], true);
            $this->ValidateString('Remark', $this->PostParams['Remark'], 20, true);
            $this->ValidateID('PlatformID', $this->PostParams['PlatformID'], 10, true);

            $MinAmount = 1; // 金額下限
            $MaxAmount = 19999; // 金額上限
            if ($this->PostParams['GoodsAmount'] < $MinAmount or $this->PostParams['GoodsAmount'] > $MaxAmount) {
                throw new Exception('Invalid GoodsAmount.');
            }

            // 產生 CheckMacValue
            $this->PostParams['CheckMacValue'] = ECPay_CheckMacValue::generate($this->PostParams, $this->HashKey, $this->HashIV);

            // 解析回傳結果
            // 正確：RtnMerchantTradeNo | RtnOrderNo
            // 錯誤：|ErrorMessage
            $Feedback = ECPay_IO::ServerPost($this->PostParams, $this->ServiceURL);
            $Pieces = explode('|', $Feedback);
            $Result = ['RtnMerchantTradeNo' => '', 'RtnOrderNo' => ''];
            if (empty($Pieces[0])) {
                $Result = ['ErrorMessage' => $Pieces[1]];
            } else {
                $Result['RtnMerchantTradeNo'] = $Pieces[0];
                $Result['RtnOrderNo'] = $Pieces[1];
            }

            return $Result;
        }
92848
public function CreateHomeReturnOrder()
        {

            // 參數初始化
            $ParamList = [
                'MerchantID' => '',
                'AllPayLogisticsID' => '',
                'LogisticsSubType' => '',
                'ServerReplyURL' => '',
                'SenderName' => '',
                'SenderPhone' => '',
                'SenderCellPhone' => '',
                'SenderZipCode' => '',
                'SenderAddress' => '',
                'ReceiverName' => '',
                'ReceiverPhone' => '',
                'ReceiverCellPhone' => '',
                'ReceiverZipCode' => '',
                'ReceiverAddress' => '',
                'GoodsAmount' => '',
                'GoodsName' => '',
                'Temperature' => Temperature::ROOM,
                'Distance' => Distance::SAME,
                'Specification' => Specification::CM_60,
                'ScheduledPickupTime' => ScheduledPickupTime::UNLIMITED,
                'ScheduledDeliveryTime' => '',
                'ScheduledDeliveryDate' => '',
                'PackageCount' => 0,
                'Remark' => '',
                'PlatformID' => '',
            ];
            $this->PostParams = $this->GetPostParams($this->Send, $ParamList);
            $this->PostParams['ScheduledPickupTime'] = ScheduledPickupTime::UNLIMITED; // 預定取件時段(ScheduledPickupTime)固定為不限時
            $IsAllpayLogisticsIdEmpty = false; // 物流交易編號(AllPayLogisticsID)是否為空
            $IsAllowEmpty = true;
            $MinAmount = 1; // 金額下限
            $MaxAmount = 20000; // 金額上限

            // 參數檢查
            $this->ValidateHashKey();
            $this->ValidateHashIV();
            $this->ValidateID('MerchantID', $this->PostParams['MerchantID'], 10);
            $this->ServiceURL = $this->GetURL('HOME_RETURN_ORDER');

            $this->ValidateID('AllPayLogisticsID', $this->PostParams['AllPayLogisticsID'], 20, true);

            $this->ValidateLogisticsSubType(true);

            // 物流交易編號(AllPayLogisticsID)與物流子類型(LogisticsSubType)擇一不可為空
            if (empty($this->PostParams['AllPayLogisticsID'])) {
                $IsAllpayLogisticsIdEmpty = true;
            }
            if ($IsAllpayLogisticsIdEmpty === true and empty($this->PostParams['LogisticsSubType'])) {
                throw new Exception('One of AllPayLogisticsID and LogisticsSubType is required.');
            }

            $this->ValidateURL('ServerReplyURL', $this->PostParams['ServerReplyURL']);

            // 物流交易編號(AllPayLogisticsID)為空值時，退貨人姓名(SenderName)不可為空。
            if ($IsAllpayLogisticsIdEmpty) {
                $IsAllowEmpty = false;
            }
            $this->ValidateString('SenderName', $this->PostParams['SenderName'], 10, $IsAllowEmpty);

            $this->ValidatePhoneNumber('SenderPhone', $this->PostParams['SenderPhone'], true);
            $this->ValidateCellphoneNumber('SenderCellPhone', $this->PostParams['SenderCellPhone'], true);
            // 物流交易編號(AllPayLogisticsID)為空值時，退貨人電話(SenderPhone)與退貨人手機(SenderCellPhone)擇一不可為空。
            if ($IsAllpayLogisticsIdEmpty) {
                if (empty($this->PostParams['SenderPhone']) and empty($this->PostParams['SenderCellPhone'])) {
                    throw new Exception('One of SenderPhone and SenderCellPhone is required.');
                }
            }

            // 物流交易編號(AllPayLogisticsID)為空值時，退貨人郵遞區號(SenderZipCode)不可為空。
            $this->ValidateZipCode('SenderZipCode', $this->PostParams['SenderZipCode'], $IsAllowEmpty);

            // 物流交易編號(AllPayLogisticsID)為空值時，SenderAddress(SenderAddress)不可為空。
            $this->ValidateAddress('SenderAddress', $this->PostParams['SenderAddress'], 6, 60, $IsAllowEmpty);

            // 若物流交易編號(AllPayLogisticsID)為空值時，收件人姓名(ReceiverName)不可為空。
            $this->ValidateString('ReceiverName', $this->PostParams['ReceiverName'], 10, $IsAllowEmpty);

            $this->ValidatePhoneNumber('ReceiverPhone', $this->PostParams['ReceiverPhone'], 20, true);
            $this->ValidateCellphoneNumber('ReceiverCellPhone', $this->PostParams['ReceiverCellPhone'], 20, true);
            // 物流交易編號(AllPayLogisticsID)為空值時，收件人電話(ReceiverPhone)與收件人手機(ReceiverCellPhone)擇一不可為空。
            if ($IsAllpayLogisticsIdEmpty) {
                if (empty($this->PostParams['ReceiverPhone']) and empty($this->PostParams['ReceiverCellPhone'])) {
                    throw new Exception('One of ReceiverPhone and ReceiverCellPhone is required.');
                }
            }

            // 若物流交易編號(AllPayLogisticsID)為空值時，收件人郵遞區號(ReceiverZipCode)不可為空。
            $this->ValidateZipCode('ReceiverZipCode', $this->PostParams['ReceiverZipCode'], $IsAllowEmpty);

            // 若物流交易編號(AllPayLogisticsID)為空值時，收件人地址(ReceiverAddress)不可為空。
            $this->ValidateAddress('ReceiverAddress', $this->PostParams['ReceiverAddress'], 6, 60, $IsAllowEmpty);

            if ($this->PostParams['LogisticsSubType'] == LogisticsSubType::ECAN and $this->PostParams['Temperature'] !== Temperature::ROOM) {
                // 物流子類型為宅配通(ECAN)時，溫層(Temperature)只能用常溫(ROOM)
                throw new Exception('Temperature should be ROOM when LogisticsSubType is ECAN.');
            }

            if ($this->PostParams['LogisticsSubType'] == LogisticsSubType::ECAN and date('Ymd', strtotime($this->PostParams['ScheduledDeliveryDate'])) < date('Ymd', strtotime('+3 day'))) {
                // 指定送達日期為該訂單建立時間 + 3 天
                throw new Exception('ScheduledDeliveryDate should be the time that create order + 3 day.');
            }

            $this->ValidateAmount('GoodsAmount', $this->PostParams['GoodsAmount']);
            if ($this->PostParams['GoodsAmount'] < $MinAmount or $this->PostParams['GoodsAmount'] > $MaxAmount) {
                throw new Exception('Invalid GoodsAmount.');
            }
            $this->ValidateString('GoodsName', $this->PostParams['GoodsName'], 60, true);
            $this->ValidateTemperature();
            $this->ValidateDistance();
            $this->ValidateSpecification();
            $this->ValidateScheduledDeliveryTime(true);
            $this->ValidateString('Remark', $this->PostParams['Remark'], 200, true);

            $this->ValidateID('PlatformID', $this->PostParams['PlatformID'], 10, true);

            // 產生 CheckMacValue
            $this->PostParams['CheckMacValue'] = ECPay_CheckMacValue::generate($this->PostParams, $this->HashKey, $this->HashIV);

            // 解析回傳結果
            // 正確：1|OK
            // 錯誤：0|ErrorMessage
            $Feedback = ECPay_IO::ServerPost($this->PostParams, $this->ServiceURL);
            $Result = $this->ParseFeedback($Feedback);

            return $Result;
        }
1273615
@SuppressWarnings("unchecked")
    protected void configure() {

        Properties properties = readDefaultConfig();

        Properties appProperties = new Props();

        List<String> appConf = Lists.newArrayListWithExpectedSize(configFiles.length);
        for (String conf : configFiles) {
            //读取应用程序配置
            URL appCfgUrl = readAppConfig(appProperties, conf);
            appConf.add(toExternalForm(appCfgUrl));
        }

        //获取应用程序模式
        try {
            mode = Mode.valueOf(appProperties.getProperty("app.mode").toUpperCase());
        } catch (Exception e) {
            mode = Mode.PRODUCT;
        }

        //设置应用程序名称
        setApplicationName(StringUtils.defaultString(appProperties.getProperty("app.name"), DEFAULT_APP_NAME));
        applicationVersion = appProperties.getProperty("app.version");
        if (StringUtils.isBlank(applicationVersion)) {
            applicationVersion = new UnknownVersion();
        }

        //配置日志器
        configureLogger(appProperties);

        if (!isInitialized())
            Ameba.printInfo();

        logger.info(Messages.get("info.init"));
        logger.info(Messages.get("info.app.conf", appConf));

        //读取模式配置
        readModeConfig(properties, mode);

        //读取模块配置
        readModuleConfig(properties, getMode().isDev());

        properties.putAll(appProperties);

        srcProperties.putAll((Map) properties);

        setEnvironmentConfig(srcProperties);

        addOnSetup(srcProperties);

        //转换jersey配置项
        convertJerseyConfig(srcProperties);

        //将临时配置对象放入应用程序配置
        addProperties(srcProperties);

        srcProperties = Collections.unmodifiableMap(srcProperties);

        registerBinder();

        configureExclude(srcProperties);

        //配置资源
        configureResource();

        //配置特性
        configureFeature(srcProperties);

        //配置服务器相关
        configureServer();

        //清空临时读取的配置
        properties.clear();

        scanClasses();

        addOnDone();

        addons = Collections.unmodifiableSet(addons);
        excludes = Collections.unmodifiableSet(excludes);

        logger.info(Messages.get("info.feature.load"));
    }
1195883
function initText(elem, parsed, extra){
  var param = extra.param;
  var throttle, lazy = param.lazy

  if('throttle' in param){
    // <input throttle r-model>
    if(param.throttle === true){
      throttle = 400;
    }else{
      throttle = parseInt(param.throttle, 10)
    }
  }

  var self = this;
  var wc = this.$watch(parsed, function(newValue){
    if(elem.value !== newValue) elem.value = newValue == null? "": "" + newValue;
  }, STABLE);

  // @TODO to fixed event
  var isCompositing = false;
  var handler = function (ev){

    if(isCompositing) return;

    isCompositing = false;

    var that = this;
    if(ev.type==='cut' || ev.type==='paste'){
      _.nextTick(function(){
        var value = that.value
        parsed.set(self, value);
        wc.last = value;
        self.$update();
      })
    }else{
        var value = that.value
        parsed.set(self, value);
        wc.last = value;
        self.$update();
    }
  };

  function onCompositionStart(){
    isCompositing = true;
  }

  function onCompositionEnd(ev){
    isCompositing = false;
    handler.call(this,ev)
  }

  if(throttle && !lazy){
    var preHandle = handler, tid;
    handler = _.throttle(handler, throttle);
  }

  if(hasInput === undefined){
    hasInput = dom.msie !== 9 && "oninput" in document.createElement('input')
  }

  if(lazy){
    dom.on(elem, 'change', handler)
  }else{

    if(typeof CompositionEvent === 'function' ){ //lazy的情况不需要compositionend
      elem.addEventListener("compositionstart", onCompositionStart );
      elem.addEventListener("compositionend", onCompositionEnd );
    }

    if( hasInput){
      elem.addEventListener("input", handler );
    }else{
      dom.on(elem, "paste keyup cut change", handler)
    }
  }
  if(parsed.get(self) === undefined && elem.value){
     parsed.set(self, elem.value);
  }
  return function (){
    if(lazy) return dom.off(elem, "change", handler);
    if( hasInput ){
      elem.removeEventListener("input", handler );
    }else{
      dom.off(elem, "paste keyup cut change", handler)
    }
  }
}
410563
public static PreparedStatement prepareStatement(Connection conn, String sql, Object... params) throws SQLException {
		Assert.notBlank(sql, "Sql String must be not blank!");

		sql = sql.trim();
		SqlLog.INSTASNCE.log(sql, params);
		PreparedStatement ps;
		if (StrUtil.startWithIgnoreCase(sql, "insert")) {
			// 插入默认返回主键
			ps = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
		} else {
			ps = conn.prepareStatement(sql);
		}
		return fillParams(ps, params);
	}
163729
function addEntries(env, webpackConfig) {
    // 指定入口的 js 文件和 html 文件的路径, 默认相对于 src 目录(根目录)
    wieldyWebpack.createEntry('index/index.js', 'index.html', {
        env: env,
        // 有多个入口时, 在创建时需要设置 setChunks 为 true
        setChunks: true
    }).addToWebpackConfig(webpackConfig);

    // 使用 layout 机制
    wieldyWebpack.createEntry('about/about.js', 'about/about.html', {
        title: 'wieldy-webpack 多入口示例项目 about',
        env: env,
        setChunks: true
    }).useLayout('layout.html', {
        env: {
            __body_start__: '<p>测试</p>'
        }
    }).addToWebpackConfig(webpackConfig);

    // 使用 layout 机制时可以不指定入口的 html 文件
    wieldyWebpack.createEntry('login/login.js', '', {
        title: 'wieldy-webpack 多入口示例项目 login',
        env: env,
        setChunks: true
    }).useLayout('layout.html', {
        env: {
            __body_start__: `
                <h1>登录</h1>
                <ul>
                    <li><a href="/index.html">首页</a></li>
                    <li><a href="/about/about.html">关于</a></li>
                    <li><a href="/login/login.html">登录</a></li>
                </ul>
            `
        }
    }).addToWebpackConfig(webpackConfig);
}
447510
private function resolveMysqlOrPostgresqlParameters()
    {
        /** @var IConfig $config */
        $config = $this->di->getShared('config');

        //判断是否主从
        $isMaster = (bool)$config->get($this->getName() . '.is_master', true);
        if ($isMaster) {
            $normalParameters = [
                'host' => '',
                'dbname' => '',
                'username' => '',
                'password' => '',
                'port' => '',
                'charset' => 'UTF8'
            ];
            $parameters = array_intersect_key($config->get($this->getName()), $normalParameters);

        } else {
            $connections = $config->get($this->getName() . '.connections');
            if (!is_array($connections)) {
                throw new \InvalidArgumentException(
                    sprintf('Invalid %s parameters. It must be array.', $this->getName() . '.connections')
                );
            }
            $connections = array_shift($connections);
            $parameters = array_rand($connections);
        }

        if (!is_array($parameters)) {
            throw new \InvalidArgumentException(
                sprintf('invalid %s parameters.', $this->getName())
            );
        }
        if (!isset($parameters['host']) || !$parameters['host']) {
            throw new \InvalidArgumentException('host is not set.');
        }
        if (!isset($parameters['dbname']) || !$parameters['dbname']) {
            throw new \InvalidArgumentException('database name is not set.');
        }
        if (!isset($parameters['username']) || !$parameters['username']) {
            throw new \InvalidArgumentException('database name is not set.');
        }
        if (!isset($parameters['password']) || !$parameters['password']) {
            throw new \InvalidArgumentException('database name is not set.');
        }
        if (!isset($parameters['port']) || !$parameters['port']) {
            $parameters['port'] = 3306;
        }
        if (!Validator::port($parameters['port'])) {
            throw new \InvalidArgumentException(
                sprintf('invalid memcache port: %s', $parameters['port'])
            );
        }
        //设置编码
        if (!isset($parameters['charset'])) {
            $parameters['charset'] = 'UTF8';
        }
        $parameters['options'][\PDO::MYSQL_ATTR_INIT_COMMAND] = sprintf('SET NAMES \'%s\'', $parameters['charset']);
        unset($parameters['charset']);
        return $parameters;
    }
1198554
function insertQueue(queue, resource) {
    let len = queue.length;
    let curResource;
    let insertPosition = queue.length;
    let requires;
    let attr;

    if (resource.type === 'js') {
        requires = resource.requiredModules;
        attr = 'requiredModules';
    } else if (resource.type === 'css') {
        attr = 'requiredCSS';
        requires = resource.requiredCSS;
    }

    for (let i = 0; i < len; ++i) {
        curResource = queue[i];
        // 遇到资源依赖项
        if (requires.indexOf(curResource.id) > -1) {
            insertPosition = i + 1;
            continue;
        }
        // 遇到依赖资源项
        if (curResource[attr].indexOf(resource.id) > -1) {
            insertPosition = i;
            break;
        }
    }

    queue.splice(insertPosition, 0, resource);
}
103528
function initApp(options,app) {    
    app.set('trust proxy', 1);

    //在中间件之前使用中间件
    if(options.beforeMid) {
        options.beforeMid(app,middlewares);
    }

    //session中间件
    app.use(session(options.session));
    //cookies解析中间件
    app.use(cookieParser());
    //日志中间件
    app.use(morgan('combined'));
    //faviocn中间件
    app.use(favicon(options.public +path.sep+'favicon.ico'));
    //spm调试中间件
    if (env === 'development') {
        app.use(serveSPM(options.client, {
            log: console.log
        }));
        app.use(express.static(options.public));
    } else if (env === 'test') {
        //静态目录
        app.use(express.static(options.public));
    }

    //声明小部件目录
    hbs.registerPartials(options.partials);

    //设置handlebars视图引擎
    app.set('view engine', options.tempExt);
    app.engine(options.tempExt, hbs.__express);
    app.set('views', options.views);

    //body 序列化
    app.use(bodyParser.json());
    app.use(bodyParser.urlencoded({
        extended: false,
        limit:options.bodyLimit||'1000kb'
    }));

    return app;
}