4 * @link http://dompdf.github.com/
5 * @author Benj Carson <benjcarson@digitaljunkies.ca>
6 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
11 * Executes inline PHP code during the rendering process
24 * PhpEvaluator constructor.
25 * @param Canvas $canvas
27 public function __construct(Canvas
$canvas)
29 $this->_canvas
= $canvas;
36 public function evaluate($code, $vars = array())
38 if (!$this->_canvas
->get_dompdf()->getOptions()->getIsPhpEnabled()) {
42 // Set up some variables for the inline code
43 $pdf = $this->_canvas
;
44 $fontMetrics = $pdf->get_dompdf()->getFontMetrics();
45 $PAGE_NUM = $pdf->get_page_number();
46 $PAGE_COUNT = $pdf->get_page_count();
48 // Override those variables if passed in
49 foreach ($vars as $k => $v) {
59 public function render(Frame
$frame)
61 $this->evaluate($frame->get_node()->nodeValue
);