--- C:/Users/Peter/AppData/Local/Temp/svn-D1B164	Thu Jul 23 21:28:12 2015
+++ E:/www/Squared/sap/sites/all/modules/views_php/plugins/views/views_php_handler_field.inc	Thu Jul 23 21:26:09 2015
@@ -195,25 +195,18 @@ class views_php_handler_field extends views_handle
   }
 
   /**
-   * Implements views_handler_field#pre_render().
-   */
-  function pre_render(&$values) {
-    if (!empty($this->options['php_output'])) {
-      $this->php_output_lamda_function = create_function('$view, $handler, &$static, $row, $data, $value', ' ?>' . $this->options['php_output'] . '<?php ');
-    }
-  }
-
-  /**
    * Implements views_handler_field#render().
    */
   function render($values) {
-    // Ecexute output PHP code.
-    if (!empty($this->options['php_output']) && isset($this->php_output_lamda_function)) {
+    // Execute output PHP code.
+    if (!empty($this->options['php_output'])) {
+      $php_output = $this->tokenize_value($this->options['php_output']);
+      $this->php_output_lamda_function = create_function('$view, $handler, &$static, $row, $data, $value', ' ?>' . $php_output . '<?php ');
       $normalized_row = new stdClass;
       foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) {
         $normalized_row->$field = isset($values->{$handler->field_alias}) ? $values->{$handler->field_alias} : NULL;
       }
-
+      
       $function = $this->php_output_lamda_function;
       ob_start();
       $function($this->view, $this, $this->php_static_variable, $normalized_row, $values, isset($values->{$this->field_alias}) ? $values->{$this->field_alias} : NULL);
@@ -224,4 +217,19 @@ class views_php_handler_field extends views_handle
     }
     return $value;
   }
+  
+  function tokenize_value($value) {
+    if (strpos($value, '[') !== FALSE || strpos($value, '!') !== FALSE || strpos($value, '%') !== FALSE) {
+      // Row tokens might be empty, for example for node row style.
+      $tokens = array();
+      if (!empty($this->view->style_plugin->render_tokens)) {
+        $tokens = $this->view->style_plugin->render_tokens[$this->view->row_index];
+      }
+
+      if ($tokens) {
+        $value = strtr($value, $tokens);
+      }
+    }
+    return $value;
+  }
 }
