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
Search Repo:
Click here to lend your support to: chyrp and make a donation at www.pledgie.com !
* Store a boolean variable of "is this post filtered?" in 
Post->filtered, and have Post->title(), Post->excerpt(), 
Post->feed_content(), and Post->title_from_excerpt() act 
accordingly.
* Documentation improvements.
* Fixed the Chat and Text feather theme files to only show a title when 
one is set for the post.
vito (author)
Sat Jul 05 19:46:31 -0700 2008
commit  a75589b7e6c2fa7897f57cd2fa8d83ba05ece368
tree    9c91c5747e843fcba01460613e77424858f6cda6
parent  44f0b2e22dafde5d1171dbe585a1f7cc65b2a535
...
2
3
4
 
 
5
6
7
...
2
3
4
5
6
7
8
9
0
@@ -2,6 +2,8 @@
0
   /**
0
    * Class: Group
0
    * The Group model.
0
+ * See Also:
0
+ * <Model>
0
    */
0
   class Group extends Model {
0
     public $no_results = false;
...
2
3
4
 
 
5
6
 
 
7
8
9
10
11
...
2
3
4
5
6
7
8
9
10
11
 
12
13
14
0
@@ -2,10 +2,13 @@
0
   /**
0
    * Class: Page
0
    * The Page model.
0
+ * See Also:
0
+ * <Model>
0
    */
0
   class Page extends Model {
0
+ # Boolean: $no_results
0
+ # Was a result found?
0
     public $no_results = false;
0
- public $id = 0;
0
 
0
     /**
0
      * Function: __construct
...
2
3
4
 
 
5
6
 
 
7
8
9
10
11
12
13
14
 
 
15
16
17
18
19
20
 
 
21
22
23
...
40
41
42
 
43
44
 
 
45
46
47
...
409
410
411
412
 
413
414
415
416
417
418
419
 
 
 
 
 
420
421
422
...
436
437
438
439
440
 
 
 
 
 
 
 
441
442
443
...
448
449
450
451
452
 
 
 
 
 
 
 
453
454
455
...
460
461
462
463
 
 
 
 
 
 
 
464
465
466
...
500
501
502
503
504
505
506
507
 
508
509
510
511
 
512
513
514
...
2
3
4
5
6
7
8
9
10
11
12
 
 
 
 
 
 
13
14
15
16
 
 
 
 
17
18
19
20
21
...
38
39
40
41
42
 
43
44
45
46
47
...
409
410
411
 
412
413
414
415
416
417
418
 
419
420
421
422
423
424
425
426
...
440
441
442
 
 
443
444
445
446
447
448
449
450
451
452
...
457
458
459
 
 
460
461
462
463
464
465
466
467
468
469
...
474
475
476
 
477
478
479
480
481
482
483
484
485
486
...
520
521
522
 
 
 
523
 
524
525
526
527
 
528
529
530
531
0
@@ -2,22 +2,20 @@
0
   /**
0
    * Class: Post
0
    * The Post model.
0
+ * See Also:
0
+ * <Model>
0
    */
0
   class Post extends Model {
0
+ # Boolean: $no_results
0
+ # Was a result found?
0
     public $no_results = false;
0
 
0
- public $id = 0;
0
-
0
- /**
0
- * String: $private
0
- * SQL "where" text for which posts the current user can view.
0
- */
0
+ # String: $private
0
+ # SQL "where" text for which posts the current user can view.
0
     static $private;
0
 
0
- /**
0
- * String: $enabled_feathers
0
- * SQL "where" text for each of the feathers. Prevents posts of a disabled Feather from showing.
0
- */
0
+ # String: $enabled_feathers
0
+ # SQL "where" text for each of the feathers. Prevents posts of a disabled Feather from showing.
0
     static $enabled_feathers;
0
 
0
     /**
0
@@ -40,8 +38,10 @@
0
       if ($this->no_results)
0
         return;
0
 
0
+ $this->filtered = !isset($options["filter"]) or $options["filter"];
0
       $this->slug =& $this->url;
0
- $this->parse(!isset($options["filter"]) or $options["filter"]);
0
+
0
+ $this->parse();
0
     }
0
 
0
     /**
0
@@ -409,14 +409,18 @@
0
      * Generates an acceptable Title from the post's excerpt.
0
      *
0
      * Returns:
0
- * $normalized - The post's excerpt. filtered -> tags stripped -> truncated to 75 characters -> normalized.
0
+ * The post's excerpt. iltered -> first line -> ftags stripped -> truncated to 75 characters -> normalized.
0
      */
0
     public function title_from_excerpt() {
0
       if ($this->no_results) return false;
0
 
0
       global $feathers;
0
 
0
- $excerpt = $this->excerpt();
0
+ # Excerpts are likely to have some sort of markup module applied to them;
0
+ # if the current instantiation is not filtered, make one that is.
0
+ $post = ($this->filtered) ? $this : new Post($this->id) ;
0
+
0
+ $excerpt = $post->excerpt();
0
       Trigger::current()->filter($excerpt, "title_from_excerpt");
0
 
0
       $split_lines = explode("\n", $excerpt);
0
@@ -436,8 +440,13 @@
0
     public function title() {
0
       if ($this->no_results) return false;
0
       global $feathers;
0
- $title = $feathers[$this->feather]->title($this);
0
- return Trigger::current()->filter($title, "title");
0
+
0
+ # Excerpts are likely to have some sort of markup module applied to them;
0
+ # if the current instantiation is not filtered, make one that is.
0
+ $post = ($this->filtered) ? $this : new Post($this->id) ;
0
+
0
+ $title = $feathers[$this->feather]->title($post);
0
+ return Trigger::current()->filter($title, "title", $post);
0
     }
0
 
0
 
0
@@ -448,8 +457,13 @@
0
     public function excerpt() {
0
       if ($this->no_results) return false;
0
       global $feathers;
0
- $excerpt = $feathers[$this->feather]->excerpt($this);
0
- return Trigger::current()->filter($excerpt, "excerpt");
0
+
0
+ # Excerpts are likely to have some sort of markup module applied to them;
0
+ # if the current instantiation is not filtered, make one that is.
0
+ $post = ($this->filtered) ? $this : new Post($this->id) ;
0
+
0
+ $excerpt = $feathers[$this->feather]->excerpt($post);
0
+ return Trigger::current()->filter($excerpt, "excerpt", $post);
0
     }
0
 
0
 
0
@@ -460,7 +474,13 @@
0
     public function feed_content() {
0
       if ($this->no_results) return false;
0
       global $feathers;
0
- return call_user_func(array($feathers[$this->feather], "feed_content"), $this);
0
+
0
+ # Excerpts are likely to have some sort of markup module applied to them;
0
+ # if the current instantiation is not filtered, make one that is.
0
+ $post = ($this->filtered) ? $this : new Post($this->id) ;
0
+
0
+ $feed_content = $feathers[$this->feather]->feed_content($post);
0
+ return Trigger::current()->filter($feed_content, "feed_content", $post);
0
     }
0
 
0
     /**
0
@@ -500,15 +520,12 @@
0
     /**
0
      * Function: parse
0
      * Parses the passed XML and loads the tags and values into <Post>.
0
- *
0
- * Parameters:
0
- * $filter - Should the data be run through any triggers?
0
      */
0
- private function parse($filter = false) {
0
+ private function parse() {
0
       foreach (self::xml2arr(simplexml_load_string($this->xml)) as $key => $val)
0
         $this->$key = codepoint2name($val);
0
 
0
- if (!$filter)
0
+ if (!$this->filtered)
0
         return;
0
 
0
       $class = camelize($this->feather);
...
2
3
4
 
 
5
6
 
 
7
8
9
10
11
...
2
3
4
5
6
7
8
9
10
11
 
12
13
14
0
@@ -2,10 +2,13 @@
0
   /**
0
    * Class: User
0
    * The User model.
0
+ * See Also:
0
+ * <Model>
0
    */
0
   class User extends Model {
0
+ # Boolean: $no_results
0
+ # Was a result found?
0
     public $no_results = false;
0
- public $can = array();
0
 
0
     /**
0
      * Function: __construct
...
2
3
4
 
 
5
6
7
...
2
3
4
5
6
7
8
9
0
@@ -2,6 +2,8 @@
0
   /**
0
    * Class: Visitor
0
    * The model for the currently browsing <User>. Group falls back to whatever group is set as the "Guest Group".
0
+ * See Also:
0
+ * <User>
0
    */
0
   class Visitor extends User {
0
     public $id = 0;
...
1
2
3
4
 
5
6
7
...
1
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 {% extends "content/post.twig" %}
0
 
0
 {% block content %}
0
-{% if post.title %}
0
+{% if post['title'] %}
0
             <h1>
0
               <a href="$post.url" rel="bookmark" title="${ "Permanent Link to" | translate } &quot;$post.title&quot;">$post.title</a>
0
             </h1>
...
1
2
3
4
 
5
6
7
...
1
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 {% extends "content/post.twig" %}
0
 
0
 {% block content %}
0
-{% if post.title %}
0
+{% if post['title'] %}
0
             <h1>
0
               <a href="$post.url" rel="bookmark" title="${ "Permanent Link to" | translate } &quot;$post.title&quot;">$post.title</a>
0
             </h1>

Comments

    No one has commented yet.