This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$flashMessages = Yii::app()->user->getFlashes(); | |
if ($flashMessages) { | |
foreach($flashMessages as $key => $message) { | |
echo '$message'; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fileContents = file_get_contents('http://webdevelopergeeks.com/demo/sms.xml'); | |
$fileContents = str_replace(array("\n", "\r", "\t"), '', $fileContents); | |
$fileContents = trim(str_replace('"', "'", $fileContents)); | |
$simpleXml = simplexml_load_string($fileContents); | |
$json = json_encode($simpleXml); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function arrayToXml($array, $rootElement = null, $xml = null) { | |
$_xml = $xml; | |
if ($_xml === null) { | |
$_xml = new SimpleXMLElement($rootElement !== null ? $rootElement : '<root><root/>'); | |
} | |
foreach ($array as $k => $v) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fileName = 'Billing-Summary.csv'; | |
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); | |
header('Content-Description: File Transfer'); | |
header("Content-type: text/csv"); | |
header("Content-Disposition: attachment; filename={$fileName}"); | |
header("Expires: 0"); | |
header("Pragma: public"); | |
$fh = @fopen( 'php://output', 'w' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Generating CSV formatted string from an array. | |
*/ | |
function array_to_csv($array, $header_row = true, $col_sep = ",", $row_sep = "\n", $qut = '"') | |
{ | |
if (!is_array($array) or !is_array($array[0])) return false; | |
//Header row. | |
if ($header_row) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
array( | |
'name'=>'name', | |
'type'=>'raw', | |
'value'=>'$data->name', | |
'filter'=>$this->widget('zii.widgets.jui.CJuiAutoComplete', array( | |
'model'=>$model, | |
'attribute'=>'name', | |
'source'=>$this->createUrl('user/usersAutoComplete'), | |
'options'=>array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$date1 = '2009-12-20 20:12:10'; | |
$date2 = '2009-12-24 12:12:10'; | |
$ts1 = strtotime($date1); | |
$ts2 = strtotime($date2); | |
$seconds_diff = $ts2 - $ts1; | |
echo floor($seconds_diff/3600/24); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
if ( ! function_exists('mpr')) | |
{ | |
function mpr($d, $echo = TRUE) | |
{ | |
if($echo) | |
{ | |
echo '<pre>'.print_r($d, true).'</pre>'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html, body, div, span, applet, object, iframe, | |
h1, h2, h3, h4, h5, h6, p, blockquote, pre, | |
a, abbr, acronym, address, big, cite, code, | |
del, dfn, em, font, img, ins, kbd, q, s, samp, | |
small, strike, strong, sub, sup, tt, var, | |
b, u, i, center, | |
dl, dt, dd, ol, ul, li, | |
fieldset, form, label, legend, | |
table, caption, tbody, tfoot, thead, tr, th, td { | |
background: transparent; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Facebook Simple Styles */ | |
/* | |
Add to your user stylesheet to activate. | |
Preview a screenshot at http://cl.ly/E8I3. | |
+ Removes a bunch of panels, including chat, ads, status update form, apps, etc. | |
+ Center aligns the page. | |
+ Hides search bar until hover. Expands search bar to page width. | |
+ Expand image sizes by 140%. Adds rounded corners to images. | |
+ Hide comments until hover, then popover. |