/** * * * @file function.import_js.php * @package plugins * @author wangpeng20@baidu.com * @date 2012-12-17 10:47 */ function importTangram($files, $returnFile = true, &$config) { // global $MATCHED, $DEBUG, $IMPORTED; $MATCHED =& $config['MATCHED']; $DEBUG =& $config['DEBUG']; $IMPORTED =& $config['IMPORTED']; $output = ""; if (is_string($files)) { $files = array($files); } else { if (!is_array($files)) { return $output; } } if ($DEBUG) { var_dump($files); } foreach ($files as $file) { if (strrpos($file, '*')) { $output .= importTangram(getPackage(str_replace(array(".", '*'), array('/', ''), $file)), true, $config); } elseif (in_array($file, $IMPORTED)) { continue; } else { $IMPORTED[] = $file; // echo "file name:".$file."\n"; $file = str_replace(".", '/', $file) . ".js"; // echo "file name:".$file."\n"; // echo "\n"; if ($DEBUG) { echo "Importing: " . $file . ", returnFile {$returnFile}\n"; } if (!in_array($file, $MATCHED)) { $content = file_get_contents(getRealFilePath($file, $config['PATH'])); if (!$content) { if ($DEBUG) { echo "no content... \n;"; } continue; } $MATCHED[] = $file; $matches = array(); //去掉注释 $content = trim(preg_replace("/\\/\\*(.*?)\\*\\//ies", "", $content)); $output .= preg_replace("/\\/\\/\\/import\\s+([\\w\\-\$]+(\\.[\\w\\-\$]+)*);?/ies", "importTangram('\\1',true,\$config)", $content); } } } return $output; }
function importTangram($files, $returnFile = true){ global $MATCHED, $DEBUG, $IMPORTED; $output = ""; if(is_string($files)){ $files = array($files); }else if(!is_array($files)){ return $output; } if($DEBUG) var_dump($files); foreach($files as $file){ if(strrpos($file, '*')){ $output .= importTangram(getPackage(str_replace(array(".", '*'), array('/', ''), $file))); }elseif(in_array($file, $IMPORTED)){ continue; }else{ $IMPORTED[] = $file; // echo "file name:".$file."\n"; $file = str_replace(".", '/', $file) . ".js"; // echo "file name:".$file."\n"; // echo "\n"; if($DEBUG) echo "Importing: " . $file . ", returnFile $returnFile\n"; if(!in_array($file, $MATCHED)){ $content = file_get_contents(getRealFilePath($file)); if(!$content){ if($DEBUG) echo "no content... \n;"; continue; } $MATCHED[] = $file; $matches = array(); //去掉注释 $content = trim(preg_replace("/\/\*(.*?)\*\//ies", "", $content)); $output .= preg_replace("/\/\/\/import\s+([\w\-\$]+(\.[\w\-\$]+)*);?/ies", "importTangram('\\1')", $content); } } } return $output; }
function importTangram($files, $returnFile = true) { global $MATCHED, $DEBUG, $IMPORTED; $output = ""; if (is_string($files)) { $files = array($files); } else { if (!is_array($files)) { return $output; } } if ($DEBUG) { var_dump($files); } foreach ($files as $file) { if (strrpos($file, '*')) { $output .= importTangram(getPackage(str_replace(array(".", '*'), array('/', ''), $file))); } elseif (in_array($file, $IMPORTED)) { continue; } else { $IMPORTED[] = $file; $file = str_replace(".", '/', $file) . ".js"; if ($DEBUG) { echo "Importing: " . $file . ", returnFile {$returnFile}\n"; } if (!in_array($file, $MATCHED)) { $content = getFileContents($file); if (!$content) { if ($DEBUG) { echo "no content... \n;"; } continue; } $MATCHED[] = $file; $matches = array(); //去掉注释 $content = trim(preg_replace("/\\/\\*(.*?)\\*\\//ies", "", $content)); $output .= preg_replace("/\\/\\/\\/+\\s*import\\s+([\\w\\-\$]+(\\.[\\w\\-\$]+)*);?/ies", "importTangram('\\1')", $content); } } } return $output; }
return $argv[$argc - 1]; } /** * Find the package to work on * @param $argc * @param $argv * @return string */ function getPackage($argc, $argv) { if ($argc == 3) { return $argv[1]; } return 'app'; } // Prepare the autoloader require_once __DIR__ . '/autoload.php'; require_once __DIR__ . '/AppKernel.php'; use snb\http\Request; // Create the app kernel and boot the system $app = new AppKernel('dev', microtime(true)); $app->boot(); // Get the migration manager $migrate = $app->container->get('db.migrate'); // Decide what migration to perform and do it $cmd = getCommand($argc, $argv); $package = getPackage($argc, $argv); performMigration($cmd, $package, $migrate); // Show the results $logger = $app->container->get('logger'); $logger->dump();
$appid2 = "wx3e7ddcfb2e2e59ee"; //替换appid $appkey2 = "62PNF9abhLg4DsbYkrgrlNrZB8xaDK7MKWoWC6WibB96n25pKJD4pMvsksxZlTn5rE0VIjIyMxdu3a3TUEt72fZjpwG7WFeZcnT5VTXzzwWib4zd10r038ztHXFMlyn3"; //替换appkey $partner2 = "1220019101"; //替换partnerid $partnerKey2 = "b01d961b83bd549b5593f0f0a41b18a2"; //替换partnerkey $notify_url2 = "http://www.jinguishop.com/auth/wxpaynotify.php"; $input_charset2 = "UTF-8"; //传递下列参数 $body2 = !empty($_GET['orderName']) ? $_GET['orderName'] : ''; $out_trade_no2 = !empty($_GET['orderid']) ? $_GET['orderid'] : ''; //订单号,商户需要保证该字段对于本商户的唯一性 $total_fee2 = !empty($_GET['price']) ? $_GET['price'] : ''; $packageString = getPackage($body2, $input_charset2, $notify_url2, $out_trade_no2, $partner2, $spbill_create_ip2, $total_fee2, $partnerKey2); $time_stamp = time(); $nonce_str = randomkeys(); $sign = getSign($appid2, $appkey2, $nonce_str, $packageString, $time_stamp); function getPackage($body2, $input_charset2, $notify_url2, $out_trade_no2, $partner2, $spbill_create_ip2, $total_fee2, $partnerKey2) { $banktype = "WX"; $fee_type = "1"; //费用类型,这里1为默认的人民币 $body = $body2; $input_charset = $input_charset2; $notify_url = $notify_url2; $out_trade_no = $out_trade_no2; $partner = $partner2; $spbill_create_ip = $spbill_create_ip2; $total_fee = $total_fee2;
$start = 0; } $count = 0; // needs to be here $packages = queryPackages($_GET['f'], $_GET['q'], 'package,name,tag', $count, $start, $step, 'name'); $output .= getSearchResultsHTML($packages, $count, $start, $step); } else { $output .= getSearchFormHTML(); $output .= 'No Results!'; } } echo $output; } else { if (isset($_GET['id']) && $_GET['id'] != '') { header('content-type: text/html'); $package = getPackage($_GET['id']); $output = ''; if ($package) { $output .= getSinglePackageResultHTML($package); } else { $output .= 'Package Doesn\'t Exist!' . "\n"; } echo $output; } else { if (isset($_GET['pageid'])) { if ($_GET['pageid'] == 'faqs') { header('content-type: text/html'); $output = ''; $output .= file_get_contents('faqs.data'); echo $output; }