function delete_taxonomy_terms($tax) { global $wpdb; $sql = sprintf("delete %s from %sterm_taxonomy tt left join %sterm_relationships tr on tt.term_taxonomy_id = tr.term_taxonomy_id where tt.taxonomy = '%s'", gdFunctionsGDTT::mysql_pre_4_1() ? sprintf("%sterm_taxonomy, %sterm_relationships", $wpdb->prefix, $wpdb->prefix) : "tt, tr", $table_prefix, $table_prefix, $tax); $wpdb->query($sql); }
/** * Scans folder and adds all folders to array. * * @param string $path folder path * @return array founded folders in array */ function get_folders($path) { $folders = gdFunctionsGDTT::scan_dir($path); $import = array(); foreach ($folders as $folder) { if (substr($folder, 0, 1) != ".") { if (is_dir($path . $folder . "/")) { $import[] = $folder; } } } return $import; }
function plugin_check_version($file, $plugin_data) { static $this_plugin; if (!$this_plugin) { $this_plugin = plugin_basename(__FILE__); } if ($file == $this_plugin) { $current = get_transient('update_plugins'); if (!isset($current->response[$file])) { return false; } $url = gdFunctionsGDTT::get_update_url($this->o, get_option('home')); $update = wp_remote_fopen($url); if ($update != "") { echo '<td colspan="3" class="gdr-plugin-update"><div class="gdr-plugin-update-message">'; echo $update; echo '</div></td>'; } } }
function install_plugin() { global $wp_version; $this->wp_version = substr(str_replace('.', '', $wp_version), 0, 2); define('GDTAXTOOLS_WPV', intval($this->wp_version)); $new_install = false; $role = get_role('administrator'); $role->add_cap('gdcpttools_basic'); $this->o = get_option('gd-taxonomy-tools'); $this->t = get_option('gd-taxonomy-tools-tax'); $this->p = get_option('gd-taxonomy-tools-cpt'); if (!is_array($this->t)) { $new_install = true; $this->t = array(); update_option('gd-taxonomy-tools-tax', $this->t); } if (!is_array($this->p)) { $new_install = true; $this->p = array(); update_option('gd-taxonomy-tools-cpt', $this->p); } if (!is_array($this->o)) { $this->o = $this->default_options; update_option('gd-taxonomy-tools', $this->o); } else { if ($this->o['build'] != $this->default_options['build'] || $this->o['edition'] != $this->default_options['edition']) { $this->o = gdFunctionsGDTT::upgrade_settings($this->o, $this->default_options); $this->o['version'] = $this->default_options['version']; $this->o['date'] = $this->default_options['date']; $this->o['status'] = $this->default_options['status']; $this->o['build'] = $this->default_options['build']; $this->o['edition'] = $this->default_options['edition']; update_option('gd-taxonomy-tools', $this->o); $this->reindex_and_save(); } } if ($this->o['upgrade_notice_132'] == 1 && $new_install) { $this->o['upgrade_notice_132'] = 0; update_option('gd-taxonomy-tools', $this->o); } $this->taxes = array(); $this->posts = array(); foreach ($this->t as $tx) { $this->taxes[] = $tx['name']; } foreach ($this->p as $pt) { $this->posts[] = $pt['name']; } $this->script = $_SERVER['PHP_SELF']; $this->script = end(explode('/', $this->script)); }