PluginProbe
QuadMenu – Mega Menu / 3.3.3
QuadMenu – Mega Menu v3.3.3
3.3.7 3.3.6 trunk 1.8.4 1.8.5 1.8.7 1.8.8 1.8.9 1.9.0 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 All 87 releases
quadmenu / lib / integrations / class-polylang.php

class-polylang.php in QuadMenu – Mega Menu 3.3.3, at lib/integrations/class-polylang.php

66 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace QuadLayers\QuadMenu\Integrations;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 die( '-1' );
7 }
8
9 /**
10 * Polylang ex QuadMenu_Polylang Class
11 */
12 class Polylang {
13
14 private static $instance;
15
16 public function __construct() {
17 if ( ! defined( 'POLYLANG_BASENAME' ) ) {
18 return;
19 }
20 add_action( 'init', array( $this, 'locations' ), -11 );
21 add_action( 'init', array( $this, 'active' ), -9 );
22 }
23
24 function locations() {
25
26 global $quadmenu, $quadmenu_locations, $quadmenu_active_locations;
27
28 if ( function_exists( 'pll_languages_list' ) ) {
29 foreach ( pll_languages_list() as $lang ) {
30
31 foreach ( $quadmenu_locations as $id => $location ) {
32
33 if ( strpos( $id, "___{$lang}" ) !== false ) {
34 unset( $quadmenu_locations[ $id ] );
35 }
36 }
37 }
38 }
39 }
40
41 function active() {
42
43 global $quadmenu, $quadmenu_locations, $quadmenu_active_locations;
44
45 if ( function_exists( 'pll_languages_list' ) ) {
46
47 foreach ( $quadmenu_active_locations as $id => $theme ) {
48
49 foreach ( pll_languages_list() as $lang ) {
50
51 if ( strpos( $id, "___{$lang}" ) === false ) {
52 $quadmenu_active_locations[ "{$id}___{$lang}" ] = $quadmenu_active_locations[ $id ];
53 }
54 }
55 }
56 }
57 }
58
59 public static function instance() {
60 if ( ! isset( self::$instance ) ) {
61 self::$instance = new self();
62 }
63 return self::$instance;
64 }
65 }
66