public
Description: The ultra-lightweight ultra-flexible blogging engine with a fetish for birds and misspellings.
Homepage: http://chyrp.net/
Clone URL: git://github.com/vito/chyrp.git
Click here to lend your support to: chyrp and make a donation at www.pledgie.com !
Implemented hashtags to the bookmarklet, and implemented automatic 
YouTube-viewing detection for the Video feather. [#134 state:resolved]
vito (author)
Tue Jul 01 12:40:22 -0700 2008
commit  b28583e6ff248f1ae386dd4e8c8503611f4a6007
tree    591fa8b665a126c5df90b90be9b28141dad3784c
parent  73c320260b0db0abf712fd8759d1d05859875f52
...
4
5
6
7
 
 
8
9
10
...
4
5
6
 
7
8
9
10
11
0
@@ -4,7 +4,8 @@
0
       $this->setField(array("attr" => "video",
0
                             "type" => "text_block",
0
                             "rows" => 4,
0
-                            "label" => __("Video", "video")));
0
+                            "label" => __("Video", "video"),
0
+                            "bookmarklet" => (isset($_GET['url']) and strpos($_GET['url'], "youtube")) ? "url" : ""));
0
       $this->setField(array("attr" => "caption",
0
                             "type" => "text_block",
0
                             "rows" => 4,
...
100
101
102
103
 
104
105
106
...
100
101
102
 
103
104
105
106
0
@@ -100,7 +100,7 @@
0
       $options = (isset($_POST['option'])) ? $_POST['option'] : array() ;
0
 
0
       if (isset($_POST['bookmarklet']))
0
-        $trigger->filter("bookmarklet_submit", array(&$values, &$options));
0
+        Trigger::current()->filter("bookmarklet_submit", array(&$values, &$options));
0
 
0
       foreach ($values as $name => &$value)
0
         $value = self::makesafe($value);
...
41
42
43
 
 
 
 
 
 
 
 
 
 
 
 
44
45
46
...
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
0
@@ -41,6 +41,18 @@
0
 <?php
0
     }
0
 
0
+    public function bookmarklet_submit($stuff) {
0
+      $values =& $stuff[0];
0
+      foreach ($values as &$value)
0
+        if (preg_match_all("/([^\\\\]|^)#([^ \n#]+)([^\\\\]#)?/", $value, $tags)) {
0
+          $_POST['tags'] = implode(", ", $tags[2]);
0
+
0
+          $value = preg_replace("/([^\\\\]|^)#([^ \n#]+)([^\\\\])#/", "\\1\\2\\3", $value);
0
+          $value = preg_replace("/([^\\\\]|^)#([^ \n#]+)/", "\\1\\2", $value);
0
+          $value = preg_replace("/\\\\#/", "#", $value);
0
+        }
0
+    }
0
+
0
     static function add_post($post) {
0
       if (empty($_POST['tags'])) return;
0
 

Comments