protected function _validateOptionValue($optionKey, &$optionValue) { switch ($optionKey) { case 'limit': if (empty($optionValue)) { $optionValue = 5; } break; } return parent::_validateOptionValue($optionKey, $optionValue); }
protected function _validateOptionValue($optionKey, &$optionValue) { switch ($optionKey) { case 'limit': if (empty($optionValue)) { $optionValue = 5; } break; case 'order': if (empty($optionValue)) { $optionValue = 'register_date'; } break; case 'direction': if (empty($optionValue)) { $optionValue = 'DESC'; } break; } return parent::_validateOptionValue($optionKey, $optionValue); }
protected function _validateOptionValue($optionKey, &$optionValue) { switch ($optionKey) { case 'thread_id': if (!empty($optionValue)) { $optionValue = strtolower($optionValue); if ($optionValue === 'random') { // random mode } else { $threadModel = XenForo_Model::create('XenForo_Model_Thread'); $thread = $threadModel->getThreadById($optionValue); if (empty($thread)) { throw new XenForo_Exception(new XenForo_Phrase('requested_thread_not_found'), true); } elseif (empty($thread['discussion_type']) or 'poll' != $thread['discussion_type']) { throw new XenForo_Exception(new XenForo_Phrase('wf_requested_thread_does_not_have_poll'), true); } } } break; } return parent::_validateOptionValue($optionKey, $optionValue); }