@@ -4,24 +4,32 @@ namespace BNETDocs\Templates;
44use \BNETDocs \Libraries \Common ;
55use \BNETDocs \Libraries \Pair ;
66
7- $ title = $ this ->getContext ()->document ->getTitle ();
8- $ description = Common::stripUpTo (trim (filter_var ($ this ->getContext ()->document ->getContent (true ), FILTER_SANITIZE_STRING )), "\n" , 300 );
9- $ this ->opengraph ->attach (new Pair ("url " , "/document/ " . $ this ->getContext ()->document ->getId ()));
7+ $ object_id = $ this ->getContext ()->document_id ;
8+ $ object = $ this ->getContext ()->document ;
9+
10+ $ title = ($ object ? $ object ->getTitle () : "Document Not Found " );
11+ $ description = Common::stripUpTo (trim (filter_var (
12+ ($ object ? $ object ->getContent (true ) : "The requested document does not exist or could not be found. " ),
13+ FILTER_SANITIZE_STRING
14+ )), "\n" , 300 );
15+ $ this ->opengraph ->attach (new Pair ("url " , "/document/ " . urlencode ($ object_id )));
1016$ this ->opengraph ->attach (new Pair ("type " , "article " ));
1117
12- $ url = Common::relativeUrlToAbsolute ("/document/ " . urlencode ($ this ->getContext ()->document ->getId ()));
13- $ url .= "/ " . Common::sanitizeForUrl ($ this ->getContext ()->document ->getTitle (), true );
18+ $ url = Common::relativeUrlToAbsolute ("/document/ " . urlencode ($ object_id ));
19+ if ($ object )
20+ $ url .= "/ " . Common::sanitizeForUrl ($ object ->getTitle (), true );
1421
1522#$this->additional_css[] = "/a/document.css";
1623require ("./header.inc.phtml " );
1724?>
1825 <article>
26+ <?php if ($ object ) { ?>
1927 <a href="https://plus.google.com/share?url=<?php echo urlencode ($ url ); ?> " rel="external" data-popup="1"><img class="social-btn float-right" src="<?php echo Common::relativeUrlToAbsolute ("/a/social-gplus-24px.png " ); ?> "/></a>
20- <a href="https://twitter.com/share?text=<?php echo urlencode ($ this -> getContext ()-> document ->getTitle ()); ?> &url=<?php echo urlencode ($ url ); ?> " rel="external" data-popup="1"><img class="social-btn float-right" src="<?php echo Common::relativeUrlToAbsolute ("/a/social-twitter-24px.png " ); ?> "/></a>
28+ <a href="https://twitter.com/share?text=<?php echo urlencode ($ object ->getTitle ()); ?> &url=<?php echo urlencode ($ url ); ?> " rel="external" data-popup="1"><img class="social-btn float-right" src="<?php echo Common::relativeUrlToAbsolute ("/a/social-twitter-24px.png " ); ?> "/></a>
2129 <a href="https://facebook.com/sharer/sharer.php?u=<?php echo urlencode ($ url ); ?> " rel="external" data-popup="1"><img class="social-btn float-right" src="<?php echo Common::relativeUrlToAbsolute ("/a/social-facebook-24px.png " ); ?> "/></a>
22- <header><a href="<?php echo $ url ; ?> "><?php echo htmlspecialchars ($ this -> getContext ()-> document ->getTitle (), ENT_HTML5 , "UTF-8 " ); ?> </a></header>
30+ <header><a href="<?php echo $ url ; ?> "><?php echo htmlspecialchars ($ object ->getTitle (), ENT_HTML5 , "UTF-8 " ); ?> </a></header>
2331 <section>
24- <?php echo $ this -> getContext ()-> document ->getContent (true ); ?>
32+ <?php echo $ object ->getContent (true ); ?>
2533 </section>
2634 </article>
2735 <article>
@@ -30,5 +38,9 @@ require("./header.inc.phtml");
3038 <?php require ("./NYI.inc.phtml " ); ?>
3139 <p class="center">If you'd like to leave a suggestion or concern, you can do so <a href="https://github.com/BNETDocs/bnetdocs-web/issues/new?labels[]=bnetdocs-phoenix&labels[]=question&body=<?php echo rawurlencode ("Hi, \n\n<fill in your question here> \n\nThanks! \n\nReference: " . $ url ); ?> " rel="external">over on GitHub</a>. Sorry for the trouble!</p>
3240 </section>
41+ <?php } else { ?>
42+ <header class="red"><?php echo htmlspecialchars ($ title , ENT_HTML5 , "UTF-8 " ); ?> </header>
43+ <section class="red"><?php echo htmlspecialchars ($ description , ENT_HTML5 , "UTF-8 " ); ?> </section>
44+ <?php } ?>
3345 </article>
3446<?php require ("./footer.inc.phtml " ); ?>
0 commit comments