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


PHP XenForo_DataWriter类代码示例

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


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


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