name() публичный Метод

Returns the table name.
С версии: 3.0.0
public name ( ) : string
Результат string The table name.
Пример #1
0
 /**
  * Imports all active languages from the according network option into the languages table.
  *
  * @return void
  */
 private function import_active_languages()
 {
     $languages = (array) get_network_option(null, 'inpsyde_multilingual', []);
     if (!$languages) {
         return;
     }
     $table = $this->languages_table->name();
     $query = "SELECT ID FROM {$table} WHERE wp_locale = %s OR iso_639_1 = %s";
     array_walk($languages, function (array $language) use($table, $query) {
         $language_id = $this->db->get_var($this->db->prepare($query, $language['lang'], $language['lang']));
         if ($language_id) {
             $this->db->update($table, ['priority' => 10], ['ID' => $language_id]);
             return;
         }
         if (!isset($language['lang'])) {
             $language['lang'] = '';
         }
         if (!isset($language['text'])) {
             $language['text'] = '';
         }
         $this->db->insert($table, ['english_name' => '' === $language['text'] ? $language['lang'] : $language['text'], 'wp_locale' => $language['lang'], 'http_name' => str_replace('_', '-', $language['lang'])]);
     });
 }
 /**
  * Constructor. Sets up the properties.
  *
  * @since 3.0.0
  *
  * @param Table         $table          Content relations table object.
  * @param SiteRelations $site_relations Site relations API object.
  */
 public function __construct(Table $table, SiteRelations $site_relations)
 {
     $this->table = $table->name();
     $this->site_relations = $site_relations;
     $this->db = $GLOBALS['wpdb'];
 }
 /**
  * Constructor. Sets up the properties.
  *
  * @since 3.0.0
  *
  * @param Table $table Site relations table object.
  */
 public function __construct(Table $table)
 {
     $this->table = $table->name();
     $this->db = $GLOBALS['wpdb'];
 }
Пример #4
0
 /**
  * Constructor. Sets up the properties.
  *
  * @since 3.0.0
  *
  * @param Table $table Site relations table object.
  */
 public function __construct(Table $table)
 {
     $this->table = $table->name();
     $this->db = $GLOBALS['wpdb'];
     $this->fields = $this->extract_field_specifications_from_table($table);
 }
 /**
  * Inserts the according default content into the given table.
  *
  * @param Table $table Table object.
  *
  * @return void
  */
 private function insert_default_content(Table $table)
 {
     $table_name = $table->name();
     // Bail if the table is not empty.
     if ($this->db->query("SELECT 1 FROM {$table_name} LIMIT 1")) {
         return;
     }
     $default_content = $table->default_content_sql();
     if (empty($default_content)) {
         return;
     }
     $columns = array_keys($table->schema());
     $columns = array_diff($columns, $table->columns_without_default_content());
     $columns = implode(',', $columns);
     $this->db->query("INSERT INTO {$table_name} ({$columns}) VALUES {$default_content}");
 }