I have a simple code:
class o99_custom_fields {
var $prefix = 'o99_';
var $customFields = array(
array(
"name" => "some_name",
"title" => "some Title",
"description" => "Some Desctiption Text",
"type" => "k_upload",
"scope" => array( "post" ),
"capability" => "edit_post"
),
array(
"name" => "some_name2",
"title" => "some Title",
"description" => "Some Desctiption Text",
"type" => "k_upload",
"scope" => array( "post" ),
"capability" => "edit_post"
),
array(
"name" => "some_name3",
"title" => "some Title",
"description" => "",
"type" => "k_textarea",
"scope" => array( "post" ),
"capability" => "edit_post"
),
);
... more functions and more code ...
}
And everything looks fine
The problem starts when I try to change some array values ββand put them in brackets ()
eg:
array(
"name" => "some_name",
"title" => __("some Title","text_domain"),
"description" => "Some Desctiption Text",
"type" => "k_upload",
"scope" => array( "post" ),
"capability" => "edit_post"
),
Error message:
Parse error: syntax error, unexpected '(', expecting ')' in E:\my_path\myfile.php on line 18
Please note that this is not related to the function __()( standard Wordpress translation function ), and the error is not related to the function, but SYNTAX. (I use this hundreds of times in the past without any problems - and in this case also, _x()and _e()fail at the same syntax error ..)
All my brackets are closed, I checked and checked again, and if I am not completely blind, I would say that everything is in order, but I still get this error, regardless of where I put the brackets inside this class.
: :
class o99_custom_fields {
var $prefix = 'o99_';
var $dummy_strings = array (
__('x1','text_domain'),
__('x2','text_domain'),
);
... more functions and more code ...
}
, SYNTAX, .
php (UTF-8 )
- // .
I:
..
function o99_custom_fields() { $this->__construct(); }
function __construct() {
add_action( 'admin_menu', array( &$this, 'createCustomFields' ) );
add_action( 'save_post', array( &$this, 'saveCustomFields' ) );
}