Last active
August 29, 2015 14:06
-
-
Save lloc/2c232cef3f910acf692f to your computer and use it in GitHub Desktop.
API Documentation http://msls.co/api-documentation/
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
$obj = new MslsGetSet; | |
$obj->tmp = 'test'; | |
$val = $obj->get_arr(); // array( 'tmp' => 'test' ) == $val | |
$val = $obj->has_value( 'tmp' ); // true == $val | |
$val = $obj->is_empty(); // false == $val | |
echo $obj->tmp; // Output: test | |
$obj->reset(); | |
$val = $obj->get_arr(); // array() == $val | |
$val = $obj->has_value( 'tmp' ); // false == $val | |
$val = $obj->is_empty(); // true == $val | |
echo $obj->tmp; // Output: |
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
$obj = new MslsJson; | |
$obj->add( null, 'Test 3' ) | |
->add( '2', 'Test 2' ) | |
->add( 1, 'Test 1' ); | |
// Output: [{"value":1,"label":"Test 1"},{"value":2,"label":"Test 2"},{"value":0,"label":"Test 3"}] | |
echo $obj; |
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
$arr = array( | |
'it' => 1, | |
'de_DE' => 2, | |
); | |
$obj = new MslsLanguageArray( $arr ); | |
$val = $obj->get_val( 'it' ); // 1 == $val | |
$val = $obj->get_val( 'fr_FR' ); // 0 == $val | |
$val = $obj->get_arr(); // array( 'it' => 1, 'de_DE' => 2 ) == $val | |
$val = $obj->get_arr( 'de_DE' ); // array( 'it' => 1 ) == $val |
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
// __CLASS__ and __METHOD__ are just for creating a unique footprint here | |
$cache = MslsSqlCacher::init( __CLASS__ )->set_params( __METHOD__ ); | |
// With MslsSqlCacher you can use everything from WPDB as usual | |
$var = $cache->get_results( | |
$cache->prepare( | |
"SELECT ID FROM {$cache->posts} WHERE YEAR(post_date) = %d AND post_status = 'publish'", | |
date( 'Y' ) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment