October 2011

  • strict warning: Non-static method view::load() should not be called statically in /home1/nate01/public_html/sites/all/modules/views/views.module on line 1113.
  • strict warning: Declaration of views_handler_argument::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home1/nate01/public_html/sites/all/modules/views/handlers/views_handler_argument.inc on line 917.
  • strict warning: Declaration of views_handler_argument::query() should be compatible with views_handler::query($group_by = false) in /home1/nate01/public_html/sites/all/modules/views/handlers/views_handler_argument.inc on line 917.
  • strict warning: Declaration of views_handler_sort::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home1/nate01/public_html/sites/all/modules/views/handlers/views_handler_sort.inc on line 165.
  • strict warning: Declaration of views_handler_sort::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /home1/nate01/public_html/sites/all/modules/views/handlers/views_handler_sort.inc on line 165.
  • strict warning: Declaration of views_handler_sort::query() should be compatible with views_handler::query($group_by = false) in /home1/nate01/public_html/sites/all/modules/views/handlers/views_handler_sort.inc on line 165.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home1/nate01/public_html/sites/all/modules/views/handlers/views_handler_filter.inc on line 587.
  • strict warning: Declaration of views_handler_filter::query() should be compatible with views_handler::query($group_by = false) in /home1/nate01/public_html/sites/all/modules/views/handlers/views_handler_filter.inc on line 587.
  • strict warning: Declaration of views_plugin_pager_none::post_execute() should be compatible with views_plugin_pager::post_execute(&$result) in /home1/nate01/public_html/sites/all/modules/views/plugins/views_plugin_pager_none.inc on line 69.
  • strict warning: Declaration of views_plugin_query::options_submit() should be compatible with views_plugin::options_submit($form, &$form_state) in /home1/nate01/public_html/sites/all/modules/views/plugins/views_plugin_query.inc on line 169.
  • strict warning: Declaration of views_plugin_style_default::options() should be compatible with views_object::options() in /home1/nate01/public_html/sites/all/modules/views/plugins/views_plugin_style_default.inc on line 24.
  • strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /home1/nate01/public_html/sites/all/modules/views/plugins/views_plugin_row.inc on line 136.
  • strict warning: Non-static method view::load() should not be called statically in /home1/nate01/public_html/sites/all/modules/views/views.module on line 1113.
  • strict warning: Declaration of views_handler_field::query() should be compatible with views_handler::query($group_by = false) in /home1/nate01/public_html/sites/all/modules/views/handlers/views_handler_field.inc on line 1147.
  • strict warning: Non-static method view::load() should not be called statically in /home1/nate01/public_html/sites/all/modules/views/views.module on line 1113.

setInterval() and clearInterval() Example

var t;
 
function show_uploaded_logo() {
   if($('div.form-item div.image-widget div.image-preview img').is('*'))
   {
      // use console.log to test that the function has stopped running
      //console.log('running');
      if(!$('img#step-1-preview-image').is('*'))
      {
            //code here
      }
      else
      {
           clearInterval(t);	
      }
 
   }   
}
 
t = setInterval(show_uploaded_logo,1000);

Use jQuery to hide a DIV when the user clicks outside of it

$('div#personalize-window').hover(function(){
     mouse_is_inside = true;
},
function()
{ 
     mouse_is_inside=false; 
});
 
 
$("body").mouseup(function(){
     if(! mouse_is_inside)  $('div#personalize-window').fadeOut('slow');
});

PHP Get Current URL

Sometimes it is not as straightforward as one may think to get the current url to use it inside your application. Here is a snippet that I use to fetch the current URL and use it in a script. The current url (whether http or https) is now a local variable that you can do with as you please.

$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] :
 
"http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

You should groom this value before using in anything sensitive, like a sql query.

Mobile Version of Website

To implement our changes, we first set the viewport to the device's width. Do this by inserting the following line of code into the head of your XHTML template:

chown and chgrp in one command

chown user:group filename.ext

Of Course, to change all of the files in a folder:

chown user:group folder/*

And then, once you know that, you can do multiple files/folders at once:

chown user:group folder folder/* filename.ext filename2.ext

Mobile Device Detection in PHP

<?php
 
function mobile_device_detect($iphone=true,$ipad=true,$android=true,$opera=true,$blackberry=true,
$palm=true,$windows=true,$mobileredirect=false,$desktopredirect=false){
 
  $mobile_browser   = false; 
// set mobile browser as false till we can prove otherwise
 
  $user_agent       = $_SERVER['HTTP_USER_AGENT']; 
// get the user agent value - this should be cleaned to ensure no nefarious input gets executed
 
  $accept           = $_SERVER['HTTP_ACCEPT']; 
// get the content accept value - this should be cleaned to ensure no nefarious input gets executed
 
  switch(tr