--- SubPages.php	2008-09-01 12:47:13.000000000 +0200
+++ SubPages-v1.2.php	2008-09-01 13:04:01.000000000 +0200
@@ -3,7 +3,7 @@
 Plugin Name: Sub Pages widget
 Description: Show only the sub pages, if the current page has sub pages
 Author: Alper Haytabay
-Version: 1.1
+Version: 1.2
 Author URI: http://www.haytabay.de
 */
 
@@ -27,6 +27,8 @@
 
 /*
 Change log:
+  Version 1.2:
+  - Add additional options to make the title a link
   Version 1.1:
   - Add additional options to change the displayed content of the sub pages widget.
     The additional options are:
@@ -61,6 +63,7 @@
   		$title = $options['title'];
   		
   		// default values for the items added in version 1.1
+      $titleLink = 1; //the title is a link per default
   		$useRoot = 1;  // we use the root page per default
       $onlyFirstLevel = 0; // display all children
       $parentIcon = '<='; // the default parent icon is "<="
@@ -69,11 +72,15 @@
   		
   		// If an old version is used where this config is not defined
   		// don't try to load the config value use the default instead
+      if (isset($options['titleLink']))
+      {
+         $titleLink = $options['titleLink'];
+      }
       if (isset($options['useRoot']))
-      {		
+      {
   		   $useRoot = $options['useRoot'];
   		}
-  		
+
   		if (isset($options['onlyFirstLevel']))
       {		
   		   $onlyFirstLevel = $options['onlyFirstLevel'];
@@ -142,8 +149,12 @@
       {
     		// These lines generate our output. Widgets can be very complex
     		// but as you can see here, they can also be very, very simple.
-    		echo $before_widget . $before_title;    		
-        echo '<a href="'.get_permalink($rootPost->ID).'">'.$title.'</a>'.$after_title;            		
+    		echo $before_widget . $before_title;
+        if ($titleLink != 0 ) {
+          echo '<a href="'.get_permalink($rootPost->ID).'">'.$title.'</a>'.$after_title;
+        } else {
+          echo ''.$title.''.$after_title;
+        }
     		echo '<ul>';
     		
         echo $output;
@@ -161,12 +172,13 @@
 		$options = get_option('widget_subpages');
 		if ( !is_array($options) )
 		{
-			$options = array('title'=>'', 'useRoot'=>1, 'onlyFirstLevel'=>0, 'parentIcon'=>'<=', 'parentPosition'=>'top');
+			$options = array('title'=>'', 'titleLink'=>1, 'useRoot'=>1, 'onlyFirstLevel'=>0, 'parentIcon'=>'<=', 'parentPosition'=>'top');
 		}
 		
 		if ( $_POST['subpages-submit'] ) {
 			// Remember to sanitize and format use input appropriately.
 			$options['title'] = strip_tags(stripslashes($_POST['subpages-title']));
+      $options['titleLink'] = isset($_POST['subpages-titleLink']);
       $options['useRoot'] = isset($_POST['subpages-useRoot']);
       $options['onlyFirstLevel'] = isset($_POST['subpages-onlyFirstLevel']);
       $options['parentIcon'] = stripslashes($_POST['subpages-parentIcon']);
@@ -177,12 +189,18 @@
 
 		// Be sure you format your options to be valid HTML attributes.
 		$title = htmlspecialchars($options['title'], ENT_QUOTES);
+    $titleLink = 'checked="checked"';
 		$useRoot = 'checked="checked"';
 		$onlyFirstLevel='';
 		$parentIcon = "<=";
 		$parentPosition = 'top';
 		$addParent = 'checked="checked"';
-		
+
+    if (isset($options['titleLink']))
+    {
+      $titleLink = $options['titleLink'] ? 'checked="checked"' : '';
+    }
+
 		if (isset($options['useRoot']))
     {
       $useRoot = $options['useRoot'] ? 'checked="checked"' : '';
@@ -214,6 +232,7 @@
 		// Here is our little form segment. Notice that we don't need a
 		// complete form. This will be embedded into the existing form.
 		echo '<p style="text-align:right;"><label for="subpages-title">' . __('Title:') . ' <input style="width: 200px;" id="subpages-title" name="subpages-title" type="text" value="'.$title.'" /></label></p>';
+    echo '<p style="text-align:right;margin-right:40px;"><label for="subpages-titleLink" style="text-align:right;">'.__('Link the title:').'<input class="checkbox" type="checkbox" '.$titleLink.' id="subpages-titleLink" name="subpages-titleLink" /></label></p>';
     echo '<p style="text-align:right;margin-right:40px;"><label for="subpages-useRoot" style="text-align:right;">'.__('Use Root:').'<input class="checkbox" type="checkbox" '.$useRoot.' id="subpages-useRoot" name="subpages-useRoot" /></label></p>';		
     echo '<p style="text-align:right;margin-right:40px;"><label for="subpages-onlyFirstLevel" style="text-align:right;">'.__('First level only:').'<input class="checkbox" type="checkbox" '.$onlyFirstLevel.' id="subpages-onlyFirstLevel" name="subpages-onlyFirstLevel" /></label></p>';
     echo '<p style="text-align:right;margin-right:40px;"><label for="subpages-addParent" style="text-align:right;">'.__('Add Parent Page:').'<input class="checkbox" type="checkbox" '.$addParent.' id="subpages-addParent" name="subpages-addParent" /></label></p>';

