Skip to content

Commit

Permalink
Adding iUseThis stats to application sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Hall committed Jan 1, 2010
1 parent a42e464 commit 4f83f44
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
21 changes: 18 additions & 3 deletions application.php
Expand Up @@ -15,6 +15,7 @@
$app->name = $_POST['name'];
$app->link = $_POST['link'];
$app->bundle_name = $_POST['bundle_name'];
$app->i_use_this_key = $_POST['i_use_this_key'];
$app->s3key = $_POST['s3key'];
$app->s3pkey = $_POST['s3pkey'];
$app->s3bucket = $_POST['s3bucket'];
Expand All @@ -39,6 +40,7 @@
$name = $_POST['name'];
$link = $_POST['link'];
$bundle_name = $_POST['bundle_name'];
$i_use_this_key = $_POST['i_use_this_key'];
$s3key = $_POST['s3key'];
$s3pkey = $_POST['s3pkey'];
$s3bucket = $_POST['s3bucket'];
Expand All @@ -62,6 +64,7 @@
$name = $app->name;
$link = $app->link;
$bundle_name = $app->bundle_name;
$i_use_this_key = $app->i_use_this_key;
$s3key = $app->s3key;
$s3pkey = $app->s3pkey;
$s3bucket = $app->s3bucket;
Expand Down Expand Up @@ -126,9 +129,14 @@
<span class="info">Your application's product page</span>
</p>
<p>
<label for="url">Bundle Name</label>
<label for="url">Bundle Name</label>
<input type="text" class="text" name="bundle_name" id="bundle_name" value="<?PHP echo $bundle_name; ?>">
<span class="info">Ex: MyApplication.app</span>
<span class="info">Ex: MyApplication.app</span>
</p>
<p>
<label for="url">i use this URL Key Slug</label>
<input type="text" class="text" name="i_use_this_key" id="i_use_this_key" value="<?PHP echo $i_use_this_key; ?>">
<span class="info">Ex: http://osx.iusethis.com/app/<strong>virtualhostx</strong></span>
</p>

<hr>
Expand Down Expand Up @@ -235,7 +243,14 @@
</div></div>
</div>
<div id="sidebar" class="yui-b">

<div class="block">
<div class="hd">
<h3>i use this</h3>
</div>
<div class="bd">
<?PHP echo $app->iUseThisHTML(); ?>
</div>
</div>
</div>
</div>

Expand Down
10 changes: 9 additions & 1 deletion includes/class.objects.php
Expand Up @@ -28,7 +28,7 @@ class Application extends DBObject
{
public function __construct($id = null)
{
parent::__construct('applications', array('name', 'link', 'bundle_name', 's3key', 's3pkey', 's3bucket', 's3path', 'sparkle_key', 'sparkle_pkey', 'ap_key', 'ap_pkey', 'from_email', 'email_subject', 'email_body', 'license_filename', 'custom_salt', 'license_type', 'return_url', 'fs_security_key'), $id);
parent::__construct('applications', array('name', 'link', 'bundle_name', 's3key', 's3pkey', 's3bucket', 's3path', 'sparkle_key', 'sparkle_pkey', 'ap_key', 'ap_pkey', 'from_email', 'email_subject', 'email_body', 'license_filename', 'custom_salt', 'license_type', 'return_url', 'fs_security_key', 'i_use_this_key'), $id);
}

public function versions()
Expand Down Expand Up @@ -122,6 +122,14 @@ function ordersPerMonth()
ksort($orders);
return $orders;
}

public function iUseThisHTML()
{
$html = file_get_contents("http://osx.iusethis.com/app/include/{$this->i_use_this_key}/2");
$count = preg_replace('/[^0-9]/', '', strip_tags($html));
$result = "<div style=\"width: 160px;background: no-repeat url(http://osx.iusethis.com/static/badges/ucb2.png); height: 43px; cursor: pointer;\"><a href='http://osx.iusethis.com/app/{$this->i_use_this_key}'><div style=\"color: #383838; font: 14px Geneva, Arial, Helvetica, sans-serif; position: relative; top: 14px; left: 45px; font-weight: bold; text-align: left;\">$count<span style=\"color:#7a7a7a; font:12px;\">usethis</span></div></a></div>";
return $result;
}
}

class Order extends DBObject
Expand Down

0 comments on commit 4f83f44

Please sign in to comment.