]> git.mjollnir.org Git - s9y.git/commitdiff
- Fix a template API problem with empty XML elements
authorgarvinhicking <garvinhicking>
Wed, 21 Jun 2006 09:06:52 +0000 (09:06 +0000)
committergarvinhicking <garvinhicking>
Wed, 21 Jun 2006 09:06:52 +0000 (09:06 +0000)
- Fix entryproperty no_frontpage bug
- Added assign_by_ref template API calls

docs/NEWS
include/template_api.inc.php
plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php

index 078ee175a1f8dbedc50040a18338204c6627cb19..e4cd4cb214a362a6571ffde633eaf50cdea7bf3a 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,9 @@
 Version 1.1-alpha7()
 ------------------------------------------------------------------------
 
+    * Fixed not showing entries in the quicksearch that have the
+      "no frontpage" entryproperty set (garvinhicking)
+
     * Fixed sidebar category plugin to show proper category listing
       for permission-based restrictions, when "current autho" mode
       is selected (garvinhicking)
index f9983b573ee9a457203b8ba86ffcd33e3db305e2..1439ea6be86a246405380c87c699d14201c2b005 100644 (file)
@@ -65,7 +65,6 @@ class serendipity_smarty_emulator {
 
 /**
  * Assign one or multiple template variable
- * @TODO: Why can't this function accept references. This sucks.
  *
  * @param   mixed       Either a variable name, or an array of variables
  * @param   mixed       Either null or the variable content.
@@ -86,6 +85,20 @@ class serendipity_smarty_emulator {
         return true;
     }
 
+/**
+ * Assign one or multiple template variable by reference
+ *
+ * @param   string      Variable name
+ * @param   mixed       Referenced variable
+ * @access public
+ * @return null
+ */
+    function assign_by_ref($tpl_var, &$value) {
+        $GLOBALS['tpl'][$tpl_var] =& $value;
+
+        return true;
+    }
+
 /**
  * Helper function to call a 'serendipity_smarty_xx' function with less parameters.
  *
@@ -230,9 +243,7 @@ class serendipity_smarty_emulator_xml extends serendipity_smarty_emulator {
     function assign($tpl_var, $value = null, $level = 0) {
         if (is_array($tpl_var)) {
             foreach ($tpl_var as $key => $val) {
-                if ($key != '') {
-                    $this->createXML($level, $key, $val);
-                }
+                $this->createXML($level, $key, $val);
             }
         } else {
             $this->createXML($level, $tpl_var, $value);
@@ -241,6 +252,33 @@ class serendipity_smarty_emulator_xml extends serendipity_smarty_emulator {
         return true;
     }
     
+/**
+ * Assign one or multiple template variable by reference
+ *
+ * @param   string      Variable name
+ * @param   mixed       Referenced variable
+ * @access public
+ * @return null
+ */
+    function assign_by_ref($tpl_var, &$value) {
+        if (is_array($value)) {
+            foreach ($value as $key => $val) {
+                $this->createXML($level, $key, $val);
+            }
+        } else {
+            $this->createXML($level, $tpl_var, $value);
+        }
+
+        return true;
+    }
+
+/**
+  * Create the XML output for an element
+  *
+  * @param  int     The intend level
+  * @param  mixed   The XML element name
+  * @param  mixed   The XML element value
+  */
     function createXML(&$level, &$key, &$val) {
         if (is_numeric($key)) {
             $openkey  = 'item index="' . $key . '"';
index 20ab2b376755d1ab443a6f8183d298f38ad99358..31b7708096a9084ccdec1fce4d56c1f74b4ccfe4 100644 (file)
@@ -21,7 +21,7 @@ class serendipity_event_entryproperties extends serendipity_event
         $propbag->add('description',   PLUGIN_EVENT_ENTRYPROPERTIES_DESC);
         $propbag->add('stackable',     false);
         $propbag->add('author',        'Garvin Hicking');
-        $propbag->add('version',       '1.9');
+        $propbag->add('version',       '1.10');
         $propbag->add('requirements',  array(
             'serendipity' => '0.8',
             'smarty'      => '2.6.7',
@@ -607,7 +607,7 @@ class serendipity_event_entryproperties extends serendipity_event
                         $conds[] = " (ep_access.property IS NULL OR ep_access.value = 'public')";
                     }
 
-                    if (!isset($serendipity['GET']['category']) && !isset($serendipity['GET']['adminModule']) && $event == 'frontend_fetchentries') {
+                    if (!isset($serendipity['GET']['category']) && !isset($serendipity['GET']['adminModule']) && $event == 'frontend_fetchentries' && $addData['source'] != 'search') {
                         $conds[] = " (ep_no_frontpage.property IS NULL OR ep_no_frontpage.value != 'true') ";
                         $joins[] = " LEFT OUTER JOIN {$serendipity['dbPrefix']}entryproperties ep_no_frontpage
                                                   ON (e.id = ep_no_frontpage.entryid AND ep_no_frontpage.property = 'ep_no_frontpage')";