Skip to content

Instantly share code, notes, and snippets.

@rthrash
rthrash / Excerpt.php
Created October 6, 2010 23:26
A MODx filter for creating smart excerpts of long text passages
/**
* Excerpt
*
* Creates intro excerpts from long passages of text like a Ninja.
*
* @category snippet
* @version 1.0
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
* @autohor Kevin Marvin, Ryan Thrash
* @internal @modx_category Content
<?php
$link = urlencode($link);
//return getSmallLink($link);
//function getSmallLink($longurl){
// Bit.ly
$url = "http://api.bit.ly/v3/shorten?login=YOUR_LOGIN&apiKey=YOUR_API_KEY&longUrl=$link&format=txt&history=1";
$s = curl_init();