當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。