private function createBottomTreeDom() { $mainDiv = new Div(); $mainDiv->addStyleClass("bottom_panel"); $div01 = new Div(); $mainDiv->addChild($div01); $div01->addStyleClasses(["bottom_panel_window"]); $container = new Div(); $container->addStyleClasses(["bottom_panel_item", "w-31p"]); $container->updateId("bottom_catalog_tree"); $containerChild = new Div(); $containerChild->addStyleClasses(["catalog"]); $container->addChild($containerChild); $div01->addChildList([$container]); $mainTitle = new A(); $mainTitle->addChild("Каталог"); $mainTitle->addAttribute("href", Labels::$TOP_NAVIGATION_LINKS["catalog"]); $mainTitle->addStyleClasses(["f-16", "title"]); $containerChild->addChild($mainTitle); $treeContainer = new Div(); $treeContainer->addStyleClass("content"); $containerChild->addChild($treeContainer); $this->treeProcessBottom($this->mainTree, $treeContainer); return $mainDiv; }
function foo() { $a = new A(); $a->foo(); $a->bar(); # $a->baz(); }
function foo() { $a = new A(); $a->foo(); $a->field = 123; $a->foo(); }
function main() { $a = new A(); $a->foo = 12; $a->f(); inOtherUnit(1, 2); }
public function __construct() { $str = 'string'; $a = new A(); $str = $a->str(); $this->a = $a->instance(); }
private function mainTreeRender(Tree &$tree, $selectedKey) { $li = new Li(); $mainDiv = new Div(); $mainDiv->addStyleClasses(["expand", "text_non_select", "tree_text_node", "input_hover"]); $table = new Table(); $tr = new Tr(); $nodeIcon = new Td(); $nodeText = new Td(); $nodeText->addStyleClass("tree_text"); $nodeSearchCount = new Td(); $nodeSearchCount->addStyleClass("tree_search_count"); if (count($tree->childrens) > 0) { $nodeIcon->addStyleClasses(["tree_btn"]); $icon = new Img(); $icon->addAttribute("style", "top: 2px; position: relative; margin: 0 5px;"); $icon->addAttribute("src", $this->treeLevel <= $this->DEFAULT_TREE_LEVEL_TO_SHOW || $tree->show ? "images/arrow90.png" : "images/arrow00.png"); $nodeIcon->addChild($icon); } else { $nodeIcon->addStyleClass("tree_empty"); } $link = new A(); $link->addAttribute("href", URLBuilder::getCatalogLinkForTree($tree->key)); $link->addChild($tree->value); $link->addStyleClass("input_hover"); $nodeSelected = new Div(); $nodeSelected->addStyleClass($tree->key == $selectedKey ? 'selected' : 'tree_empty'); $link->addChild($nodeSelected); $nodeText->addChild($link); return $li->addChild($mainDiv->addChild($table->addChild($tr->addChildList([$nodeIcon, $nodeText, $nodeSearchCount])))); }
function bar() { $obj = new A(); $obj->foo(); $obj = new B(); $obj->foo(); }
function f() { $a = new A(); for ($i = 0; $i < 1000000; $i++) { $a->g(); } }
function bar() { $obj = new A(); $obj->foo(123); $obj = new B(); $obj->foo(123, 456); }
public function testStubWithMockFailsExpectation() { $this->stubWithMock('A', function ($test, $mock, $args) { $mock->expects($test->once())->method('B')->with($test->equalTo('FAILURE'))->will($test->returnValue(7)); }, array(), false); $x = new A(); $this->assertEquals(7, $x->B('abc')); }
public function getLink($pageNumber, $num) { $mainTag = new A(); $mainTag->addStyleClasses(["link_style", "cursor_pointer", "text_non_select", "f-15", "input_hover"]); $mainTag->addAttribute("href", URLBuilder::getCatalogLinkNumeric($pageNumber, $num)); $mainTag->addChild($pageNumber); return $mainTag; }
function test() { $a = new A(); echo $a->foo(); $a = new B(); echo $a->foo(555); echo $a->foo(); }
public function getPaginationLinks($pageNumber, $num, $totalCount, $topBottom) { $mainTag = new Div(); $catalogLink = new CatalogLink(); $dots = false; $topBottomStyle = $topBottom == 'bottom' ? 'link_next_prev_bottom' : ''; if ($totalCount != 0) { $amountPages = ceil($totalCount / $num); if ($pageNumber > 0 && $pageNumber <= $amountPages) { $mainTag->addStyleClasses(["pagination_bar", "right_top_bar", $topBottomStyle]); $brokerTag = new Div(); $mainTag->addChild($brokerTag); $tagCenterContainer = new Span(); if ($pageNumber != 1) { $tagPrevious = new A(); $tagPrevious->addStyleClasses(["f-16", "text_non_select", "link_style", "link_next_prev", "input_hover", "prev_link"]); $tagPrevious->addAttribute("href", URLBuilder::getCatalogLinkPrev($pageNumber, $num)); $text = new Div(); $text->addStyleClass("text"); $text->addChild("назад"); $arrow = new Div(); $arrow->addStyleClass("arrow"); $tagCenterContainer->addChild($tagPrevious->addChildList([$arrow, $text])); } $brokerTag->addChild($tagCenterContainer); $tagCenterContainer->addStyleClasses(["numeric_links", "f-15"]); for ($currentRenderPage = 1; $currentRenderPage <= $amountPages; $currentRenderPage++) { if ($currentRenderPage < 2 || $currentRenderPage > $pageNumber - $this->linksGroupCount && $currentRenderPage < $pageNumber + $this->linksGroupCount || $currentRenderPage > $amountPages - 1) { $dots = false; if ($currentRenderPage != $pageNumber) { $tagCenterContainer->addChild($catalogLink->getLink($currentRenderPage, $num)); } else { $emptyLinkView = $catalogLink->getEmptyLink($pageNumber); $emptyLinkView->addStyleClass("f-16"); $tagCenterContainer->addChild($emptyLinkView); } } else { if (!$dots) { $dots = true; $tagCenterContainer->addChild($catalogLink->get3dots()); } } } if ($pageNumber != $amountPages) { $tagNext = new A(); $tagNext->addStyleClasses(["f-16", "text_non_select", "link_style", "input_hover", "link_next_prev", "next_link"]); $tagNext->addAttribute("href", URLBuilder::getCatalogLinkNext($pageNumber, $num)); $text = new Div(); $text->addStyleClass("text"); $text->addChild("вперед"); $arrow = new Div(); $arrow->addStyleClass("arrow"); $tagCenterContainer->addChild($tagNext->addChildList([$text, $arrow])); } } } return $mainTag; }
public function foo() { $a = new A(); $a->foo(); $b = new Boo(); $b->foo(); $c = new Clo(); $c->foo(); }
function test2ClosureAccess() { $obj = new A(); $obj->mul1 = function ($a, $b) { return $a * $b; }; for ($i = 0; $i < TIMES; $i++) { assert($obj->mul1(10, 10) === 100); } }
function main() { $obja = new A(); $obja->entry(); A::static_entry(); call_user_func('A::foo'); call_user_func(array('A', 'foo')); call_user_func(array($obja, 'foo')); // raises warning; no call to __callStatic caller(); }
public function testObservable() { $a = new A(); $a->on('Hello', function ($name) { echo 'Hello ', $name, "\n"; }); $a->on('Hello', function ($name) { echo 'Hello again ', $name, "\n"; }); ob_start(); $a->trigger('Hello', 'lloyd'); $this->assertEquals("Hello lloyd\nHello again lloyd\n", ob_get_clean()); return $a; }
function twitterBadge($userEmail, $userPassword, $count = 4) { $json = new Services_JSON(); // Create the twitter Cacher object to pull feed // Password is needed in case feed is protected // HTTP Basic Auth hasn't been deprecated...yet...so...lazy wins for now $tc = new TwitterCacher($userEmail, $userPassword); $tc->setUserAgent("Mozilla/5.0 (compatible; TwitterCacher/1.0; +http://www.kolich.com)"); //echo '<!-- ' . $tc->getUserTimeline(4) . ' -->'; //Create a timeline object of the feed (pull from live if old) $timeline = $json->decode($tc->getUserTimeline($count)); if (!$timeline) { return '<p>Error locating tweets.</p>'; } // Create unorderer list of tweets (see gagawa module) $ul = new Ol(); foreach ($timeline as $tweet) { $text = $tweet->text; //Format date as 5 min ago, 2 hours ago, etc. $date = distance_of_time_in_words(strtotime($tweet->created_at)) . ' ago'; // Tweet source, i.e. twhril, tweetie, tweetdeck, etc. // $source = $tweet->source; // Generate direct link to tweet $tweetid = $tweet->id; $screenname = $tweet->user->screen_name; $tweetlink = 'http://twitter.com/' . $screenname . '/status/' . $tweetid; // Turn links into links $text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\\+.~#?&//=]+)', '<a href="\\1" target="_blank">\\1</a>', $text); // Turn twitter @username into links to the users Twitter page $text = preg_replace('/(^|\\s)@(\\w+)/', '\\1<a href="http://www.twitter.com/\\2">@\\2</a>', $text); // Turn #hashtags into searches $text = preg_replace('/(^|\\s)#(\\w+)/', '\\1<a href="http://search.twitter.com/search?q=%23\\2">#\\2</a>', $text); // Personal Formatting, see Gagawa for documentaiton. // <li>Tweet Text <span>(<a href="linktotweet">some time ago</a>)<span></li> $li = new Li(); $ul->appendChild($li); $li->appendChild(new Text($text . ' (')); $span = new Span(); $link = new A(); $link->setHref($tweetlink); $link->appendChild(new Text($date)); $span->appendChild($link); $li->appendChild($span); $li->appendChild(new Text(')')); } //end foreach( $timeline as $tweet ) // Returns the stack of li's enclosed by ul return $ul->write(); }
public function testSiblings() { $node = new Node(); $node->appendChild($a = new A()); $b = new B($node); $node->prependChild($c = new C()); $node->appendChild($d = new D()); $a->remove(); $this->assertSame(null, $c->getPreviousSibling()); $this->assertSame($b, $c->getNextSibling()); $this->assertSame(null, $d->getNextSibling()); $this->assertSame($b, $d->getPreviousSibling()); $this->assertSame($c, $b->getPreviousSibling()); $this->assertSame($d, $b->getNextSibling()); }
/** * Маршрутизатор действий. */ function Action($action) { $res = false; switch ($action) { case "save": $res = $this->SavePage(); break; case "fld_add": $res = $this->AddField(); break; case "fld_edit": $res = $this->EditField(); break; case "fld_del": $res = $this->DelField(); break; case "delarch": $res = $this->delArch(); break; case "delete": $res = $this->Delete(); break; } if ($res) { A::goUrl("admin.php?mode=sections&item=" . SECTION, array('tab', 'page')); } }
public function foo3() { $this->foo(); // $this changes 'static' parent::foo(); // 'parent' doesn't change 'static' }
public static function getInstance() { if (!self::$instance) { self::$instance = new A(); } return self::$instance; }
static function factory() { if (self::$singleton === null) { self::$singleton = new a(); } return self::$singleton; }
public function a() { if (null === ($rs = parent::a())) { $rs = new B(); } return $rs; }
public function __construct() { var_dump(self::method()); var_dump(parent::method()); var_dump(self::$property); var_dump(parent::$property); }
public function returnsThis() { if (null === ($rs = parent::returnsThis())) { $rs = new B(); } return $rs; }
function test() { A::test1(1, 'a'); B::test2(1, 'a'); self::test3(1, 'a'); parent::test4(1, 'a'); }
function Action($action) { $res = false; switch ($action) { case "add": $res = $this->Add(); break; case "edit": $res = $this->Edit(); break; case "del": $res = $this->Del(); break; case "addurl": $res = $this->AddUrl(); break; case "editurl": $res = $this->EditUrl(); break; case "delurl": $res = $this->DelUrl(); break; } if ($res) { A::goUrl("admin.php?mode=structures&item=" . ITEM, array('idv', 'tab')); } }
public function __get($propertyName) { echo 'B1'; parent::__get($propertyName); if ($propertyName == 'E') { $this->E = 6; } }
/** * Test the getInstance method */ public function testSingleton() { $a1 = A::getInstance(); $a2 = A::getInstance(); $this->assertEquals($a1, $a2); $b = B::getInstance(); $this->assertNotEquals($a1, $b); }