public function testClear() { $prepare = new Prepare(); $prepare('foo'); $this->assertEquals(1, count($prepare->getParameters())); $prepare->clear(); $this->assertEquals(0, count($prepare->getParameters())); }
public static function element($tagNameOrElementOptions, $contentValue = null, $contentType = Glaze::TYPE_TEXT) { $element = Prepare::element($tagNameOrElementOptions, $contentValue, $contentType); if (burntCheck($element, false) !== false) { $element->serve(); } }
/** * Appends a new HTML comment. */ public function appendInvisibleComment($contentValue = null, $contentType = Glaze::TYPE_TEXT) { $content = Prepare::invisibleComment($contentValue, $contentType); if (!isset($content) || $content === false) { return; } $this->appendPreparedItem($content); return $content; }
function run() { DB::escapePost(); Prepare::run(); $this->redirect('/prepare/'); }
<?php /** * 处理下百科里的词状态正常的产品 */ $prepare = new Prepare(); $prepare->run(); class Prepare { private $env = "product"; public function __construct() { if ($this->env == "dev") { $this->conn = new Table("local189"); $this->beanstalk = new \Phalcon\Queue\Beanstalk(array("host" => "192.168.8.189", "port" => 11300)); } else { $this->conn = new Table("txonline"); $this->beanstalk = new \Phalcon\Queue\Beanstalk(array("host" => "172.17.16.101", "port" => 11300)); } } public function run() { $fp = fopen("chongfu.txt", "r"); while (!feof($fp)) { $keyword = trim(fgets($fp)); if (empty($keyword)) { continue; } $dataRs = $this->conn->findOne("select id, keyword, state from gckeyword.key_proword where keyword = '" . $keyword . "' limit 1"); if (empty($dataRs)) { echo "关键词 " . $keyword . " 不存在\n";
function setPage($item) { $sql = ' INSERT INTO {{tree}} SET parent=' . $item['tree']['parent'] . ', name=\'' . $item['tree']['name'] . '\', seo_title=\'' . $item['tree']['seo_title'] . '\', seo_keywords=\'' . $item['tree']['seo_keywords'] . '\', seo_description=\'' . $item['tree']['seo_description'] . '\', site=\'' . $item['tree']['site'] . '\', path=\'' . $item['tree']['path'] . '\', visible=' . $item['tree']['visible'] . ', menu=0, cdate=\'' . $item['tree']['cdate'] . '\', mdate=\'' . $item['tree']['mdate'] . '\', udate=\'' . $item['tree']['udate'] . '\', num=' . $item['tree']['num'] . ' '; if (Prepare::$show == 1) { print DB::prefix($sql); } else { DB::exec($sql); } $newid = mysql_insert_id(); $sql = ' INSERT INTO {{relations}} SET modul1=\'tree\', modul2=\'' . Prepare::$module . '\', id1=' . $newid . ', id2=1, cdate=NOW() '; if (Prepare::$show == 1) { print DB::prefix($sql); } else { DB::exec($sql); } foreach ($item['data'] as $row) { Prepare::field($newid, $row); } }
<?php /** * 初始化下类目信息 */ $prepare = new Prepare(); $prepare->runAction(); class Prepare { public function __construct() { $this->conn = new Table("local189"); } public function runAction() { //$this->initNewcaijiCate(); //$this->getMuchParent(); //$this->updateLevel(); //$this->updateRelaToCateinfo(); //$this->initLeafCate(); //$this->initOldLeafCate(); //$this->initCateZh(); //$this->scanLeafCateFormap(); //$this->signIsmap(); /* 初始化fbcate_relation_map表 */ $this->initNewcateRelationMap(); } /** * 初始化新分类下的所有对应关系 * * @Author tianyunzi
public function finishCapturingContent($contentType = Glaze::TYPE_UNSAFE_HTML) { $capturedHTMLContent = ob_get_clean(); $preparedContent = Prepare::content($capturedHTMLContent, $contentType); $this->appendPreparedItem($preparedContent); }
<?php /** * 初始化关键词打入队列处理 */ $prepare = new Prepare(); $prepare->runCom(); class Prepare { public function __construct() { require "./SocketBeanstalk.php"; $this->beanstalk = new SocketBeanstalk(array("host" => "192.168.8.189", "port" => 11300)); $this->conn = new Table("forbuyers"); } public function run() { $kid = 0; while (1) { $mysqlRs = $this->conn->findAll("select kid, keyword from f_keyword_product where kid > '" . $kid . "' order by kid asc limit 100"); if (empty($mysqlRs)) { break; } foreach ($mysqlRs as $value) { $kid = $value["kid"]; $this->writeBeans($value["keyword"]); } } } public function runCom() {
public function testHasValidationConstraints() { $collection = $this->method->getValidationConstraints(); $this->assertInstanceOf('Symfony\\Component\\Validator\\Constraints\\Collection', $collection); }