本文整理汇总了PHP中Zend_Filter::filterStatic方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Filter::filterStatic方法的具体用法?PHP Zend_Filter::filterStatic怎么用?PHP Zend_Filter::filterStatic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Filter
的用法示例。
在下文中一共展示了Zend_Filter::filterStatic方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _unmapCustom
/**
* @return AM_Mapper_Sqlite_Element
*/
protected function _unmapCustom()
{
$sContentText = null;
$oElementDataSet = $this->getModel()->getResources();
/* @var $oElementDataSet AM_Model_Db_Element_Data_Abstract */
foreach ($oElementDataSet->getData() as $oElementData) {
/* @var $oElementData AM_Model_Db_Element_Data_Abstract */
if (AM_Model_Db_Element_Data_Resource::PDF_INFO == $oElementData->key_name) {
if (!empty($oElementData->value)) {
$aPdfInfo = Zend_Json_Decoder::decode($oElementData->value, true);
$sContentText = $aPdfInfo['text'];
}
}
$sElementDataMapperClassName = self::ELEMENT_DATA_MAPPER_CLASS_PREFIX . Zend_Filter::filterStatic($oElementData->key_name, 'Word_UnderscoreToCamelCase');
if (class_exists($sElementDataMapperClassName, true)) {
$oElementDataMapper = new $sElementDataMapperClassName($oElementData, array('adapter' => $this->_getAdapter()));
$oElementDataMapper->unmap();
continue;
}
$aData = array('element_id' => $this->getModel()->id, 'type' => $oElementData->key_name, 'value' => $oElementDataSet->getDataValueForExport($oElementData->key_name), 'position_id' => 0);
$this->_getSqliteGateway('element_data')->insert($aData);
}
$aData = array('id' => $this->getModel()->id, 'page_id' => $this->getModel()->page, 'element_type_name' => $this->getModel()->getFieldTypeTitle(), 'weight' => intval($this->getModel()->weight), 'content_text' => $sContentText);
$this->_getSqliteGateway()->insert($aData);
return $this;
}
示例2: moreAction
/**
* Action more.
*
* @return void
*/
public function moreAction()
{
$page = Zend_Filter::filterStatic($this->_getParam('page'), 'int');
$identity = Zend_Auth::getInstance()->getIdentity();
$courses = Application_Model_Classroom::getAllByUser($identity->id);
$this->view->timeline = Application_Model_Timeline::getByClassroom($courses, $page);
}
示例3: viewAction
public function viewAction()
{
$identity = Zend_Auth::getInstance()->getIdentity();
$id = Zend_Filter::filterStatic($this->_getParam('id'), 'int');
$exerciseId = Zend_Filter::filterStatic($this->_getParam('exerciseId'), 'int');
$userId = Zend_Filter::filterStatic($this->_getParam('userId', $identity->id), 'int');
$exercise = new Tri_Db_Table('exercise');
$exerciseQuestion = new Tri_Db_Table('exercise_question');
$exerciseNote = new Tri_Db_Table('exercise_note');
$exerciseAnswer = new Tri_Db_Table('exercise_answer');
if ($id) {
$note = $exerciseNote->fetchRow(array('id = ?' => $id));
} elseif ($exerciseId) {
$note = $exerciseNote->fetchRow(array('exercise_id = ?' => $exerciseId, 'user_id = ?' => $userId), 'id DESC');
}
if ($note) {
$row = $exercise->fetchRow(array('id = ?' => $note->exercise_id));
if ($row) {
$where = array('exercise_id = ?' => $row->id, 'status = ?' => 'active');
$this->view->questions = $exerciseQuestion->fetchAll($where);
$this->view->exercise = $row;
$this->view->answers = $exerciseAnswer->fetchAll(array('exercise_note_id = ?' => $note->id));
$this->view->note = $note;
$whereNote = array('exercise_id = ?' => $note->exercise_id, 'id <> ?' => $note->id, 'user_id = ?' => $userId);
$this->view->notes = $exerciseNote->fetchAll($whereNote, 'id DESC');
$this->view->userId = $userId;
} else {
$this->view->message = 'there are no records';
}
} else {
$this->view->message = 'there are no records';
}
}
示例4: date
public function date($value, $displayTime = false)
{
if ($displayTime) {
$translate = Zend_Registry::get('Zend_Translate');
$locale = key(Zend_Registry::get('Zend_Locale')->getDefault());
$date = new Zend_Date($value, null, $locale);
if ($date->isToday()) {
$h = $date->toString('H');
$m = $date->toString('m');
$s = $date->toString('s');
if (date('H') == $h) {
$min = (int) date('i') - (int) $m;
if ($min < 1) {
$sec = (int) date('s') - (int) $s;
if ($sec < 10) {
return $translate->_('now');
}
return $sec . ' ' . $translate->_('seconds ago');
}
return $min . ' ' . $translate->_('minutes ago');
} elseif (date('H') > $h) {
return (int) date('H') - (int) $h . ' ' . $translate->_('hours ago');
}
return $date->toString('H:m');
} else {
return $date->toString('dd/MM/y H:m');
}
}
return Zend_Filter::filterStatic($value, 'date', array(), 'Tri_Filter');
}
示例5: filter
public function filter($value)
{
$digits = Zend_Filter::filterStatic($value, 'Digits');
$padded = str_pad($digits, 5, '0', STR_PAD_LEFT);
$output = 'HRS' . $padded;
return $output;
}
示例6: __call
public function __call($function, $args)
{
$re = '/(' . join('|', array_keys(array_map('preg_quote', $this->_queryTypes))) . ')(.+?)(?:By(.+))*$/';
if (preg_match($re, $function, $matches)) {
$queryType = $matches[1];
if (isset($this->_queryTypes[$queryType])) {
$temp = str_split($matches[2]);
$temp[0] = strtolower($temp[0]);
$method_names = array('_' . $queryType . $matches[2] . 'Query', '_' . join($temp) . 'Query');
$queryMethod = $this->_queryTypes[$queryType];
if (isset($matches[3])) {
array_unshift($method_names, '_' . $queryType . $matches[2] . 'ByQuery');
if (Zend_Version::compareVersion('1.7.9') < 0) {
$filter = new Zend_Filter_Word_CamelCaseToUnderscore();
$field = strtolower($filter->filter($matches[3]));
} else {
$field = strtolower(Zend_Filter::filterStatic($matches[3], 'Word_CamelCaseToUnderscore'));
}
array_unshift($args, $field);
}
foreach ($method_names as $method) {
if (method_exists($this, $method)) {
$sql = call_user_func_array(array($this, $method), $args);
return $this->{$queryMethod}($sql);
break;
}
}
die("Cannot find proper query method for function <b>" . $function . "</b> of class " . get_class($this));
}
}
de('Table.php: ', $function, $args);
return parent::__call($function, $args);
}
示例7: postSave
public function postSave($entity, $dto = NULL)
{
$data = $dto->getMap();
unset($data['sqUsuarioExterno']);
$entityPF = $this->_getRepository('app:UsuarioPessoaFisica')->find($entity->getSqUsuarioExterno());
$data['sqTipoEscolaridade'] = NULL;
$data['sqPaisOrigem'] = NULL;
if ($dto->getSqTipoEscolaridade()) {
$data['sqTipoEscolaridade'] = $this->_getRepository('app:TipoEscolaridade')->find($dto->getSqTipoEscolaridade());
}
if ($dto->getSqPaisOrigem()) {
$data['sqPaisOrigem'] = $this->_getRepository('app:Pais')->find($dto->getSqPaisOrigem());
}
if ($entityPF) {
$entityPF->fromArray($data);
} else {
$entityPF = \Core_Dto::factoryFromData($dto->getMap(), 'entity', $this->_entityOption)->getEntity();
$entityPF->setSqTipoEscolaridade($data['sqTipoEscolaridade']);
$entityPF->setSqPaisOrigem($data['sqPaisOrigem']);
}
$entityPF->setNuCpf(\Zend_Filter::filterStatic($entityPF->getNuCpf(), 'Digits'));
$entityPF->setSqUsuarioExterno($entity);
$this->getEntityManager()->persist($entityPF);
$this->getEntityManager()->flush($entityPF);
parent::postSave($entity, $dto);
}
示例8: filterStatic
public static function filterStatic($value, $classBaseName, array $args = array(), $namespaces = array())
{
$namespaces = array_merge(array('Kwf_Filter'), (array) $namespaces);
class_exists('Kwf_Filter_' . ucfirst($classBaseName));
//trigger autoloader
return parent::filterStatic($value, $classBaseName, $args, $namespaces);
}
示例9: direct
/**
*
* @param La_Db_Table $table
* @param La_Form $form
*/
public function direct(La_Db_Table $table = null, La_Form $form = null)
{
$controller = $this->getActionController();
$id = Zend_Filter::filterStatic($controller->getParam("id"), 'int');
$ajaxContext = $controller->getHelper('AjaxContext');
$formData = $controller->getParam("formData");
$ajaxContext->addActionContext('form', 'html')->initContext();
if (!$form) {
$form = $controller->form;
}
if (!$table) {
$table = $controller->table;
}
$table->setAutoJoin(false);
$controller->view->data = $table->createRow();
if ($id) {
$row = $table->find($id)->current();
if (!$row) {
$controller->view->messages = array($controller->getHelper('Message')->direct('ERROR_LOAD'));
} else {
$controller->view->data = $row;
$form->populate($row->toArray());
if ($formData) {
$form->populate($formData);
$controller->view->messages = array($controller->getHelper('Message')->direct('ERROR', true));
}
}
}
$controller->view->dynamicFormId = uniqid();
$controller->view->form = $form;
$controller->view->id = $id;
}
示例10: direct
/**
*
* @param La_Db_Table $table
*/
public function direct(La_Db_Table $table = null, $redirectUrl = null)
{
$controller = $this->getActionController();
$data = $this->getRequest()->getParams();
$table = $table ?: $controller->table;
$url = sprintf('%s/%s/index/parent_id/%s/table/%s', $data['module'], $data['controller'], $data['parent_id'], $table->getName());
if (!$table) {
$table = $controller->table;
}
if ($redirectUrl) {
$url = $redirectUrl;
}
$id = $data['id'];
if ($id) {
$ids = (array) $id;
try {
foreach ($ids as $id) {
$where = array('id = ?' => Zend_Filter::filterStatic($id, 'int'));
$table->logicDelete($where);
}
$message = $controller->getHelper('Message')->direct('SUCCESS');
$controller->redirect($url);
} catch (Exception $e) {
$message = $controller->getHelper('Message')->direct('ERROR_DELETE');
$controller->redirect($url);
}
}
$message = $controller->getHelper('Message')->direct('ERROR_DELETE');
$controller->redirect($url);
}
示例11: splitTelephone
public function splitTelephone($telephone)
{
$telephone = Zend_Filter::filterStatic($telephone, 'Digits');
$ddd = substr($telephone, 0, 2);
$number = substr($telephone, 2);
$data = array('ddd' => $ddd, 'number' => $number);
return $data;
}
示例12: direct
/**
*
* @param Zend_Db_Select|Zend_Db_Table_Select $select
* @return \La_Paginator
*/
public function direct(Zend_Db_Select $select)
{
$request = $this->getRequest();
$page = Zend_Filter::filterStatic($request->getParam('page', 1), 'int');
$quantity = Zend_Filter::filterStatic($request->getParam('quantity', 10), 'int');
$paginator = new La_Paginator($select, $page, $quantity);
return $paginator->getResult();
}
示例13: saveAction
public function saveAction()
{
$session = new Zend_Session_Namespace('data');
$userId = Zend_Filter::filterStatic($this->_getParam('userId'), 'int');
Panel_Model_Certificate::emit($userId, $session->classroom_id);
$this->_helper->_flashMessenger->addMessage('Success');
$this->_redirect('/panel');
}
示例14: mountSelect
/**
* return select table content
*
* @param int $discipline => id discipline
* @param mixed $columns => columns apresentation select
* @param null|int $content => id content
* @access private
* @return object Zend_Db_Table_Select
*/
private function mountSelect($discipline, $columns, $content_id = null)
{
$content = new Content_Model_Content();
$select = $content->select()->setIntegrityCheck(false)->from(array("tcs" => "content"), $columns, 'trails')->where("tcs.discipline_id = ?", Zend_Filter::filterStatic($discipline, 'Int'))->order(array("tcs.content_id", "tcs.position", "tcs.id"));
if ($content_id) {
$select->join(array("tc" => "trails.content"), "tcs.id = tc.content_id", array())->where("( tcs.content_id = ?", $content_id)->orWhere("tcs.id = ? )", $content_id);
}
return $select;
}
示例15: saveTelefoneSgdoce
public function saveTelefoneSgdoce($entity, $entityAux1)
{
$telefone = $this->getServiceLocator()->getService('VwTelefone')->findTelefone($entity->getSqPessoa());
$entityTelefoneArtefato = NULL;
$filter = new \Zend_Filter();
if ($telefone->getSqTelefone()) {
$entityTelefoneArtefato = $this->_newEntity('app:TelefoneSgdoce');
$tipoTelefone = $this->getEntityManager()->getPartialReference('app:VwTipoTelefone', \Core_Configuration::getSgdoceTipoTelefoneResidencial());
$entityTelefoneArtefato->setSqPessoaSgdoce($entityAux1);
$entityTelefoneArtefato->setSqTipoTelefone($tipoTelefone);
$entityTelefoneArtefato->setDtCadastro(new \Zend_Date());
$entityTelefoneArtefato->setNuDdd($filter->filterStatic($telefone->getNuDdd(), 'Digits'));
$entityTelefoneArtefato->setNuTelefone($filter->filterStatic($telefone->getNuTelefone(), 'Digits'));
$this->getEntityManager()->persist($entityTelefoneArtefato);
}
$this->getEntityManager()->flush($entityTelefoneArtefato);
return $entityTelefoneArtefato;
}