Created
August 23, 2011 11:08
-
-
Save bainternet/1164863 to your computer and use it in GitHub Desktop.
WordPress run once class
This file contains 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 | |
/* | |
* run Once class | |
* | |
*/ | |
if (!class_exists('run_once')){ | |
class run_once{ | |
function run($key){ | |
$test_case = get_option('run_once'); | |
if (isset($test_case[$key]) && $test_case[$key]){ | |
return false; | |
}else{ | |
$test_case[$key] = true; | |
update_option('run_once',$test_case); | |
return true; | |
} | |
} | |
function clear($key){ | |
$test_case = get_option('run_once'); | |
if (isset($test_case[$key])){ | |
unset($test_case[$key]); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment