예제 #1
0
 function parse_js($mode = "normal")
 {
     maxUtils::addTime("Button :: parse JS");
     $js = $this->button_js;
     $js = apply_filters('mb-js-blocks', $js, $mode);
     $this->button_js = $js;
 }
 function outputInline($domObj, $pseudo = 'normal')
 {
     $domObj = $domObj->load($domObj->save());
     $inline = $this->inline;
     // ISSUE #43 Sometimes this breaks
     if (!isset($inline[$pseudo])) {
         return $domObj;
     }
     $elements = array_keys($inline[$pseudo]);
     if ($pseudo != 'normal') {
         // gather all elements
         $elements = array_merge($elements, array_keys($inline["normal"]));
     }
     foreach ($elements as $element) {
         $styles = isset($inline[$pseudo][$element]) ? $inline[$pseudo][$element] : '';
         if ($pseudo != 'normal') {
             // parse all possible missing styles from pseudo el.
             $normstyle = $this->compile($inline['normal'][$element]);
         }
         $normstyle = '';
         if ($pseudo != 'normal') {
             // parse all possible missing styles from pseudo el.
             $normstyle = $this->compile($inline['normal'][$element]);
         }
         maxUtils::addTime("CSSParser: Parse inline done");
         $styles = $normstyle . $this->compile($styles);
         $element = trim(str_replace(".", " ", $element));
         // molten css class, seperator.
         $el = $domObj->find('[class*="' . $element . '"]', 0);
         if (is_null($el)) {
             echo "NULL";
         }
         $el->style = $styles;
     }
     return $domObj;
 }
 public function check_database($blocks)
 {
     maxUtils::addTime("Check database");
     $sql = "SELECT id,name,status,cache";
     foreach ($blocks as $block => $class) {
         $sql .= ", {$block}";
     }
     $sql .= " from " . maxUtils::get_buttons_table_name() . " limit 1";
     global $wpdb;
     $wpdb->hide_errors();
     $result = $wpdb->get_results($sql);
     // check this query for errors. If there is an error, one or more database fields are missing. Fix that.
     if (isset($wpdb->last_error) && $wpdb->last_error != '') {
         $install = $this->getClass("install");
         $install::create_database_table();
         $install::migrate();
     }
     maxUtils::addTime("End check database");
 }