Archive for September, 2010

Small Google Translator

Tuesday, September 28th, 2010

Package:
Small Google Translator
Summary:
Translate text using Google Traslate API
Groups:
Localization, PHP 5, Web services
Author:
Pawan Adhikari
Description:
This class can be used to translate text using Google Translate API.

It can take a text and send an HTTP request to Google Translate API Web servers to translate the text between two given idioms.

Currently it supports the following idioms: Arabic, Bulgarian, Simplified Chinese, Traditional Chinese, Croatian, Czech, Danish, Dutch, English, Finnish, French, German, Greek, Hindi, Italian, Japanese, Korean, Polish, Portuguese, Romanian, Russian, Spanish and Swedish.


Tags: ,
Posted in Classes | No Comments »

5 Biggest Copyright Pitfalls for Web Designers

Tuesday, September 28th, 2010


When it comes to design, copyright is often a very muddled gray area. Just as the lines between plagiarism and homage are often confusing, so too is the line between infringing and non-infringing use of copyrighted material. Since it is natural and even expected of Web designers to incorporate elements from other sites and other creations, it is important to understand the risks and hazards when it comes to copyright in Web design. As such, here are five of the most common copyright pitfalls Web designers face and how to best avoid them.


1. Images

The most common issue many web designers face when it comes to copyright law has to do with the images they use in their layouts. For some designers, it is common practice to find images they need by doing a Google search or pulling an unlicensed image from a stock photo library.

The problem with this is that, as Google itself warns, these images are usually protected by copyrights, and their use as part of a layout almost certainly constitutes an infringement. Historically, artists have not had many resources for finding such infringements, but as detection tools improve in quality and drop in price, more infringements are being detected.

It is important that you always make sure you have the rights to use an image in your layout, even if it is just a placeholder.

If you need to locate free images that you can use legally, search for Creative Commons-licensed work on Flickr or visit StockXchng (sxc.hu) to find high-resolution images you can use legally – as long as you are sure to follow the terms of the licenses carefully.


2. HTML/Source Code

Most Web designers are expected to crib some of their source code, either from other sites or their previous work. But where taking a portion of a page to get a table format or a few CSS elements from a stylesheet likely won’t raise any alarm, large scale copying, such as taking an entire style sheet or whole theme elements, likely constitutes copyright infringement.

The problem is that HTML code, much like computer software, is considered an original work of authorship, even if it is created with the help of tools, and enjoys copyright protection. Though you can’t copyright the general look of the site, meaning Google can’t copyright a white background with a center logo, you can protect the code that created that work.

The best way to avoid any issues over your source code is to create as much of it yourself as possible and limit any copying to only things that you could trivially reproduce but wanted to save time on. The more it becomes clear where your code came from, the more likely the copyright holder may become upset.


3. Platform Licensing

The days of static websites went out nearly a decade ago. Most sites today are built on top of a platform of some variety or another, be it WordPress, Joomla, Presta Shop or some other software. However, many of these tools have strict and/or unusual licensing requirements and it is easy for designers to run afoul of their terms when setting up a new site.

The most common mistake is installing a purchased application on too many sites; for example, by buying a one-domain license on ThemeForest for an application, but using it with multiple clients.

However, even open source applications carry risks as many designers, in an attempt to keep the site clean, remove attribution lines in the code and files on the server that are required as part of the license.

When using any software to build a site, take a moment to read thorough the license and understand what it means. Follow those terms closely. Developers are constantly becoming more savvy about tracking down those who violate their licenses and even authors that license under the GPL are becoming more aggressive about enforcing their terms.


4. Open Source Blunders

A related mistake comes when web designers use and publish works based on open source code, particularly GPLed code (which includes many WordPress themes) and forget to either retain the license information and/or fail to donate their modified code back to the GPL.

If you create a derivative work of a GPL-licensed one, such as making a GPL WordPress theme a different color, the new theme has to be licensed under the GPL.

If you are unsure of whether your new work meets the requirement for GPL “inheritance”, this 2001 article by Lawrence Rosen (http://www.sitepoint.com/article/public-license-explained/) explains it quite nicely.


5. Dummy Copy

Though the use of dummy text is largely a hold over from the print design world, many web designers continue to use it for various reasons. It can pose a great risk if the dummy copy is pulled from another site. Even if the copy is just for testing purposes, it still constitutes an infringement. It may be unwittingly harming the original authors if the search engines have detected the test site.

Generally speaking, it is best to either use content from the client’s current site if possible, or true lorem ipsum text if it isn’t (http://www.lipsum.com/). Considering that lorem ipsum text is actually more flexible than using articles and content from other sites, it makes sense in nearly every regard.

Be especially careful of scraping RSS feeds for the purpose of filling up a test application or blog, this is especially frowned upon by bloggers and may have your test site mistaken for a spam blog.


Bottom Line

In the end, it is important to keep copyright infringement in mind when designing websites and services. This is especially crucial if your test sites are public facing or may be indexed by the search engines – as you may find your test pages taken down by your host.

However, even if you test solely on a private server, it’s worth keeping these issues in mind so you do not pass along an infringing site to your clients, even by accident. Nothing will sour a relationship with a client faster than them receiving cease and desist letters or take-down notices for content in your layout.

Given the minimal amount of effort that it takes to remain on the right side of copyright law, it doesn’t make sense to even take the chance. It only takes a few minutes to do things correctly but it takes just one copyright infringement complaint to sandbag an entire design career.

This article was originally posted on the ThemeForest blog. We are currently porting over some of the more popular articles to Nettuts+.

Tags: , , ,
Posted in PHP Tutorials | No Comments »

Quick Tip: Dissecting jQuery – Text

Tuesday, September 28th, 2010


In this latest episode of “Dissecting jQuery,” we’ll discuss the text() method, as well as a new feature, as of jQuery 1.4, that you may not be aware of yet.

jQuery Source for the text Method

text: function( text ) {
		if ( jQuery.isFunction(text) ) {
			return this.each(function(i) {
				var self = jQuery(this);
				self.text( text.call(this, i, self.text()) );
			});
		}

		if ( typeof text !== "object" && text !== undefined ) {
			return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
		}

		return jQuery.text( this );
	}

Keep in mind that the ability to pass a function to the text() method is only available, via the user of version 1.4 or higher. But that’s no problem; and if you’re still using 1.3, you should really stop! :)


Other Episodes in the “Dissecting jQuery” Series

  1. Filters
  2. Grep

Tags: , , ,
Posted in PHP Tutorials | No Comments »

Billwerx

Tuesday, September 28th, 2010

Billwerx is a small, simple, and secure billing script written in PHP and powered by MySQL. Billwerx allows employees to create an invoice for a client. Once the invoice is generated the invoice can be sent to the client as a PDF attachment, viewed by the client in his or her control panel. Billwerx features and integrated survey system, file and storage attachments, with a feature looking graphic user interface.

Tags:
Posted in Free PHP Scripts | No Comments »

MySQL Newsletter

Monday, September 27th, 2010

Package:
MySQL Newsletter
Summary:
Store and retrieve newsletter e-mails from MySQL
Groups:
Databases, PHP 5
Author:
Carlson A. Soares
Description:
This class can be used to store and retrieve newsletter subscriber e-mail addresses from a MySQL database.

It can create a MySQL database table for storing subscriber addresses, add an e-mail address, remove an e-mail address and retrieve the whole list of subscriber addresses.


Tags: ,
Posted in Classes | No Comments »

eDurian.NET

Monday, September 27th, 2010

the Source

Tags:
Posted in Free PHP Scripts | No Comments »

20 Excellent Coda Tips

Monday, September 27th, 2010


I’ve been using Coda for a while now, and it’s become my web development application of choice. There are quite a few great web development applications out there (read “18 Wonderful IDEs for Windows, Mac, and Linux“) but if you’re a Mac user, Coda is easily one of the best.

Here are 20 excellent Coda tips to increase productivity that I’ve gathered during my use of Coda so far.


1. Set Your Preferences

There are a few things I had to change right away when I first started using Coda. These are all found in Coda’s preferences.

I never use a GUI CSS editor so I set Coda to always open CSS files with the text editor.

Coda Preferences General Tab

Under the Editor tab I’ve check-marked “Show line numbers” and “Use tabs” for indenting. You can hide/show line numbers by pushing Command + Option + L as well.

Coda Preferences Editor Tab

Under the Colors tab I’ve check-marked “Highlight Current line” to make it easier to see where the cursor is when switching back and fourth between applications.

Under the files tab I set files to open when double clicked instead of a single click. You may also need to setup your external editors. Coda automatically used Photoshop for the image formats I use.

Coda Preferences Files Tab

This is how Coda’s navigation bar at the top is by default. This is just a waste of space in my opinion although it is pretty.

Coda Nav Bar Big

I’ve changed mine to display only text titles and as small as possible. Since I don’t use the buttons I have that section minimized most of the time anyway. Instead I use the shortcut keys which I’ll cover next.

Coda Nav Bar Small

Aside from these changes, I’ve left everything else at the default settings. I’ve played around with the color schemes a little but I didn’t find anything I was really happy with so I’ve kept the default color scheme.


2. Switching Modes

If you aren’t using shortcut keys to change modes, now is a good time to learn. Pushing Command + 1-6 changes the mode you’re in. You can switch between your sites, editor, preview, etc. modes very quickly this way.


3. Navigating Open Documents

Pushing Command + Shift + Left or Right Bracket will navigate through your open documents.


4. Line Indenting

Coda automatically indents certain markup for you by default but you’ll still find yourself using the Tab button pretty frequently. Instead of jumping to the front of a line to indent it you can push Command + Left or Right Bracket to indent the line the cursor is currently in.


5. Clips and Text Inserts

Pushing Command + Control + C will open up Coda’s clips. Clips is a place to store snippets of code for quickly inserting into documents. You can save snippets for use in all documents or just site specific clips.

Coda Clips General

You can assign tags to quickly insert clips. For example, I’ve set “htmltemp” to insert an HTML 4.01 Template when I start a new document. I would type “htmltemp” into the blank document and push Tab to insert the clip. You can also insert a selection placeholder if the cursor needs to go somewhere specific in the clip after being inserted.

Coda Clips General

6. Inline HTML Validation

Validate your HTML while you’re working. Okay, if you’re experienced with HTML you might only want to use the validation feature when you’re ready to validate, otherwise you’ll have errors popup as you’re typing which can be pretty annoying.

Coda Inline Validation

Coda will tell you what needs to be fixed. Sometimes there is a little orange “snapback” button in the balloon that will take you to the beginning of the error when clicked.

Coda Inline Validation Example

7. Use Coda’s Hints

If you aren’t quite comfortable with HTML or CSS yet you can use Coda’s Hints feature to give you a little extra guidance.

Coda Hints

8. Use Coda Books

Highlighting something and pushing Command + ‘ will search the books you have available in Coda for the highlighted text. You can also just hold Command and double click a word you want to search for.

Coda's Books

9. Setup More Coda Books

Add more books to reference more information. You can read more about adding more Coda books here.

Coda Books

10. Block Edit Text

If you need to edit multiple lines you can do a block edit to do them all at once. You can highlight the text you want to edit and push Command + Shift + B or you can hold down Option and select the lines you want to block edit that way.

Block Edit Text

11. Shift Text

Highlighting text and pushing Command + Left or Right Bracket will shift the highlighted text left or right. This is great for shifting a whole section of markup for good looking markup formatting.


12. Preview in a Browser

You can preview files in Coda’s built in Preview mode (which uses the same engine as Safari) and while in that mode you can click the Preview in Browser button in the top right to open the file in the browser of your choice.

You can also push Command + Option + B while in any mode to open and preview the file in the default browser (Safari). When you make changes to the document you can use this shortcut to refresh the preview in the browser a little faster.

Coda Browser Preview

13. Use the Preview Tools

There are three tools included with Coda’s preview mode. These can be helpful for quick development issues (although I still find myself using Firebug :-P ).

Preview Tools

The left button lets you preview the source code. Kind of strange since you’re just in the preview mode and you could just switch back to the edit mode. However, this lets you edit the source code and preview the changes without actually editing the document. A great feature for testing and debugging.

The center button is the JavaScript log and the right button is the DOM hierarchy inspector. You can quickly find and see elements with this which is helpful if you aren’t sure what’s going on.

DOM Inspector

14. Split Windows

You can split windows using the icon in the top right of the window (the plus with lines). Pushing Option will change the direction of the lines meaning the split will change from horizontal to vertical (or the opposite if changed in preferences). You can also push Command + Control + L to split the window using shortcut keys (hold option to split the other direction).

Coda Split Windows

Within each window you can independently change modes.

Coda Window Previews

15. Open Separate Files in Split Window

You can also open separate files in split windows by right clicking files in the File Browser and selecting “Open in Split” or by dragging the file into an already open split. Now you can edit two separate files in a split window.


16. Hide/Show File Browser

Coda’s file browser is great but you won’t be using it the majority of the time so you can quickly hide/show it by pushing Command + Control + B.


17. Hide/Show Code Navigator

If you need a little help jumping around a document you can pop open the code navigator.

Code Navigator

A little hidden feature with Coda and the code navigator is that you can create “bookmarks” within your code to jump around your document faster using the code navigator. For example.

<!-- !THIS IS AN HTML BOOKMARK -->

This would create a bookmark in the code navigator that looks like this.

Bookmarks

Basically the bookmark is created with markup comments that use an exclamation point before the bookmark text. You can do this for HTML, CSS, PHP, etc.


18. Use the Find Features

Instead of using the code navigator to find things, I use the find features. Pushing Command + F opens the bar to search. Then just type in what you’re looking for and push enter. Coda will scroll the document to the first matching text and highlight it. There are several more shortcut keys for searching and several options you can change if needed. Using the find feature is much faster for me than using the code navigator since my hands never have to leave the keyboard.

Find

19. Quick Close Tag Shortcut

By default Coda will automatically close a tag once you’ve opened one. However, that doesn’t always work and I still find myself needing to close HTML tags manually all the time. Pushing Command + Option + . (period) will automatically close the current HTML tag (wherever the cursor is).


20. Get Plugins

While Coda has a lot of great features, there are many features developers still want. There are a few plugins available from third party developers that you can install to give Coda extra functionality. Here is a list of third-party plugins available.


Final Thoughts

These are some great tips for using Coda but like any great web development application, there are plenty more, so take some time to explore. With some practice, you can pick up tons of keyboard shortcuts that will keep your hands on the keyboard instead of wasting time mousing around. ;-)

For video tutorials, tips, guides and other information, visit Panic’s Coda Developer Zone.

If you have some great tips, feel free to share them with us by leaving a comment below.

This article was originally posted on the ThemeForest blog late last year. We are currently porting over some of the more popular articles to Nettuts+.

Tags: , , ,
Posted in PHP Tutorials | No Comments »

Display Anything you want from the Envato API using PHP

Monday, September 27th, 2010


If you’re unaware, Envato has a stable and fantastic API to work with that is super powerful and super simple. The latest version (at the time of writing) is release v2. In this article, we’ll review how to access every single public set from the Envato API.


Learning the Basics

First things first: you need to know where to find the API, what it is, and how exactly it works. You can find the official API release on the forums, as well as the update to the API thread and the v1 update information.

The API works by making requests to custom URLs containing data that you wish to be returned. The data can also be returned in two formats, xml or JSON, which is returned is up to you. I prefer returning as JSON and using PHPs json_decode to turn the data into nested arrays.


What we will Accomplish

Below, you will see a screenshot of all of the currently available public sets. We will go through each and everyone of these today, individually, and with a working code example and preview of the final result!

Release Table

For each set we cover today, I will briefly describe what the point of the set is, post the code, and then later explain each step of the code below. Be sure to ask any questions about any of the code snippets you find below.

Also, feel free to use the this code and techniques learned in this tutorial however you wish!


1. Blog Posts

The blog-posts set allows you to query and display a list of blog posts for any particular market. It requires one parameter, which is the marketplace you would like the recent blog posts from.

//Initialize curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://marketplace.envato.com/api/v1/blog-posts:themeforest.json');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$ch_data = curl_exec($ch);
curl_close($ch);

if(!empty($ch_data))
{
	$json_data = json_decode($ch_data, true);
	//print_r($json_data);
	$data_count = count($json_data['blog-posts']) -1;

	echo '


';
}
else
{
	echo 'Sorry, but there was a problem connecting to the API.';
}

Lets walk through the above snippet in detail, as the rest of our snippets will look very similar.

Keep these details in mind; like I said, you will see this pattern in almost every set we cover, though they will vary slightly.

And a demo of the output:

Blog Posts

2. Active Threads

The active-threads set allows you to pull out some recently active forum threads.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://marketplace.envato.com/api/v1/active-threads:themeforest.json');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$ch_data = curl_exec($ch);
curl_close($ch);

if(!empty($ch_data))
{
	$json_data = json_decode($ch_data, true);
	//print_r($json_data);
	$data_count = count($json_data['active-threads']) -1;

	echo '


';
}
else
{
	echo 'Sorry, but there was a problem connecting to the API.';
}

Note a few things here; one, we have changed our request URL to reflect the new set we want to obtain. Secondly, note the array namings have changed as they will with each new set we request. Lastly, notice how print_r is commented out. This is very helpful for debugging and viewing the structure and hierarchy of the data.

And a demo of the output:

Active Threads

3. Number of Files

Don’t let the name of the number-of-files set fool you. It is not the number of a users files (but we will cover this!) but rather the number of files in a given category from a given market. For example, this would let you find out how many total site templates we have on ThemeForest, which we’ll do now.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://marketplace.envato.com/api/v1/number-of-files:themeforest.json');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$ch_data = curl_exec($ch);
curl_close($ch);

if(!empty($ch_data))
{
	$json_data = json_decode($ch_data, true);
	//print_r($json_data);
	$data_count = count($json_data['number-of-files']) -1;

	echo '


';
}
else
{
	echo 'Sorry, but there was a problem connecting to the API.';
}

Of course, our URL request has changed and we have passed the parameter of themeforest, which is the marketplace we will pull the data from. An example of the output from this snippet is below:

Number of Files

4. New Files

Just like the ThemeForest homepage displays a list of new files, you, too, can access new files from a given marketplace from the using new-files set. A nice addition from this set, is the ability to also display the item thumbnail, as you’ll shortly see.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://marketplace.envato.com/api/v1/new-files:themeforest,wordpress.json');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$ch_data = curl_exec($ch);
curl_close($ch);

if(!empty($ch_data))
{
	$json_data = json_decode($ch_data, true);
	//print_r($json_data);
	$data_count = count($json_data['new-files']) -1;

	echo '


';
}
else
{
	echo 'Sorry, but there was a problem connecting to the API.';
}

Unlike our previous snippets, this set requires two parameters. It requires the marketplace and the desired category respectively. Notice that we have added some PHP and markup inside of our for loop. This allows us to display a thumbnail of the item.

A sample output of this snippet is below:

New Files

5. Popular

Similar to displaying recently uploaded items to a given marketplace, we can also display popular items from a given marketplace. Perhaps you want to display a list of popular ThemeForest files on your blog. This snippet would accomplish that goal.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://marketplace.envato.com/api/v1/popular:themeforest.json');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$ch_data = curl_exec($ch);
curl_close($ch);

if(!empty($ch_data))
{
	$json_data = json_decode($ch_data, true);
	//print_r($json_data);
	$json_short = $json_data['popular']['items_last_week'];//Save us some typing.
	$data_count = count($json_short) -1;

	echo '


';
}
else
{
	echo 'Sorry, but there was a problem connecting to the API.';
}

Note how we have added an additional variable named json_short to save us some typing while traversing through the nested array of returned data. In just a few lines of code, we are able to display the thumbnail, name, and link of the item as demonstrated below:

Popular Files

6. New Files From User

The new-files-from-user is a popular set that we used a while back when we created a WordPress plugin with the Envato API. This set allows you to retrieve the 10 newest files a user has uploaded, and the data that goes along with it. You could use this set to promote yourself on your blog automatically every time you upload a new item.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://marketplace.envato.com/api/v1/new-files-from-user:creatingdrew,themeforest.json');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$ch_data = curl_exec($ch);
curl_close($ch);

if(!empty($ch_data))
{
	$json_data = json_decode($ch_data, true);
	//print_r($json_data);
	$data_count = count($json_data['new-files-from-user']) -1;

	echo '


';
}
else
{
	echo 'Sorry, but there was a problem connecting to the API.';
}

The parameters required are the username and the marketplace desired. The rest of the snippet follows the same logic that we have been discussing. Below is an example of the output two of my recent files.

New Files From User

7. Random New Files

The random-new-files set is pretty self explanatory and acts as expected. It returns a random list of newly uploaded files from a given marketplace. It also returns meta data about the file you are free to use and manipulate.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://marketplace.envato.com/api/v1/random-new-files:themeforest.json');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$ch_data = curl_exec($ch);
curl_close($ch);

if(!empty($ch_data))
{
	$json_data = json_decode($ch_data, true);
	//print_r($json_data);
	$data_count = count($json_data['random-new-files']) -1;

	echo '


';
}
else
{
	echo 'Sorry, but there was a problem connecting to the API.';
}

There’s nothing you haven’t seen already here. We are using this set to display some thumbnails and the title. Be sure to check out all the data that is returned though, you may be interested in it. A screenshot of the output is below:

Random New Files

8. Search

That’s right, you can actually use the API to search for custom data in custom categories from custom marketplaces! The devs really thought the API through, and the search set is perfect proof of that. Let’s take a look at a short search snippet. Keep in mind you would could take all this data from user input and setup a custom Envato search on your site, but that is beyond the scope of this tutorial.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://marketplace.envato.com/api/v1/search:themeforest,wordpress,clean.json');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$ch_data = curl_exec($ch);
curl_close($ch);

if(!empty($ch_data))
{
	$json_data = json_decode($ch_data, true);
	//print_r($json_data);
	$data_count = count($json_data['search']) -1;

	echo '


';
}
else
{
	echo 'Sorry, but there was a problem connecting to the API.';
}

Above bears some explaining.

I recommend checking out the API documentation and check out everything that is possible with the search set.

Search

9. User

The user data set returns a small amount of information about a given user. Note that the API key is not required.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://marketplace.envato.com/api/v1/user:collis.json');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$ch_data = curl_exec($ch);
curl_close($ch);

if(!empty($ch_data))
{
	$json_data = json_decode($ch_data, true);
	//print_r($json_data);
	echo '
    '; echo '
  • Location =',$json_data['user']['location'],'
  • '; echo '
  • Username =',$json_data['user']['username'],'
  • '; echo '
  • Sales =',$json_data['user']['sales'],'
  • '; echo '
'; } else { echo 'Sorry, but there was a problem connecting to the API.'; }

Since we are returning information from one user only, there is no need to perform any looping — just output the data.

User

10. Releases

You’ll probably never need to use the releases set, but I said we would cover every public set, and that’s what well do. The releases set returns release and set information for the API. Basically, it is simply used to generate documentation. Just in case you desire the snippet to display this information, you may find it below:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://marketplace.envato.com/api/v1/releases.json');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$ch_data = curl_exec($ch);
curl_close($ch);

if(!empty($ch_data))
{
	$json_data = json_decode($ch_data, true);
	print_r($json_data);
}
else
{
	echo 'Sorry, but there was a problem connecting to the API.';
}

Thanks for Reading

We have covered every single set listed in the public set of v1 of the API! Feel free to pat yourself on the back and go eat some bacon, you deserve it.

This article was originally posted on the ThemeForest blog late last year. We are currently porting over some of the more popular articles to Nettuts+.

Tags: , , ,
Posted in PHP Tutorials | No Comments »

S-mail

Sunday, September 26th, 2010

Package:
S-mail
Summary:
Compose and send e-mail messages
Groups:
Email, PHP 5
Author:
Diogo Del Santo
Description:
This class can be used to compose and send e-mail messages.

It can compose and e-mail message adding the necessary headers for setting recipients in To:, Cc: and BCc: headers, sender address, the message subject.

The composed message is sent with the PHP mail() function.

The code and the comments are in Portuguese.


Tags: ,
Posted in Classes | No Comments »

Barcode PHP

Saturday, September 25th, 2010

Package:
Barcode PHP
Summary:
Generate barcode in GD and PDF
Groups:
Graphics, PHP 5
Author:
Jean-Baptiste DEMONTE
Description:
This class can be used to generate barcode in images and PDF files.

It can take a GD image ressource and render a barcode on it.

The class can also render a barcode in a PDF object of the class FPDF.

Currently it supports barcodes in the formats: codabar, code 11, code 39, code 93, code 128, ean 8, ean 13, standard 2 of 5, interleaved 2 of 5, msi and datamatrix.


Tags: ,
Posted in Classes | No Comments »