|
@@ -1,12 +1,5 @@
|
1
|
1
|
<?php
|
2
|
|
-/*
|
3
|
|
-Plugin Name: kodrs
|
4
|
|
-Plugin URI: http://plugins.gelatocms.com/kodrs/
|
5
|
|
-Description: Geshify your source codes
|
6
|
|
-Author: Pedro Santana
|
7
|
|
-Author URI: http://www.pecesama.net/
|
8
|
|
-Version: 0.1
|
9
|
|
-*/
|
|
2
|
+
|
10
|
3
|
class kodrs extends plugins {
|
11
|
4
|
|
12
|
5
|
function kodrs() {
|
|
@@ -15,12 +8,24 @@ class kodrs extends plugins {
|
15
|
8
|
}
|
16
|
9
|
$this->addAction('post_content', 'source_code_beautifier');
|
17
|
10
|
}
|
|
11
|
+
|
|
12
|
+ function info()
|
|
13
|
+ {
|
|
14
|
+ return array(
|
|
15
|
+ 'name' => 'kodrs',
|
|
16
|
+ 'version' => '0.1',
|
|
17
|
+ 'url' => 'http://plugins.gelatocms.com/kodrs/',
|
|
18
|
+ 'author' => 'Pedro Santana',
|
|
19
|
+ 'authorurl' => 'http://www.pecesama.net/',
|
|
20
|
+ 'license' => 'MIT License',
|
|
21
|
+ 'description' => 'Geshify your source codes',
|
|
22
|
+ );
|
|
23
|
+ }
|
18
|
24
|
|
19
|
25
|
function source_code_beautifier() {
|
20
|
26
|
global $rows;
|
21
|
27
|
if(count($rows)>0){
|
22
|
28
|
foreach($rows as $key=>$post){
|
23
|
|
- // Si no es tipo 'post' entonces no tiene 'Body' :)
|
24
|
29
|
if($post["postType"]=="post"){
|
25
|
30
|
$text = $rows[$key]['Body'];
|
26
|
31
|
$result = preg_replace_callback("/<code\s+.*lang\s*=\"(.*)\">(.*)<\/code>/siU",
|