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
<? | |
private function parse_view($html){ | |
$html = preg_replace( | |
array( | |
"/\{using ([^}]*)\}/i", | |
"/\{include ([^}]*)\}/i", | |
"/\{func ([A-Za-z_]*)->([^}]*)\(([^\)]*)\)\}/i" | |
), | |
array( | |
"<? |
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
== About this Gist == | |
I can't figure out wtf is going on here. Something strange with variable scope that I can't quite wrap my mind around. | |
If anyone knows the solution, please email me at meltingice@meltingice.net | |
This is a huge generalization of my code... some of the functions here aren't even a part of my codebase, | |
but they will still produce the same result and they are easier to understand because of their simplicity. | |
Also, I am using either PHP 5.3.0 or PHP 5.2.8 for this code. | |
== Where to Start == |
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 | |
/* | |
* Osimo - next-generation forum system | |
* Licensed under GPLv3 (GPL-LICENSE.txt) | |
* | |
* os-includes/bbcode/bbparser.php - osimo's bbcode parser | |
* This can be used on any site, just call bb2html() | |
*/ | |
function bb2html($post) |
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
<? get('data')->load_post_list(); ?> | |
<? get('theme')->include_header(); ?> | |
<div id="content"> | |
<div class="thread_title"> | |
<h1><? get('data')->thread_title(); ?></h1> | |
<h2><? get('data')->thread_description(); ?></h2> | |
</div> | |
<? if(get('data')->are_posts()): while(get('data')->has_posts()): ?> |
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
var yourVar; | |
$.ajax({ | |
type:'POST', | |
url:'someurl', | |
data:someData, | |
success: function(data){ | |
yourVar = data; | |
} | |
}); |
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
var artifact; | |
$.ajax({ | |
type: "GET", | |
url: file, |
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
function __autoload($class){ | |
$classes = array( | |
'OsimoBBParser'=>'bbparser', | |
'OsimoForum'=>'forum', | |
'OsimoModel'=>'osimomodel', | |
'OsimoPost'=>'post', | |
'OsimoThread'=>'thread', | |
'OsimoUser'=>'user' | |
); | |
$modules = array( |
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
function OsimoModal(options){ | |
this.options = { | |
'width' : 500, | |
'height' : 400, | |
'modal' : true, | |
'draggable' : false, | |
'showClose' : true, | |
'styles' : {} | |
}; | |
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
#!/usr/bin/php | |
<? | |
# some useful file paths to rememebr | |
define('NGINX_CONFIG_ROOT', "/etc/nginx/sites-enabled/"); | |
if($_SERVER['argc'] <= 1) { | |
show_help_msg(); | |
} else { | |
$new_domain = trim($_SERVER['argv'][1]); |
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
/* | |
* In order to include libraries, we need to know | |
* the absolute path to the jsonp-fu directory. | |
* | |
* BTW, jfu is a shortcut to jsonpfu that is defined | |
* as a part of the library. | |
*/ | |
jfu.set_path('/path/to/jsonp-fu/'); | |
/* |