lundi 12 octobre 2015

Syntax error, unexpected T_STRING, expecting ';'

function do_action($tag, $arg = '') {
global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;

if ( ! isset($wp_actions[$tag]) )
    $wp_actions[$tag] = 1;
else
    ++$wp_actions[$tag];

// Do 'all' actions first
if ( isset($wp_filter['all']) ) {
    $wp_current_filter[] = $tag;
    $all_args = func_get_args();
    _wp_call_all_hook($all_args);
}

if ( !isset($wp_filter[$tag]) ) {
    if ( isset($wp_filter['all']) )
        array_pop($wp_current_filter);
    return;
}

if ( !isset($wp_filter['all']) )
    $wp_current_filter[] = $tag;

$args = array();
if ( is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0]) ) // array(&$this)
    $args[] =& $arg[0];
else
    $args[] = $arg;
for ( $a = 2, $num = func_num_aons with the same priority are executed in the order in which they were added to the action 
* @param int      $accepted_args   Optional. The number of arguments the function accepts. Default 1.
 * @return boolean true
 */

function add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
global $wp_filter, $merged_filters;
$idx = _wp_filter_build_unique_id($tag, $function_to_add, $priority);
$wp_filter[$tag][$priority][$idx] = array('function' => $function_to_add, 'accepted_args' => $accepted_args);
unset( $merged_filters[ $tag ] );
return true;
}

This is the line in the code that gives me error:

for ( $a = 2, $num = func_num_aons with....

Now it gives the error that : "Parse error: syntax error, unexpected T_STRING, expecting ';' "

P.S ( i know there is a missing curly bracket in this function but believe me i never wrote this code and last night it was working fine and also i don't understand this * thing in this for loop...)

I have tried a lot to modify this code but nothings works... I,ve tried putting up semi-colons,commas,commenting but nothing works... Please help...



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire