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


PHP PerchUtil::safe_stripslashes方法代码示例

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


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

示例1: get_raw

 public function get_raw($post = false, $Item = false)
 {
     // PerchUtil::debug($this->unique_id);
     // PerchUtil::debug($this->required_id);
     $id = $this->Tag->id();
     $out = array();
     if (isset($post[$id . '_title']) && trim($post[$id . '_title']) !== '') {
         $title = PerchUtil::safe_stripslashes(trim($post[$id . '_title']));
         $out['title'] = $title;
     } else {
         $out['title'] = '';
     }
     $out['_title'] = $out['title'];
     if (isset($post[$id . '_is3d']) && trim($post[$id . '_is3d']) !== '') {
         $out['is3d'] = $post[$id . '_is3d'];
     } else {
         $out['is3d'] = false;
     }
     $width = $this->Tag->width() === false ? "460" : $this->Tag->width();
     $out['width'] = $width;
     $height = $this->Tag->height() === false ? "320" : $this->Tag->height();
     $out['height'] = $height;
     if (isset($post[$id . '_data']) && trim($post[$id . '_data']) !== '') {
         $out['data'] = $post[$id . '_data'];
     } else {
         $out['data'] = '[]';
     }
     $out['chart_id'] = $this->unique_id . $this->required_id;
     return $out;
 }
开发者ID:siansell,项目名称:perch-cms-fieldtype-piechart,代码行数:30,代码来源:simona_piechart.class.php

示例2: populate

 public function populate($formID, $templatePath, $data, $files, $timestamp = false)
 {
     $this->formID = $formID;
     $this->id = $formID;
     $this->templatePath = $templatePath;
     $this->timestamp = $timestamp;
     if (PerchUtil::count($data)) {
         foreach ($data as &$datum) {
             $datum = PerchUtil::safe_stripslashes($datum);
         }
     }
     $this->data = $data;
     $this->files = $files;
 }
开发者ID:jaredmedley,项目名称:Perch-Core-Files,代码行数:14,代码来源:PerchAPI_SubmittedForm.class.php

示例3: pdb

 public function pdb($value)
 {
     // Stripslashes
     if (get_magic_quotes_runtime()) {
         $value = PerchUtil::safe_stripslashes($value);
     }
     $link = $this->get_link();
     if (!$link) {
         return false;
     }
     // Quote
     switch (gettype($value)) {
         case 'integer':
         case 'double':
             $escape = $value;
             break;
         case 'string':
             $escape = $link->quote($value);
             break;
         case 'NULL':
             $escape = 'NULL';
             break;
         default:
             $escape = $link->quote($value);
     }
     return $escape;
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:27,代码来源:PerchDB_MySQL.class.php

示例4: value

 private function value($value)
 {
     if ($this->force_clear) {
         return '';
     }
     if (is_array($value)) {
         return $value;
     }
     return PerchUtil::safe_stripslashes($value);
 }
开发者ID:jaredmedley,项目名称:Perch-Core-Files,代码行数:10,代码来源:PerchForm.class.php

示例5: get_posted_content

 public function get_posted_content($Template, $Factory, $Item = false, $include_repeaters = true, $json_encode = true)
 {
     $data = array();
     $prev = false;
     if ($Item) {
         $prev = $Item->to_array();
     }
     $dynamic_fields = $this->receive_from_template_fields($Template, $prev, $Factory, $Item, true, false);
     $static_fields = array();
     // fetch out static fields
     foreach ($Factory->static_fields as $field) {
         if (array_key_exists($field, $dynamic_fields)) {
             //($dynamic_fields[$field])) {
             if (is_array($dynamic_fields[$field])) {
                 if (isset($dynamic_fields[$field]['_default'])) {
                     $data[$field] = trim($dynamic_fields[$field]['_default']);
                 }
                 if (isset($dynamic_fields[$field]['processed'])) {
                     $data[$field] = trim($dynamic_fields[$field]['processed']);
                 }
             }
             if (!isset($data[$field])) {
                 $data[$field] = $dynamic_fields[$field];
             }
             unset($dynamic_fields[$field]);
         } else {
             if (isset($_POST[$field])) {
                 if (!is_array($_POST[$field])) {
                     $data[$field] = trim(PerchUtil::safe_stripslashes($_POST[$field]));
                 } else {
                     $data[$field] = $_POST[$field];
                 }
             }
         }
     }
     if (!$json_encode) {
         return $dynamic_fields;
     }
     $data[$Factory->dynamic_fields_column] = PerchUtil::json_safe_encode($dynamic_fields);
     return $data;
 }
开发者ID:jaredmedley,项目名称:Perch-Core-Files,代码行数:41,代码来源:PerchAPI_Form.class.php

示例6: get_raw

 /**
  * Get raw value
  *
  * @return void
  * @author Drew McLellan
  */
 public function get_raw($post = false, $Item = false)
 {
     if ($post === false) {
         $post = $_POST;
     }
     $id = $this->Tag->id();
     if (isset($post[$id])) {
         $this->raw_item = trim(PerchUtil::safe_stripslashes($post[$id]));
         return $this->raw_item;
     }
     return null;
 }
开发者ID:jaredmedley,项目名称:Perch-Core-Files,代码行数:18,代码来源:PerchFieldType.class.php

示例7: get_raw

 public function get_raw($post = false, $Item = false)
 {
     if ($post === false) {
         $post = $_POST;
     }
     $id = $this->Tag->id();
     if (isset($post[$id])) {
         $raw = trim($post[$id]);
         $flang = 'plain';
         if ($this->Tag->html()) {
             $flang = 'html';
         }
         $value = PerchUtil::safe_stripslashes($raw);
         // Strip HTML by default
         if (!is_array($value) && PerchUtil::bool_val($this->Tag->html()) == false) {
             $value = PerchUtil::html($value);
             $value = strip_tags($value);
         }
         $Markdown = new PerchParsedown();
         $value = $Markdown->smartypants($value);
         $flang = 'smartypants';
         $store = array('_flang' => $flang, 'raw' => $raw, 'processed' => $value);
         $this->raw_item = $store;
         return $this->raw_item;
     }
     return null;
 }
开发者ID:jaredmedley,项目名称:Perch-Core-Files,代码行数:27,代码来源:PerchFieldTypes.class.php

示例8: read_items_from_post


//.........这里部分代码省略.........
                             $item_tags[] = new PerchXMLTag('<perch:' . $Template->namespace . ' id="_block_id" value="' . $new_postitems['_block_id'] . '" type="editcontrol" />');
                             $item_tags[] = new PerchXMLTag('<perch:' . $Template->namespace . ' id="_block_index" value="' . $new_postitems['_block_index'] . '" type="editcontrol" />');
                         }
                         $as_in_block = true;
                     } else {
                         $item_tags = $Tag->tags;
                         $as_in_block = false;
                     }
                     list($result, $search_text) = self::read_items_from_post($Item, $item_tags, $subprefix . $i, $new_form_vars, $new_postitems, $Form, $search_text, $options, $Resources, true, $Template, $as_in_block);
                     //PerchUtil::debug($result, 'notice');
                     if (strlen(self::multi_implode($result)) > 0) {
                         $form_vars[$Tag->id()][] = $result;
                     }
                     $i++;
                     while (in_array($item_prefix . $subprefix . $i, $deleted_blocks)) {
                         PerchUtil::debug('Skipping ' . $Item->itemID() . '_' . $subprefix . $i . ' as deleted (2)');
                         $i++;
                     }
                     $new_postitems = $Form->find_items($perch_prefix . '_' . $subprefix . $i . '_');
                     //PerchUtil::debug('Looking for: '.$perch_prefix.$subprefix.'_'.$i.'_');
                     //PerchUtil::debug($new_postitems);
                     //if (!PerchUtil::count($new_postitems)) {
                     //PerchUtil::debug('Not found: '.$perch_prefix.'_'.$subprefix.$i.'_', 'error');
                     //}
                 }
                 // if ($Tag->id()=='_blocks' && isset($form_vars[$Tag->id()])) {
                 // 	$form_vars[$Tag->id()] = PerchUtil::array_sort($form_vars[$Tag->id()], '_block_index');
                 // }
                 if ($in_block) {
                     $subprefix = $given_subprefix;
                 } else {
                     $subprefix = '';
                 }
             } else {
                 if ($subprefix) {
                     $field_prefix = $perch_prefix . '_' . $subprefix . '_' . $Tag->id();
                 } else {
                     $field_prefix = $perch_prefix . '_' . $Tag->id();
                 }
                 //PerchUtil::debug('Form looking for field prefix: '.$field_prefix);
                 if ($in_repeater) {
                     $Tag->set('in_repeater', true);
                     $Tag->set('tag_context', $subprefix . '_' . $Tag->id());
                     if (isset($_POST[$perch_prefix . '_' . $subprefix . '_prevpos'])) {
                         $parts = explode('_', $subprefix);
                         array_pop($parts);
                         $parts[] = (int) $_POST[$perch_prefix . '_' . $subprefix . '_prevpos'];
                         if (isset($_POST[$perch_prefix . '_' . $subprefix . '_present'])) {
                             $Tag->set('tag_context', implode('_', $parts) . '_' . $Tag->id());
                         } else {
                             $Tag->set('tag_context', false);
                         }
                     } else {
                         $Tag->set('tag_context', false);
                     }
                 }
                 $var = false;
                 $Tag->set('input_id', $field_prefix);
                 $FieldType = PerchFieldTypes::get($Tag->type(), $Form, $Tag, $tags, $Form->app_id);
                 $FieldType->set_unique_id($Item->id());
                 $var = $FieldType->get_raw($postitems, $Item);
                 if ($Tag->searchable(true)) {
                     //PerchUtil::debug('Getting search text for: '.$Tag->id().' ('.$Tag->type().')');
                     $search_text .= $FieldType->get_search_text($var) . ' ';
                     //PerchUtil::debug($FieldType->get_search_text($var));
                 }
                 if ($var || is_string($var) && strlen($var)) {
                     if (!is_array($var)) {
                         $var = PerchUtil::safe_stripslashes($var);
                     }
                     $form_vars[$Tag->id()] = $var;
                     // title
                     $form_vars = self::determine_title($Tag, $var, $options, $form_vars);
                 } else {
                     // Store empty values for valid fields
                     if ($Tag->is_set('type') && $Tag->type() != 'hidden' && substr($Tag->id(), 0, 1) != '_') {
                         //PerchUtil::debug('Empty '.$Tag->id(), 'error');
                         $form_vars[$Tag->id()] = null;
                     }
                 }
                 // Resources
                 #if ($Item->ready_to_log_resources()) {
                 #	$resourceIDs = $Resources->get_logged_ids();
                 #	if (PerchUtil::count($resourceIDs)) {
                 #	    $Item->log_resources($resourceIDs);
                 #	}
                 #}
             }
             $seen_tags[] = $Tag->id();
         }
     }
     // Resources
     if (!$in_repeater && !$in_block && $Item->ready_to_log_resources()) {
         $resourceIDs = $Resources->get_logged_ids();
         if (PerchUtil::count($resourceIDs)) {
             $Item->log_resources($resourceIDs);
         }
     }
     return array($form_vars, $search_text);
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:101,代码来源:PerchContent_Util.class.php


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