You are here

function bueditor_processed_buttons in BUEditor 6.2

Same name and namespace in other branches
  1. 6 bueditor.module \bueditor_processed_buttons()
  2. 7 bueditor.inc \bueditor_processed_buttons()

Processed buttons. Evaluate php code for php buttons and translate titles prefixed with t:.

1 call to bueditor_processed_buttons()
_bueditor_settle in ./bueditor.inc
Include necessary js and css files for editor settlement.

File

./bueditor.inc, line 55
Implements commonly used functions for bueditor.

Code

function bueditor_processed_buttons($eid) {
  $buttons = array();
  foreach (bueditor_buttons($eid) as $bid => $button) {
    if (($content = $button->content) && substr($content, 0, 4) == 'php:') {
      if (!($content = drupal_eval('<?php ' . substr($content, 4) . ' ?>'))) {

        //php returned false or nothing. include empty button in order not to break sprite index.
        if (substr($button->title, 0, 4) != 'tpl:' && preg_match('/\\.(png|gif|jpg)$/', $button->icon)) {
          $buttons[] = array();
        }
        continue;
      }
    }
    $title = substr($button->title, 0, 2) == 't:' ? call_user_func('t', trim(substr($button->title, 2))) : $button->title;
    $buttons[] = array(
      $title,
      $content,
      $button->icon,
      $button->accesskey,
    );
  }
  return $buttons;
}