~ubuntu-branches/ubuntu/trusty/php-mime-type/trusty

« back to all changes in this revision

Viewing changes to MIME_Type-1.2.0/docs/examples/example.php

  • Committer: Package Import Robot
  • Author(s): Thomas Goirand
  • Date: 2012-02-26 14:49:59 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120226144959-15su7r6j5injbj2g
Tags: 1.3.1-1
* New upstream version.
* Added a debian/gbp.conf.
* Switching to source format 3.0 (quilt).
* Switching to pkg-php-tools and dh 8 sequencer.
* Rewrote debian/copyright using machine-readable format, now using the LGPL
version 3 (upstream and maintainer relicense).
* Standards-Version: 3.9.3 (no change but the above).
* Fixed VCS fields (Closes: #638523).
* Now using PKG-PHP-PEAR team as maintainer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
 
3
 
ini_set('error_reporting', E_ALL);
4
 
require 'MIME/Type.php';
5
 
 
6
 
$type = 'application/x-test-app; foo="bar" (First argument); bar=baz (Second argument)';
7
 
$type2 = 'application/vnd.pear.test-type';
8
 
 
9
 
print "Checking type: $type\n";
10
 
if (MIME_Type::isExperimental($type)) {
11
 
    print "Type is experimental\n";
12
 
} else {
13
 
    print "Type is not experimental\n";
14
 
}
15
 
 
16
 
print "\nChecking type: $type2\n";
17
 
if (MIME_Type::isVendor($type2)) {
18
 
    print "Type is vendor-specific\n";
19
 
} else {
20
 
    print "Type is not vendor-specific\n";
21
 
}
22
 
 
23
 
$file = '@doc_dir@/MIME_Type/example.php';
24
 
print "\nChecking type of: $file\n";
25
 
$type = MIME_Type::autoDetect($file);
26
 
if (PEAR::isError($type)) {
27
 
    print 'Error: ' . $type->getMessage() . "\n";
28
 
} else {
29
 
    print $type . "\n";
30
 
}
31
 
 
32
 
?>