# quadmenu/1.9.0/includes/3rd/polylang.php

QuadMenu – Mega Menu, version 1.9.0. 54 lines.

- Page: https://pluginprobe.com/plugins/quadmenu/1.9.0/code/includes/3rd/polylang.php
- Raw: https://pluginprobe.com/plugins/quadmenu/1.9.0/raw/includes/3rd/polylang.php
- Modified: 2018-11-10T15:50:44+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/quadmenu/1.9.0/code/includes/3rd/polylang.php#L10-L20`.

```php
<?php

if (!defined('ABSPATH')) {
  die('-1');
}

if (defined('POLYLANG_BASENAME')) {

  class QuadMenu_Polylang {

    public function __construct() {
      add_action('init', array($this, 'locations'), -11);
      add_action('init', array($this, 'active'), -9);
    }

    function locations() {

      global $quadmenu, $quadmenu_locations, $quadmenu_active_locations;

      if (function_exists('pll_languages_list')) {
        foreach (pll_languages_list() as $lang) {

          foreach ($quadmenu_locations as $id => $location) {

            if (strpos($id, "___{$lang}") !== false) {
              unset($quadmenu_locations[$id]);
            }
          }
        }
      }
    }

    function active() {

      global $quadmenu, $quadmenu_locations, $quadmenu_active_locations;

      if (function_exists('pll_languages_list')) {

        foreach ($quadmenu_active_locations as $id => $theme) {

          foreach (pll_languages_list() as $lang) {

            if (strpos($id, "___{$lang}") === false) {
              $quadmenu_active_locations["{$id}___{$lang}"] = $quadmenu_active_locations[$id];
            }
          }
        }
      }
    }

  }

  new QuadMenu_Polylang();
}
```
