Alex (SirShurf) Frenkel's Blog

A web log of a PHP professional

Posts Tagged ‘php

PHP 5.4 is out, and here is the list you should be watching

leave a comment »

As of today PHP team has released PHP 5.4.

Since this is a major version here is the list of things you should look at:

    • The break and continue keywords don’t accept variable argument anymore. Consider using a static constant argument.
    • Safe mode is no longer supported. Any application that rely on safe mode may need adjustements in term of security.
    • Salsa10 and Salsa20 hash algorithms have been removed.
    • In Date extension, setting the timezone with the TZ environment variable is no longer supported. The extension will no longer guess the default timezone if none is set, instead it will always fall back to “UTC”.
    • get_magic_quotes_gpc() and get_magic_quotes_runtime() now always return false. set_magic_quotes_runtime() raises an E_CORE_ERROR
    • Non-numeric string offsets – e.g. $a[‘foo’] where $a is a string – now return false on isset() and true on empty(), and produce warning if trying to use them. Offsets of types double, bool and null produce notice. Numeric strings ($a[‘2’]) still work as before. Note that offsets like ‘12.3’ and ‘5 and a half’ are considered non-numeric and produce warning, but are converted to 12 and 5 respectively for BC reasons.
    • Turning null, false or empty string into an object by adding a property will now emit a warning instead of an E_STRICT error.
    • Converting array to string now will cause E_NOTICE warning.
    • Shadowing names of superglobals for parameter names now causes a fatal error.
    • array_combine() now returns array() instead of FALSE when two empty arrays are provided as parameters.
    • call_user_func_array() no longer allows call-time pass by reference.
    • htmlentities() now emits an E_STRICT warning when used with asian characters, as in that case htmlentities() has (and already had before this version) the same functionality as htmlspecialchars().

The following keyword(s) are now reserved and may not be used in function, class, etc. names.

  • trait
  • callable
  • insteadof

The following functions have been removed from PHP :

  • define_syslog_variables()
  • import_request_variables()
  • session_is_registered(), session_register() and session_unregister()
  • mysqli_bind_param(), mysqli_bind_result(), mysqli_client_encoding(), mysqli_fetch(), mysqli_param_count(), mysqli_get_metadata(), mysqli_send_long_data(), mysqli::client_encoding() and mysqli_stmt::stmt()

Have fun coding!

Advertisements

Written by Alex (Shurf) Frenkel

March 2, 2012 at 8:53 am

JQuery & CSS Dropw down menu

leave a comment »

I have been looking for a long time for a JQuery/CSS drop down menu that would not clash with Zend Framework, and especially with Zend Navigation.

This is the one that comes closest:
http://www.noupe.com/tutorial/drop-down-menu-jquery-css.html

Written by Alex (Shurf) Frenkel

August 23, 2011 at 10:17 am

Posted in Uncategorized

Tagged with , , , , ,

jQGrid with Zend Framework Updated

with 9 comments

Recently I had some time to update the fork I have of the jQGrid encapsulation for Zend Framework.

Among the things updated is:
* Support for jQGrid 4.1.
* Support for methods in options.
* 2 new decorators
* New special decorator, a multi select element on grid search.
* Support for advanced search

And many more…
You can locate the code at my GitHub:

If you dont use jQGrid it is an Ajax-enabled JavaScript control that provides solutions for representing and manipulating tabular data on the web.

Written by Alex (Shurf) Frenkel

August 22, 2011 at 7:19 pm

How to use Zend-Framework-PDF-Table-Helper

with 10 comments

Here is the example of how to user ZendFramework PDF-Table-Helper.

You can get the code from GitHub here:

One of the prerequisites is that you mast have the zf_autoloader on and configured since I am relaying on it to auto load files.

first you have to in instantiate the class:

$pdf = new SirShurf_Pdf_TableSet ();

You can instantiate it with a Zend_PDF object and without it, in which case it will be created for you, but if you are instantating with Zend_PDF you have to tell the system on what page you are working (Default is page 0).

Now what you need it to initialise a Table you are going to work with:
$objTableRow = $table->addRow ();

Each table can have his own number of columns and settings.
Each table can have a different number of rows a row can be added using this method:

And as with HTML a row has a number of cells (or columns):
$objTableRow->addCol ( $strCourseId, array (
'bold' => false, 'colspan' => 1, 'align' => 'center'
) );
$objTableRow->addCol ( Labadmin_Models_Static::convertHebrew ( $this->view->translate ( 'LBL_GRADE_FORM_COURSE_ID' ) ), array (
'bold' => false, 'colspan' => 1, 'align' => 'center', 'font' => 'arial.ttf', 'fontBold' => 'arialbd.ttf'
) );

The Cell can have each own definitions as the example here shows, and you can iterate over the data to create it.

And finally you can call render(); in order to render the changes to PDF, or build(‘fileName’) to save the finale PDF to a file.

$pdf->build ( $strGradeFileLocation . $intTimeStamp . ".grade.pdf" );

Written by Alex (Shurf) Frenkel

July 26, 2011 at 3:15 pm

Library to create a tables in Zend Framework PDF

with 2 comments

I had to create a PDF with a tables in a Zend Framework project I am making.

I have searched the web and have not found any library that can be used for this from the box, but I have found on GitHub a start of the library I was needed:
https://github.com/btm6084/Zend_PDF_Helper

Unfortunately the library was incomplete and not maintained, so I contacted the owner and he gave me the permission to take the code and do what I like with it.

So here is my version (working one) of the library that can create tables in PDF using Zend Framework PDF library.

Zend Framework PDF Table Helper

I will write a working example soon and post it here and on GitHub.

Written by Alex (Shurf) Frenkel

July 24, 2011 at 11:04 am

Does anybody know ActiveReport for PHP?

leave a comment »

One of my clients need something like ActiveReport (.net) with PHP.

Does anybody know anything I can use?

Written by Alex (Shurf) Frenkel

June 28, 2010 at 11:37 am

Posted in Uncategorized

Tagged with , ,

Grouping orWhere elements in Zend Framework Zend_Db_select

leave a comment »

Practicly each time I am working with Zend_Db_Select (with Table or without it) I am searching for how easy to group orWhere elements.

After lot’s of searching and try and error’s I have come to this code:


if (false !== $this->_customSearchKeyword) {

$searchFields = array(‘p.photo_name’, ‘p.photo_desc’);


$keywordWhere = array();


if (!empty($searchFields)) {


foreach ($searchFields as $searchField) {

$searchField = $db0->quoteIdentifier($searchField);
$keywordWhere[] = ‘(‘ . $db0->quoteInto(“$searchField = ?”,

$this->_customSearchKeyword) . ‘)’;

}
$select->where( implode(‘ OR ‘, $keywordWhere) );

}

}

I hope that would be of some help to somebody 🙂 more then me I mean

Written by Alex (Shurf) Frenkel

May 13, 2010 at 7:11 pm