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
/* | |
* this.getTextSelection() | |
* Utility function that returns the text that is selected | |
* and is cross-browser compatible. | |
*/ | |
OsimoEditorControls.prototype.getTextSelection = function(){ | |
var textarea = $('#'+this.input+'_editbox').get(0); | |
if (window.getSelection) { | |
var len = textarea.value.length; | |
var start = textarea.selectionStart; |
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 that = this; | |
Overlay = { | |
init: function(elementToOverlay, content, options) { | |
that.options = $.extend({ | |
element: 'div', | |
attributes: {} | |
}, options); | |
that.overlay = $(html[that.options.element](that.options.attributes, content)) | |
.click(that.hideOverlay) |
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
<%% using(common) %%> | |
<%% common/header() %%> | |
page content | |
<%% common/footer() %%> |
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 [email protected] | |
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( |
OlderNewer