Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: 63ba5f5109
...
compare: c05554cd2c
  • 4 commits
  • 3 files changed
  • 0 commit comments
  • 2 contributors
Commits on Mar 05, 2013
Brennen Bearnes fix broken G+ images
Ok, so actually just remove them if one is not in the most obvious place.

I loathe nested data structures.
3ea0e38
Commits on Mar 13, 2013
Brennen Bearnes Template&addContext() takes a Template
s/template/context/

Should have tested this.
315ee87
Commits on Mar 15, 2013
Brennen Bearnes add Renderable interface, use it for Template 3d8857c
Commits on Mar 28, 2013
@robacarp robacarp Merge branch 'master' into endicia_7 c05554c
Showing with 27 additions and 5 deletions.
  1. +8 −0 Renderable.php
  2. +16 −3 SocialNoise/GooglePlus.php
  3. +3 −2 Template.php
View
8 Renderable.php
@@ -0,0 +1,8 @@
+<?php
+namespace SparkLib;
+
+interface Renderable {
+
+ public function render();
+
+}
View
19 SocialNoise/GooglePlus.php
@@ -1,6 +1,8 @@
<?php
namespace SparkLib\SocialNoise;
+use \SparkLib\Fail;
+
class GooglePlus extends \SparkLib\SocialNoise {
protected $_key = null;
@@ -37,9 +39,20 @@ public function searchHTML ($text, $qty)
$html = '<table class="' . htmlspecialchars($this->tableClass) . '">';
foreach ($result->items as $activity) {
- $html .= '<tr>'
- . '<td><img src="' . $activity->actor->image->url . '"></td>'
- . '<td><a href="' . $activity->actor->url . '">' . htmlspecialchars($activity->actor->displayName) . '</a> ';
+
+ $image_url = $activity->actor->image->url;
+
+ $html .= '<tr>';
+ if (strlen($image_url) > 14) {
+ // if actor->image->url is this short, it's probably bunk data, and we are too
+ // lazy to go digging through the rest of the stuff in the response looking
+ // for a valid one:
+ $html .= '<td><img height=50 width=50 src="' . htmlspecialchars($image_url) . '"></td>';
+ } else {
+ $html .= '<td></td>';
+ }
+
+ $html .= '<td><a href="' . htmlspecialchars($activity->actor->url) . '">' . htmlspecialchars($activity->actor->displayName) . '</a> ';
if (isset($activity->title))
$html .= $activity->title;
View
5 Template.php
@@ -1,6 +1,7 @@
<?php
namespace SparkLib;
+use \SparkLib\Renderable;
use \SparkLib\Fail;
/**
@@ -32,7 +33,7 @@
* Inside a template, the Template instance may be accessed as $this.
* $h() is available as a wrapper around htmlspecialchars().
*/
-class Template extends HTML {
+class Template extends HTML implements Renderable {
/**
* Template filename.
@@ -135,7 +136,7 @@ public function setContext ($context = array())
public function addContext ($context = array())
{
if ($context instanceof Template)
- $context = $template->getContext();
+ $context = $context->getContext();
foreach ($context as $key => $val) {
$this->__set($key, $val);

No commit comments for this range

Something went wrong with that request. Please try again.