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


PHP SpoonFilter::arrayMapRecursive方法代码示例

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


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

示例1: parse

 /**
  * Parse the form
  */
 protected function parse()
 {
     parent::parse();
     // prevent XSS
     $filter = \SpoonFilter::arrayMapRecursive('htmlspecialchars', $this->filter);
     $this->tpl->assign($filter);
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:10,代码来源:Add.php

示例2: loadDataGrid

 /**
  * Loads the datagrid with the clicked link
  */
 private function loadDataGrid()
 {
     // no statistics found
     if (empty($this->statistics['clicked_links'])) {
         return false;
     }
     // map urlencode to clicked links stack
     $this->statistics['clicked_links'] = \SpoonFilter::arrayMapRecursive('urlencode', $this->statistics['clicked_links']);
     // create a new source-object
     $source = new \SpoonDatagridSourceArray($this->statistics['clicked_links']);
     // call the parent, as in create a new datagrid with the created source
     $this->dataGrid = new BackendDataGrid($source);
     $this->dataGrid->setURL(BackendModel::createURLForAction() . '&offset=[offset]&order=[order]&sort=[sort]&id=' . $this->id);
     // set headers values
     $headers['link'] = strtoupper(BL::lbl('URL'));
     $headers['clicks'] = \SpoonFilter::ucfirst(BL::msg('ClicksAmount'));
     // set headers
     $this->dataGrid->setHeaderLabels($headers);
     // sorting columns
     $this->dataGrid->setSortingColumns(array('link', 'clicks'), 'link');
     // set column functions
     $this->dataGrid->setColumnFunction('urldecode', array('[link]'), 'link', true);
     $this->dataGrid->setColumnFunction('urldecode', array('[link]'), 'link', true);
     // set paging limit
     $this->dataGrid->setPagingLimit(self::PAGING_LIMIT);
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('StatisticsLink')) {
         // add edit column
         $this->dataGrid->addColumnAction('users', null, BL::lbl('Who'), BackendModel::createURLForAction('StatisticsLink') . '&url=[link]&mailing_id=' . $this->id, BL::lbl('Who'));
     }
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:34,代码来源:Statistics.php

示例3: parse

 /**
  * Parse the form
  */
 protected function parse()
 {
     parent::parse();
     // prevent XSS
     $filter = \SpoonFilter::arrayMapRecursive('htmlspecialchars', $this->filter);
     // parse filter
     $this->tpl->assign($filter);
     $this->tpl->assign('filterQuery', $this->filterQuery);
     // assign id, name
     $this->tpl->assign('name', $this->record['name']);
     $this->tpl->assign('id', $this->record['id']);
 }
开发者ID:newaltcoin,项目名称:forkcms,代码行数:15,代码来源:Edit.php

示例4: getMethod

 /**
  * Retrieve the form method or the submitted data.
  *
  * @return	string
  * @param	bool[optional] $array	Should we return the submitted data?
  */
 public function getMethod($array = false)
 {
     // we want to get the actual $_GET or $_POST data
     if ($array) {
         // $_POST array
         if ($this->method == 'post') {
             return $_POST;
         }
         // $_GET array
         return SpoonFilter::arrayMapRecursive('urldecode', $_GET);
     }
     // submitted via met get or post
     return $this->method;
 }
开发者ID:sunkangtaichi,项目名称:library,代码行数:20,代码来源:element.php

示例5: testArrayMapRecursive

 public function testArrayMapRecursive()
 {
     /* without allowedKeys parameter */
     // test array
     $testArray = array(0 => array('string1' => 'This%20is%20a%20string'), 1 => array('string2' => 'This%20is%20a%20string'));
     // expected result
     $testResult = array(0 => array('string1' => 'This is a string'), 1 => array('string2' => 'This is a string'));
     // perform test
     $this->assertEquals($testResult, SpoonFilter::arrayMapRecursive('urldecode', $testArray));
     /* with allowedKeys parameter */
     // test array
     $testArray = array(0 => serialize(array('string1' => 'spoon')), 1 => serialize(array('string2' => 'rocks')));
     // expected result
     $testResult = array(0 => 'a:1:{s:7:"string1";s:5:"spoon";}', 1 => array('string2' => 'rocks'));
     // perform test
     $this->assertEquals($testResult, SpoonFilter::arrayMapRecursive('unserialize', $testArray, '1'));
     /* with allowedKeys parameter, depth of 4 */
     // test array
     $testArray = array(0 => array('array1' => array(array('spoon' => serialize('kicks'), 'serious' => serialize('ass')))), 1 => serialize(array('string2' => 'ass')));
     // expected result
     $testResult = array(0 => array('array1' => array(array('spoon' => 's:5:"kicks";', 'serious' => 'ass'))), 1 => array('string2' => 'ass'));
     // perform test
     $this->assertEquals($testResult, SpoonFilter::arrayMapRecursive('unserialize', $testArray, array('serious', '1')));
 }
开发者ID:jeroendesloovere,项目名称:library,代码行数:24,代码来源:SpoonFilterTest.php

示例6: exportStatistics

 /**
  * Exports the statistics of a given mailing in CSV format. This function will send headers to download the CSV and exit your script after use.
  *
  * @param int $id The ID of the mailing.
  */
 public static function exportStatistics($id)
 {
     // fetch the addresses by group
     $records = array();
     $records[] = BackendMailmotorCMHelper::getStatistics($id, true);
     // fetch separate arrays
     $statsClickedLinks = isset($records[0]['clicked_links']) ? $records[0]['clicked_links'] : array();
     $statsClickedLinksBy = isset($records[0]['clicked_links_by']) ? $records[0]['clicked_links_by'] : array();
     // unset multi-dimensional arrays
     unset($records[0]['clicked_links'], $records[0]['clicked_links_by'], $records[0]['opens'], $records[0]['clicks'], $records[0]['clicks_percentage'], $records[0]['clicks_total'], $records[0]['recipients_total'], $records[0]['recipients_percentage'], $records[0]['online_version']);
     // set columns
     $columns = array();
     $columns[] = BL::msg('MailingCSVRecipients');
     $columns[] = BL::msg('MailingCSVUniqueOpens');
     $columns[] = BL::msg('MailingCSVUnsubscribes');
     $columns[] = BL::msg('MailingCSVBounces');
     $columns[] = BL::msg('MailingCSVUnopens');
     $columns[] = BL::msg('MailingCSVBouncesPercentage');
     $columns[] = BL::msg('MailingCSVUniqueOpensPercentage');
     $columns[] = BL::msg('MailingCSVUnopensPercentage');
     // set start of the CSV
     $csv = BackendCSV::arrayToString($records, $columns);
     // check set links
     if (!empty($statsClickedLinks)) {
         // urldecode the clicked URLs
         $statsClickedLinks = SpoonFilter::arrayMapRecursive('urldecode', $statsClickedLinks);
         // fetch CSV strings
         $csv .= PHP_EOL . BackendCSV::arrayToString($statsClickedLinks);
     }
     // set the filename and path
     $filename = 'statistics-' . SpoonDate::getDate('YmdHi') . '.csv';
     // set headers for download
     $headers = array();
     $headers[] = 'Content-type: application/octet-stream';
     $headers[] = 'Content-Disposition: attachment; filename="' . $filename . '"';
     // overwrite the headers
     SpoonHTTP::setHeaders($headers);
     // output the CSV string
     echo $csv;
     // exit here
     exit;
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:47,代码来源:model.php


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