You are here

private function InstapageCmsPluginWPConnector::isProhibitedTermSlug in Instapage plugin 8.3

Same name and namespace in other branches
  1. 7.3 core/connectors/InstapageCmsPluginWPConnector.php \InstapageCmsPluginWPConnector::isProhibitedTermSlug()

Checks if given slug is prohibited in terms of publishing a landing page. If it's free - will return false. Otherwise an array with slug details will be returned

@uses self::getSiteURL() @uses self::getDBPrefix() @uses self::getResults()

Parameters

string $slug Slug to be checked:

Return value

bool|array

1 call to InstapageCmsPluginWPConnector::isProhibitedTermSlug()
InstapageCmsPluginWPConnector::isProhibitedSlug in core/connectors/InstapageCmsPluginWPConnector.php
Checks if given slug is prohibited in terms of publishing a landing page. If it's free - will return false. Otherwise an array with slug details will be returned

File

core/connectors/InstapageCmsPluginWPConnector.php, line 1030

Class

InstapageCmsPluginWPConnector
Class that utilizes native WordPress functions to perform actions like remote requests and DB operations.

Code

private function isProhibitedTermSlug($slug) {
  $editUrl1 = $this
    ->getSiteURL() . '/wp-admin/edit-tags.php?action=edit&post_type=post&taxonomy=';
  $editUrl2 = '&tag_ID=';
  $dbPrefix = $this
    ->getDBPrefix();
  $sql = 'SELECT t.term_id AS id, t.slug AS slug, CONCAT(\'' . $editUrl1 . '\', tt.taxonomy, \'' . $editUrl2 . '\', t.term_id) AS editUrl ' . 'FROM ' . $dbPrefix . 'terms t LEFT JOIN ' . $dbPrefix . 'term_taxonomy tt ON t.term_id = tt.term_id ' . 'WHERE (tt.taxonomy = \'category\' OR tt.taxonomy = \'post_tag\')' . 'AND t.slug = \'%s\' LIMIT 1';
  $results = $this
    ->getResults($sql, $slug);
  return $results;
}