/**
  * @param bool $is_admin code to be executed on an admin (dashboard) page
  * @return array|null|object
  */
 public function getCodeItemsToExecute($is_admin)
 {
     global $wpdb;
     $this->plugin->ensureDatabaseTableInstalled();
     // ensure created in multisite
     $table = $this->plugin->getTableName();
     $sql = "select * from {$table} where enabled = 1";
     if ($is_admin) {
         $sql .= " and inadmin = 1";
     }
     $sql .= " order by id";
     return $wpdb->get_results($sql, ARRAY_A);
 }
 public function updateItem($item)
 {
     $this->ensureAllIndexesSet($item);
     $this->conformInputValues($item);
     global $wpdb;
     $this->plugin->ensureDatabaseTableInstalled();
     // ensure created in multisite
     $table = $this->plugin->getTableName();
     $sql = $wpdb->prepare("update {$table} set name = %s, description = %s, capability = %s, enabled = %d, shortcode = %d, buffer = %d, inadmin = %d, code = %s where id = %d", $item['name'], $item['description'], $item['capability'], $item['enabled'], $item['shortcode'], $item['buffer'], $item['inadmin'], $item['code'], $item['id']);
     $wpdb->query($sql);
     return $item['id'];
 }