Skip to content

Instantly share code, notes, and snippets.

@scragz
scragz / kst-file-structure
Created January 14, 2011 00:42
KST file structure
kitchen-sink-html5-base
kitchen-sink-html5-base/LICENSE
kitchen-sink-html5-base/README
kitchen-sink-html5-base/init.php (plugin manifest, init(), sensible_defaults(), maybe some kind of loader)
# all our codey stuff
kitchen-sink-html5-base/lib
kitchen-sink-html5-base/lib/KST.php
kitchen-sink-html5-base/lib/KST
kitchen-sink-html5-base/lib/KST/Asides.php
kitchen-sink-html5-base/lib/KST/Options.php
# java -jar ~/Library/jEdit/jars/ruby.jar -S gem install -i ~/.gem/jruby/1.8 gist
require 'rubygems'
require 'gist'
def gistBufferOrSelection(view)
textarea, buffer = view.getTextArea, view.getBuffer
if textarea.getSelectionCount > 0
text = textarea.getSelectedText
else
text = textarea.getText
end
[user]
name =
email =
[color]
diff = auto
status = auto
branch = auto
interactive = auto
[color "branch"]
current = yellow reverse
/**
* Theme/Plugin "activates" the plugin
* Allow designers/developers to choose what and how they use KST
*
* @since 0.1
*/
public static function init( $settings ) {
/**
* KST itself needs options so just require the class for everyone
* @see settings_core.php
<?php
public function output( $post_object, $is_new_day = 1, $reverse = 1 ) {
if ( !empty( $this->asides ) && $is_new_day ) {
if ( $reverse )
$this->asides = array_reverse($this->asides);
?>
<article id="post-aside-<?php $this->asides[0]->post_date; ?>" class="aside hentry">
<?php
foreach ( $this->asides as $post ) {
<?php
$validation_error = false;
if (array_key_exists('submit', $_POST)) {
if (
!strlen($_POST['contact_name']) ||
!strlen($_POST['contact_email']) ||
!strlen($_POST['contact_message'])
) {
$validation_error = 'Please complete all required fields.';
} else {
<?php
/**
* Retrieve the name of the highest priority template file that exists.
*
* Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which
* inherit from a parent theme can just overload one file.
*
* @since 2.7.0
*
* @param array $template_names Array of template files to search for in priority order.
<?php
class KST_Kitchen {
protected static $_appliances;
// Registers a loadable appliance and shortname for it
public function registerAppliance($shortname, $path, $class_name=false) {
if (array_key_exists($shortname, $_appliances)) {
// collision!
} else {
self::$_appliances[$shortname] = [];
plugins/
kitchen-sink-html5-base/
docs/
wordpress/
intro_to_wordpress.html
theme/
customizing_icons.html
[etc.]
kst-extra-bonus-appliances/
docs/
<?php
function my_error_handler($errno, $errstr, $errfile, $errline){
$errno = $errno & error_reporting();
if($errno == 0) return;
if(!defined('E_STRICT')) define('E_STRICT', 2048);
if(!defined('E_RECOVERABLE_ERROR')) define('E_RECOVERABLE_ERROR', 4096);
print "<pre>\n<b>";
switch($errno){
case E_ERROR: print "Error"; break;