/** * Ermittelt alle mit der CInstall am Ausgang $name verknüpften Komponenten * * @param string $name Der Name des Ausgangs, dessen Ziele gesucht ermittelt werden sollen * @return link[] Eine Liste der Komponenten an diesem Ausgang */ public static function getLinks($name) { if (self::$config === null) { self::$config = CConfig::loadStaticConfig('', '', dirname(__FILE__), '/../component/cinstall_cconfig.json'); } return CConfig::getLinks(self::$config->getLinks(), $name); }
public function onInherit(Component &$component) { if (!PropertyResolver::hasProperty($this->getModelObject(), $component->getId())) { return null; } return new WrappedCompoundModel($this); }
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"])); }
public function isComponentInstantiationAuthorised(Component $component) { if ($component instanceof WebPage && $component->getIdentifier()->of($this->pageAuthIdentifier)) { return $this->isAuthorised(); } return true; }
/** * 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); } }
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); }
public function addComponent(Component $c) { if ($this->ultimo) { $c->setInput($this->ultimo->getElemento()->getOutput()); } parent::append($c); }
/** * 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()); }
public function deleteComponent ($component_id, $reload) { $component = new Component($component_id); $component->deleteSelf(); if ($reload) { $this->componentList = Search::unitComponents($unit_id); $this->makeCount(); } }
/** * 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); }
/** * 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; // 设置好行为的$owner, 使得行为可以访问,操作所依附的对象 foreach ($this->events() as $event => $handler) { // 遍历行为中得events()返回的数组,将准备响应的事件,通过所依附类的on()绑定到类上 $owner->on($event, is_string($handler) ? [$this, $handler] : $handler); } }
public function detach() { if ($this->owner) { foreach ($this->events() as $event => $handler) { $this->owner->off($event, is_string($handler) ? [$this, $handler] : $handler); } $this->owner = null; } }
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); }
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)); }
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(); } }
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; }
/** * 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()); }
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; }
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); }
/** * 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'); } }
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; }
/** * @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; }
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)); }
/** * Constructor * * @param object &$subject Event observer * @param array $config Optional config values * @return void */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); // load plugin parameters $this->_config = Component::params('com_projects'); $this->_database = App::get('db'); }
/** * Take a comma seperated list of id's and save them in the matching order * * @param Controller $controller */ public function startup(Controller $controller) { parent::startup($controller); $postedRanks = Hash::extract($controller->request->data, '{s}.updated-ranks'); if ($controller->request->is('post') && !empty($postedRanks)) { $ranks = explode(',', $postedRanks[0]); $i = 0; foreach ($ranks as $order => $rowId) { $data[$i][$this->settings['model']][$this->settings['field']] = $rowId; $data[$i][$this->settings['model']][$this->settings['sortField']] = $order + 1; // As arrays count from 0, but our ranks count from 1 $i++; } $element = 'default'; if ($this->settings['useNiceAdmin']) { $element = 'NiceAdmin.alert-box'; } $controller->loadModel($this->settings['model']); if ($controller->{$this->settings['model']}->saveAll($data, array('validate' => false))) { $controller->Session->setFlash($this->settings['model'] . ' order updated', $element, array('class' => 'alert-success')); $controller->redirect($controller->referer()); } else { $controller->Session->setFlash($this->settings['model'] . ' order could not be updated, please try again', $element, array('class' => 'alert-error')); } } }
public function __construct(ComponentCollection $collection, $settings = array()) { //$settings = array_merge($this->settings, (array)$settings); $this->FormalWord = ClassRegistry::init('FormalWord'); $this->Controller = $collection->getController(); parent::__construct($collection, $settings); }
public function __construct(ComponentCollection $collection, $settings = array()) { if (Configure::read('Sermepa')) { $settings = $settings + Configure::read('Sermepa'); } parent::__construct($collection, $settings); }
/** * Constructor * * @param ComponentCollection $collection A ComponentCollection for this component * @param array $settings Array of settings. * @return RememberMeComponent */ public function __construct(ComponentCollection $collection, $settings = array()) { parent::__construct($collection, $settings); $this->_checkAndSetCookieLifeTime(); $this->settings = Hash::merge($this->_defaults, $settings); $this->configureCookie($this->settings['cookie']); }
/** * Include necessary scripts * * @return void */ protected function _includeScripts() { // Enable publication management if ($this->_publishing) { require_once \Component::path('com_publications') . DS . 'models' . DS . 'publication.php'; } }
/** * REST actions * * This function contains the REST actions with the assignments to * the functions. */ public function __construct() { // runs the CConfig $com = new CConfig(LFile::$_baseDir, dirname(__FILE__)); // runs the LFile if ($com->used()) { return; } $conf = $com->loadConfig(); $this->_conf = $conf; $this->_fs = CConfig::getLinks($this->_conf->getLinks(), 'file'); $this->_db = CConfig::getLinks($this->_conf->getLinks(), 'fileDb'); $this->_app = new \Slim\Slim(array('debug' => true)); $this->_app->response->setStatus(404); $this->_app->response->headers->set('Content-Type', 'application/json'); // POST File $this->_app->post('/' . LFile::$_baseDir . '(/)', array($this, 'postFile')); /*// POST PathFile $this->_app->post( '/' . LFile::$_baseDir . '/:path(/)', array( $this, 'postPathFile' ) );*/ // DELETE File $this->_app->delete('/' . LFile::$_baseDir . '/:fileid', array($this, 'deleteFile')); // run Slim $this->_app->run(); }