| @@ -390,9 +390,8 @@ | ||
| 390 | 390 | $scopes = [ |
| 391 | 391 | "global" => "persistent", |
| 392 | 392 | "front-end" => "frontend", |
| 393 | 393 | "admin" => "backend", |
| 394 | - "content" => "content_php", | |
| 395 | 394 | ]; |
| 396 | 395 | |
| 397 | 396 | if ( array_key_exists( $params['scope'], $scopes ) ) { |
| 398 | 397 | $params['scope'] = $scopes[$params['scope']]; |
| @@ -586,12 +585,9 @@ | ||
| 586 | 585 | $stats[$scope] = $this->wpdb->get_var( $this->wpdb->prepare( "SELECT COUNT( * ) FROM $this->table_name WHERE scope = %s", $scope ) ); |
| 587 | 586 | } |
| 588 | 587 | $stats['all'] += $stats[$scope]; |
| 589 | 588 | } |
| 590 | - | |
| 591 | - // Combined count for the "Content" filter (PHP + JS). Not added to 'all', already counted above. | |
| 592 | - $stats['content'] = (int) $stats['content_php'] + (int) $stats['content_js']; | |
| 593 | - | |
| 589 | + | |
| 594 | 590 | return $stats; |
| 595 | 591 | } |
| 596 | 592 | |
| 597 | 593 | public function import( ) |
| @@ -627,21 +623,8 @@ | ||
| 627 | 623 | |
| 628 | 624 | return $code; |
| 629 | 625 | } |
| 630 | 626 | |
| 631 | - public function delete_duplicates() { | |
| 632 | - // Delete snippets that have the same code and scope, keeping only the most recent one ( based on the updated column ) | |
| 633 | - $query = "DELETE t1 FROM $this->table_name t1 | |
| 634 | - INNER JOIN $this->table_name t2 | |
| 635 | - WHERE t1.id < t2.id | |
| 636 | - AND t1.code = t2.code | |
| 637 | - AND t1.scope = t2.scope"; | |
| 638 | - | |
| 639 | - $this->wpdb->query( $query ); | |
| 640 | - | |
| 641 | - return $this->wpdb->rows_affected; | |
| 642 | - } | |
| 643 | - | |
| 644 | 627 | #endregion |
| 645 | 628 | |
| 646 | 629 | #region Snippet CRUD |
| 647 | 630 | |
| @@ -671,11 +654,8 @@ | ||
| 671 | 654 | $freshFilters[] = [ 'accessor' => 'tags', 'value' => $filter['value'] ]; |
| 672 | 655 | } |
| 673 | 656 | else if ( $filter['accessor'] === 'scope' && $filter['value'] === 'global' ) { |
| 674 | 657 | $freshFilters[] = [ 'accessor' => 'scope', 'value' => ['backend', 'frontend', 'persistent'] ]; |
| 675 | - } | |
| 676 | - else if ( $filter['accessor'] === 'scope' && $filter['value'] === 'content' ) { | |
| 677 | - $freshFilters[] = [ 'accessor' => 'scope', 'value' => ['content_php', 'content_js'] ]; | |
| 678 | 658 | } |
| 679 | 659 | else { |
| 680 | 660 | $freshFilters[] = $filter; |
| 681 | 661 | } |