本文整理汇总了PHP中is_instance_of函数的典型用法代码示例。如果您正苦于以下问题:PHP is_instance_of函数的具体用法?PHP is_instance_of怎么用?PHP is_instance_of使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_instance_of函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getSelect
protected function _getSelect()
{
//$ret = parent::_getSelect(); what do we lose by not using that?
if ($this->_getParam('filterComponentId')) {
$filter = Kwf_Component_Data_Root::getInstance()->getComponentById($this->_getParam('filterComponentId'));
if (!is_instance_of($filter->componentClass, 'Kwc_Directories_List_Component')) {
$filter = $filter->getChildComponent('-list');
//TODO don't hardcode that here
}
$viewData = $filter->getChildComponent('-view');
//TODO don't hardcode that here
} else {
$viewData = $this->_component;
}
$view = $viewData->getComponent();
if ($view->hasSearchForm()) {
$sf = $view->getSearchForm();
$params = $this->getRequest()->getParams();
$params[$sf->componentId . '-post'] = true;
//post
$params[$sf->componentId] = true;
//submit
$sf->getComponent()->processInput($params);
//TODO don't do processInput here in _getSelect()
}
$ret = $view->getSelect();
return $ret;
}
示例2: load
public function load($row, $postData = array())
{
$ret = parent::load($row, $postData);
$component = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($row->component_id, array('ignoreVisible' => true, 'limit' => 1));
if ($component) {
//component can be non-existent if it's in a not selected card
if (is_instance_of($component->componentClass, 'Kwc_Abstract_Image_Component')) {
$contentWidth = null;
$usesContentWidth = false;
foreach (Kwc_Abstract::getSetting($component->componentClass, 'dimensions') as $dim) {
if (isset($dim['width'])) {
if ($dim['width'] == Kwc_Abstract_Image_Component::CONTENT_WIDTH) {
$usesContentWidth = true;
} else {
if ($dim['width'] > $contentWidth) {
$contentWidth = $dim['width'];
}
}
}
}
if ($usesContentWidth) {
$contentWidth = $component->getComponent()->getMaxContentWidth();
}
} else {
$contentWidth = $component->getComponent()->getContentWidth();
}
$ret[$this->getFieldName()]['contentWidth'] = $contentWidth;
}
return $ret;
}
示例3: testIt
public function testIt()
{
$gen = Kwc_Abstract::getSetting('Kwf_Component_ChildSettings_SingleStatic_Root', 'generators');
$c = $gen['empty']['component'];
$this->assertTrue(is_instance_of($c, 'Kwc_Basic_None_Component'));
$this->assertEquals(Kwc_Abstract::getSetting($c, 'componentName'), 'test123');
}
示例4: __construct
public function __construct($reference = null, $fieldname = null)
{
if (is_object($reference)) {
$model = $reference;
} else {
if (class_exists($reference) && is_instance_of($reference, 'Zend_Db_Table_Abstract')) {
$model = new $reference();
} else {
$this->setReferenceName($reference);
}
}
if (!$fieldname) {
$fieldname = is_object($reference) ? get_class($reference) : $reference;
}
parent::__construct($fieldname);
if (isset($model)) {
if (!$model instanceof Kwf_Model_Interface) {
$model = new Kwf_Model_Db(array('table' => $model));
}
$this->setModel($model);
}
$this->fields = new Kwf_Collection_FormFields();
$this->setBorder(false);
$this->setBaseCls('x2-plain');
$this->setXtype('multifields');
$this->setMinEntries(1);
}
示例5: getAllMaintenanceJobs
public static function getAllMaintenanceJobs()
{
static $ret;
if (isset($ret)) {
return $ret;
}
foreach (Kwc_Abstract::getComponentClasses() as $c) {
if (is_instance_of($c, 'Kwf_Util_Maintenance_JobProviderInterface')) {
$providerClasses[] = $c;
}
}
foreach (Kwf_Model_Abstract::findAllInstances() as $model) {
if ($model instanceof Kwf_Util_Maintenance_JobProviderInterface) {
$providerClasses[] = get_class($model);
}
}
$jobClasses = array();
foreach ($providerClasses as $c) {
$jobClasses = array_merge($jobClasses, call_user_func(array($c, 'getMaintenanceJobs')));
}
$jobClasses = array_unique($jobClasses);
$ret = array();
foreach ($jobClasses as $i) {
$ret[] = new $i();
}
usort($ret, array('Kwf_Util_Maintenance_Dispatcher', '_compareJobsPriority'));
return $ret;
}
示例6: _initFields
protected function _initFields()
{
parent::_initFields();
$showDirectoryClass = Kwc_Abstract::getSetting($this->getClass(), 'showDirectoryClass');
$hideDirectoryClasses = Kwc_Abstract::getSetting($this->getClass(), 'hideDirectoryClasses');
$cards = $this->add(new Kwf_Form_Container_Cards('source_component_id', trlKwf('Directory')));
$defaultCard = null;
$categories = Kwf_Component_Data_Root::getInstance()->getComponentsByClass('Kwc_Directories_Category_Directory_Component');
foreach ($categories as $category) {
$itemDirectory = $category->parent;
if (is_instance_of($itemDirectory->componentClass, $showDirectoryClass)) {
foreach ($hideDirectoryClasses as $c) {
if (is_instance_of($itemDirectory->componentClass, $c)) {
continue 2;
}
}
$categoriesModel = $category->getComponent()->getChildModel();
$select = $categoriesModel->select()->whereEquals('component_id', $category->componentId);
$values = array();
foreach ($categoriesModel->getRows($select) as $row) {
$values[$row->id] = $row->name;
}
$card = $cards->add();
$card->setTitle($category->parent->getTitle());
$card->setName($category->componentId);
if (!$defaultCard) {
$defaultCard = $category->componentId;
}
$model = Kwf_Model_Abstract::getInstance('Kwc_Directories_Category_ShowCategories_Model');
$card->add(new Kwf_Form_Field_MultiCheckboxLegacy($model, trlKwf('Categories')))->setValues($values)->setReferences(array('columns' => array('component_id'), 'refColumns' => array('id')))->setColumnName('category_id');
}
}
$cards->setDefaultValue($defaultCard);
}
示例7: _getParent
private function _getParent()
{
$previous = null;
$parent = $this->_data->parent;
while ($parent && (!$parent->isPage || is_instance_of(Kwc_Abstract::getSetting($parent->componentClass, 'contentSender'), 'Kwf_Component_Abstract_ContentSender_Lightbox'))) {
$previous = $parent;
$parent = $parent->parent;
}
if ($parent instanceof Kwc_Basic_LinkTag_FirstChildPage_Data) {
$parent = $parent->_getFirstChildPage();
if ($parent == $this->_data) {
$parent = $parent->parent;
while ($parent && $parent instanceof Kwc_Basic_LinkTag_FirstChildPage_Data) {
$parent = $parent->parent;
}
}
}
if (!$parent) {
$parent = $this->_data->getSubroot()->getChildPage(array('home' => true), array());
}
//TODO: the proper solution would be to restructure List_Switch so that the page is our parent
if (is_instance_of($parent->componentClass, 'Kwc_List_Switch_Component') && $previous) {
$parent = $parent->getChildComponent('_' . $previous->id);
}
return $parent;
}
示例8: onListItemChange
public function onListItemChange(Kwf_Component_Event_Component_Abstract $event)
{
// get previous and next items and delete the cache for them
$c = $event->component;
if ($c->componentClass != $this->_class) {
foreach ($c->getRecursiveChildComponents(array('componentClass' => $this->_class)) as $c) {
$i = $c->parent->parent;
if (is_instance_of($i->componentClass, 'Kwc_Basic_LinkTag_Component')) {
$i = $i->parent;
}
$getChildren = array();
while ($i != $event->component) {
if ($i->generator->getGeneratorFlag('table')) {
//only relevant if child is *not* created by a table generator
continue 2;
}
$getChildren[] = $i->generator->getIdSeparator() . $i->id;
$i = $i->parent;
}
$result = call_user_func(array($this->_class, 'getPreviousAndNextImagePage'), $this->_class, $event->component, $getChildren, true);
foreach ($result as $r) {
if (!$r) {
continue;
}
$this->fireEvent(new Kwf_Component_Event_Component_ContentChanged($this->_class, $r));
}
}
}
}
示例9: alterBackendOrderForm
public function alterBackendOrderForm(Kwc_Shop_AddToCartAbstract_FrontendForm $form)
{
$component = null;
foreach (Kwc_Abstract::getComponentClasses() as $c) {
if (is_instance_of($c, 'Kwc_Shop_Products_Directory_Component')) {
$detailClasses = Kwc_Abstract::getChildComponentClasses($c, 'detail');
foreach ($detailClasses as $key => $class) {
if (Kwc_Abstract::getChildComponentClass($class, 'addToCart') == $this->_class) {
$component = $key;
}
}
}
}
$m = Kwf_Model_Abstract::getInstance('Kwc_Shop_Products');
$s = $m->select();
$s->whereEquals('visible', 1);
if ($component) {
$s->whereEquals('component', $component);
}
$s->order('pos');
$data = array();
foreach ($m->getRows($s) as $product) {
$data[] = array($product->current_price_id, $product->__toString() . ' (' . $product->current_price . ' €)');
}
$form->prepend(new Kwf_Form_Field_Select('shop_product_price_id', trlKwfStatic('Product')))->setValues($data)->setAllowBlank(false);
}
示例10: getDomainComponent
/**
* @param Kwf_Component_Data $component data, which is a parent domain component
* @return Kwc_Root_DomainRoot_Domain_Component
*/
public static function getDomainComponent(Kwf_Component_Data $component)
{
while ($component && !is_instance_of($component->componentClass, 'Kwc_Root_DomainRoot_Domain_Component')) {
$component = $component->parent;
}
return $component;
}
示例11: load
public function load($row)
{
$name = $this->_dataIndex;
if (is_string($this->_parentTable) || !is_array($this->_parentTable)) {
$tables = array($this->_parentTable);
} else {
$tables = $this->_parentTable;
}
foreach ($tables as $t) {
if ((is_object($t) || class_exists($t)) && is_instance_of($t, 'Zend_Db_Table_Abstract')) {
$row = $row->findParentRow($t, $this->_ruleKey);
} else {
$row = $row->getParentRow($t);
}
if (!$row) {
return '';
}
}
if (!$this->_dataIndex) {
return $row->__toString();
}
if (!isset($row->{$name}) && !is_null($row->{$name})) {
//scheiß php
throw new Kwf_Exception("Index '{$name}' doesn't exist in row.");
}
return $row->{$name};
}
示例12: _initColumns
protected function _initColumns()
{
parent::_initColumns();
$this->_columns->add(new Kwf_Grid_Column('id'));
//shows editDialog
$this->_columns->add(new Kwf_Grid_Column_Button('properties', ' ', 20))->setButtonIcon('/assets/silkicons/newspaper.png')->setTooltip(trlKwf('Properties'));
if (is_instance_of(Kwc_Abstract::getSetting($this->_getParam('class'), 'extConfig'), 'Kwc_Directories_Item_Directory_ExtConfigEditButtons')) {
$extConfigType = 'extConfig';
} else {
if (is_instance_of(Kwc_Abstract::getSetting($this->_getParam('class'), 'extConfigControllerIndex'), 'Kwc_Directories_Item_Directory_ExtConfigEditButtons')) {
$extConfigType = 'extConfigControllerIndex';
}
}
$extConfig = Kwf_Component_Abstract_ExtConfig_Abstract::getInstance($this->_getParam('class'), $extConfigType)->getConfig(Kwf_Component_Abstract_ExtConfig_Abstract::TYPE_DEFAULT);
$extConfig = $extConfig['items'];
if (count($extConfig['countDetailClasses']) > 1 && !$this->_getModel()->hasColumn('component')) {
throw new Kwf_Exception('If you have more than one detail-component your table has to have a column named "component"');
}
$i = 0;
foreach ($extConfig['contentEditComponents'] as $ec) {
$name = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($ec['componentClass'], 'componentName'));
$icon = Kwc_Abstract::getSetting($ec['componentClass'], 'componentIcon');
$icon = new Kwf_Asset($icon);
$this->_columns->add(new Kwc_Directories_Item_Directory_Trl_ControllerEditButton('edit_' . $i, ' ', 20))->setColumnType('editContent')->setEditComponentClass($ec['componentClass'])->setEditComponent($ec['component'])->setEditType($ec['type'])->setEditIdTemplate($ec['idTemplate'])->setEditComponentIdSuffix($ec['componentIdSuffix'])->setButtonIcon($icon->toString(array('arrow')))->setTooltip(trlKwf('Edit {0}', $name));
$i++;
}
}
示例13: _graphData
private function _graphData($class, $parent = '')
{
if (is_instance_of($class, 'Kwc_Paragraphs_Component')) {
return;
}
static $processed = array();
$ret = '';
$last = $class . $parent;
foreach (Kwc_Abstract::getSetting($class, 'generators') as $generatorKey => $generator) {
$g = $this->_getGenerator($class, $generatorKey);
$shape = $this->_getShape($g);
foreach ($this->_getChildren($generator) as $child) {
$color = $this->_getColor($child);
$fontcolor = in_array($child, $processed) ? 'grey40' : 'black';
$classname = $this->_getClassName($child, $class);
$label = '';
if ($g->getGeneratorFlag('table')) {
$label = 'headlabel = "*"';
}
$name = $child . $class;
$node = "Node_{$name}";
$ret .= "{ {$name} [label=\"{$classname}\" shape={$shape} color={$color} fontcolor=\"{$fontcolor}\" fontsize=12] } \n";
$ret .= "{ {$node} [shape=point] }\n";
$ret .= "{ {$node} -> {$name} [arrowhead=none {$label}] }\n";
$ret .= "{ {$last} -> {$node} [arrowhead=none] rank=same }\n";
$ret .= "\n";
$last = $node;
if (!in_array($child, $processed)) {
$processed[] = $child;
$ret .= $this->_graphData($child, $class);
}
}
}
return $ret;
}
示例14: onRecursiveUrlChanged
public function onRecursiveUrlChanged(Kwf_Component_Event_Page_RecursiveUrlChanged $event)
{
$component = $event->component->parent;
while ($component && is_instance_of($component->componentClass, 'Kwc_Basic_LinkTag_FirstChildPage_Component')) {
$this->_fireUrlChanged($component);
$component = $component->parent;
}
}
示例15: getLinkTitle
public function getLinkTitle()
{
$parent = $this->parent;
if (is_instance_of($parent->componentClass, 'Kwc_Basic_LinkTag_Component')) {
return $this->parent->getComponent()->getLinkTitle();
}
return parent::getLinkTitle();
}