本文整理汇总了PHP中Component类的典型用法代码示例。如果您正苦于以下问题:PHP Component类的具体用法?PHP Component怎么用?PHP Component使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Component类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: onInherit
public function onInherit(Component &$component)
{
if (!PropertyResolver::hasProperty($this->getModelObject(), $component->getId())) {
return null;
}
return new WrappedCompoundModel($this);
}
开发者ID:picon,项目名称:picon-framework,代码行数:7,代码来源:CompoundPropertyModel.php
示例2: test_generic_component
function test_generic_component()
{
$bodyStyle = new StyleCollection("body", "hey", "Body Style", "Global style settings.");
$bodyStyle->addSP(new BackgroundColorSP("#FFFCF0"));
$bodyStyle->addSP(new ColorSP("#2E2B33"));
$bodyStyle->addSP(new FontSP("Verdana", "10pt"));
$mainBoxStyle = new StyleCollection("*.mainBoxStyle", "mainBoxStyle", "Main Box Style", "Style for the main box.");
$mainBoxStyle->addSP(new BackgroundColorSP("#FFF3C2"));
$mainBoxStyle->addSP(new BorderSP("1px", "solid", "#2E2B33"));
$mainBoxStyle->addSP(new WidthSP("750px"));
$mainBoxStyle->addSP(new MarginSP("5px"));
$mainBoxStyle->addSP(new PaddingSP("5px"));
$comp1 = new Component(null, BLANK, 3);
$style = $comp1->addStyle($bodyStyle);
$this->assertReference($style, $bodyStyle);
$comp1->addStyle($mainBoxStyle);
$this->assertReference($comp1->_styleCollections["body"], $bodyStyle);
$this->assertReference($comp1->_styleCollections["*.mainBoxStyle"], $mainBoxStyle);
$this->assertIdentical($comp1->getType(), BLANK);
$this->assertReference($comp1->getStyle("body"), $bodyStyle);
$comp2 = new Component(null, BLANK, 3, $bodyStyle, $mainBoxStyle);
$this->assertIdentical($comp2->_styleCollections["body"], $bodyStyle);
$this->assertIdentical($comp2->_styleCollections["*.mainBoxStyle"], $mainBoxStyle);
$this->assertIdentical($comp1->getType(), BLANK);
$this->assertIdentical($comp2->getIndex(), 3);
$this->assertIdentical($comp1, $comp2);
$style = $comp1->removeStyle("body");
$this->assertReference($style, $bodyStyle);
$this->assertTrue(!isset($comp1->_styleCollections["body"]));
}
开发者ID:adamfranco,项目名称:harmoni,代码行数:30,代码来源:ComponentsTestCase.class.php
示例3: isComponentInstantiationAuthorised
public function isComponentInstantiationAuthorised(Component $component)
{
if ($component instanceof WebPage && $component->getIdentifier()->of($this->pageAuthIdentifier)) {
return $this->isAuthorised();
}
return true;
}
开发者ID:picon,项目名称:picon-framework,代码行数:7,代码来源:AbstractPageClassAuthorisationStrategy.php
示例4: attach
/**
* Attaches the behavior object to the component.
* The default implementation will set the [[owner]] property
* and attach event handlers as declared in [[events]].
* Make sure you call the parent implementation if you override this method.
* @param Component $owner the component that this behavior is to be attached to.
*/
public function attach($owner)
{
$this->owner = $owner;
foreach ($this->events() as $event => $handler) {
$owner->on($event, is_string($handler) ? [$this, $handler] : $handler);
}
}
开发者ID:ajnok,项目名称:yii2book,代码行数:14,代码来源:Behavior.php
示例5: get
public static function get(Component $component)
{
if ($component->getParent() == null && !$component instanceof WebPage) {
trigger_error('It is not safe to rely on the localizer until the component hierarchy is complete', E_USER_WARNING);
}
return new self($component);
}
开发者ID:picon,项目名称:picon-framework,代码行数:7,代码来源:Localizer.php
示例6: addComponent
public function addComponent(Component $c)
{
if ($this->ultimo) {
$c->setInput($this->ultimo->getElemento()->getOutput());
}
parent::append($c);
}
开发者ID:DaniloEpic,项目名称:slast,代码行数:7,代码来源:Path.php
示例7: getTimeZone
/**
* This method will try to find out the correct timezone for an iCalendar
* date-time value.
*
* You must pass the contents of the TZID parameter, as well as the full
* calendar.
*
* If the lookup fails, this method will return UTC.
*
* @param string $tzid
* @param Sabre\VObject\Component $vcalendar
* @return DateTimeZone
*/
public static function getTimeZone($tzid, Component $vcalendar = null)
{
// First we will just see if the tzid is a support timezone identifier.
try {
return new \DateTimeZone($tzid);
} catch (\Exception $e) {
}
// Next, we check if the tzid is somewhere in our tzid map.
if (isset(self::$map[$tzid])) {
return new \DateTimeZone(self::$map[$tzid]);
}
if ($vcalendar) {
// If that didn't work, we will scan VTIMEZONE objects
foreach ($vcalendar->select('VTIMEZONE') as $vtimezone) {
if ((string) $vtimezone->TZID === $tzid) {
// Some clients add 'X-LIC-LOCATION' with the olson name.
if (isset($vtimezone->{'X-LIC-LOCATION'})) {
try {
return new \DateTimeZone($vtimezone->{'X-LIC-LOCATION'});
} catch (\Exception $e) {
}
}
// Microsoft may add a magic number, which we also have an
// answer for.
if (isset($vtimezone->{'X-MICROSOFT-CDO-TZID'})) {
if (isset(self::$microsoftExchangeMap[(int) $vtimezone->{'X-MICROSOFT-CDO-TZID'}->value])) {
return new \DateTimeZone(self::$microsoftExchangeMap[(int) $vtimezone->{'X-MICROSOFT-CDO-TZID'}->value]);
}
}
}
}
}
// If we got all the way here, we default to UTC.
return new \DateTimeZone(date_default_timezone_get());
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:48,代码来源:TimeZoneUtil.php
示例8: deleteComponent
public function deleteComponent ($component_id, $reload) {
$component = new Component($component_id);
$component->deleteSelf();
if ($reload) {
$this->componentList = Search::unitComponents($unit_id);
$this->makeCount();
}
}
开发者ID:sonnaxindustries,项目名称:sonnax_php,代码行数:8,代码来源:clsUnitComponents.php
示例9: getRelatedTagsResult
/**
* Answer tag cloud of related tags
*
* @param Component $mainScreen
* @return void
* @access public
* @since 4/8/08
*/
public function getRelatedTagsResult(Component $mainScreen)
{
ob_start();
print "<h3 style='margin-top: 0px; margin-bottom: 0px;'>" . _("Related Tags:") . "</h3>";
$tag = $this->getTag();
print TagAction::getTagCloudDiv($tag->getRelatedTags(TAG_SORT_FREQ), 'view', 100);
$mainScreen->add(new Block(ob_get_clean(), STANDARD_BLOCK), "100%", null, LEFT, TOP);
}
开发者ID:adamfranco,项目名称:segue,代码行数:16,代码来源:SegueAllTagAction.abstract.php
示例10: setUp
function setUp()
{
$view = new Component();
$this->form_component = new MockFormComponent($this);
$view->addChild($this->form_component, $this->form_id);
$toolkit =& Limb :: saveToolkit();
$toolkit->setView($view);
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:9,代码来源:FormInitCommandTest.class.php
示例11: onComponentTagBody
public function onComponentTagBody(Component $component, ComponentTag &$tag)
{
$panelMarkup = $component->loadAssociatedMarkup();
$panel = MarkupUtils::findPiconTag('panel', $panelMarkup, $component);
if ($panel == null) {
throw new \MarkupNotFoundException(sprintf("Found markup for panel %s however there is no picon:panel tag.", $component->getId(0)));
}
$tag->setChildren(array($panel));
}
开发者ID:picon,项目名称:picon-framework,代码行数:9,代码来源:PanelMarkupSource.php
示例12: renderHead
public function renderHead(Component $component, HeaderContainer $headerContainer, HeaderResponse $headerResponse)
{
$markup = $component->loadAssociatedMarkup();
$heads = $this->findHead(array($markup));
foreach ($heads as $index => $head) {
$id = $component->getId() . '_head_' . $index;
$headerPart = new HeaderPartContainer($id, $head);
$headerPart->render();
}
}
开发者ID:picon,项目名称:picon-framework,代码行数:10,代码来源:AbstractAssociatedMarkupSource.php
示例13: list_drop
function list_drop()
{
$component = new Component();
$component->get();
foreach ($component as $row) {
$data[''] = '[ Components ]';
$data[$row->comp_id] = $row->comp_name . ' - ' . $row->comp_type;
}
return $data;
}
开发者ID:anggadjava,项目名称:payroll,代码行数:10,代码来源:component.php
示例14: getTimeZone
/**
* This method will try to find out the correct timezone for an iCalendar
* date-time value.
*
* You must pass the contents of the TZID parameter, as well as the full
* calendar.
*
* If the lookup fails, this method will return the default PHP timezone
* (as configured using date_default_timezone_set, or the date.timezone ini
* setting).
*
* Alternatively, if $failIfUncertain is set to true, it will throw an
* exception if we cannot accurately determine the timezone.
*
* @param string $tzid
* @param SabreForRainLoop\VObject\Component $vcalendar
* @return DateTimeZone
*/
public static function getTimeZone($tzid, Component $vcalendar = null, $failIfUncertain = false)
{
// First we will just see if the tzid is a support timezone identifier.
try {
return new \DateTimeZone($tzid);
} catch (\Exception $e) {
}
// Next, we check if the tzid is somewhere in our tzid map.
if (isset(self::$map[$tzid])) {
return new \DateTimeZone(self::$map[$tzid]);
}
// Maybe the author was hyper-lazy and just included an offset. We
// support it, but we aren't happy about it.
if (preg_match('/^GMT(\\+|-)([0-9]{4})$/', $tzid, $matches)) {
return new \DateTimeZone('Etc/GMT' . $matches[1] . ltrim(substr($matches[2], 0, 2), '0'));
}
if ($vcalendar) {
// If that didn't work, we will scan VTIMEZONE objects
foreach ($vcalendar->select('VTIMEZONE') as $vtimezone) {
if ((string) $vtimezone->TZID === $tzid) {
// Some clients add 'X-LIC-LOCATION' with the olson name.
if (isset($vtimezone->{'X-LIC-LOCATION'})) {
$lic = (string) $vtimezone->{'X-LIC-LOCATION'};
// Libical generators may specify strings like
// "SystemV/EST5EDT". For those we must remove the
// SystemV part.
if (substr($lic, 0, 8) === 'SystemV/') {
$lic = substr($lic, 8);
}
try {
return new \DateTimeZone($lic);
} catch (\Exception $e) {
}
}
// Microsoft may add a magic number, which we also have an
// answer for.
if (isset($vtimezone->{'X-MICROSOFT-CDO-TZID'})) {
$cdoId = (int) $vtimezone->{'X-MICROSOFT-CDO-TZID'}->getValue();
// 2 can mean both Europe/Lisbon and Europe/Sarajevo.
if ($cdoId === 2 && strpos((string) $vtimezone->TZID, 'Sarajevo') !== false) {
return new \DateTimeZone('Europe/Sarajevo');
}
if (isset(self::$microsoftExchangeMap[$cdoId])) {
return new \DateTimeZone(self::$microsoftExchangeMap[$cdoId]);
}
}
}
}
}
if ($failIfUncertain) {
throw new \InvalidArgumentException('We were unable to determine the correct PHP timezone for tzid: ' . $tzid);
}
// If we got all the way here, we default to UTC.
return new \DateTimeZone(date_default_timezone_get());
}
开发者ID:helsaba,项目名称:rainloop-webmail,代码行数:73,代码来源:TimeZoneUtil.php
示例15: renderComponent
private function renderComponent(Component $viewComp)
{
if (isset($_GET["ajax"])) {
return StringUtil::getJson("body", $viewComp->renderBodyChildren());
}
$view = $viewComp->render();
if (isset($_GET["file"])) {
$view .= $this->jsRewriteParent();
}
return $view;
}
开发者ID:aeberh,项目名称:php-movico,代码行数:11,代码来源:ViewRenderer.php
示例16: testStuff
function testStuff()
{
$vcard = new Component('VCARD');
$vcard->VERSION = '3.0';
$vcard->PHOTO = base64_encode('random_stuff');
$vcard->PHOTO->add('BASE64', null);
$vcard->UID = 'foo-bar';
$result = $vcard->serialize();
$expected = array("BEGIN:VCARD", "VERSION:3.0", "PHOTO;BASE64:" . base64_encode('random_stuff'), "UID:foo-bar", "END:VCARD", "");
$this->assertEquals(implode("\r\n", $expected), $result);
}
开发者ID:samj1912,项目名称:repo,代码行数:11,代码来源:Issue154Test.php
示例17: removeChild
/**
* Remove um filho desse componente.
* @param Component $child O filho que será removido.
* @return Composite Uma referência a esse componente.
* @throws InvalidArgumentException Se o componente informado não
* for filho desse componente.
*/
public function removeChild(Component $child)
{
$hash = $child->hashCode();
if (isset($this->children[$hash])) {
unset($this->children[$hash]);
$child->setOrphan();
return $this;
} else {
throw new InvalidArgumentException('O componente informado não é filho desse componente');
}
}
开发者ID:rcastardo,项目名称:mvc-na-pratica,代码行数:18,代码来源:Composite.php
示例18: checkHasDescendantOfType
private function checkHasDescendantOfType(Component $comp, $type)
{
$children = $comp->getChildren();
foreach ($children as $child) {
if ($child instanceof $type) {
return true;
}
if ($this->checkHasDescendantOfType($child, $type)) {
return true;
}
}
return false;
}
开发者ID:aeberh,项目名称:php-movico,代码行数:13,代码来源:Component.php
示例19: handle
/**
* @param \PowerEcommerce\Framework\Routing\Component $target
*
* @return \PowerEcommerce\System\Object
*/
public function handle(Component $target)
{
/** @type \PowerEcommerce\Framework\Routing\Target $target */
!$target instanceof \PowerEcommerce\Framework\Routing\Target && $this->invalid();
/** @type \PowerEcommerce\Framework\Routing\Component $route */
foreach ($this->getComponents() as $route) {
$pattern = '/' . addcslashes($route->getId(), '/') . '/' . $route->getModifiers();
if (preg_match($pattern, $target->getId()) || $route instanceof \PowerEcommerce\Framework\Routing\Router) {
$route->handle($target);
}
}
return $this;
}
开发者ID:powerecommerce,项目名称:powerecommerce,代码行数:18,代码来源:Router.php
示例20: onComponentTagBody
public function onComponentTagBody(Component $component, ComponentTag &$tag)
{
$borderMarkup = $component->loadAssociatedMarkup();
$border = MarkupUtils::findPiconTag('border', $borderMarkup, $component);
if ($border == null) {
throw new \MarkupNotFoundException(sprintf("Found markup for border %s however there is no picon:border tag.", $component->getId(0)));
}
$body = MarkupUtils::findPiconTag('body', $borderMarkup);
if ($body == null) {
throw new \RuntimeException('No picon:body tag was found in border.');
}
$body->setChildren($tag->getChildren());
$tag->setChildren(array($border));
}
开发者ID:picon,项目名称:picon-framework,代码行数:14,代码来源:BorderMarkupSourcingStratagy.php
注:本文中的Component类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论