public function check_database($blocks)
 {
     maxButtonsUtils::addTime("Check database");
     $sql = "SELECT id,name,status,cache";
     foreach ($blocks as $block => $class) {
         $sql .= ", {$block}";
     }
     $sql .= " from " . maxButtonsUtils::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 != '') {
         //echo $wpdb->last_error;  echo "ERREUR!";
         $install = $this->getClass("install");
         $install::create_database_table();
         $install::migrate();
     }
     maxButtonsUtils::addTime("End check database");
 }
Exemple #2
0
 function parse_button($mode = 'normal')
 {
     maxButtonsUtils::addTime("Button :: parse button");
     $domObj = new simple_html_dom();
     $domObj->load("<a  class=\"maxbutton-" . $this->id . " maxbutton\"></a>");
     $domObj = apply_filters('mb-parse-button', $domObj, $mode);
     $domObj->load($domObj->save());
     $cssParser = $this->getCSSParser();
     $cssParser->loadDom($domObj);
     maxButtonsUtils::addTime("Button parsed, returning dom");
     return $domObj;
 }
Exemple #3
0
 function outputInline($domObj, $pseudo = 'normal')
 {
     $domObj = $domObj->load($domObj->save());
     $inline = $this->inline;
     // ISSUE #43 Sometimes this breaks
     if (!isset($inline[$pseudo])) {
         return $domObj;
     }
     foreach ($inline[$pseudo] as $element => $styles) {
         //$element = $element[$pseudo];
         $normstyle = '';
         if ($pseudo != 'normal') {
             // parse all possible missing styles from pseudo el.
             $normstyle = $this->compile($inline['normal'][$element]);
         }
         maxButtonsUtils::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;
 }