Skip to content

Instantly share code, notes, and snippets.

class Bootstrap_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl( &$output, $depth ) {
//In a child UL, add the 'dropdown-menu' class
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul class=\"dropdown-menu\">\n";
}
#!/usr/bin/env bash
# Usage: {script} DIRECTORY
# Find PHP's commented code and remove then.
#
# --help, -h Displays this help
#
# Report bugs to Henrique Moody <[email protected]>
#
declare -r SCRIPT_NAME=$(basename ${0})
#!/usr/bin/env bash
# Usage: {script} DIRECTORY [ PREFIX ]
#
# --help, h Displays this help
#
# Report bugs to Henrique Moody <[email protected]>
#
_help()
{
@bugsysop
bugsysop / trimmed.php
Created December 7, 2013 17:30
Kirby CMS Trimmed & lowercase parser
<?php
/*
Kirby CMS Trimmed & lowercase parser
Install:
Drop this php file in your plugins folder. It's done !
Usage :
<section role="main" class="<?php echo trimmed($page->title())?>">
<?php
class kirbytextExtended extends kirbytext {
function __construct($text, $markdown=true) {
parent::__construct($text, $markdown);
$this->addTags('thumb');
$this->addAttributes('crop', 'quality');
<?php
s::start();
function panelUser() {
$cookie = cookie::get('auth');
if(!$cookie) return false;
$info = s::get($cookie);
@bugsysop
bugsysop / longpost.php
Last active August 29, 2015 13:56 — forked from texnixe/longpost.php
Template for Kirby CMS that splits long post into several pages
<?php
// Source and documentation : http://www.texniq.de/en/kirby-wiki/split-long-posts-into-pages
// store the content of the kirbytext text variable in $text
$text = kirbytext($page->text());
// split the content of $text whenever a <!--pagebreak--> code is encountered and store in the array $pages
$pages = explode('<!--pagebreak-->', $text);
@bugsysop
bugsysop / kirby-statify.php
Last active March 19, 2017 03:15 — forked from bastianallgeier/statify.php
A first draft for a script, which converts a Kirby site into a static site. It's a rough first draft, so don't expect it to be perfect. Play with it, if you like it!
<?php
/**
* Instructions:
*
* 1. Put this into the document root of your Kirby site
* 2. Make sure to setup the base url for your site correctly
* 3. Run this script with `php statify.php` or open it in your browser
* 4. Upload all files and folders from static to your server
* 5. Test your site
@bugsysop
bugsysop / kirby-first-paragraph.php
Last active August 29, 2015 14:05
Kirby - Extract the first paragraph from an article
<?php
//If you want to remove the paragraph tags from the resulting string, uncomment the second line of the function.
function getFirstPara($string){
$string = substr($string,0, strpos($string, "</p>")+4);
//$string = str_replace("<p>", "", str_replace("<p/>", "", $string));
return $string;
}
$text = getFirstPara(kirbytext($page->text())); ?>
?>
#!/bin/bash
# Takes one parameter: a remote git repository URL.
#
# This is the stuff this script does:
#
# 1. Clones the repository
# 2. Fetches all remote branches
# 3. Compresses the folder
# 4. Deletes the cloned folder.