com web/php: Better handling for deprecated functions: include/footer.inc include/shared-manual.inc

[email protected] (Maciej Sobaczewski)
Newsgroups php.webmaster
Message-ID <[email protected]>
Commit:    920eb39277ec8cb1c12fee8aafb0308fc2594cf4
Author:    Sobak <[email protected]>         Fri, 6 Mar 2015 05:31:19 +0100
Parents:   75775a7c42bd76f73490967fbcb0c6df83829848
Branches:  master

Link:       http://git.php.net/?p=web/php.git;a=commitdiff;h=920eb39277ec8cb1c12fee8aafb0308fc2594cf4

Log:
Better handling for deprecated functions

Changed paths:
  M  include/footer.inc
  M  include/shared-manual.inc


Diff:
diff --git a/include/footer.inc b/include/footer.inc
index 4eb0870..d198a95 100644
--- a/include/footer.inc
+++ b/include/footer.inc
@@ -7,10 +7,11 @@
     }
 
     ?>
-<?php if (!empty($config['related_menu'])): ?>
+<?php if ($config['related_menu'] || $config['related_menu_deprecated']): ?>
     <aside class='layout-menu'>
     
         <ul class='parent-menu-list'>
+            <?php if ($config['related_menu']): ?>
             <?php foreach($config['related_menu'] as $section): ?>
             <li>
                 <a href="<?php echo $section['link']; ?>"><?php echo $section['title']; ?></a>
@@ -32,6 +33,20 @@
     
             </li>
             <?php endforeach; ?>
+            <?php endif; ?>
+
+            <?php if ($config['related_menu_deprecated']): ?>
+            <li>
+                <span class="header">Deprecated</span>
+                <ul class="child-menu-list">
+                <?php foreach ($config['related_menu_deprecated'] as $item): ?>
+                    <li class="<?php echo ($item['current']) ? 'current' : ''; ?>">
+                        <a href="<?php echo $item['link']; ?>" title="<?php echo $item['title']; ?>"><?php echo $item['title']; ?></a>
+                    </li>
+                <?php endforeach; ?>
+                </ul>
+            </li>
+            <?php endif; ?>
         </ul>
     </aside>
 <?php endif; ?>
diff --git a/include/shared-manual.inc b/include/shared-manual.inc
index 98e357f..a579a7b 100644
--- a/include/shared-manual.inc
+++ b/include/shared-manual.inc
@@ -337,16 +337,9 @@ function manual_navigation_breadcrumbs(array $setup) {
 
 function manual_navigation_related(array $setup) {
     $siblings = array();
-    foreach($setup["toc"] as $entry) {
-        // We strip out any class prefix here, we only want method names
-        $methodname = $entry[1];
-        if(strpos($entry[1], '::') !== false && strpos($entry[1], ' ') === false) {
-            list($classname, $methodname) = explode('::', $entry[1]); 
-        }       
-        //add zero-width spaces to allow line-breaks at various characters
-        $methodname = str_replace(array('-','_'), array('-&#8203;','_&#8203;'), $methodname);
+    foreach($setup['toc'] as $entry) {
         $siblings[] = array(
-            "title" => $methodname,
+            "title" => manual_navigation_methodname($entry[1]),
             "link"  => $entry[0],
             "current" => $setup["this"][0] == $entry[0],
         );      
@@ -363,6 +356,29 @@ function manual_navigation_related(array $setup) {
     return $siblings;
 }
 
+function manual_navigation_deprecated(array $setup) {
+    $methods = array();
+    foreach($setup['toc_deprecated'] as $entry) {
+        $methods[] = array(
+            "title" => manual_navigation_methodname($entry[1]),
+            "link"  => $entry[0],
+            "current" => $setup["this"][0] == $entry[0],
+        );
+    }
+
+    return $methods;
+}
+
+function manual_navigation_methodname($methodname) {
+    // We strip out any class prefix here, we only want method names
+    if (strpos($entry[1], '::') !== false && strpos($entry[1], ' ') === false) {
+        $tmp = explode('::', $entry[1]);
+        $methodname = $tmp[1];
+    }
+
+    // Add zero-width spaces to allow line-breaks at various characters
+    return str_replace(array('-','_'), array('-&#8203;','_&#8203;'), $methodname);
+}
 
 // Set up variables important for this page
 // including HTTP header information
@@ -399,8 +415,9 @@ function manual_setup($setup) {
     $lastmod = max($timestamps);
 
     $breadcrumbs = manual_navigation_breadcrumbs($setup);
-    $__RELATED = manual_navigation_related($setup);
-    
+    $__RELATED['toc'] = manual_navigation_related($setup);
+    $__RELATED['toc_deprecated'] = manual_navigation_deprecated($setup);
+
     $config = array(
         "current" => "docs",
         "breadcrumbs" => $breadcrumbs,
@@ -478,7 +495,8 @@ function manual_footer() {
     manual_notes($USERNOTES);
     echo "</section>";
     $config = array(
-        'related_menu' => $__RELATED
+        'related_menu' => $__RELATED['toc'],
+        'related_menu_deprecated' => $__RELATED['toc_deprecated']
     );
     site_footer($config);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.