本文整理汇总了PHP中Kwc_Abstract::getFlag方法的典型用法代码示例。如果您正苦于以下问题:PHP Kwc_Abstract::getFlag方法的具体用法?PHP Kwc_Abstract::getFlag怎么用?PHP Kwc_Abstract::getFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kwc_Abstract
的用法示例。
在下文中一共展示了Kwc_Abstract::getFlag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getListeners
public function getListeners()
{
$ret = parent::getListeners();
$ret[] = array('class' => null, 'event' => 'Kwf_Component_Event_Page_ParentChanged', 'callback' => 'onPageParentChanged');
foreach (Kwc_Abstract::getComponentClasses() as $class) {
$classWithoutPoint = $class;
if (($pos = strpos($class, '.')) !== false) {
$classWithoutPoint = substr($class, 0, $pos);
}
if (Kwc_Abstract::getFlag($class, 'hasAlternativeComponent') && in_array($this->_class, call_user_func(array($classWithoutPoint, 'getAlternativeComponents'), $class))) {
$ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onParentHasContentChanged');
$ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_Component_RecursiveHasContentChanged', 'callback' => 'onParentRecursiveHasContentChanged');
}
foreach (Kwc_Abstract::getSetting($class, 'generators') as $generator) {
if ($generator['class'] == 'Kwf_Component_Generator_Box_StaticSelect' && is_array($generator['component']) && in_array($this->_class, $generator['component'])) {
foreach ($generator['component'] as $componentClass) {
if ($componentClass == $this->_class) {
continue;
}
$ret[] = array('class' => $componentClass, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onParentHasContentChanged');
$ret[] = array('class' => $componentClass, 'event' => 'Kwf_Component_Event_Component_RecursiveHasContentChanged', 'callback' => 'onParentRecursiveHasContentChanged');
}
}
}
}
return $ret;
}
示例2: _getTitle
protected function _getTitle()
{
if (trim($this->_getRow()->title)) {
return $this->_getRow()->title;
}
//if no title is configured get from next subroot/root
$c = $this->getData()->parent;
while ($c) {
if ($c->inherits && Kwc_Abstract::getFlag($c->componentClass, 'subroot') || $c->componentId == 'root') {
$title = $c->getChildComponent(array('id' => '-' . $this->getData()->id, 'componentClass' => $this->getData()->componentClass));
if ($title) {
$title = $title->getComponent()->_getRow()->title;
}
if ($title) {
$ret = $this->getData()->getTitle();
//append own title
if ($ret) {
$ret .= ' - ';
}
return $ret . $title;
}
}
$c = $c->parent;
}
return parent::_getTitle();
}
示例3: getAllChainedByMasterFromChainedStart
public static function getAllChainedByMasterFromChainedStart($componentClass, $master, $chainedType, $parentDataSelect = array())
{
if (Kwc_Abstract::getFlag($componentClass, 'chainedType') != $chainedType) {
return array();
}
$ret = array();
foreach (Kwf_Component_Data_Root::getInstance()->getComponentsByClass($componentClass, $parentDataSelect) as $chainedStart) {
//if additional subroots are above trl subroot (eg. domains)
if ($sr = $chainedStart->parent->getSubroot()) {
$masterSr = $master;
while (Kwc_Abstract::getFlag($masterSr->componentClass, 'chainedType') != $chainedType) {
$masterSr = $masterSr->parent;
if (!$masterSr) {
continue 2;
}
}
if ($masterSr->parent && $sr != $masterSr->parent->getSubroot()) {
continue;
}
}
$i = Kwc_Chained_Abstract_Component::getChainedByMasterAndType($master, $chainedStart, $chainedType, $parentDataSelect);
if ($i) {
$ret[] = $i;
}
}
return $ret;
}
示例4: getInstance
/**
* Returns Zend_Search_Lucene instance for given subroot
*
* every subroot has it's own instance
*
* @param Kwf_Component_Data for this index
* @return Zend_Search_Lucene_Interface
*/
public static function getInstance(Kwf_Component_Data $subroot)
{
while ($subroot) {
if (Kwc_Abstract::getFlag($subroot->componentClass, 'subroot')) {
break;
}
$subroot = $subroot->parent;
}
if (!$subroot) {
$subroot = Kwf_Component_Data_Root::getInstance();
}
static $instance = array();
if (!isset($instance[$subroot->componentId])) {
$analyzer = new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive();
$analyzer->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_ShortWords(2));
//$stopWords = explode(' ', 'der dir das einer eine ein und oder doch ist sind an in vor nicht wir ihr sie es ich');
//$analyzer->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_StopWords($stopWords));
Zend_Search_Lucene_Analysis_Analyzer::setDefault($analyzer);
Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions(0666);
$path = 'cache/fulltext';
$path .= '/' . $subroot->componentId;
try {
$instance[$subroot->componentId] = Zend_Search_Lucene::open($path);
} catch (Zend_Search_Lucene_Exception $e) {
$instance[$subroot->componentId] = Zend_Search_Lucene::create($path);
}
}
return $instance[$subroot->componentId];
}
示例5: _onOwnRowUpdate
protected function _onOwnRowUpdate(Kwf_Component_Data $c, Kwf_Events_Event_Row_Abstract $event)
{
parent::_onOwnRowUpdate($c, $event);
if (Kwc_Abstract::getFlag($c->parent->componentClass, 'subroot') || $c->parent instanceof Kwf_Component_Data_Root) {
$this->fireEvent(new Kwf_Component_Event_Component_RecursiveContentChanged($this->_class, $c));
}
}
示例6: _getAllLanguages
private function _getAllLanguages()
{
$config = Zend_Registry::get('config');
$langs = array();
if ($config->webCodeLanguage) {
$langs[] = $config->webCodeLanguage;
}
if ($config->languages) {
foreach ($config->languages as $lang => $name) {
$langs[] = $lang;
}
}
if (Kwf_Component_Data_Root::getComponentClass()) {
foreach (Kwc_Abstract::getComponentClasses() as $c) {
if (Kwc_Abstract::getFlag($c, 'hasAvailableLanguages')) {
foreach (call_user_func(array($c, 'getAvailableLanguages'), $c) as $i) {
if (!in_array($i, $langs)) {
$langs[] = $i;
}
}
}
}
}
$langs = array_unique($langs);
return $langs;
}
示例7: duplicated
public static function duplicated(Kwf_Component_Data $source, Kwf_Component_Data $new)
{
$chained = Kwf_Component_Data_Root::getInstance()->getComponentsByClass('Kwc_Root_TrlRoot_Chained_Component', array('ignoreVisible' => true));
//bySameClass wenn fkt nicht mehr static (todo oben erledigt)
$sourceChained = array();
foreach ($chained as $c) {
$subRootAboveTrl = $c;
//eg. domain
while ($subRootAboveTrl = $subRootAboveTrl->parent) {
if (Kwc_Abstract::getFlag($subRootAboveTrl->componentClass, 'subroot')) {
break;
}
}
if (!$subRootAboveTrl) {
$subRootAboveTrl = Kwf_Component_Data_Root::getInstance();
}
$d = $source;
while ($d = $d->parent) {
if ($d->componentId == $subRootAboveTrl->componentId) {
$sourceChained[$c->getLanguage()] = $c;
}
}
}
$targetChained = array();
foreach ($chained as $c) {
$subRootAboveTrl = $c;
//eg. domain
while ($subRootAboveTrl = $subRootAboveTrl->parent) {
if (Kwc_Abstract::getFlag($subRootAboveTrl->componentClass, 'subroot')) {
break;
}
}
if (!$subRootAboveTrl) {
$subRootAboveTrl = Kwf_Component_Data_Root::getInstance();
}
$d = $new;
while ($d = $d->parent) {
if ($d->componentId == $subRootAboveTrl->componentId) {
if (isset($sourceChained[$c->getLanguage()])) {
//only if there is a source language
$targetChained[] = array('targetChained' => $c, 'sourceChained' => $sourceChained[$c->getLanguage()]);
}
}
}
}
foreach ($targetChained as $c) {
$sourceChained = Kwc_Chained_Trl_Component::getChainedByMaster($source, $c['sourceChained'], array('ignoreVisible' => true));
$newChained = Kwc_Chained_Trl_Component::getChainedByMaster($new, $c['targetChained'], array('ignoreVisible' => true));
if (!$sourceChained || $source->componentId == $sourceChained->componentId) {
continue;
//wenn sourceChained nicht gefunden handelt es sich zB um ein MasterAsChild - was ignoriert werden muss
}
if (!$newChained) {
throw new Kwf_Exception("can't find chained components");
}
Kwc_Admin::getInstance($newChained->componentClass)->duplicate($sourceChained, $newChained);
}
}
示例8: getMetaTagsForData
public static function getMetaTagsForData($data)
{
$ret = array();
if (Kwf_Config::getValue('application.kwf.name') == 'Koala Framework') {
$ret['generator'] = 'Koala Web Framework CMS';
}
if ($data->getPage()) {
if (Kwc_Abstract::getFlag($data->getPage()->componentClass, 'metaTags')) {
foreach ($data->getPage()->getComponent()->getMetaTags() as $name => $content) {
if (!isset($ret[$name])) {
$ret[$name] = '';
}
//TODO: for eg noindex,nofollow other separator
$ret[$name] .= ' ' . $content;
}
}
if (Kwc_Abstract::getFlag($data->getPage()->componentClass, 'noIndex')) {
if (isset($ret['robots'])) {
$ret['robots'] .= ',';
} else {
$ret['robots'] = '';
}
$ret['robots'] .= 'noindex';
}
}
foreach ($ret as &$i) {
$i = trim($i);
}
unset($i);
// verify-v1
if (isset($_SERVER['HTTP_HOST'])) {
$host = $_SERVER['HTTP_HOST'];
} else {
$host = Kwf_Config::getValue('server.domain');
}
$hostParts = explode('.', $host);
if (count($hostParts) < 2) {
$configDomain = $host;
} else {
$shortParts = array('com', 'co', 'gv', 'or');
if (count($hostParts) > 2 & in_array($hostParts[count($hostParts) - 2], $shortParts)) {
$hostParts[count($hostParts) - 2] = $hostParts[count($hostParts) - 3] . $hostParts[count($hostParts) - 2];
}
$configDomain = $hostParts[count($hostParts) - 2] . $hostParts[count($hostParts) - 1];
// zB 'com'
}
$configVerify = Kwf_Config::getValueArray('verifyV1');
if ($configVerify && isset($configVerify[$configDomain])) {
$ret['verify-v1'] = $configVerify[$configDomain];
}
$configVerify = Kwf_Config::getValueArray('googleSiteVerification');
if ($configVerify && isset($configVerify[$configDomain])) {
$ret['google-site-verification'] = $configVerify[$configDomain];
}
return $ret;
}
示例9: getListeners
public function getListeners()
{
$ret = array();
foreach (Kwc_Abstract::getComponentClasses() as $c) {
if (Kwc_Abstract::getFlag($c, 'requestHttps')) {
$ret[] = array('class' => $c, 'event' => 'Kwf_Component_Event_Component_Added', 'callback' => 'onComponentAdded');
}
}
return $ret;
}
示例10: getListeners
public function getListeners()
{
$ret = parent::getListeners();
foreach (Kwc_Abstract::getComponentClasses() as $c) {
if (Kwc_Abstract::getFlag($c, 'assetsPackage')) {
$ret[] = array('class' => $c, 'event' => 'Kwf_Component_Event_Component_Added', 'callback' => 'onComponentAddedRemoved');
$ret[] = array('class' => $c, 'event' => 'Kwf_Component_Event_Component_Removed', 'callback' => 'onComponentAddedRemoved');
}
}
return $ret;
}
示例11: _findFormFields
private static function _findFormFields($data)
{
$ret = array();
foreach ($data->getChildComponents(array('page' => false, 'pseudoPage' => false)) as $c) {
if (Kwc_Abstract::getFlag($c->componentClass, 'formField')) {
$ret[] = $c;
}
$ret = array_merge($ret, self::_findFormFields($c));
}
return $ret;
}
示例12: getFulltextContentForPage
public function getFulltextContentForPage(Kwf_Component_Data $page, array $fulltextComponents = array())
{
if (Kwc_Abstract::getFlag($page->componentClass, 'skipFulltext')) {
return null;
}
$c = $page;
while ($c = $c->parent) {
if (Kwc_Abstract::getFlag($c->componentClass, 'skipFulltextRecursive')) {
return null;
}
}
if (!$fulltextComponents) {
$fulltextComponents = $this->getFulltextComponents($page);
}
$ret = array();
//whole content, for preview in search result
$ret['content'] = '';
//normal content with boost=1 goes here
$ret['normalContent'] = '';
$row = Kwf_Component_PagesMetaModel::getInstance()->getRow($page->componentId);
if ($row && $row->changed_date) {
$ret['lastModified'] = new Kwf_DateTime($row->changed_date);
}
$t = $page->getTitle();
if (substr($t, -3) == ' - ') {
$t = substr($t, 0, -3);
}
$ret['title'] = $t;
foreach ($fulltextComponents as $c) {
if (!method_exists($c->getComponent(), 'getFulltextContent')) {
continue;
}
$content = $c->getComponent()->getFulltextContent();
unset($c);
foreach ($content as $field => $text) {
if (!$text) {
continue;
}
if (isset($ret[$field])) {
if (is_string($ret[$field])) {
$ret[$field] = $ret[$field] . ' ' . $text;
}
} else {
$ret[$field] = $text;
}
}
}
if (!$ret['content']) {
//echo " [no content]";
$ret = null;
}
return $ret;
}
示例13: getRows
public function getRows($where = null, $order = null, $limit = null, $start = null)
{
if (!is_object($where) || $where instanceof Kwf_Model_Select_Expr_Interface) {
$select = $this->select($where, $order, $limit, $start);
} else {
$select = $where;
}
$dataKeys = array();
$whereEquals = $select->getPart(Kwf_Model_Select::WHERE_EQUALS);
if (isset($whereEquals['parent_component_id'])) {
$whereId = null;
if (isset($whereEquals['id'])) {
$whereId = $whereEquals['id'];
}
$childPagesComponentSelect = array();
$childPagesComponentSelect['showInMenu'] = true;
if ($whereId || isset($whereEquals['ignore_visible']) && $whereEquals['ignore_visible'] || $select->getPart(Kwf_Component_Select::IGNORE_VISIBLE)) {
$childPagesComponentSelect[Kwf_Component_Select::IGNORE_VISIBLE] = true;
}
$component = Kwf_Component_Data_Root::getInstance()->getComponentById($whereEquals['parent_component_id'], array(Kwf_Component_Select::IGNORE_VISIBLE => true));
while ($component) {
$component = $component->parent;
if ($component->isPage) {
break;
}
if (!$component->parent) {
break;
}
if (Kwc_Abstract::getFlag($component->componentClass, 'menuCategory')) {
break;
}
}
$pages = $component->getChildPages($childPagesComponentSelect);
$i = 0;
foreach ($pages as $page) {
$j = 0;
foreach ($page->getChildPages($childPagesComponentSelect) as $childPage) {
if (isset($whereEquals['filename']) && $childPage->filename != $whereEquals['filename']) {
continue;
}
$id = $this->_getIdForPage($childPage);
if (!$whereId || $id == $whereId) {
$this->_data[$id] = array('id' => $id, 'pos' => $j++, 'target_page_id' => $childPage->componentId, 'name' => $childPage->name, 'filename' => $childPage->filename, 'parent_pos' => $i, 'parent_name' => $page->name);
$dataKeys[] = $id;
}
}
$i++;
}
} else {
throw new Kwf_Exception_NotYetImplemented();
}
return new $this->_rowsetClass(array('dataKeys' => $dataKeys, 'model' => $this));
}
示例14: _build
protected function _build()
{
if (!file_exists('build/trl')) {
mkdir('build/trl');
}
foreach (glob('build/trl/*') as $f) {
unlink($f);
}
$config = Zend_Registry::get('config');
$langs = array();
if ($config->webCodeLanguage) {
$langs[] = $config->webCodeLanguage;
}
if ($config->languages) {
foreach ($config->languages as $lang => $name) {
$langs[] = $lang;
}
}
try {
if (Kwf_Component_Data_Root::getComponentClass()) {
foreach (Kwc_Abstract::getComponentClasses() as $c) {
if (Kwc_Abstract::getFlag($c, 'hasAvailableLanguages')) {
foreach (call_user_func(array($c, 'getAvailableLanguages'), $c) as $i) {
if (!in_array($i, $langs)) {
$langs[] = $i;
}
}
}
}
}
} catch (Kwf_Trl_BuildFileMissingException $e) {
$originatingException = $e->getSettingsNonStaticTrlException();
if ($originatingException) {
throw $originatingException;
}
throw $e;
}
foreach ($langs as $l) {
if ($l != $config->webCodeLanguage) {
$c = $this->_loadTrlArray(Kwf_Trl::SOURCE_WEB, $l, true);
file_put_contents(Kwf_Trl::generateBuildFileName(Kwf_Trl::SOURCE_WEB, $l, true), serialize($c));
$c = $this->_loadTrlArray(Kwf_Trl::SOURCE_WEB, $l, false);
file_put_contents(Kwf_Trl::generateBuildFileName(Kwf_Trl::SOURCE_WEB, $l, false), serialize($c));
}
if ($l != 'en') {
$c = $this->_loadTrlArray(Kwf_Trl::SOURCE_KWF, $l, true);
file_put_contents(Kwf_Trl::generateBuildFileName(Kwf_Trl::SOURCE_KWF, $l, true), serialize($c));
$c = $this->_loadTrlArray(Kwf_Trl::SOURCE_KWF, $l, false);
file_put_contents(Kwf_Trl::generateBuildFileName(Kwf_Trl::SOURCE_KWF, $l, false), serialize($c));
}
}
}
示例15: getConfig
public final function getConfig($type)
{
if ($type == self::TYPE_SHARED) {
if (Kwc_Abstract::getFlag($this->_class, 'sharedDataClass')) {
return $this->_getConfig();
}
} else {
if (!Kwc_Abstract::getFlag($this->_class, 'sharedDataClass')) {
return $this->_getConfig();
}
}
return array();
}