CI_DB_forge::rename_table()

rename_table($table_name, $new_table_name) Parameters: $table (string) – Current of the table $new_table_name (string) – New name of the table Returns: TRUE on success, FALSE on failure Return type: bool Renames a table. Usage: See Renaming a table.

CI_User_agent::accept_lang()

accept_lang([$lang = 'en']) Parameters: $lang (string) – Language key Returns: TRUE if provided language is accepted, FALSE if not Return type: bool Lets you determine if the user agent accepts a particular language. Example: if ($this->agent->accept_lang('en')) { echo 'You accept English!'; } Note This method is not typically very reliable since some browsers do not provide language info, and even among those that do, it is not always accurate.

form_fieldset()

form_fieldset([$legend_text = ''[, $attributes = array()]]) Parameters: $legend_text (string) – Text to put in the <legend> tag $attributes (array) – Attributes to be set on the <fieldset> tag Returns: An HTML fieldset opening tag Return type: string Lets you generate fieldset/legend fields. Example: echo form_fieldset('Address Information'); echo "<p>fieldset content here</p>\n"; echo form_fieldset_close(); /* Produces: <fieldse

CI_Migration::version()

version($target_version) Parameters: $target_version (mixed) – Migration version to process Returns: TRUE if no migrations are found, current version string on success, FALSE on failure Return type: mixed Version can be used to roll back changes or step forwards programmatically to specific versions. It works just like current() but ignores $config['migration_version']. $this->migration->version(5);

CI_Unit_test::result()

result([$results = array()]) Parameters: $results (array) – Tests results list Returns: Array of raw result data Return type: array Returns raw tests results data.

write_file()

write_file($path, $data[, $mode = 'wb']) Parameters: $path (string) – File path $data (string) – Data to write to file $mode (string) – fopen() mode Returns: TRUE if the write was successful, FALSE in case of an error Return type: bool Writes data to the file specified in the path. If the file does not exist then the function will create it. Example: $data = 'Some file data'; if ( ! write_file('./path/to/file.php', $data)) { echo 'Unable to write the file'; } else {

Database Caching Class

The Database Caching Class permits you to cache your queries as text files for reduced database load. Important This class is initialized automatically by the database driver when caching is enabled. Do NOT load this class manually. Important Not all query result functions are available when you use caching. Please read this page carefully. Enabling Caching Caching is enabled in three steps: Create a writable directory on your server where the cache files can be stored. Set the path to your

CI_Session::sess_regenerate()

sess_regenerate([$destroy = FALSE]) Parameters: $destroy (bool) – Whether to destroy session data Return type: void Regenerate session ID, optionally destroying the current session’s data. Note This method is just an alias for PHP’s native session_regenerate_id() function.

CI_Email::attachment_cid()

attachment_cid($filename) Parameters: $filename (string) – Existing attachment filename Returns: Attachment Content-ID or FALSE if not found Return type: string Sets and returns an attachment’s Content-ID, which enables your to embed an inline (picture) attachment into HTML. First parameter must be the already attached file name. $filename = '/img/photo1.jpg'; $this->email->attach($filename); foreach ($list as $address) { $this->email->to($address); $cid

CI_Security::xss_clean()

xss_clean($str[, $is_image = FALSE]) Parameters: $str (mixed) – Input string or an array of strings Returns: XSS-clean data Return type: mixed Tries to remove XSS exploits from the input data and returns the cleaned string. If the optional second parameter is set to true, it will return boolean TRUE if the image is safe to use and FALSE if malicious data was detected in it.