• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP XenForo_DataWriter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: verifyOption

 /**
  * Verifies database connection information
  *
  * @param array $words List of words to censor (from input). Keys: word, exact, replace
  * @param XenForo_DataWriter $dw Calling DW
  * @param string $fieldName Name of field/option
  *
  * @return true
  */
 public static function verifyOption(array &$database, XenForo_DataWriter $dw = null, $fieldName = null)
 {
     if (array_key_exists('newInstall', $database)) {
         return true;
     }
     if (!array_key_exists('adapter', $database) || !array_key_exists('host', $database) || !array_key_exists('port', $database) || !array_key_exists('dbname', $database) || !array_key_exists('username', $database) || !array_key_exists('password', $database)) {
         return false;
     }
     try {
         $db = Zend_Db::factory($database['adapter'], array('host' => $database['host'], 'port' => $database['port'], 'dbname' => $database['dbname'], 'username' => $database['username'], 'password' => $database['password']));
         $db->getConnection();
         $sbTables = array($database['table_prefix'] . '_admins', $database['table_prefix'] . '_admins_servers_groups', $database['table_prefix'] . '_banlog', $database['table_prefix'] . '_bans', $database['table_prefix'] . '_comments', $database['table_prefix'] . '_demos', $database['table_prefix'] . '_groups', $database['table_prefix'] . '_log', $database['table_prefix'] . '_mods', $database['table_prefix'] . '_overrides', $database['table_prefix'] . '_protests', $database['table_prefix'] . '_servers', $database['table_prefix'] . '_servers_groups', $database['table_prefix'] . '_settings', $database['table_prefix'] . '_srvgroups', $database['table_prefix'] . '_srvgroups_overrides', $database['table_prefix'] . '_submissions');
         $query = $db->listTables();
         if (count(array_diff($sbTables, $query)) > 0) {
             $dw->error(new XenForo_Phrase('sourcebans_table_prefix_invalid'));
             return false;
         }
     } catch (Zend_Db_Adapter_Exception $e) {
         if ($dw) {
             $dw->error($e->getMessage(), $fieldName);
         }
         return false;
     }
     return true;
 }
开发者ID:jljr222,项目名称:sourcebans-xenforo-sync,代码行数:34,代码来源:Database.php


示例2: watermark

 public static function watermark(array &$optionValues, XenForo_DataWriter $optionDw, $optionId)
 {
     if ($optionId !== 'sonnbXG_watermark') {
         return true;
     }
     if (!empty($optionValues['enabled'])) {
         switch ($optionValues['overlay']) {
             case 'image':
                 if (!Zend_Uri::check($optionValues['url']) && !is_file($optionValues['url'])) {
                     $optionDw->error(new XenForo_Phrase('sonnb_xengallery_watermark_image_not_valid'), $optionId);
                     return false;
                 }
                 break;
             case 'text':
                 if (!self::isTextColorValid($optionValues['textColor'])) {
                     $optionDw->error(new XenForo_Phrase('sonnb_xengallery_watermark_text_color_not_valid'), $optionId);
                     return false;
                 }
                 if (!self::isBgColorValid($optionValues['bgColor'])) {
                     $optionDw->error(new XenForo_Phrase('sonnb_xengallery_watermark_bg_color_not_valid'), $optionId);
                     return false;
                 }
                 if (!empty($optionValues['font']) && !is_file($optionValues['font'])) {
                     $optionDw->error(new XenForo_Phrase('sonnb_xengallery_watermark_font_path_not_valid'), $optionId);
                     return false;
                 }
                 break;
         }
     }
     return true;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:31,代码来源:Check.php


示例3: xenWrapperCallback

 public static function xenWrapperCallback(array &$configs, XenForo_DataWriter $dw, $fieldName)
 {
     if (isset($configs['Bbm_wrapper_callback']) && $configs['Bbm_wrapper_callback'] == 'callback' && !BBM_Helper_Bbm::callbackChecker($configs['class'], $configs['method'])) {
         $dw->error(new XenForo_Phrase('bbm_xenwrapper_callback_not_valid'));
     }
     return true;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:7,代码来源:Verification.php


示例4: schedule

 public function schedule($optionId, XenForo_DataWriter $dw, $dwField, $key = false)
 {
     extract($this->_getTargets($optionId, $key));
     if (!empty($included)) {
         $dw->set($dwField, array('targets' => $targets));
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:7,代码来源:SocialShare.php


示例5: verifyGoogleAnalyticsWebPropertyId

 /**
  * Verifies that the Google Analytics Web Property ID is valid, if specified.
  * See https://www.google.com/support/googleanalytics/bin/answer.py?answer=113500
  *
  * @param string $wpId
  * @param XenForo_DataWriter $dw
  * @param string $fieldName
  *
  * @return boolean
  */
 public static function verifyGoogleAnalyticsWebPropertyId(&$wpId, XenForo_DataWriter $dw, $fieldName)
 {
     if ($wpId !== '' && !preg_match('/^UA-\\d+-\\d+$/', $wpId)) {
         $dw->error(new XenForo_Phrase('please_enter_your_google_analytics_web_property_id_in_format'), $fieldName);
         return false;
     }
     return true;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:18,代码来源:Option.php


示例6: verifyOption

 public static function verifyOption(&$optionValue, XenForo_DataWriter $dw, $fieldName)
 {
     if ($optionValue == 'imPecl' && !class_exists('Imagick')) {
         $dw->error(new XenForo_Phrase('must_have_imagick_pecl_extension'), $fieldName);
         return false;
     }
     return true;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:8,代码来源:ImageLibrary.php


示例7: verifyUri

 /**
  * Verifies that the provided string is a valid URL
  *
  * @param string $url
  *
  * @return boolean
  */
 public static function verifyUri(&$uri, XenForo_DataWriter $dw, $fieldName = false)
 {
     if (Zend_Uri::check($uri)) {
         return true;
     }
     $dw->error(new XenForo_Phrase('please_enter_valid_url'), $fieldName);
     return false;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:15,代码来源:Uri.php


示例8: verifyOption

 /**
  * Verifies the license key.
  *
  * @param string $licenseKey license key to be verified
  * @param XenForo_DataWriter $dw Calling DW
  * @param string $fieldName Name of field/option
  *
  * @return true
  */
 public static function verifyOption(&$licenseKey, XenForo_DataWriter $dw, $fieldName)
 {
     if (XenForo_Application::getOptions()->simpleFormsLicenseKey && !self::VerifyLicense($licenseKey)) {
         $errorMessage = 'The license key you entered is invalid. If you are having trouble with your license, please contact <a href="https://liquidpro.net/clients/clientarea.php" target="_blank">LiquidPro Support</a>.';
         $dw->error($errorMessage, $fieldName);
     }
     return true;
 }
开发者ID:jljr222,项目名称:xenforo-simple-forms,代码行数:17,代码来源:LicenseKey.php


示例9: validateOption

 public static function validateOption(&$choices, XenForo_DataWriter $dw, $fieldName)
 {
     if ($dw->isInsert()) {
         return true;
     }
     if (!in_array($choices, self::$navbarPositions)) {
         $dw->error(new XenForo_Phrase('invalid_argument'), $fieldName);
         return false;
     }
     return true;
 }
开发者ID:NixFifty,项目名称:XenForo-SimplePortal,代码行数:11,代码来源:Tab.php


示例10: verifyOption

 public static function verifyOption(&$optionValue, XenForo_DataWriter $dw, $fieldName)
 {
     if ($dw->isInsert()) {
         return true;
     }
     $redirects = new XenGallery_Option_Redirects();
     $redirects->addOnId = 'EWRmedio';
     $redirects->route = 'ewrmedio';
     $redirects->replaceRoute = 'media';
     $redirects->verifyOptionForAddOn($optionValue, $dw, $fieldName);
     return true;
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:12,代码来源:XenMedioRedirect.php


示例11: verifyMoodId

 /**
  * Verifies that the provided integer is a valid mood ID
  *
  * @param integer $moodId
  * @param XenForo_DataWriter The current running data writer
  * @param string Field being affected
  *
  * @return boolean
  */
 public static function verifyMoodId($moodId, XenForo_DataWriter $dw, $fieldName = false)
 {
     if ($moodId === 0) {
         // explicitly set to 0, use system default
         return true;
     }
     if ($dw->getModelFromCache('XenMoods_Model_Mood')->getMoodById($moodId)) {
         return true;
     }
     $dw->error(new XenForo_Phrase('please_select_valid_mood'), $fieldName);
     return false;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:21,代码来源:Mood.php


示例12: verifyUsernameExists

 public static function verifyUsernameExists(&$username, XenForo_DataWriter $dw = null, $fieldName = null)
 {
     if ($username != '') {
         $userModel = XenForo_Model::create('XenForo_Model_User');
         $user = $userModel->getUserByName($username);
         if (!$user) {
             $dw->error(new XenForo_Phrase('AWickham_SourceBansSync_InvalidUsername'));
             return false;
         }
     }
     return true;
 }
开发者ID:jljr222,项目名称:sourcebans-xenforo-sync,代码行数:12,代码来源:User.php


示例13: verifyOption

 /**
  * Updates the build date of styles after the value of the minifyCss option changes.
  *
  * @param boolean $option
  * @param XenForo_DataWriter $dw
  * @param string $fieldName
  *
  * @return boolean
  */
 public static function verifyOption(&$option, XenForo_DataWriter $dw, $fieldName)
 {
     if ($dw->isInsert()) {
         return true;
         // don't need to do anything
     }
     if ($option) {
         XenForo_Model::create('XenForo_Model_Template')->writeTemplateFiles(false, false);
     } else {
         XenForo_Model::create('XenForo_Model_Template')->deleteTemplateFiles();
     }
     return true;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:22,代码来源:TemplateFiles.php


示例14: verifyOption

 /**
  * Verifies the autoEmbedMedia setting
  *
  * @param array $values
  * @param XenForo_DataWriter $dw Calling DW
  * @param string $fieldName Name of field/option
  *
  * @return true
  */
 public static function verifyOption(array &$values, XenForo_DataWriter $dw, $fieldName)
 {
     if (empty($values['linkBbCode'])) {
         $values['linkBbCode'] = '[i][size=2][url={$url}]View: {$url}[/url][/size][/i]';
     }
     if ($values['embedType'] != XenForo_Helper_Media::AUTO_EMBED_MEDIA_DISABLED) {
         if (strpos($values['linkBbCode'], '{$url}') === false) {
             $dw->error(new XenForo_Phrase('link_bbcode_must_include_url_token'), $fieldName);
             return false;
         }
     }
     return true;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:22,代码来源:AutoEmbedMedia.php


示例15: verifySerialized

 public static function verifySerialized(&$serial, XenForo_DataWriter $dw, $fieldName = false)
 {
     if (!is_string($serial)) {
         $serial = serialize($serial);
         return true;
     }
     if (@unserialize($serial) === false && $serial != serialize(false)) {
         // debugging message, no need for phrasing
         $dw->error('The data provided as a serialized array does not unserialize.', $fieldName);
         return false;
     }
     return true;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:13,代码来源:Denormalization.php


示例16: validateColour

 public static function validateColour($value, XenForo_DataWriter $dw, $fieldName)
 {
     // #fff and #fff444 are acceptable formats here
     if (strlen($value) != 7 && strlen($value) != 4) {
         $dw->error(new XenForo_Phrase("mc_assoc_errors_hex_colour"), $fieldName);
     }
     $truncatedValue = substr($value, 1);
     // chop off the #
     if (!ctype_xdigit($truncatedValue) || $value[0] != "#") {
         $dw->error(new XenForo_Phrase("mc_assoc_errors_hex_colour"), $fieldName);
     }
     return $dw;
 }
开发者ID:adamjdev,项目名称:XenForo-MCASSOC,代码行数:13,代码来源:Options.php


示例17: verifyTweetOption

 public static function verifyTweetOption(array &$option, XenForo_DataWriter $dw, $fieldName)
 {
     if (!empty($option['enabled'])) {
         if (!empty($option['via']) && !XenForo_Helper_UserField::verifyTwitter(array(), $option['via'], $error)) {
             $dw->error($error, $fieldName);
             return false;
         }
         if (!empty($option['related']) && !XenForo_Helper_UserField::verifyTwitter(array(), $option['related'], $error)) {
             $dw->error($error, $fieldName);
             return false;
         }
     }
     return true;
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:14,代码来源:Twitter.php


示例18: verifyOption

 public static function verifyOption(array &$options, XenForo_DataWriter $dw, $fieldName)
 {
     if (!$dw->isInsert()) {
         $grouped = array();
         foreach ($options as $option) {
             if (!isset($option['group']) || strval($option['group']) === '') {
                 continue;
             }
             $grouped[strval($option['group'])][] = array('group' => strval($option['group']), 'name' => strval($option['name']), 'format' => strval($option['format']));
         }
         $options = $grouped;
     }
     return true;
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:14,代码来源:ExifOptions.php


示例19: verifyTweetOption

 public static function verifyTweetOption(array &$option, XenForo_DataWriter $dw, $fieldName)
 {
     if (!empty($option['enabled'])) {
         if (!XenForo_Model_IdentityService_Twitter::verifyAccountName($option['via'], $error)) {
             $dw->error($error);
             return false;
         }
         if (!XenForo_Model_IdentityService_Twitter::verifyAccountName($option['related'], $error)) {
             $dw->error($error);
             return false;
         }
     }
     return true;
 }
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:14,代码来源:Twitter.php


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP XenForo_Db类代码示例发布时间:2022-05-23
下一篇:
PHP XenForo_CodeEvent类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap