zip
Note that if the archive is a tarball, a compressed file that contains a tar archive, the
inner TAR file will automatically be extracted.
If we attempt to extract an unsupported archive type, a warning
will be thrown.
Arrays
Arrays are an integral part of PHP and we constantly use them when building
Joomla! extensions. PHP provides us with a number of very useful functions for
working with arrays. We can use the static JArrayHelper class to simplify other
common tasks when working with arrays.
The JArrayHelper class is located in the joomla.utilities.array library. Before
we can use the JArrayHelper class we must import the relevant library:
jimport('joomla.utilities.array');
Imagine we have a CSV file, which holds records with mathematical data:
2, 4.6
0, 0.0
1, 2.5
4, 8.2
Now imagine we want to order the data by ID (the first field) and we want the values
(second field) to be displayed as integers.
The first thing we need to do is retrieve the contents of the CSV file; we do this using
the JFile class, discussed earlier in this chapter:
jimport('joomla.
Pages:
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495