当前位置: 首页>>代码示例>>PHP>>正文


PHP XenForo_DataWriter::setExtraData方法代码示例

本文整理汇总了PHP中XenForo_DataWriter::setExtraData方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_DataWriter::setExtraData方法的具体用法?PHP XenForo_DataWriter::setExtraData怎么用?PHP XenForo_DataWriter::setExtraData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XenForo_DataWriter的用法示例。


在下文中一共展示了XenForo_DataWriter::setExtraData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setExtraData

 /**
  *
  * @see XenForo_DataWriter::setExtraData
  */
 public function setExtraData($name, $value)
 {
     if ($name == self::DATA_BIBLE && is_array($value) && !empty($value['bible_id'])) {
         self::setBibleCacheItem($value);
     }
     if ($name == self::DATA_BOOK && is_array($value) && !empty($value['book_id'])) {
         self::setBookCacheItem($value);
     }
     return parent::setExtraData($name, $value);
 }
开发者ID:ThemeHouse-XF,项目名称:Biblea,代码行数:14,代码来源:Verse.php

示例2: verifyPosition

 public static function verifyPosition(&$positions, XenForo_DataWriter $dw, $fieldName = false)
 {
     $positions = trim($positions);
     if (empty($positions)) {
         $dw->error(new XenForo_Phrase('wf_position_can_not_be_empty'), $fieldName);
     }
     if ('all' == $positions) {
         return true;
     }
     /** @var XenForo_Model_Template $templateModel */
     $templateModel = $dw->getModelFromCache('XenForo_Model_Template');
     $db = XenForo_Application::getDb();
     $positionsArray = explode(',', $positions);
     $positionsGood = array();
     $templateForHooks = array();
     foreach ($positionsArray as $position) {
         $position = trim($position);
         if (empty($position)) {
             continue;
         }
         if (in_array($position, array('wf_widget_page', 'hook:wf_widget_page_contents'), true) and !$dw->get('widget_page_id')) {
             $dw->error(new XenForo_Phrase('wf_position_x_requires_widget_page', array('position' => $position)), $fieldName);
             return false;
         }
         if (in_array($position, array('wf_widget_ajax'), true)) {
             $dw->error(new XenForo_Phrase('wf_invalid_position_x', array('position' => $position)), $fieldName);
             return false;
         }
         // sondh@2012-08-25
         // added support for hook:hook_name
         if (substr($position, 0, 5) == 'hook:') {
             // accept all kind of hooks, just need to get parent templates for them
             $templates = $db->fetchAll("\n\t\t\t\t\tSELECT title\n\t\t\t\t\tFROM `xf_template_compiled`\n\t\t\t\t\tWHERE template_compiled LIKE " . XenForo_Db::quoteLike('callTemplateHook(\'' . substr($position, 5) . '\',', 'lr') . "\n\t\t\t\t");
             if (count($templates) > 0) {
                 $templateForHooks[$position] = array();
                 foreach ($templates as $template) {
                     $templateForHooks[$position][] = $template['title'];
                 }
                 $templateForHooks[$position] = array_unique($templateForHooks[$position]);
             } else {
                 $dw->error(new XenForo_Phrase('wf_non_existent_hook_x', array('hook' => substr($position, 5))), $fieldName);
                 return false;
             }
         } elseif (!$templateModel->getTemplateInStyleByTitle($position)) {
             $dw->error(new XenForo_Phrase('wf_invalid_position_x', array('position' => $position)), $fieldName);
             return false;
         }
         $positionsGood[] = $position;
     }
     $dw->setExtraData(WidgetFramework_DataWriter_Widget::EXTRA_DATA_TEMPLATE_FOR_HOOKS, $templateForHooks);
     asort($positionsGood);
     $positions = implode(', ', $positionsGood);
     return true;
 }
开发者ID:maitandat1507,项目名称:bdWidgetFramework,代码行数:54,代码来源:Widget.php

示例3: verifyPosition

 public static function verifyPosition(&$positions, XenForo_DataWriter $dw, $fieldName = false)
 {
     if ($dw->get('widget_page_id') > 0) {
         if ($positions === 'sidebar') {
             // good
         } else {
             $positions = '';
         }
         return true;
     }
     // sondh@2012-08-28
     // it may be better to use strtolower with $positions (making it easier for
     // admins)
     // but some add-on developers decided to use template with mixed case characters
     // so...
     // no strtolower goodness for everyone.
     $positions = trim($positions);
     if (empty($positions)) {
         $dw->error(new XenForo_Phrase('wf_position_can_not_be_empty'), $fieldName);
     }
     if ('all' == $positions) {
         return true;
     }
     $templateModel = $dw->getModelFromCache('XenForo_Model_Template');
     $db = XenForo_Application::getDb();
     $positionsArray = explode(',', $positions);
     $positionsGood = array();
     $templateForHooks = array();
     foreach ($positionsArray as $position) {
         $position = trim($position);
         if (empty($position)) {
             continue;
         }
         // sondh@2012-08-25
         // added support for hook:hook_name
         if (substr($position, 0, 5) == 'hook:') {
             // accept all kind of hooks, just need to get parent templates for them
             $templates = $db->fetchAll("\n\t\t\t\t\tSELECT title\n\t\t\t\t\tFROM `xf_template_compiled`\n\t\t\t\t\tWHERE template_compiled LIKE " . XenForo_Db::quoteLike('callTemplateHook(\'' . substr($position, 5) . '\',', 'lr') . "\n\t\t\t\t");
             if (count($templates) > 0) {
                 $templateForHooks[$position] = array();
                 foreach ($templates as $template) {
                     $templateForHooks[$position][] = $template['title'];
                 }
                 $templateForHooks[$position] = array_unique($templateForHooks[$position]);
             } else {
                 $dw->error(new XenForo_Phrase('wf_non_existent_hook_x', array('hook' => substr($position, 5))), $fieldName);
                 return false;
             }
         } else {
             $found = $templateModel->getTemplateInStyleByTitle($position);
             if (!$found) {
                 $dw->error(new XenForo_Phrase('wf_invalid_position_x', array('position' => $position)), $fieldName);
                 return false;
             }
         }
         $positionsGood[] = $position;
     }
     $dw->setExtraData(WidgetFramework_DataWriter_Widget::EXTRA_DATA_TEMPLATE_FOR_HOOKS, $templateForHooks);
     asort($positionsGood);
     $positions = implode(', ', $positionsGood);
     return true;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:62,代码来源:Widget.php

示例4: setExtraData

 /**
  *
  * @see XenForo_DataWriter::setExtraData
  */
 public function setExtraData($name, $value)
 {
     if ($name == self::DATA_SOCIAL_FORUM && is_array($value) && !empty($value['social_forum_id'])) {
         self::setSocialForumCacheItem($value);
     }
     return parent::setExtraData($name, $value);
 }
开发者ID:AndroidOS,项目名称:SocialGroups,代码行数:11,代码来源:SocialForumMember.php


注:本文中的XenForo_DataWriter::setExtraData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。