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


PHP stripslashes_recursive函数代码示例

本文整理汇总了PHP中stripslashes_recursive函数的典型用法代码示例。如果您正苦于以下问题:PHP stripslashes_recursive函数的具体用法?PHP stripslashes_recursive怎么用?PHP stripslashes_recursive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: noslashes_recursive

/**
 * Undoes any magic quote slashing from an array, like the GET or POST
 * @param    array    $a    Probably either $_GET or $_POST or $_COOKIES
 * @return   array    The array with all of the values in it noslashed
 *
 * In many cases, this can be a drop-in replacement for stripslashes_recursive
 * since this is what we typically use stripslashes_recursive for.  This is
 * somewhat different in that if we ever turn off magic quotes, it will still
 * behave correctly and not double stripslashes.
 *
 */
function noslashes_recursive($a)
{
    if (get_magic_quotes_gpc()) {
        $a = stripslashes_recursive($a);
    }
    return $a;
}
开发者ID:luxurymask,项目名称:platform,代码行数:18,代码来源:strings.php

示例2: remove_magic_quotes

function remove_magic_quotes()
{
    if (get_magic_quotes_gpc()) {
        $_GET = stripslashes_recursive($_GET);
        $_POST = stripslashes_recursive($_POST);
    }
}
开发者ID:thanush,项目名称:master_autoindex,代码行数:7,代码来源:functions.php

示例3: useredit_update_user_preference

function useredit_update_user_preference($usernew)
{
    $ua = (array) $usernew;
    foreach ($ua as $key => $value) {
        if (strpos($key, 'preference_') === 0) {
            $name = substr($key, strlen('preference_'));
            set_user_preference($name, stripslashes_recursive($value), $usernew->id);
        }
    }
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:10,代码来源:editlib.php

示例4: stripslashes_recursive

function stripslashes_recursive($value)
{
    if (is_array($value)) {
        foreach ($value as $index => $val) {
            $value[$index] = stripslashes_recursive($val);
        }
        return $value;
    } else {
        return stripslashes($value);
    }
}
开发者ID:joksnet,项目名称:php-old,代码行数:11,代码来源:db.php

示例5: form_process_data

 function form_process_data($cform)
 {
     if ($this->form) {
         $data = $cform->get_data();
         // cr_serialize() will add slashes
         $data = stripslashes_recursive($data);
         $components = cr_unserialize($this->config->components);
         $components['columns']['config'] = $data;
         $this->config->components = cr_serialize($components);
         update_record('block_configurable_reports_report', $this->config);
     }
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:12,代码来源:component.class.php

示例6: checklist_update_instance

/**
 * Given an object containing all the necessary data,
 * (defined by the form in mod_form.php) this function
 * will update an existing instance with new data.
 *
 * @param object $checklist An object from the form in mod_form.php
 * @return boolean Success/Fail
 */
function checklist_update_instance($checklist)
{
    $checklist->timemodified = time();
    $checklist->id = $checklist->instance;
    $returnid = update_record('checklist', $checklist);
    // Add or remove all calendar events, as needed
    $course = get_record('course', 'id', $checklist->course);
    $cm = get_coursemodule_from_instance('checklist', $checklist->id, $course->id);
    $chk = new checklist_class($cm->id, 0, $checklist, $cm, $course);
    $chk->setallevents();
    $checklist = stripslashes_recursive($checklist);
    checklist_grade_item_update($checklist);
    return $returnid;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:22,代码来源:lib.php

示例7: glossary_update_instance

function glossary_update_instance($glossary)
{
    /// Given an object containing all the necessary data,
    /// (defined by the form in mod.html) this function
    /// will update an existing instance with new data.
    global $CFG;
    if (empty($glossary->globalglossary)) {
        $glossary->globalglossary = 0;
    }
    if (!has_capability('mod/glossary:manageentries', get_context_instance(CONTEXT_SYSTEM))) {
        // keep previous
        unset($glossary->globalglossary);
    }
    $glossary->timemodified = time();
    $glossary->id = $glossary->instance;
    if (empty($glossary->userating)) {
        $glossary->assessed = 0;
    }
    if (empty($glossary->ratingtime) or empty($glossary->assessed)) {
        $glossary->assesstimestart = 0;
        $glossary->assesstimefinish = 0;
    }
    //Check displayformat is a valid one
    $formats = get_list_of_plugins('mod/glossary/formats', 'TEMPLATE');
    if (!in_array($glossary->displayformat, $formats)) {
        error("This format doesn't exist!");
    }
    if ($return = update_record("glossary", $glossary)) {
        if ($glossary->defaultapproval) {
            execute_sql("update {$CFG->prefix}glossary_entries SET approved = 1 where approved != 1 and glossaryid = " . $glossary->id, false);
        }
        $glossary = stripslashes_recursive($glossary);
        glossary_grade_item_update($glossary);
    }
    return $return;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:36,代码来源:lib.php

示例8: update_instance

 /**
  * Updates a new assignment activity
  *
  * Given an object containing all the necessary data,
  * (defined by the form in mod.html) this function
  * will update the assignment instance and return the id number
  * The due date is updated in the calendar
  * This is common to all assignment types.
  *
  * @param $assignment object The data from the form on mod.html
  * @return int The assignment id
  */
 function update_instance($assignment)
 {
     global $COURSE;
     $assignment->timemodified = time();
     $assignment->id = $assignment->instance;
     $assignment->courseid = $assignment->course;
     if (!update_record('assignment', $assignment)) {
         return false;
     }
     if ($assignment->timedue) {
         $event = new object();
         if ($event->id = get_field('event', 'id', 'modulename', 'assignment', 'instance', $assignment->id)) {
             $event->name = $assignment->name;
             $event->description = $assignment->description;
             $event->timestart = $assignment->timedue;
             update_event($event);
         } else {
             $event = new object();
             $event->name = $assignment->name;
             $event->description = $assignment->description;
             $event->courseid = $assignment->course;
             $event->groupid = 0;
             $event->userid = 0;
             $event->modulename = 'assignment';
             $event->instance = $assignment->id;
             $event->eventtype = 'due';
             $event->timestart = $assignment->timedue;
             $event->timeduration = 0;
             add_event($event);
         }
     } else {
         delete_records('event', 'modulename', 'assignment', 'instance', $assignment->id);
     }
     // get existing grade item
     $assignment = stripslashes_recursive($assignment);
     assignment_grade_item_update($assignment);
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:50,代码来源:lib.php

示例9: process_config

 /**
  * Processes and stores configuration data for this authentication plugin.
  */
 function process_config($config)
 {
     // set to defaults if undefined
     if (!isset($config->host)) {
         $config->host = 'localhost';
     }
     if (!isset($config->type)) {
         $config->type = 'mysql';
     }
     if (!isset($config->sybasequoting)) {
         $config->sybasequoting = 0;
     }
     if (!isset($config->name)) {
         $config->name = '';
     }
     if (!isset($config->user)) {
         $config->user = '';
     }
     if (!isset($config->pass)) {
         $config->pass = '';
     }
     if (!isset($config->table)) {
         $config->table = '';
     }
     if (!isset($config->fielduser)) {
         $config->fielduser = '';
     }
     if (!isset($config->fieldpass)) {
         $config->fieldpass = '';
     }
     if (!isset($config->passtype)) {
         $config->passtype = 'plaintext';
     }
     if (!isset($config->extencoding)) {
         $config->extencoding = 'utf-8';
     }
     if (!isset($config->setupsql)) {
         $config->setupsql = '';
     }
     if (!isset($config->debugauthdb)) {
         $config->debugauthdb = 0;
     }
     if (!isset($config->removeuser)) {
         $config->removeuser = 0;
     }
     if (!isset($config->changepasswordurl)) {
         $config->changepasswordurl = '';
     }
     $config = stripslashes_recursive($config);
     // save settings
     set_config('host', $config->host, 'auth/db');
     set_config('type', $config->type, 'auth/db');
     set_config('sybasequoting', $config->sybasequoting, 'auth/db');
     set_config('name', $config->name, 'auth/db');
     set_config('user', $config->user, 'auth/db');
     set_config('pass', $config->pass, 'auth/db');
     set_config('table', $config->table, 'auth/db');
     set_config('fielduser', $config->fielduser, 'auth/db');
     set_config('fieldpass', $config->fieldpass, 'auth/db');
     set_config('passtype', $config->passtype, 'auth/db');
     set_config('extencoding', trim($config->extencoding), 'auth/db');
     set_config('setupsql', trim($config->setupsql), 'auth/db');
     set_config('debugauthdb', $config->debugauthdb, 'auth/db');
     set_config('removeuser', $config->removeuser, 'auth/db');
     set_config('changepasswordurl', trim($config->changepasswordurl), 'auth/db');
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:70,代码来源:auth.php

示例10: game_after_add_or_update

/**
 * This function is called at the end of game_add_instance
 * and game_update_instance, to do the common processing.
 *
 * @param object $game the game object.
 */
function game_after_add_or_update($game)
{
    //update related grade item
    game_grade_item_update(stripslashes_recursive($game));
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:11,代码来源:lib.php

示例11: stripslashes_recursive

            $response->setError(1404, 'Operation not found: ' . $operation);
        }
        if ($response !== false) {
            echo $response->emitJSON();
        }
    }
}
/** Take care of stripping the slashes */
function stripslashes_recursive($value)
{
    $value = is_array($value) ? array_map('stripslashes_recursive', $value) : stripslashes($value);
    return $value;
}
/** END **/
if (!defined('MOBILE_API_CONTROLLER_AVOID_TRIGGER')) {
    $clientRequestValues = $_POST;
    // $_REQUEST or $_GET
    $clientRequestValuesRaw = array();
    // Set of request key few controllers are interested in raw values (example, SaveRecord)
    /*$rawValueHeaders = array('values');
    	foreach($rawValueHeaders as $rawValueHeader) {
    		if(isset($clientRequestValues[$rawValueHeader])) {
    			$clientRequestValuesRaw[$rawValueHeader] = $clientRequestValues[$rawValueHeader];
    		}
    	}*/
    // END
    if (get_magic_quotes_gpc()) {
        $clientRequestValues = stripslashes_recursive($clientRequestValues);
    }
    Mobile_API_Controller::process(new Mobile_API_Request($clientRequestValues, $clientRequestValuesRaw));
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:31,代码来源:api.php

示例12: stripslashes_recursive

/**
 * Recursively un-quotes a quoted variable
 *
 * @param  mixed $var
 * @return mixed
 */
function stripslashes_recursive($var)
{
    if (is_array($var)) {
        $unquoted = array();
        foreach ($var as $key => $value) {
            $unquoted[$key] = stripslashes_recursive($value);
        }
        return $unquoted;
    } elseif (is_scalar($var)) {
        return stripslashes($var);
    } else {
        return $var;
    }
}
开发者ID:bank32,项目名称:ansible-php-directory-by-vagrant,代码行数:20,代码来源:index.php

示例13: data_update_instance

function data_update_instance($data)
{
    global $CFG;
    $data->timemodified = time();
    $data->id = $data->instance;
    if (empty($data->assessed)) {
        $data->assessed = 0;
    }
    if (empty($data->notification)) {
        $data->notification = 0;
    }
    if (!update_record('data', $data)) {
        return false;
    }
    $data = stripslashes_recursive($data);
    data_grade_item_update($data);
    return true;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:18,代码来源:lib.php

示例14: groups_update_grouping

/**
 * Update grouping
 * @param object $data grouping properties (with magic quotes)
 * @return boolean success
 */
function groups_update_grouping($data)
{
    global $CFG;
    $data->timemodified = time();
    $data->name = trim($data->name);
    $result = update_record('groupings', $data);
    if ($result) {
        //trigger groups events
        events_trigger('groups_grouping_updated', stripslashes_recursive($data));
    }
    return $result;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:17,代码来源:lib.php

示例15: stripslashes_recursive

/**
 * Recursive implementation of stripslashes()
 *
 * This function will allow you to strip the slashes from a variable.
 * If the variable is an array or object, slashes will be stripped
 * from the items (or properties) it contains, even if they are arrays
 * or objects themselves.
 *
 * @param mixed the variable to remove slashes from
 * @return mixed
 */
function stripslashes_recursive($var)
{
    if (is_object($var)) {
        $new_var = new object();
        $properties = get_object_vars($var);
        foreach ($properties as $property => $value) {
            $new_var->{$property} = stripslashes_recursive($value);
        }
    } else {
        if (is_array($var)) {
            $new_var = array();
            foreach ($var as $property => $value) {
                $new_var[$property] = stripslashes_recursive($value);
            }
        } else {
            if (is_string($var)) {
                $new_var = stripslashes($var);
            } else {
                $new_var = $var;
            }
        }
    }
    return $new_var;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:35,代码来源:weblib.php


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