Restrict Widgets - Version 1.3.0

Version Description

  • New: Customizer support
  • New: Dedicated options page
  • Tweak: Switched from Chosen.js to Select2 script
  • Tweak: General code cleanup
Download this release

Release Info

Developer dfactory
Plugin Icon 128x128 Restrict Widgets
Version 1.3.0
Comparing to
See all releases

Code changes from version 1.2.9 to 1.3.0

assets/i18n/ar.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ar",[],function(){return{errorLoading:function(){return"لا يمكن تحميل النتائج"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="الرجاء حذف "+t+" عناصر";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="الرجاء إضافة "+t+" عناصر";return n},loadingMore:function(){return"جاري تحميل نتائج إضافية..."},maximumSelected:function(e){var t="تستطيع إختيار "+e.maximum+" بنود فقط";return t},noResults:function(){return"لم يتم العثور على أي نتائج"},searching:function(){return"جاري البحث…"}}}),{define:e.define,require:e.require}})();
assets/i18n/az.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/az",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return t+" simvol silin"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(e){return"Sadəcə "+e.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"}}}),{define:e.define,require:e.require}})();
assets/i18n/bg.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bg",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Моля въведете с "+t+" по-малко символ";return t>1&&(n+="a"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Моля въведете още "+t+" символ";return t>1&&(n+="a"),n},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(e){var t="Можете да направите до "+e.maximum+" ";return e.maximum>1?t+="избора":t+="избор",t},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"}}}),{define:e.define,require:e.require}})();
assets/i18n/ca.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Si us plau, elimina "+t+" car";return t==1?n+="àcter":n+="àcters",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Si us plau, introdueix "+t+" car";return t==1?n+="àcter":n+="àcters",n},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var t="Només es pot seleccionar "+e.maximum+" element";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"}}}),{define:e.define,require:e.require}})();
assets/i18n/cs.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/cs",[],function(){function e(e,t){switch(e){case 2:return t?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím zadejte o jeden znak méně":n<=4?"Prosím zadejte o "+e(n,!0)+" znaky méně":"Prosím zadejte o "+n+" znaků méně"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím zadejte ještě jeden znak":n<=4?"Prosím zadejte ještě další "+e(n,!0)+" znaky":"Prosím zadejte ještě dalších "+n+" znaků"},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(t){var n=t.maximum;return n==1?"Můžete zvolit jen jednu položku":n<=4?"Můžete zvolit maximálně "+e(n,!1)+" položky":"Můžete zvolit maximálně "+n+" položek"},noResults:function(){return"Nenalezeny žádné položky"},searching:function(){return"Vyhledávání…"}}}),{define:e.define,require:e.require}})();
assets/i18n/da.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Angiv venligst "+t+" tegn mindre";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Angiv venligst "+t+" tegn mere";return n},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var t="Du kan kun vælge "+e.maximum+" emne";return e.maximum!=1&&(t+="r"),t},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"}}}),{define:e.define,require:e.require}})();
assets/i18n/de.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/de",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Bitte "+t+" Zeichen weniger eingeben"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Bitte "+t+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var t="Sie können nur "+e.maximum+" Eintr";return e.maximum===1?t+="ag":t+="äge",t+=" auswählen",t},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"}}}),{define:e.define,require:e.require}})();
assets/i18n/en.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Please enter "+t+" or more characters";return n},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),{define:e.define,require:e.require}})();
assets/i18n/es.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"La carga falló"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor, elimine "+t+" car";return t==1?n+="ácter":n+="acteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Por favor, introduzca "+t+" car";return t==1?n+="ácter":n+="acteres",n},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
assets/i18n/et.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" vähem",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" rohkem",n},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var t="Saad vaid "+e.maximum+" tulemus";return e.maximum==1?t+="e":t+="t",t+=" valida",t},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"}}}),{define:e.define,require:e.require}})();
assets/i18n/eu.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gutxiago",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gehiago",n},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return e.maximum===1?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"}}}),{define:e.define,require:e.require}})();
assets/i18n/fa.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="لطفاً "+t+" کاراکتر را حذف نمایید";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لطفاً تعداد "+t+" کاراکتر یا بیشتر وارد نمایید";return n},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(e){var t="شما تنها می‌توانید "+e.maximum+" آیتم را انتخاب نمایید";return t},noResults:function(){return"هیچ نتیجه‌ای یافت نشد"},searching:function(){return"در حال جستجو..."}}}),{define:e.define,require:e.require}})();
assets/i18n/fi.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Ole hyvä ja anna "+t+" merkkiä vähemmän"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Ole hyvä ja anna "+t+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(e){return"Voit valita ainoastaan "+e.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){}}}),{define:e.define,require:e.require}})();
assets/i18n/fr.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fr",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Supprimez "+t+" caractère";return t!==1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Saisissez "+t+" caractère";return t!==1&&(n+="s"),n},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){var t="Vous pouvez seulement sélectionner "+e.maximum+" élément";return e.maximum!==1&&(t+="s"),t},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"}}}),{define:e.define,require:e.require}})();
assets/i18n/gl.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/gl",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Elimine ";return t===1?n+="un carácter":n+=t+" caracteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Engada ";return t===1?n+="un carácter":n+=t+" caracteres",n},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){var t="Só pode ";return e.maximum===1?t+="un elemento":t+=e.maximum+" elementos",t},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
assets/i18n/he.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="נא למחוק ";return t===1?n+="תו אחד":n+=t+" תווים",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="נא להכניס ";return t===1?n+="תו אחד":n+=t+" תווים",n+=" או יותר",n},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(e){var t="באפשרותך לבחור עד ";return e.maximum===1?t+="פריט אחד":t+=e.maximum+" פריטים",t},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"}}}),{define:e.define,require:e.require}})();
assets/i18n/hi.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" अक्षर को हटा दें";return t>1&&(n=t+" अक्षरों को हटा दें "),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="कृपया "+t+" या अधिक अक्षर दर्ज करें";return n},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(e){var t="आप केवल "+e.maximum+" आइटम का चयन कर सकते हैं";return t},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."}}}),{define:e.define,require:e.require}})();
assets/i18n/hr.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hr",[],function(){function e(e){var t=" "+e+" znak";return e%10<5&&e%10>0&&(e%100<5||e%100>19)?e%10>1&&(t+="a"):t+="ova",t}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Unesite "+e(n)},inputTooShort:function(t){var n=t.minimum-t.input.length;return"Unesite još "+e(n)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(e){return"Maksimalan broj odabranih stavki je "+e.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})();
assets/i18n/hu.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Túl hosszú. "+t+" karakterrel több, mint kellene."},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Túl rövid. Még "+t+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"}}}),{define:e.define,require:e.require}})();
assets/i18n/id.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Hapuskan "+t+" huruf"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Masukkan "+t+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(e){return"Anda hanya dapat memilih "+e.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})();
assets/i18n/is.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/is",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vinsamlegast styttið texta um "+t+" staf";return t<=1?n:n+"i"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vinsamlegast skrifið "+t+" staf";return t>1&&(n+="i"),n+=" í viðbót",n},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(e){return"Þú getur aðeins valið "+e.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"}}}),{define:e.define,require:e.require}})();
assets/i18n/it.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Per favore cancella "+t+" caratter";return t!==1?n+="i":n+="e",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Per favore inserisci "+t+" o più caratteri";return n},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var t="Puoi selezionare solo "+e.maximum+" element";return e.maximum!==1?t+="i":t+="o",t},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"}}}),{define:e.define,require:e.require}})();
assets/i18n/ja.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" 文字を削除してください";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="少なくとも "+t+" 文字を入力してください";return n},loadingMore:function(){return"読み込み中…"},maximumSelected:function(e){var t=e.maximum+" 件しか選択できません";return t},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"}}}),{define:e.define,require:e.require}})();
assets/i18n/ko.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="너무 깁니다. "+t+" 글자 지워주세요.";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="너무 짧습니다. "+t+" 글자 더 입력해주세요.";return n},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(e){var t="최대 "+e.maximum+"개까지만 선택 가능합니다.";return t},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"}}}),{define:e.define,require:e.require}})();
assets/i18n/lt.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lt",[],function(){function e(e,t,n,r){return e%100>9&&e%100<21||e%10===0?e%10>1?n:r:t}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Pašalinkite "+n+" simbol";return r+=e(n,"ių","ius","į"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Įrašykite dar "+n+" simbol";return r+=e(n,"ių","ius","į"),r},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(t){var n="Jūs galite pasirinkti tik "+t.maximum+" element";return n+=e(t.maximum,"ų","us","ą"),n},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"}}}),{define:e.define,require:e.require}})();
assets/i18n/lv.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lv",[],function(){function e(e,t,n,r){return e===11?t:e%10===1?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Lūdzu ievadiet par "+n;return r+=" simbol"+e(n,"iem","u","iem"),r+" mazāk"},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Lūdzu ievadiet vēl "+n;return r+=" simbol"+e(n,"us","u","us"),r},loadingMore:function(){return"Datu ielāde…"},maximumSelected:function(t){var n="Jūs varat izvēlēties ne vairāk kā "+t.maximum;return n+=" element"+e(t.maximum,"us","u","us"),n},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"}}}),{define:e.define,require:e.require}})();
assets/i18n/mk.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/mk",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Ве молиме внесете "+e.maximum+" помалку карактер";return e.maximum!==1&&(n+="и"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Ве молиме внесете уште "+e.maximum+" карактер";return e.maximum!==1&&(n+="и"),n},loadingMore:function(){return"Вчитување резултати…"},maximumSelected:function(e){var t="Можете да изберете само "+e.maximum+" ставк";return e.maximum===1?t+="а":t+="и",t},noResults:function(){return"Нема пронајдено совпаѓања"},searching:function(){return"Пребарување…"}}}),{define:e.define,require:e.require}})();
assets/i18n/ms.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ms",[],function(){return{errorLoading:function(){return"Keputusan tidak berjaya dimuatkan."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Sila hapuskan "+t+" aksara"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Sila masukkan "+t+" atau lebih aksara"},loadingMore:function(){return"Sedang memuatkan keputusan…"},maximumSelected:function(e){return"Anda hanya boleh memilih "+e.maximum+" pilihan"},noResults:function(){return"Tiada padanan yang ditemui"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})();
assets/i18n/nb.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nb",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Vennligst fjern "+t+" tegn"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vennligst skriv inn ";return t>1?n+=" flere tegn":n+=" tegn til",n},loadingMore:function(){return"Laster flere resultater…"},maximumSelected:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"}}}),{define:e.define,require:e.require}})();
assets/i18n/nl.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Gelieve "+t+" karakters te verwijderen";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Gelieve "+t+" of meer karakters in te voeren";return n},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var t=e.maximum==1?"kan":"kunnen",n="Er "+t+" maar "+e.maximum+" item";return e.maximum!=1&&(n+="s"),n+=" worden geselecteerd",n},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"}}}),{define:e.define,require:e.require}})();
assets/i18n/pl.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pl",[],function(){var e=["znak","znaki","znaków"],t=["element","elementy","elementów"],n=function(t,n){if(t===1)return n[0];if(t>1&&t<=4)return n[1];if(t>=5)return n[2]};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Usuń "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Podaj przynajmniej "+r+" "+n(r,e)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(e){return"Możesz zaznaczyć tylko "+e.maximum+" "+n(e.maximum,t)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"}}}),{define:e.define,require:e.require}})();
assets/i18n/pt-BR.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Apague "+t+" caracter";return t!=1&&(n+="es"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Digite "+t+" ou mais caracteres";return n},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var t="Você só pode selecionar "+e.maximum+" ite";return e.maximum==1?t+="m":t+="ns",t},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
assets/i18n/pt.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor apague "+t+" ";return n+=t!=1?"caracteres":"carácter",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Introduza "+t+" ou mais caracteres";return n},loadingMore:function(){return"A carregar mais resultados…"},maximumSelected:function(e){var t="Apenas pode seleccionar "+e.maximum+" ";return t+=e.maximum!=1?"itens":"item",t},noResults:function(){return"Sem resultados"},searching:function(){return"A procurar…"}}}),{define:e.define,require:e.require}})();
assets/i18n/ro.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ro",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vă rugăm să introduceți mai puțin de "+t;return n+=" caracter",n!==1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vă rugăm să introduceți incă "+t;return n+=" caracter",n!==1&&(n+="e"),n},loadingMore:function(){return"Se încarcă…"},maximumSelected:function(e){var t="Aveți voie să selectați cel mult "+e.maximum;return t+=" element",t!==1&&(t+="e"),t},noResults:function(){return"Nu a fost găsit nimic"},searching:function(){return"Căutare…"}}}),{define:e.define,require:e.require}})();
assets/i18n/ru.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ru",[],function(){function e(e,t,n,r){return e%10<5&&e%10>0&&e%100<5||e%100>20?e%10>1?n:t:r}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Пожалуйста, введите на "+n+" символ";return r+=e(n,"","a","ов"),r+=" меньше",r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Пожалуйста, введите еще хотя бы "+n+" символ";return r+=e(n,"","a","ов"),r},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(t){var n="Вы можете выбрать не более "+t.maximum+" элемент";return n+=e(t.maximum,"","a","ов"),n},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"}}}),{define:e.define,require:e.require}})();
assets/i18n/sk.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sk",[],function(){var e={2:function(e){return e?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadajte o jeden znak menej":n>=2&&n<=4?"Prosím, zadajte o "+e[n](!0)+" znaky menej":"Prosím, zadajte o "+n+" znakov menej"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadajte ešte jeden znak":n<=4?"Prosím, zadajte ešte ďalšie "+e[n](!0)+" znaky":"Prosím, zadajte ešte ďalších "+n+" znakov"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(t){return t.maximum==1?"Môžete zvoliť len jednu položku":t.maximum>=2&&t.maximum<=4?"Môžete zvoliť najviac "+e[t.maximum](!1)+" položky":"Môžete zvoliť najviac "+t.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"}}}),{define:e.define,require:e.require}})();
assets/i18n/sr-Cyrl.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr-Cyrl",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Преузимање није успело."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Обришите "+n+" симбол";return r+=e(n,"","а","а"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Укуцајте бар још "+n+" симбол";return r+=e(n,"","а","а"),r},loadingMore:function(){return"Преузимање још резултата…"},maximumSelected:function(t){var n="Можете изабрати само "+t.maximum+" ставк";return n+=e(t.maximum,"у","е","и"),n},noResults:function(){return"Ништа није пронађено"},searching:function(){return"Претрага…"}}}),{define:e.define,require:e.require}})();
assets/i18n/sr.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Preuzimanje nije uspelo."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Obrišite "+n+" simbol";return r+=e(n,"","a","a"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Ukucajte bar još "+n+" simbol";return r+=e(n,"","a","a"),r},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(t){var n="Možete izabrati samo "+t.maximum+" stavk";return n+=e(t.maximum,"u","e","i"),n},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})();
assets/i18n/sv.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vänligen sudda ut "+t+" tecken";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vänligen skriv in "+t+" eller fler tecken";return n},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(e){var t="Du kan max välja "+e.maximum+" element";return t},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"}}}),{define:e.define,require:e.require}})();
assets/i18n/th.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/th",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="โปรดลบออก "+t+" ตัวอักษร";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="โปรดพิมพ์เพิ่มอีก "+t+" ตัวอักษร";return n},loadingMore:function(){return"กำลังค้นข้อมูลเพิ่ม…"},maximumSelected:function(e){var t="คุณสามารถเลือกได้ไม่เกิน "+e.maximum+" รายการ";return t},noResults:function(){return"ไม่พบข้อมูล"},searching:function(){return"กำลังค้นข้อมูล…"}}}),{define:e.define,require:e.require}})();
assets/i18n/tr.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/tr",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" karakter daha girmelisiniz";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="En az "+t+" karakter daha girmelisiniz";return n},loadingMore:function(){return"Daha fazla…"},maximumSelected:function(e){var t="Sadece "+e.maximum+" seçim yapabilirsiniz";return t},noResults:function(){return"Sonuç bulunamadı"},searching:function(){return"Aranıyor…"}}}),{define:e.define,require:e.require}})();
assets/i18n/uk.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/uk",[],function(){function e(e,t,n,r){return e%100>10&&e%100<15?r:e%10===1?t:e%10>1&&e%10<5?n:r}return{errorLoading:function(){return"Неможливо завантажити результати"},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Будь ласка, видаліть "+n+" "+e(t.maximum,"літеру","літери","літер")},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Будь ласка, введіть "+t+" або більше літер"},loadingMore:function(){return"Завантаження інших результатів…"},maximumSelected:function(t){return"Ви можете вибрати лише "+t.maximum+" "+e(t.maximum,"пункт","пункти","пунктів")},noResults:function(){return"Нічого не знайдено"},searching:function(){return"Пошук…"}}}),{define:e.define,require:e.require}})();
assets/i18n/vi.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/vi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vui lòng nhập ít hơn "+t+" ký tự";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vui lòng nhập nhiều hơn "+t+' ký tự"';return n},loadingMore:function(){return"Đang lấy thêm kết quả…"},maximumSelected:function(e){var t="Chỉ có thể chọn được "+e.maximum+" lựa chọn";return t},noResults:function(){return"Không tìm thấy kết quả"},searching:function(){return"Đang tìm…"}}}),{define:e.define,require:e.require}})();
assets/i18n/zh-CN.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-CN",[],function(){return{errorLoading:function(){return"无法载入结果。"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="请删除"+t+"个字符";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="请再输入至少"+t+"个字符";return n},loadingMore:function(){return"载入更多结果…"},maximumSelected:function(e){var t="最多只能选择"+e.maximum+"个项目";return t},noResults:function(){return"未找到结果"},searching:function(){return"搜索中…"}}}),{define:e.define,require:e.require}})();
assets/i18n/zh-TW.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-TW",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="請刪掉"+t+"個字元";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="請再輸入"+t+"個字元";return n},loadingMore:function(){return"載入中…"},maximumSelected:function(e){var t="你只能選擇最多"+e.maximum+"項";return t},noResults:function(){return"沒有找到相符的項目"},searching:function(){return"搜尋中…"}}}),{define:e.define,require:e.require}})();
assets/select2.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
assets/select2.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice;this.listeners=this.listeners||{},a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return e!==f||"hidden"!==f&&"visible"!==f?"scroll"===e||"scroll"===f?!0:d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth:!1},c.escapeMarkup=function(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")});var f=e.filter("[aria-selected=true]");f.length>0?f.first().trigger("mouseenter"):e.first().trigger("mouseenter")})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&d.setClasses()}),b.on("unselect",function(){b.isOpen()&&d.setClasses()}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||(c.which==b.DELETE||c.which==b.BACKSPACE)&&this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">&times;</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,
2
+ c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&""!==a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return f?!1:(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var c=(this._lastTag,this.$element.find("option[data-select2-tag]"));c.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(a,b,c){function d(a){e.trigger("select",{data:a})}var e=this;b.term=b.term||"";var f=this.tokenizer(b,this.options,d);f.term!==b.term&&(this.$search.length&&(this.$search.val(f.term),this.$search.focus()),b.term=f.term),a.call(this,b,c)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return a(c.data.results)<this.minimumResultsForSearch?!1:b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(){d._handleSelectOnClose()})},a.prototype._handleSelectOnClose=function(){var a=this.getHighlightedResults();if(!(a.length<1)){var b=a.data("data");null!=b.element&&b.element.selected||null==b.element&&b.selected||this.trigger("select",{data:b})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(O){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(P){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var Q=k.loadPath(this.defaults.amdLanguageBase+"en"),R=new k(l.language);R.extend(Q),l.translations=R}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this._sync=c.bind(this._syncAttributes,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._sync);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._sync)}),this._observer.observe(this.$element[0],{attributes:!0,subtree:!1})):this.$element[0].addEventListener&&this.$element[0].addEventListener("DOMAttrModified",b._sync,!1)},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._sync),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&this.$element[0].removeEventListener("DOMAttrModified",this._sync,!1),this._sync=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d;return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2.");var e=Array.prototype.slice.call(arguments,1);d=c[b].apply(c,e)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
css/admin.css CHANGED
@@ -1,39 +1,463 @@
1
- .restrict-widgets .restrict-widgets-select, .restrict-widgets .restrict-widgets-hide {
2
- width:100%;
3
- }
4
- .widget .widget-inside p.restrict-widgets-display-label { margin-bottom:3px; }
5
- .restrict-widgets-select-div { clear:both; }
6
- .restrict-widgets-hide-div { clear:both; margin-bottom:3px; }
7
- #widgets-left #widgets-options {
8
- margin-left: 0;
9
- margin-right: 0;
10
- margin-right: 340px;
11
- width: 100%;
12
- border: 1px solid #e5e5e5;
13
- box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
14
- }
15
- #widgets-left #widgets-options .widgets-sortables {
16
- padding: 15px;
17
- }
18
-
19
- #widgets-options input[type="text"] {
20
- line-height:20px;
21
- }
22
- #widgets-options select {
23
- width: 100% !important;
24
- -webkit-box-sizing: border-box;‌​
25
- -moz-box-sizing: border-box;
26
- box-sizing: border-box;
27
- }
28
- .widget-liquid-right .widget, .inactive-sidebar .widget, .widget-liquid-right .sidebar-description {
29
- overflow: visible !important;
30
- }
31
- #widgets-options table { width:100%; }
32
- #widgets-options label { vertical-align:top; margin: 10px 0; display: inline-block; font-weight:bold; }
33
- #widgets-options label .description { font-weight: normal; }
34
- #widgets-options #save-widgets-options { margin: 20px 0 0 0; }
35
- #widgets-options form .description { font-style: italic; padding: 0; }
36
- .widgets-holder-wrap .widgets-sortables { min-height:0!important; height:auto!important; }
37
-
38
- #df-credits { float:right; font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif; font-style:italic; margin:15px 0 0; display:block; }
39
- #df-credits a { padding: 5px 0 0 7px; vertical-align:middle; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* settings page */
2
+ .restrict-widgets-settings {
3
+ margin-right: 300px;
4
+ }
5
+
6
+ .restrict-widgets-settings form {
7
+ float: left;
8
+ min-width: 463px;
9
+ width: auto;
10
+ }
11
+
12
+ .df-credits {
13
+ float: right;
14
+ width: 280px;
15
+ background: #fff;
16
+ margin: 20px -300px 20px 20px;
17
+ position: relative;
18
+ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
19
+ }
20
+
21
+ .df-credits .inner {
22
+ padding-left: 10px;
23
+ padding-right: 10px;
24
+ }
25
+
26
+ .df-credits h3 {
27
+ font-size: 14px;
28
+ line-height: 1.4;
29
+ margin: 0;
30
+ padding: 8px 12px;
31
+ border-bottom: 1px solid #eee;
32
+ }
33
+
34
+ .df-credits .df-link {
35
+ font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
36
+ font-style: italic;
37
+ padding-bottom: 10px;
38
+ margin: 0;
39
+ }
40
+
41
+ .df-credits .df-link a {
42
+ vertical-align: middle;
43
+ padding: 5px 0 0 4px;
44
+ }
45
+
46
+ .df-credits hr {
47
+ border: solid #eee;
48
+ border-width: 1px 0 0;
49
+ clear: both;
50
+ height: 0;
51
+ }
52
+
53
+ /*
54
+ * checkBo lightweight jQuery plugin v0.1.4 by @ElmahdiMahmoud
55
+ * Licensed under the MIT license - https://github.com/elmahdim/checkbo/blob/master/LICENSE
56
+ *
57
+ * Custom checkbox and radio
58
+ * Author URL: elmahdim.com
59
+ */
60
+ .cb-checkbox .cb-inner, .cb-checkbox i {
61
+ width:18px;
62
+ height:18px;
63
+ -moz-border-radius:3px;
64
+ -webkit-border-radius:3px;
65
+ border-radius:3px
66
+ }
67
+ .cb-checkbox.cb-sm i, .cb-checkbox.cb-sm .cb-inner {
68
+ width:14px;
69
+ height:14px
70
+ }
71
+ .cb-checkbox.cb-md i, .cb-checkbox.cb-md .cb-inner {
72
+ width:24px;
73
+ height:24px;
74
+ -moz-border-radius:4px;
75
+ -webkit-border-radius:4px;
76
+ border-radius:4px
77
+ }
78
+ .cb-checkbox.cb-lg i, .cb-checkbox.cb-lg .cb-inner {
79
+ width:30px;
80
+ height:30px;
81
+ -moz-border-radius:6px;
82
+ -webkit-border-radius:6px;
83
+ border-radius:6px
84
+ }
85
+ .cb-radio .cb-inner {
86
+ width:18px;
87
+ height:18px
88
+ }
89
+ .cb-radio.cb-sm .cb-inner {
90
+ width:14px;
91
+ height:14px
92
+ }
93
+ .cb-radio.cb-md .cb-inner {
94
+ width:24px;
95
+ height:24px
96
+ }
97
+ .cb-radio.cb-lg .cb-inner {
98
+ width:30px;
99
+ height:30px
100
+ }
101
+ .cb-checkbox, .cb-radio {
102
+ color:inherit;
103
+ cursor:pointer;
104
+ overflow:hidden;
105
+ font-size:inherit;
106
+ font-weight:normal;
107
+ display:inline-block;
108
+ line-height:18px;
109
+ margin-right: 8px;
110
+ }
111
+ .form-table td fieldset label.cb-checkbox,
112
+ .form-table td fieldset label.cb-radio {
113
+ margin-right: 8px !important;
114
+ }
115
+ .cb-checkbox.disabled, .cb-checkbox.disabled *, .cb-radio.disabled, .cb-radio.disabled * {
116
+ cursor:default
117
+ }
118
+ .cb-checkbox input[type="checkbox"], .cb-radio input[type="radio"], .cb-switcher input[type="checkbox"], .cb-switcher input[type="radio"] {
119
+ display:none
120
+ }
121
+ .cb-checkbox.disabled, .cb-checkbox.disabled *, .cb-radio.disabled, .cb-radio.disabled *, .cb-switcher.disabled, .cb-switcher.disabled * {
122
+ cursor:default
123
+ }
124
+ .cb-checkbox.disabled {
125
+ color:#ddd
126
+ }
127
+ .cb-checkbox.disabled .cb-inner {
128
+ color:#ddd
129
+ }
130
+ .cb-checkbox.disabled:hover .cb-inner {
131
+ border-color:#ddd
132
+ }
133
+ .cb-checkbox.disabled.checked .cb-inner {
134
+ background-color:#ddd;
135
+ border-color:#ddd
136
+ }
137
+ .cb-radio.disabled {
138
+ color:#ddd
139
+ }
140
+ .cb-radio.disabled .cb-inner {
141
+ border-color:#ddd
142
+ }
143
+ .cb-radio.disabled i {
144
+ background-color:transparent
145
+ }
146
+ .cb-radio.disabled.checked .cb-inner {
147
+ border-color:#ddd
148
+ }
149
+ .cb-radio.disabled.checked .cb-inner i {
150
+ background-color:#ddd
151
+ }
152
+ .cb-radio.disabled:hover .cb-inner {
153
+ border-color:#ddd
154
+ }
155
+ .cb-checkbox .cb-inner {
156
+ float:left;
157
+ overflow:hidden;
158
+ margin:0 5px 0 0;
159
+ position:relative;
160
+ background:#f2f2f2;
161
+ display:inline-block;
162
+ border:1px solid #d6d6d6;
163
+ -moz-transition:all 0.5s ease;
164
+ -o-transition:all 0.5s ease;
165
+ -webkit-transition:all 0.5s ease;
166
+ transition:all 0.5s ease
167
+ }
168
+ .cb-checkbox i {
169
+ top:1px;
170
+ left:2px;
171
+ display:block;
172
+ position:absolute
173
+ }
174
+ .cb-checkbox i:before, .cb-checkbox i:after {
175
+ height:0;
176
+ width:2px;
177
+ content:"";
178
+ display:block;
179
+ position:absolute;
180
+ background-color:#fff;
181
+ -moz-transition:all 0.2s ease;
182
+ -o-transition:all 0.2s ease;
183
+ -webkit-transition:all 0.2s ease;
184
+ transition:all 0.2s ease
185
+ }
186
+ .cb-checkbox i:before {
187
+ top:0;
188
+ left:0;
189
+ -moz-transform:rotate(-45deg);
190
+ -ms-transform:rotate(-45deg);
191
+ -webkit-transform:rotate(-45deg);
192
+ transform:rotate(-45deg)
193
+ }
194
+ .cb-checkbox i:after {
195
+ left:7px;
196
+ bottom:5px;
197
+ -moz-transition-delay:0.3s;
198
+ -o-transition-delay:0.3s;
199
+ -webkit-transition-delay:0.3s;
200
+ transition-delay:0.3s;
201
+ -moz-transform:rotate(30deg);
202
+ -ms-transform:rotate(30deg);
203
+ -webkit-transform:rotate(30deg);
204
+ transform:rotate(30deg)
205
+ }
206
+ .cb-radio .cb-inner {
207
+ float:left;
208
+ overflow:hidden;
209
+ margin:0 5px 0 0;
210
+ position:relative;
211
+ display:inline-block;
212
+ border:1px solid #d7d7d7;
213
+ background-color:#f2f2f2;
214
+ -moz-border-radius:100%;
215
+ -webkit-border-radius:100%;
216
+ border-radius:100%;
217
+ -moz-transition:all 0.1s ease;
218
+ -o-transition:all 0.1s ease;
219
+ -webkit-transition:all 0.1s ease;
220
+ transition:all 0.1s ease
221
+ }
222
+ .cb-radio i {
223
+ top:50%;
224
+ left:50%;
225
+ width:6px;
226
+ height:6px;
227
+ margin-top:-3px;
228
+ margin-left:-3px;
229
+ position:absolute;
230
+ background-color:transparent;
231
+ -moz-border-radius:100%;
232
+ -webkit-border-radius:100%;
233
+ border-radius:100%;
234
+ -moz-transform:scale(0.05, 5);
235
+ -ms-transform:scale(0.05, 5);
236
+ -webkit-transform:scale(0.05, 5);
237
+ transform:scale(0.05, 5);
238
+ -moz-transition:all 0.2s ease;
239
+ -o-transition:all 0.2s ease;
240
+ -webkit-transition:all 0.2s ease;
241
+ transition:all 0.2s ease
242
+ }
243
+ .cb-checkbox.cb-sm, .cb-radio.cb-sm {
244
+ line-height:14px
245
+ }
246
+ .cb-checkbox.cb-md, .cb-radio.cb-md {
247
+ line-height:24px
248
+ }
249
+ .cb-checkbox.cb-lg, .cb-radio.cb-lg {
250
+ line-height:30px
251
+ }
252
+ .cb-checkbox.cb-sm i:before {
253
+ top:4px;
254
+ left:1px
255
+ }
256
+ .cb-checkbox.cb-sm i:after {
257
+ left:5px
258
+ }
259
+ .cb-checkbox.cb-md i:before {
260
+ top:10px;
261
+ left:5px
262
+ }
263
+ .cb-checkbox.cb-md i:after {
264
+ bottom:6px;
265
+ left:11px
266
+ }
267
+ .cb-checkbox.checked .cb-inner {
268
+ border-color:#0073aa;
269
+ background-color:#0085ba;
270
+ box-shadow: 0 1px 0 rgba(120, 200, 230, 0.5) inset, 0 1px 0 rgba(0, 0, 0, 0.15);
271
+ }
272
+ .cb-checkbox.checked:hover .cb-inner {
273
+ background-color:#0091cd
274
+ }
275
+ .cb-checkbox.checked.cb-sm i:before {
276
+ top:4px;
277
+ left:1px
278
+ }
279
+ .cb-checkbox.checked.cb-sm i:after {
280
+ height:9px
281
+ }
282
+ .cb-checkbox.checked.cb-md i:before {
283
+ top:10px;
284
+ left:4px;
285
+ height:8px
286
+ }
287
+ .cb-checkbox.checked.cb-md i:after {
288
+ bottom:6px;
289
+ left:11px;
290
+ height:16px
291
+ }
292
+ .cb-checkbox.checked.cb-lg i:before {
293
+ top:11px;
294
+ left:6px;
295
+ height:12px
296
+ }
297
+ .cb-checkbox.checked.cb-lg i:after {
298
+ left:14px;
299
+ bottom:7px;
300
+ height:20px
301
+ }
302
+ .cb-checkbox.checked i:before {
303
+ top:6px;
304
+ left:2px;
305
+ height:6px
306
+ }
307
+ .cb-checkbox.checked i:after {
308
+ height:12px
309
+ }
310
+ .cb-radio.checked .cb-inner {
311
+ background:#fff;
312
+ box-shadow:0 0 3px #efefef
313
+ }
314
+ .cb-radio.checked i {
315
+ -moz-transform:scale(1.1, 1.1);
316
+ -ms-transform:scale(1.1, 1.1);
317
+ -webkit-transform:scale(1.1, 1.1);
318
+ transform:scale(1.1, 1.1);
319
+ background-color:#00a0d2
320
+ }
321
+ .cb-checkbox:hover .cb-inner, .cb-radio:hover .cb-inner {
322
+ border-color:#0073aa
323
+ }
324
+ .cb-switcher {
325
+ display:inline-block;
326
+ border:1px solid #eee;
327
+ background-color:#fff;
328
+ width:95px;
329
+ height:35px;
330
+ position:relative;
331
+ -moz-border-radius:20px;
332
+ -webkit-border-radius:20px;
333
+ border-radius:20px;
334
+ -moz-transition:background 0.4s ease;
335
+ -o-transition:background 0.4s ease;
336
+ -webkit-transition:background 0.4s ease;
337
+ transition:background 0.4s ease
338
+ }
339
+ .cb-switcher, .cb-switcher * {
340
+ cursor:pointer
341
+ }
342
+ .cb-switcher ::-moz-selection {
343
+ background-color:transparent
344
+ }
345
+ .cb-switcher ::selection {
346
+ background-color:transparent
347
+ }
348
+ .cb-switcher .cb-state {
349
+ z-index:1;
350
+ text-align:center;
351
+ font-size:12px
352
+ }
353
+ .cb-switcher .cb-state, .cb-switcher:before {
354
+ width:34px;
355
+ height:34px;
356
+ line-height:34px;
357
+ position:absolute;
358
+ left:0;
359
+ top:-1px;
360
+ -moz-border-radius:100%;
361
+ -webkit-border-radius:100%;
362
+ border-radius:100%;
363
+ -moz-transition:all 0.4s ease;
364
+ -o-transition:all 0.4s ease;
365
+ -webkit-transition:all 0.4s ease;
366
+ transition:all 0.4s ease
367
+ }
368
+ .cb-switcher:before {
369
+ content:"";
370
+ background-color:#eee;
371
+ -moz-box-shadow:1px 1px 1px rgba(0, 0, 0, 0.1);
372
+ -webkit-box-shadow:1px 1px 1px rgba(0, 0, 0, 0.1);
373
+ box-shadow:1px 1px 1px rgba(0, 0, 0, 0.1)
374
+ }
375
+ .cb-switcher.checked {
376
+ background-color:#00a0d2
377
+ }
378
+ .cb-switcher.checked .cb-state, .cb-switcher.checked:before {
379
+ left:60px;
380
+ color:#00a0d2
381
+ }
382
+ .cb-switcher.checked:before {
383
+ background-color:#fff;
384
+ -moz-box-shadow:-1px 1px 1px rgba(0, 0, 0, 0.1);
385
+ -webkit-box-shadow:-1px 1px 1px rgba(0, 0, 0, 0.1);
386
+ box-shadow:-1px 1px 1px rgba(0, 0, 0, 0.1)
387
+ }
388
+ .cb-switcher.checked .inner-switcher:before {
389
+ border-top-color:#0073aa
390
+ }
391
+ .cb-switcher.checked .inner-switcher:after {
392
+ border-bottom-color:#0073aa
393
+ }
394
+ .cb-switcher .inner-switcher:before, .cb-switcher .inner-switcher:after {
395
+ content:"";
396
+ position:absolute;
397
+ left:50%;
398
+ width:0;
399
+ height:0;
400
+ z-index:2;
401
+ margin-left:-20px;
402
+ border-left:20px solid transparent;
403
+ border-right:20px solid transparent;
404
+ -moz-transition:border 0.4s ease;
405
+ -o-transition:border 0.4s ease;
406
+ -webkit-transition:border 0.4s ease;
407
+ transition:border 0.4s ease
408
+ }
409
+ .cb-switcher .inner-switcher:before {
410
+ border-top:17px solid #fff;
411
+ top:0
412
+ }
413
+ .cb-switcher .inner-switcher:after {
414
+ border-bottom:17px solid #fff;
415
+ bottom:0
416
+ }
417
+ .cb-state {
418
+ color:#ccc;
419
+ display:inline-block
420
+ }
421
+ .cb-switcher-group .cb-state {
422
+ position:relative;
423
+ top:7px
424
+ }
425
+ .is-hidden {
426
+ display:none !important;
427
+ visibility:hidden !important
428
+ }
429
+ output {
430
+ display: block;
431
+ font-size: 30px;
432
+ font-weight: bold;
433
+ text-align: center;
434
+ margin: 30px 0;
435
+ width: 100%;
436
+ }
437
+
438
+ /* widgets page */
439
+ .restrict-widgets-hide-div {
440
+ margin-bottom: 0.5em;
441
+ }
442
+
443
+ .restrict-widgets-hide-div .select2-container {
444
+ margin-top: 0.2em;
445
+ }
446
+
447
+ .restrict-widgets-select-div {
448
+ margin-top: 0;
449
+ }
450
+
451
+ .select2-container {
452
+ width: 100% !important;
453
+ display: block;
454
+ z-index: 1000001;
455
+ }
456
+
457
+ .select2-container .select2-selection__rendered li {
458
+ margin-bottom: 0;
459
+ }
460
+
461
+ .select2-container--default .select2-selection--multiple .select2-selection__choice {
462
+ font-size: 13px;
463
+ }
css/chosen.min.css DELETED
@@ -1,3 +0,0 @@
1
- /* Chosen v1.2.0 | (c) 2011-2014 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
-
3
- .chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;zoom:1;*display:inline;-webkit-user-select:none;-moz-user-select:none;user-select:none}.chosen-container *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.chosen-container .chosen-drop{position:absolute;top:100%;left:-9999px;z-index:1010;width:100%;border:1px solid #aaa;border-top:0;background:#fff;box-shadow:0 4px 5px rgba(0,0,0,.15)}.chosen-container.chosen-with-drop .chosen-drop{left:0}.chosen-container a{cursor:pointer}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),color-stop(100%,#f4f4f4));background:-webkit-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:-moz-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:-o-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(../images/chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(../images/chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:#fff url(../images/chosen-sprite.png) no-repeat 100% -20px;background:url(../images/chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;left:-9999px}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:-webkit-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:-moz-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:-o-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto!important;height:1%;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(1%,#eee),color-stop(15%,#fff));background-image:-webkit-linear-gradient(#eee 1%,#fff 15%);background-image:-moz-linear-gradient(#eee 1%,#fff 15%);background-image:-o-linear-gradient(#eee 1%,#fff 15%);background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:transparent!important;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-o-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#333;line-height:13px;cursor:default}.chosen-container-multi .chosen-choices li.search-choice span{word-wrap:break-word}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close{position:absolute;top:4px;right:3px;display:block;width:12px;height:12px;background:url(../images/chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-o-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;-moz-border-radius-bottomright:0;border-bottom-right-radius:0;-moz-border-radius-bottomleft:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#eee),color-stop(80%,#fff));background-image:-webkit-linear-gradient(#eee 20%,#fff 80%);background-image:-moz-linear-gradient(#eee 20%,#fff 80%);background-image:-o-linear-gradient(#eee 20%,#fff 80%);background-image:linear-gradient(#eee 20%,#fff 80%);box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:0;background:transparent}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single-nosearch .chosen-search,.chosen-rtl .chosen-drop{left:9999px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:0}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:#fff url(../images/chosen-sprite.png) no-repeat -30px -20px;background:url(../images/chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:2),only screen and (min-resolution:144dpi){.chosen-rtl .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-container-single .chosen-search input[type=text],.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span{background-image:url(../images/chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}}
 
 
 
js/admin.js CHANGED
@@ -1,38 +1,22 @@
1
- jQuery(document).ready(function ($) {
2
-
3
- $('#widgets-left').append($('#widgets-options'));
4
-
5
- for(i in rwArgs.restrict_widgets) {
6
- $("div[id*='"+rwArgs.restrict_widgets[i]+"'] div").remove();
7
- }
8
-
9
- for(i in rwArgs.restrict_class) {
10
- $("div[id*='"+rwArgs.restrict_class[i]+"-__i__']").remove();
11
- }
12
-
13
- for(i in rwArgs.restrict_nonclass) {
14
- $("div[id*='_"+rwArgs.restrict_nonclass[i]+"']").remove();
15
- }
16
-
17
- if(rwArgs.restrict_orphan_sidebar == 1) {
18
- $('.orphan-sidebar').remove();
19
- }
20
-
21
- $('#options-available-widgets').chosen({placeholder_text: rwArgs.restrict_available_widgets});
22
- $('#options-widgets-selection').chosen({placeholder_text: rwArgs.restrict_widgets_selection});
23
- $('#options-widgets-sidebars').chosen({placeholder_text: rwArgs.restrict_sidebars});
24
- $('#options-widgets-roles').chosen({placeholder_text: rwArgs.restrict_roles});
25
-
26
- $(document).on('ready ajaxStop ajaxStart', function() {
27
- $('#widgets-right .restrict-widgets-hide, .inactive-sidebar .restrict-widgets-hide').chosen({
28
- allow_single_deselect: true,
29
- disable_search: true,
30
- width: '100%'
31
- });
32
-
33
- $('#widgets-right .restrict-widgets-select, .inactive-sidebar .restrict-widgets-select').chosen({
34
- placeholder_text: rwArgs.placeholder_text,
35
- width: '100%'
36
- });
37
- });
38
- });
1
+ ( function ( $ ) {
2
+
3
+ $( document ).ready( function () {
4
+ $( '.restrict-widgets-settings' ).checkBo();
5
+ $( '.restrict-widgets-settings .select2' ).select2();
6
+ } );
7
+
8
+ // ask whether to reset options to defaults
9
+ $( document ).on( 'click', '#reset_rw_options', function () {
10
+ return confirm( rwArgs.resetToDefaults );
11
+ } );
12
+
13
+ } )( jQuery );
14
+
15
+ /*
16
+ * checkBo lightweight jQuery plugin v0.1.4 by @ElmahdiMahmoud
17
+ * Licensed under the MIT license - https://github.com/elmahdim/checkbo/blob/master/LICENSE
18
+ *
19
+ * Custom checkbox and radio
20
+ * Author URL: elmahdim.com
21
+ */
22
+ !function(e){e.fn.checkBo=function(c){return c=e.extend({},{checkAllButton:null,checkAllTarget:null,checkAllTextDefault:null,checkAllTextToggle:null},c),this.each(function(){function t(e){this.input=e}function n(){var c=e(this).is(":checked");e(this).closest("label").toggleClass("checked",c)}function i(e,c,t){e.text(e.parent(a).hasClass("checked")?t:c)}function h(c){var t=c.attr("data-show");c=c.attr("data-hide"),e(t).removeClass("is-hidden"),e(c).addClass("is-hidden")}var l=e(this),a=l.find(".cb-checkbox"),d=l.find(".cb-radio"),o=l.find(".cb-switcher"),s=a.find("input:checkbox"),f=d.find("input:radio");s.wrap('<span class="cb-inner"><i></i></span>'),f.wrap('<span class="cb-inner"><i></i></span>');var k=new t("input:checkbox"),r=new t("input:radio");if(t.prototype.checkbox=function(e){var c=e.find(this.input).is(":checked");e.find(this.input).prop("checked",!c).trigger("change")},t.prototype.radiobtn=function(c,t){var n=e('input:radio[name="'+t+'"]');n.prop("checked",!1),n.closest(n.closest(d)).removeClass("checked"),c.addClass("checked"),c.find(this.input).get(0).checked=c.hasClass("checked"),c.find(this.input).change()},s.on("change",n),f.on("change",n),a.find("a").on("click",function(e){e.stopPropagation()}),a.on("click",function(c){c.preventDefault(),k.checkbox(e(this)),c=e(this).attr("data-toggle"),e(c).toggleClass("is-hidden"),h(e(this))}),d.on("click",function(c){c.preventDefault(),r.radiobtn(e(this),e(this).find("input:radio").attr("name")),h(e(this))}),e.fn.toggleCheckbox=function(){this.prop("checked",!this.is(":checked"))},e.fn.switcherChecker=function(){var c=e(this),t=c.find("input"),n=c.find(".cb-state");t.is(":checked")?(c.addClass("checked"),n.html(t.attr("data-state-on"))):(c.removeClass("checked"),n.html(t.attr("data-state-off")))},o.on("click",function(c){c.preventDefault(),c=e(this),c.find("input").toggleCheckbox(),c.switcherChecker(),e(c.attr("data-toggle")).toggleClass("is-hidden")}),o.each(function(){e(this).switcherChecker()}),c.checkAllButton&&c.checkAllTarget){var u=e(this);u.find(e(c.checkAllButton)).on("click",function(){u.find(c.checkAllTarget).find("input:checkbox").each(function(){u.find(e(c.checkAllButton)).hasClass("checked")?u.find(c.checkAllTarget).find("input:checkbox").prop("checked",!0).change():u.find(c.checkAllTarget).find("input:checkbox").prop("checked",!1).change()}),i(u.find(e(c.checkAllButton)).find(".toggle-text"),c.checkAllTextDefault,c.checkAllTextToggle)}),u.find(c.checkAllTarget).find(a).on("click",function(){u.find(c.checkAllButton).find("input:checkbox").prop("checked",!1).change().removeClass("checked"),i(u.find(e(c.checkAllButton)).find(".toggle-text"),c.checkAllTextDefault,c.checkAllTextToggle)})}l.find('[checked="checked"]').closest("label").addClass("checked"),l.find("input").is("input:disabled")&&l.find("input:disabled").closest("label").off().addClass("disabled")})}}(jQuery,window,document);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/chosen.jquery.min.js CHANGED
@@ -1,2 +1,10 @@
1
- /* Chosen v1.2.0 | (c) 2011-2014 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
- !function(){var a,AbstractChosen,Chosen,SelectParser,b,c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),children:0,disabled:a.disabled}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&amp;"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0},AbstractChosen.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(){var a=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return a.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(){var a=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return a.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f;for(b="",f=this.results_data,d=0,e=f.length;e>d;d++)c=f[d],b+=c.group?this.result_add_group(c):this.result_add_option(c),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(c.text));return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match?this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,this.outerHTML(c)):"":""},AbstractChosen.prototype.result_add_group=function(a){var b;return a.search_match||a.group_match?a.active_options>0?(b=document.createElement("li"),b.className="group-result",b.innerHTML=a.search_text,this.outerHTML(b)):"":""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(this.no_results_clear(),d=0,f=this.get_search_text(),a=f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=new RegExp(a,"i"),c=this.get_search_regex(a),l=this.results_data,j=0,k=l.length;k>j;j++)b=l[j],b.search_match=!1,e=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(e=this.results_data[b.group_array_index],0===e.active_options&&e.search_match&&(d+=1),e.active_options+=1),(!b.group||this.group_search)&&(b.search_text=b.group?b.label:b.text,b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(d+=1),b.search_match?(f.length&&(g=b.search_text.search(i),h=b.search_text.substr(0,g+f.length)+"</em>"+b.search_text.substr(g+f.length),b.search_text=h.substr(0,g)+"<em>"+h.substr(g)),null!=e&&(e.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>d&&f.length?(this.update_results_content(""),this.no_results(f)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.get_search_regex=function(a){var b;return b=this.search_contains?"":"^",new RegExp(b+a,"i")},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(){var a=this;return setTimeout(function(){return a.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),a=jQuery,a.fn.extend({chosen:function(b){return AbstractChosen.browser_is_supported()?this.each(function(){var c,d;c=a(this),d=c.data("chosen"),"destroy"===b&&d instanceof Chosen?d.destroy():d instanceof Chosen||c.data("chosen",new Chosen(this,b))}):this}}),Chosen=function(c){function Chosen(){return b=Chosen.__super__.constructor.apply(this,arguments)}return d(Chosen,c),Chosen.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},Chosen.prototype.set_up_html=function(){var b,c;return b=["chosen-container"],b.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&b.push(this.form_field.className),this.is_rtl&&b.push("chosen-rtl"),c={"class":b.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(c.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=a("<div />",c),this.is_multiple?this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'):this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior(),this.form_field_jq.trigger("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.bind("touchstart.chosen",function(b){a.container_mousedown(b)}),this.container.bind("touchend.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mousedown.chosen",function(b){a.container_mousedown(b)}),this.container.bind("mouseup.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mouseenter.chosen",function(b){a.mouse_enter(b)}),this.container.bind("mouseleave.chosen",function(b){a.mouse_leave(b)}),this.search_results.bind("mouseup.chosen",function(b){a.search_results_mouseup(b)}),this.search_results.bind("mouseover.chosen",function(b){a.search_results_mouseover(b)}),this.search_results.bind("mouseout.chosen",function(b){a.search_results_mouseout(b)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(b){a.search_results_mousewheel(b)}),this.search_results.bind("touchstart.chosen",function(b){a.search_results_touchstart(b)}),this.search_results.bind("touchmove.chosen",function(b){a.search_results_touchmove(b)}),this.search_results.bind("touchend.chosen",function(b){a.search_results_touchend(b)}),this.form_field_jq.bind("chosen:updated.chosen",function(b){a.results_update_field(b)}),this.form_field_jq.bind("chosen:activate.chosen",function(b){a.activate_field(b)}),this.form_field_jq.bind("chosen:open.chosen",function(b){a.container_mousedown(b)}),this.form_field_jq.bind("chosen:close.chosen",function(b){a.input_blur(b)}),this.search_field.bind("blur.chosen",function(b){a.input_blur(b)}),this.search_field.bind("keyup.chosen",function(b){a.keyup_checker(b)}),this.search_field.bind("keydown.chosen",function(b){a.keydown_checker(b)}),this.search_field.bind("focus.chosen",function(b){a.input_focus(b)}),this.search_field.bind("cut.chosen",function(b){a.clipboard_event_checker(b)}),this.search_field.bind("paste.chosen",function(b){a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.bind("click.chosen",function(b){a.choices_click(b)}):this.container.bind("click.chosen",function(a){a.preventDefault()})},Chosen.prototype.destroy=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},Chosen.prototype.container_mousedown=function(b){return this.is_disabled||(b&&"mousedown"===b.type&&!this.results_showing&&b.preventDefault(),null!=b&&a(b.target).hasClass("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!b||a(b.target)[0]!==this.selected_item[0]&&!a(b.target).parents("a.chosen-single").length||(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(this.container[0].ownerDocument).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return a.originalEvent&&(b=a.originalEvent.deltaY||-a.originalEvent.wheelDelta||a.originalEvent.detail),null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop(b+this.search_results.scrollTop())):void 0},Chosen.prototype.blur_test=function(){return!this.active_field&&this.container.hasClass("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},Chosen.prototype.test_active_click=function(b){var c;return c=a(b.target).closest(".chosen-container"),c.length&&this.container[0]===c[0]?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){if(this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight(),b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(f>c)return this.search_results.scrollTop(c)}},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.html(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(){var a;return this.form_field.tabIndex?(a=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=a):void 0},Chosen.prototype.set_label_behavior=function(){var b=this;return this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=a("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0?this.form_field_label.bind("click.chosen",function(a){return b.is_multiple?b.container_mousedown(a):b.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},Chosen.prototype.search_results_mouseup=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c.length?(this.result_highlight=c,this.result_select(b),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c?this.result_do_highlight(c):void 0},Chosen.prototype.search_results_mouseout=function(b){return a(b.target).hasClass("active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(b){var c,d,e=this;return c=a("<li />",{"class":"search-choice"}).html("<span>"+b.html+"</span>"),b.disabled?c.addClass("search-choice-disabled"):(d=a("<a />",{"class":"search-choice-close","data-option-array-index":b.array_index}),d.bind("click.chosen",function(a){return e.choice_destroy_link_click(a)}),c.append(d)),this.search_container.before(c)},Chosen.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),b.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a(b.target))},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a[0].getAttribute("data-option-array-index"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),a.parents("li").first().remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClass("active-result"):this.reset_single_select_options(),c=this.results_data[b[0].getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(c.text),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[c.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").text(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[b.options_index].value}),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return this.search_field.val()===this.default_text?"":a("<div/>").text(a.trim(this.search_field.val())).html()},Chosen.prototype.winnow_results_set_highlight=function(){var a,b;return b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first(),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a;return this.results_showing||this.is_multiple?this.result_highlight?(a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(a=this.search_container.siblings("li.search-choice").last(),a.length&&!a.hasClass("search-choice-disabled")?(this.pending_backstroke=a,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){for(d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],i=0,j=g.length;j>i;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return b=a("<div />",{style:f}),b.text(this.search_field.val()),a("body").append(b),h=b.width()+25,b.remove(),c=this.container.outerWidth(),h>c-10&&(h=c-10),this.search_field.css({width:h+"px"})}},Chosen}(AbstractChosen)}.call(this);
 
 
 
 
 
 
 
 
1
+ // Chosen, a Select Box Enhancer for jQuery and Protoype
2
+ // by Patrick Filler for Harvest, http://getharvest.com
3
+ //
4
+ // Version 0.9.11
5
+ // Full source at https://github.com/harvesthq/chosen
6
+ // Copyright (c) 2011 Harvest http://getharvest.com
7
+
8
+ // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
9
+ // This file is generated by `cake build`, do not edit it by hand.
10
+ (function(){var e;e=function(){function e(){this.options_index=0,this.parsed=[]}return e.prototype.add_node=function(e){return e.nodeName.toUpperCase()==="OPTGROUP"?this.add_group(e):this.add_option(e)},e.prototype.add_group=function(e){var t,n,r,i,s,o;t=this.parsed.length,this.parsed.push({array_index:t,group:!0,label:e.label,children:0,disabled:e.disabled}),s=e.childNodes,o=[];for(r=0,i=s.length;r<i;r++)n=s[r],o.push(this.add_option(n,t,e.disabled));return o},e.prototype.add_option=function(e,t,n){if(e.nodeName.toUpperCase()==="OPTION")return e.text!==""?(t!=null&&(this.parsed[t].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:e.value,text:e.text,html:e.innerHTML,selected:e.selected,disabled:n===!0?n:e.disabled,group_array_index:t,classes:e.className,style:e.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},e}(),e.select_to_array=function(t){var n,r,i,s,o;r=new e,o=t.childNodes;for(i=0,s=o.length;i<s;i++)n=o[i],r.add_node(n);return r.parsed},this.SelectParser=e}).call(this),function(){var e,t;t=this,e=function(){function e(e,t){this.form_field=e,this.options=t!=null?t:{},this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return e.prototype.set_default_values=function(){var e=this;return this.click_test_action=function(t){return e.test_active_click(t)},this.activate_action=function(t){return e.activate_field(t)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=this.options.enable_split_word_search!=null?this.options.enable_split_word_search:!0,this.search_contains=this.options.search_contains||!1,this.choices=0,this.single_backstroke_delete=this.options.single_backstroke_delete||!1,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1},e.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||"Select Some Options":this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||"Select an Option",this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||"No results match"},e.prototype.mouse_enter=function(){return this.mouse_on_container=!0},e.prototype.mouse_leave=function(){return this.mouse_on_container=!1},e.prototype.input_focus=function(e){var t=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return t.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},e.prototype.input_blur=function(e){var t=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return t.blur_test()},100)},e.prototype.result_add_option=function(e){var t,n;return e.disabled?"":(e.dom_id=this.container_id+"_o_"+e.array_index,t=e.selected&&this.is_multiple?[]:["active-result"],e.selected&&t.push("result-selected"),e.group_array_index!=null&&t.push("group-option"),e.classes!==""&&t.push(e.classes),n=e.style.cssText!==""?' style="'+e.style+'"':"",'<li id="'+e.dom_id+'" class="'+t.join(" ")+'"'+n+">"+e.html+"</li>")},e.prototype.results_update_field=function(){return this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},e.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},e.prototype.results_search=function(e){return this.results_showing?this.winnow_results():this.results_show()},e.prototype.keyup_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode,this.search_field_scale();switch(t){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:e.preventDefault();if(this.results_showing)return this.result_select(e);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},e.prototype.generate_field_id=function(){var e;return e=this.generate_random_id(),this.form_field.id=e,e},e.prototype.generate_random_char=function(){var e,t,n;return e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",n=Math.floor(Math.random()*e.length),t=e.substring(n,n+1)},e}(),t.AbstractChosen=e}.call(this),function(){var e,t,n,r,i={}.hasOwnProperty,s=function(e,t){function r(){this.constructor=e}for(var n in t)i.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};r=this,e=jQuery,e.fn.extend({chosen:function(n){var r,i,s;return s=navigator.userAgent.toLowerCase(),i=/(msie) ([\w.]+)/.exec(s)||[],r={name:i[1]||"",version:i[2]||"0"},r.name==="msie"&&(r.version==="6.0"||r.version==="7.0"&&document.documentMode===7)?this:this.each(function(r){var i;i=e(this);if(!i.hasClass("chzn-done"))return i.data("chosen",new t(this,n))})}}),t=function(t){function i(){return i.__super__.constructor.apply(this,arguments)}return s(i,t),i.prototype.setup=function(){return this.form_field_jq=e(this.form_field),this.current_value=this.form_field_jq.val(),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},i.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},i.prototype.set_up_html=function(){var t,r,i,s,o,u;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/[^\w]/g,"_"):this.generate_field_id(),this.container_id+="_chzn",t=["chzn-container"],t.push("chzn-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&t.push(this.form_field.className),this.is_rtl&&t.push("chzn-rtl"),this.f_width=this.form_field_jq.outerWidth(),i={id:this.container_id,"class":t.join(" "),style:"width: "+this.f_width+"px;",title:this.form_field.title},r=e("<div />",i),this.is_multiple?r.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):r.html('<a href="javascript:void(0)" class="chzn-single chzn-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(r),this.container=e("#"+this.container_id),this.dropdown=this.container.find("div.chzn-drop").first(),s=this.container.height(),o=this.f_width-n(this.dropdown),this.dropdown.css({width:o+"px",top:s+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),u=o-n(this.search_container)-n(this.search_field),this.search_field.css({width:u+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},i.prototype.register_observers=function(){var e=this;return this.container.mousedown(function(t){return e.container_mousedown(t)}),this.container.mouseup(function(t){return e.container_mouseup(t)}),this.container.mouseenter(function(t){return e.mouse_enter(t)}),this.container.mouseleave(function(t){return e.mouse_leave(t)}),this.search_results.mouseup(function(t){return e.search_results_mouseup(t)}),this.search_results.mouseover(function(t){return e.search_results_mouseover(t)}),this.search_results.mouseout(function(t){return e.search_results_mouseout(t)}),this.form_field_jq.bind("liszt:updated",function(t){return e.results_update_field(t)}),this.form_field_jq.bind("liszt:activate",function(t){return e.activate_field(t)}),this.form_field_jq.bind("liszt:open",function(t){return e.container_mousedown(t)}),this.search_field.blur(function(t){return e.input_blur(t)}),this.search_field.keyup(function(t){return e.keyup_checker(t)}),this.search_field.keydown(function(t){return e.keydown_checker(t)}),this.search_field.focus(function(t){return e.input_focus(t)}),this.is_multiple?this.search_choices.click(function(t){return e.choices_click(t)}):this.container.click(function(e){return e.preventDefault()})},i.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},i.prototype.container_mousedown=function(t){var n;if(!this.is_disabled)return n=t!=null?e(t.target).hasClass("search-choice-close"):!1,t&&t.type==="mousedown"&&!this.results_showing&&t.preventDefault(),!this.pending_destroy_click&&!n?(this.active_field?!this.is_multiple&&t&&(e(t.target)[0]===this.selected_item[0]||e(t.target).parents("a.chzn-single").length)&&(t.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),e(document).click(this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},i.prototype.container_mouseup=function(e){if(e.target.nodeName==="ABBR"&&!this.is_disabled)return this.results_reset(e)},i.prototype.blur_test=function(e){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},i.prototype.close_field=function(){return e(document).unbind("click",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},i.prototype.activate_field=function(){return this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},i.prototype.test_active_click=function(t){return e(t.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},i.prototype.results_build=function(){var e,t,n,i,s;this.parsing=!0,this.results_data=r.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.addClass("chzn-default").find("span").text(this.default_text),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")),e="",s=this.results_data;for(n=0,i=s.length;n<i;n++)t=s[n],t.group?e+=this.result_add_group(t):t.empty||(e+=this.result_add_option(t),t.selected&&this.is_multiple?this.choice_build(t):t.selected&&!this.is_multiple&&(this.selected_item.removeClass("chzn-default").find("span").text(t.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(e),this.parsing=!1},i.prototype.result_add_group=function(t){return t.disabled?"":(t.dom_id=this.container_id+"_g_"+t.array_index,'<li id="'+t.dom_id+'" class="group-result">'+e("<div />").text(t.label).html()+"</li>")},i.prototype.result_do_highlight=function(e){var t,n,r,i,s;if(e.length){this.result_clear_highlight(),this.result_highlight=e,this.result_highlight.addClass("highlighted"),r=parseInt(this.search_results.css("maxHeight"),10),s=this.search_results.scrollTop(),i=r+s,n=this.result_highlight.position().top+this.search_results.scrollTop(),t=n+this.result_highlight.outerHeight();if(t>=i)return this.search_results.scrollTop(t-r>0?t-r:0);if(n<s)return this.search_results.scrollTop(n)}},i.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},i.prototype.results_show=function(){var e;if(!this.is_multiple)this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected);else if(this.max_selected_options<=this.choices)return this.form_field_jq.trigger("liszt:maxselected",{chosen:this}),!1;return e=this.is_multiple?this.container.height():this.container.height()-1,this.form_field_jq.trigger("liszt:showing_dropdown",{chosen:this}),this.dropdown.css({top:e+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},i.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.form_field_jq.trigger("liszt:hiding_dropdown",{chosen:this}),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},i.prototype.set_tab_index=function(e){var t;if(this.form_field_jq.attr("tabindex"))return t=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.search_field.attr("tabindex",t)},i.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},i.prototype.search_results_mouseup=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n.length)return this.result_highlight=n,this.result_select(t),this.search_field.focus()},i.prototype.search_results_mouseover=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n)return this.result_do_highlight(n)},i.prototype.search_results_mouseout=function(t){if(e(t.target).hasClass("active-result"))return this.result_clear_highlight()},i.prototype.choices_click=function(t){t.preventDefault();if(this.active_field&&!e(t.target).hasClass("search-choice")&&!this.results_showing)return this.results_show()},i.prototype.choice_build=function(t){var n,r,i,s=this;return this.is_multiple&&this.max_selected_options<=this.choices?(this.form_field_jq.trigger("liszt:maxselected",{chosen:this}),!1):(n=this.container_id+"_c_"+t.array_index,this.choices+=1,t.disabled?r='<li class="search-choice search-choice-disabled" id="'+n+'"><span>'+t.html+"</span></li>":r='<li class="search-choice" id="'+n+'"><span>'+t.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+t.array_index+'"></a></li>',this.search_container.before(r),i=e("#"+n).find("a").first(),i.click(function(e){return s.choice_destroy_link_click(e)}))},i.prototype.choice_destroy_link_click=function(t){return t.preventDefault(),this.is_disabled?t.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(e(t.target)))},i.prototype.choice_destroy=function(e){if(this.result_deselect(e.attr("rel")))return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),e.parents("li").first().remove(),this.search_field_scale()},i.prototype.results_reset=function(){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.is_multiple||this.selected_item.addClass("chzn-default"),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},i.prototype.results_reset_cleanup=function(){return this.current_value=this.form_field_jq.val(),this.selected_item.find("abbr").remove()},i.prototype.result_select=function(e){var t,n,r,i;if(this.result_highlight)return t=this.result_highlight,n=t.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(t):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=t,this.selected_item.removeClass("chzn-default")),t.addClass("result-selected"),i=n.substr(n.lastIndexOf("_")+1),r=this.results_data[i],r.selected=!0,this.form_field.options[r.options_index].selected=!0,this.is_multiple?this.choice_build(r):(this.selected_item.find("span").first().text(r.text),this.allow_single_deselect&&this.single_deselect_control_build()),(!e.metaKey&&!e.ctrlKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field_jq.val()!==this.current_value)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[r.options_index].value}),this.current_value=this.form_field_jq.val(),this.search_field_scale()},i.prototype.result_activate=function(e){return e.addClass("active-result")},i.prototype.result_deactivate=function(e){return e.removeClass("active-result")},i.prototype.result_deselect=function(t){var n,r;return r=this.results_data[t],this.form_field.options[r.options_index].disabled?!1:(r.selected=!1,this.form_field.options[r.options_index].selected=!1,n=e("#"+this.container_id+"_o_"+t),n.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[r.options_index].value}),this.search_field_scale(),!0)},i.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')},i.prototype.winnow_results=function(){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y;this.no_results_clear(),f=0,l=this.search_field.val()===this.default_text?"":e("<div/>").text(e.trim(this.search_field.val())).html(),o=this.search_contains?"":"^",s=new RegExp(o+l.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),p=new RegExp(l.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),y=this.results_data;for(d=0,m=y.length;d<m;d++){n=y[d];if(!n.disabled&&!n.empty)if(n.group)e("#"+n.dom_id).css("display","none");else if(!this.is_multiple||!n.selected){t=!1,a=n.dom_id,u=e("#"+a);if(s.test(n.html))t=!0,f+=1;else if(this.enable_split_word_search&&(n.html.indexOf(" ")>=0||n.html.indexOf("[")===0)){i=n.html.replace(/\[|\]/g,"").split(" ");if(i.length)for(v=0,g=i.length;v<g;v++)r=i[v],s.test(r)&&(t=!0,f+=1)}t?(l.length?(c=n.html.search(p),h=n.html.substr(0,c+l.length)+"</em>"+n.html.substr(c+l.length),h=h.substr(0,c)+"<em>"+h.substr(c)):h=n.html,u.html(h),this.result_activate(u),n.group_array_index!=null&&e("#"+this.results_data[n.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&a===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(u))}}return f<1&&l.length?this.no_results(l):this.winnow_results_set_highlight()},i.prototype.winnow_results_clear=function(){var t,n,r,i,s;this.search_field.val(""),n=this.search_results.find("li"),s=[];for(r=0,i=n.length;r<i;r++)t=n[r],t=e(t),t.hasClass("group-result")?s.push(t.css("display","auto")):!this.is_multiple||!t.hasClass("result-selected")?s.push(this.result_activate(t)):s.push(void 0);return s},i.prototype.winnow_results_set_highlight=function(){var e,t;if(!this.result_highlight){t=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),e=t.length?t.first():this.search_results.find(".active-result").first();if(e!=null)return this.result_do_highlight(e)}},i.prototype.no_results=function(t){var n;return n=e('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),n.find("span").first().html(t),this.search_results.append(n)},i.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},i.prototype.keydown_arrow=function(){var t,n;this.result_highlight?this.results_showing&&(n=this.result_highlight.nextAll("li.active-result").first(),n&&this.result_do_highlight(n)):(t=this.search_results.find("li.active-result").first(),t&&this.result_do_highlight(e(t)));if(!this.results_showing)return this.results_show()},i.prototype.keyup_arrow=function(){var e;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return e=this.result_highlight.prevAll("li.active-result"),e.length?this.result_do_highlight(e.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},i.prototype.keydown_backstroke=function(){var e;if(this.pending_backstroke)return this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke();e=this.search_container.siblings("li.search-choice").last();if(e.length&&!e.hasClass("search-choice-disabled"))return this.pending_backstroke=e,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")},i.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},i.prototype.keydown_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode,this.search_field_scale(),t!==8&&this.pending_backstroke&&this.clear_backstroke();switch(t){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(e),this.mouse_on_container=!1;break;case 13:e.preventDefault();break;case 38:e.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},i.prototype.search_field_scale=function(){var t,n,r,i,s,o,u,a,f;if(this.is_multiple){r=0,u=0,s="position:absolute; left: -1000px; top: -1000px; display:none;",o=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(a=0,f=o.length;a<f;a++)i=o[a],s+=i+":"+this.search_field.css(i)+";";return n=e("<div />",{style:s}),n.text(this.search_field.val()),e("body").append(n),u=n.width()+25,n.remove(),u>this.f_width-10&&(u=this.f_width-10),this.search_field.css({width:u+"px"}),t=this.container.height(),this.dropdown.css({top:t+"px"})}},i.prototype.generate_random_id=function(){var t;t="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(e("#"+t).length>0)t+=this.generate_random_char();return t},i}(AbstractChosen),r.Chosen=t,n=function(e){var t;return t=e.outerWidth()-e.width()},r.get_side_border_padding=n}.call(this);
js/widgets.js ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ( function ( $ ) {
2
+
3
+ var current_sidebar;
4
+
5
+ // only for customizer
6
+ $( document ).on( 'click', '#accordion-panel-widgets .accordion-section h3.accordion-section-title', function () {
7
+ // get sidebars (widgets are empty)
8
+ current_sidebar = $( this ).parent().find( 'ul' ).first();
9
+
10
+ $( current_sidebar ).on( 'click', '.widget-top', function () {
11
+ // get widgets
12
+ $( this ).closest( '.widget' ).find( '.restrict-widgets select.select2' ).each( function( i, el ) {
13
+ // initialize select2 only for original selects
14
+ if ( typeof $( el ).data( 'select2' ) === 'undefined' ) {
15
+ $( el ).select2();
16
+ }
17
+ } );
18
+ } );
19
+ } );
20
+
21
+ // only for widgets.php (not for customizer)
22
+ $( document ).on( 'ajaxComplete', function () {
23
+ $( '.widgets-sortables select.select2' ).each( function( i, el ) {
24
+ setTimeout( function() {
25
+ // initialize select2 only for original selects
26
+ if ( typeof $( el ).data( 'select2' ) === 'undefined' ) {
27
+ $( el ).select2();
28
+ }
29
+ }, 150 );
30
+ } );
31
+ } );
32
+
33
+ // update select2 in customizer when adding new widget
34
+ $( document ).on( 'click', '.widget-tpl', function () {
35
+ // delay initialization of select2
36
+ setTimeout( function() {
37
+ current_sidebar.children().eq( -2 ).find( '.restrict-widgets select.select2' ).select2();
38
+ }, 150 );
39
+ } );
40
+
41
+ $( document ).ready( function () {
42
+ // only for widgets.php (not for customizer)
43
+ $( '.widgets-sortables select.select2' ).select2();
44
+
45
+ for ( i in rwArgs.restrict_widgets ) {
46
+ $( "div[id*='" + rwArgs.restrict_widgets[i] + "'] div" ).remove();
47
+ }
48
+
49
+ for ( i in rwArgs.restrict_class ) {
50
+ $( "div[id*='" + rwArgs.restrict_class[i] + "-__i__']" ).remove();
51
+ }
52
+
53
+ for ( i in rwArgs.restrict_nonclass ) {
54
+ $( "div[id*='_" + rwArgs.restrict_nonclass[i] + "']" ).remove();
55
+ }
56
+
57
+ if ( rwArgs.restrict_orphan_sidebar == 1 ) {
58
+ $( '.orphan-sidebar' ).remove();
59
+ }
60
+ } );
61
+
62
+ } )( jQuery );
languages/restrict-widgets-pl_PL.po CHANGED
@@ -1,231 +1,231 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Restrict Widgets\n"
4
- "POT-Creation-Date: 2013-12-03 12:12+0100\n"
5
- "PO-Revision-Date: 2013-12-03 12:13+0100\n"
6
- "Last-Translator: Bartosz Arendt <info@digitalfactory.pl>\n"
7
- "Language-Team: dFactory <info@dfactory.eu>\n"
8
- "Language: English\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.5.7\n"
13
- "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e\n"
14
- "X-Poedit-Basepath: .\n"
15
- "X-Poedit-SourceCharset: UTF-8\n"
16
- "X-Poedit-SearchPath-0: ..\n"
17
-
18
- #: ../restrict-widgets.php:310
19
- msgid "Support"
20
- msgstr "Forum pomocy"
21
-
22
- #: ../restrict-widgets.php:332 ../restrict-widgets.php:1705
23
- #: ../restrict-widgets.php:1751
24
- msgid "Widgets"
25
- msgstr "Widgety"
26
-
27
- #: ../restrict-widgets.php:411
28
- msgid "Pages"
29
- msgstr "Strony"
30
-
31
- #: ../restrict-widgets.php:412
32
- msgid "Custom Post Types"
33
- msgstr "Własne typy wpisów"
34
-
35
- #: ../restrict-widgets.php:413
36
- msgid "Custom Post Type Archives"
37
- msgstr "Archiwa własnych typów wpisów"
38
-
39
- #: ../restrict-widgets.php:414
40
- msgid "Categories"
41
- msgstr "Kategorie"
42
-
43
- #: ../restrict-widgets.php:415
44
- msgid "Taxonomies"
45
- msgstr "Taksonomie"
46
-
47
- #: ../restrict-widgets.php:416
48
- msgid "Others"
49
- msgstr "Inne"
50
-
51
- #: ../restrict-widgets.php:423
52
- msgid "Search"
53
- msgstr "Strona wyszukiwania"
54
-
55
- #: ../restrict-widgets.php:424
56
- msgid "Single User"
57
- msgstr "Strona użytkownika"
58
-
59
- #: ../restrict-widgets.php:425
60
- msgid "Topic Tag"
61
- msgstr "Tagi tematów"
62
-
63
- #: ../restrict-widgets.php:428
64
- msgid "bbPress"
65
- msgstr "Forum bbPress"
66
-
67
- #: ../restrict-widgets.php:431
68
- msgid "Devices"
69
- msgstr "Urządzenia"
70
-
71
- #: ../restrict-widgets.php:432
72
- msgid "Users"
73
- msgstr "Użytkownicy"
74
-
75
- #: ../restrict-widgets.php:433
76
- msgid "Languages"
77
- msgstr "Języki"
78
-
79
- #: ../restrict-widgets.php:436
80
- msgid "Front Page"
81
- msgstr "Strona główna"
82
-
83
- #: ../restrict-widgets.php:437
84
- msgid "Blog Page"
85
- msgstr "Strona z wpisami"
86
-
87
- #: ../restrict-widgets.php:438
88
- msgid "Single Posts"
89
- msgstr "Pojedyncze wpisy"
90
-
91
- #: ../restrict-widgets.php:439
92
- msgid "Sticky Posts"
93
- msgstr "Wpisy przyklejone"
94
-
95
- #: ../restrict-widgets.php:440
96
- msgid "Author Archive"
97
- msgstr "Archiwum autora"
98
-
99
- #: ../restrict-widgets.php:441
100
- msgid "Date Archive"
101
- msgstr "Archiwum daty"
102
-
103
- #: ../restrict-widgets.php:442
104
- msgid "404 Page"
105
- msgstr "Strona błędów 404"
106
-
107
- #: ../restrict-widgets.php:443
108
- msgid "Search Page"
109
- msgstr "Strona wyszukiwania"
110
-
111
- #: ../restrict-widgets.php:447
112
- msgid "Logged in users"
113
- msgstr "Zalogowani użytkownicy"
114
-
115
- #: ../restrict-widgets.php:448
116
- msgid "Logged out users"
117
- msgstr "Wylogowani użytkownicy"
118
-
119
- #: ../restrict-widgets.php:452
120
- msgid "Mobile"
121
- msgstr "Mobilne"
122
-
123
- #: ../restrict-widgets.php:453
124
- msgid "Desktop, Laptop, etc."
125
- msgstr "Stacjonarne"
126
-
127
- #: ../restrict-widgets.php:669
128
- msgid "Restrict widgets"
129
- msgstr "Ograniczenia widgetów"
130
-
131
- #: ../restrict-widgets.php:673
132
- msgid ""
133
- "Use this settings to manage access to widgets page and to restrict "
134
- "availability of certain widgets, sidebars and widgets options to site "
135
- "administrators only."
136
- msgstr ""
137
- "Użyj tych ustawień aby określić kto może mieć dostęp do widgetów, jakie "
138
- "widgety, panele boczne i ustawienia widgetów są dostępne dla użytkowników a "
139
- "jakie tylko dla administratorów."
140
-
141
- #: ../restrict-widgets.php:676
142
- msgid "Restrict Users"
143
- msgstr "Ograniczenia użytkowników"
144
-
145
- #: ../restrict-widgets.php:686
146
- msgid "Select user roles restricted to manage widgets."
147
- msgstr "Wybierz role użytkowników, którzy mogą zarządzać widgetami."
148
-
149
- #: ../restrict-widgets.php:690
150
- msgid "Restrict Sidebars"
151
- msgstr "Ograniczenia paneli bocznych"
152
-
153
- #: ../restrict-widgets.php:706
154
- msgid "Select which sidebars will be restricted to admins only."
155
- msgstr "Wybierz panele boczne, które będą dostępne tylko dla administratorów."
156
-
157
- #: ../restrict-widgets.php:710
158
- msgid "Restrict Widgets"
159
- msgstr "Ograniczenia widgetów"
160
-
161
- #: ../restrict-widgets.php:723
162
- msgid "Select which widgets will be restricted to admins only."
163
- msgstr "Wybierz widgety, któe będą dostępne tylko dla administratorów."
164
-
165
- #: ../restrict-widgets.php:727
166
- msgid "Restrict Widget Options"
167
- msgstr "Ograniczenia opcji widgetów"
168
-
169
- #: ../restrict-widgets.php:737
170
- msgid "Select which widget options will be restricted to admins only."
171
- msgstr "Wybierz które opcje widgetów, będą dostępne tylko dla administratorów."
172
-
173
- #: ../restrict-widgets.php:741
174
- msgid "Restrict Option Groups"
175
- msgstr "Ograniczenia grup opcji"
176
-
177
- #: ../restrict-widgets.php:744
178
- msgid "Display widget options in groups"
179
- msgstr "Wyświetl opcje widgetów w grupach"
180
-
181
- #: ../restrict-widgets.php:748
182
- msgid "Modify is_active_sidebar()"
183
- msgstr "Modyfikuj is_active_sidebar()"
184
-
185
- #: ../restrict-widgets.php:751
186
- msgid ""
187
- "By default is_active_sidebar() function returns TRUE even if no widget is "
188
- "displayed in a sidebar. Check this if you want is_active_sidebar() to "
189
- "recognize Restrict Widgets display settings."
190
- msgstr ""
191
- "Domyślnie funkcja is_active_sidebar() zwraca TRUE navet jeśli w danym "
192
- "sidebarze nie jest wyświetlany żaden widget. Zaznacz to, jeśli chcesz aby "
193
- "is_active_sidebar() rozpoznawało ustawienia wyświetlania dodawane przez tę "
194
- "wtyczkę."
195
-
196
- #: ../restrict-widgets.php:755
197
- msgid "Plugin Deactivation"
198
- msgstr "Deaktywacja wtyczki"
199
-
200
- #: ../restrict-widgets.php:758
201
- msgid "Remove all plugin data on deactivation"
202
- msgstr "Usuń wszystkie dane wtyczki podczas deaktywacji"
203
-
204
- #: ../restrict-widgets.php:762
205
- msgid "Save settings"
206
- msgstr "Zapisz ustawienia"
207
-
208
- #: ../restrict-widgets.php:930 ../restrict-widgets.php:941
209
- #, php-format
210
- msgid "Single %s"
211
- msgstr "Pojedyncze %s"
212
-
213
- #: ../restrict-widgets.php:968 ../restrict-widgets.php:979
214
- #, php-format
215
- msgid "%s Archive"
216
- msgstr "Archiwum %s"
217
-
218
- #: ../restrict-widgets.php:1278
219
- msgid "Display / Hide Widget"
220
- msgstr "Wyświetl / Ukryj widget"
221
-
222
- #: ../restrict-widgets.php:1280
223
- msgid "Display widget on selected"
224
- msgstr "Wyświetl widget na wybranych stronach"
225
-
226
- #: ../restrict-widgets.php:1281
227
- msgid "Hide widget on selected"
228
- msgstr "Ukryj widget na wybranych stronach"
229
-
230
- #~ msgid "Created by"
231
- #~ msgstr "Stworzone przez"
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Restrict Widgets\n"
4
+ "POT-Creation-Date: 2013-12-03 12:12+0100\n"
5
+ "PO-Revision-Date: 2013-12-03 12:13+0100\n"
6
+ "Last-Translator: Bartosz Arendt <info@digitalfactory.pl>\n"
7
+ "Language-Team: dFactory <info@dfactory.eu>\n"
8
+ "Language: English\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.5.7\n"
13
+ "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e\n"
14
+ "X-Poedit-Basepath: .\n"
15
+ "X-Poedit-SourceCharset: UTF-8\n"
16
+ "X-Poedit-SearchPath-0: ..\n"
17
+
18
+ #: ../restrict-widgets.php:310
19
+ msgid "Support"
20
+ msgstr "Forum pomocy"
21
+
22
+ #: ../restrict-widgets.php:332 ../restrict-widgets.php:1705
23
+ #: ../restrict-widgets.php:1751
24
+ msgid "Widgets"
25
+ msgstr "Widgety"
26
+
27
+ #: ../restrict-widgets.php:411
28
+ msgid "Pages"
29
+ msgstr "Strony"
30
+
31
+ #: ../restrict-widgets.php:412
32
+ msgid "Custom Post Types"
33
+ msgstr "Własne typy wpisów"
34
+
35
+ #: ../restrict-widgets.php:413
36
+ msgid "Custom Post Type Archives"
37
+ msgstr "Archiwa własnych typów wpisów"
38
+
39
+ #: ../restrict-widgets.php:414
40
+ msgid "Categories"
41
+ msgstr "Kategorie"
42
+
43
+ #: ../restrict-widgets.php:415
44
+ msgid "Taxonomies"
45
+ msgstr "Taksonomie"
46
+
47
+ #: ../restrict-widgets.php:416
48
+ msgid "Others"
49
+ msgstr "Inne"
50
+
51
+ #: ../restrict-widgets.php:423
52
+ msgid "Search"
53
+ msgstr "Strona wyszukiwania"
54
+
55
+ #: ../restrict-widgets.php:424
56
+ msgid "Single User"
57
+ msgstr "Strona użytkownika"
58
+
59
+ #: ../restrict-widgets.php:425
60
+ msgid "Topic Tag"
61
+ msgstr "Tagi tematów"
62
+
63
+ #: ../restrict-widgets.php:428
64
+ msgid "bbPress"
65
+ msgstr "Forum bbPress"
66
+
67
+ #: ../restrict-widgets.php:431
68
+ msgid "Devices"
69
+ msgstr "Urządzenia"
70
+
71
+ #: ../restrict-widgets.php:432
72
+ msgid "Users"
73
+ msgstr "Użytkownicy"
74
+
75
+ #: ../restrict-widgets.php:433
76
+ msgid "Languages"
77
+ msgstr "Języki"
78
+
79
+ #: ../restrict-widgets.php:436
80
+ msgid "Front Page"
81
+ msgstr "Strona główna"
82
+
83
+ #: ../restrict-widgets.php:437
84
+ msgid "Blog Page"
85
+ msgstr "Strona z wpisami"
86
+
87
+ #: ../restrict-widgets.php:438
88
+ msgid "Single Posts"
89
+ msgstr "Pojedyncze wpisy"
90
+
91
+ #: ../restrict-widgets.php:439
92
+ msgid "Sticky Posts"
93
+ msgstr "Wpisy przyklejone"
94
+
95
+ #: ../restrict-widgets.php:440
96
+ msgid "Author Archive"
97
+ msgstr "Archiwum autora"
98
+
99
+ #: ../restrict-widgets.php:441
100
+ msgid "Date Archive"
101
+ msgstr "Archiwum daty"
102
+
103
+ #: ../restrict-widgets.php:442
104
+ msgid "404 Page"
105
+ msgstr "Strona błędów 404"
106
+
107
+ #: ../restrict-widgets.php:443
108
+ msgid "Search Page"
109
+ msgstr "Strona wyszukiwania"
110
+
111
+ #: ../restrict-widgets.php:447
112
+ msgid "Logged in users"
113
+ msgstr "Zalogowani użytkownicy"
114
+
115
+ #: ../restrict-widgets.php:448
116
+ msgid "Logged out users"
117
+ msgstr "Wylogowani użytkownicy"
118
+
119
+ #: ../restrict-widgets.php:452
120
+ msgid "Mobile"
121
+ msgstr "Mobilne"
122
+
123
+ #: ../restrict-widgets.php:453
124
+ msgid "Desktop, Laptop, etc."
125
+ msgstr "Stacjonarne"
126
+
127
+ #: ../restrict-widgets.php:669
128
+ msgid "Restrict widgets"
129
+ msgstr "Ograniczenia widgetów"
130
+
131
+ #: ../restrict-widgets.php:673
132
+ msgid ""
133
+ "Use this settings to manage access to widgets page and to restrict "
134
+ "availability of certain widgets, sidebars and widgets options to site "
135
+ "administrators only."
136
+ msgstr ""
137
+ "Użyj tych ustawień aby określić kto może mieć dostęp do widgetów, jakie "
138
+ "widgety, panele boczne i ustawienia widgetów są dostępne dla użytkowników a "
139
+ "jakie tylko dla administratorów."
140
+
141
+ #: ../restrict-widgets.php:676
142
+ msgid "Restrict Users"
143
+ msgstr "Ograniczenia użytkowników"
144
+
145
+ #: ../restrict-widgets.php:686
146
+ msgid "Select user roles restricted to manage widgets."
147
+ msgstr "Wybierz role użytkowników, którzy mogą zarządzać widgetami."
148
+
149
+ #: ../restrict-widgets.php:690
150
+ msgid "Restrict Sidebars"
151
+ msgstr "Ograniczenia paneli bocznych"
152
+
153
+ #: ../restrict-widgets.php:706
154
+ msgid "Select which sidebars will be restricted to admins only."
155
+ msgstr "Wybierz panele boczne, które będą dostępne tylko dla administratorów."
156
+
157
+ #: ../restrict-widgets.php:710
158
+ msgid "Restrict Widgets"
159
+ msgstr "Ograniczenia widgetów"
160
+
161
+ #: ../restrict-widgets.php:723
162
+ msgid "Select which widgets will be restricted to admins only."
163
+ msgstr "Wybierz widgety, któe będą dostępne tylko dla administratorów."
164
+
165
+ #: ../restrict-widgets.php:727
166
+ msgid "Restrict Widget Options"
167
+ msgstr "Ograniczenia opcji widgetów"
168
+
169
+ #: ../restrict-widgets.php:737
170
+ msgid "Select which widget options will be restricted to admins only."
171
+ msgstr "Wybierz które opcje widgetów, będą dostępne tylko dla administratorów."
172
+
173
+ #: ../restrict-widgets.php:741
174
+ msgid "Restrict Option Groups"
175
+ msgstr "Ograniczenia grup opcji"
176
+
177
+ #: ../restrict-widgets.php:744
178
+ msgid "Display widget options in groups"
179
+ msgstr "Wyświetl opcje widgetów w grupach"
180
+
181
+ #: ../restrict-widgets.php:748
182
+ msgid "Modify is_active_sidebar()"
183
+ msgstr "Modyfikuj is_active_sidebar()"
184
+
185
+ #: ../restrict-widgets.php:751
186
+ msgid ""
187
+ "By default is_active_sidebar() function returns TRUE even if no widget is "
188
+ "displayed in a sidebar. Check this if you want is_active_sidebar() to "
189
+ "recognize Restrict Widgets display settings."
190
+ msgstr ""
191
+ "Domyślnie funkcja is_active_sidebar() zwraca TRUE navet jeśli w danym "
192
+ "sidebarze nie jest wyświetlany żaden widget. Zaznacz to, jeśli chcesz aby "
193
+ "is_active_sidebar() rozpoznawało ustawienia wyświetlania dodawane przez tę "
194
+ "wtyczkę."
195
+
196
+ #: ../restrict-widgets.php:755
197
+ msgid "Plugin Deactivation"
198
+ msgstr "Deaktywacja wtyczki"
199
+
200
+ #: ../restrict-widgets.php:758
201
+ msgid "Remove all plugin data on deactivation"
202
+ msgstr "Usuń wszystkie dane wtyczki podczas deaktywacji"
203
+
204
+ #: ../restrict-widgets.php:762
205
+ msgid "Save settings"
206
+ msgstr "Zapisz ustawienia"
207
+
208
+ #: ../restrict-widgets.php:930 ../restrict-widgets.php:941
209
+ #, php-format
210
+ msgid "Single %s"
211
+ msgstr "Pojedyncze %s"
212
+
213
+ #: ../restrict-widgets.php:968 ../restrict-widgets.php:979
214
+ #, php-format
215
+ msgid "%s Archive"
216
+ msgstr "Archiwum %s"
217
+
218
+ #: ../restrict-widgets.php:1278
219
+ msgid "Display / Hide Widget"
220
+ msgstr "Wyświetl / Ukryj widget"
221
+
222
+ #: ../restrict-widgets.php:1280
223
+ msgid "Display widget on selected"
224
+ msgstr "Wyświetl widget na wybranych stronach"
225
+
226
+ #: ../restrict-widgets.php:1281
227
+ msgid "Hide widget on selected"
228
+ msgstr "Ukryj widget na wybranych stronach"
229
+
230
+ #~ msgid "Created by"
231
+ #~ msgstr "Stworzone przez"
languages/restrict-widgets-zh_CN.po CHANGED
@@ -1,468 +1,468 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: restrict-widgets-zh_CN\n"
4
- "POT-Creation-Date: 2013-06-18 08:22+0800\n"
5
- "PO-Revision-Date: \n"
6
- "Last-Translator: 倡萌@WordPress大学 <admin@cmhello.com>\n"
7
- "Language-Team: 倡萌@WordPress大学 <admin@cmhello.com>\n"
8
- "Language: zh_CN\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.5.5\n"
13
- "Plural-Forms: nplurals=2; plural=(n!=1);\n"
14
- "X-Poedit-SourceCharset: UTF-8\n"
15
- "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c\n"
16
- "X-Poedit-Basepath: .\n"
17
- "X-Poedit-SearchPath-0: ..\n"
18
-
19
- #: ../restrict-widgets.php:103
20
- msgid "Support"
21
- msgstr "支持"
22
-
23
- #: ../restrict-widgets.php:125 ../restrict-widgets.php:1436
24
- #: ../restrict-widgets.php:1481
25
- msgid "Widgets"
26
- msgstr "小工具"
27
-
28
- #: ../restrict-widgets.php:261
29
- msgid "Pages"
30
- msgstr "页面"
31
-
32
- #: ../restrict-widgets.php:262
33
- msgid "Custom Post Types"
34
- msgstr "自定义文章类型"
35
-
36
- #: ../restrict-widgets.php:263
37
- msgid "Custom Post Type Archives"
38
- msgstr "自定义文章类型存档页"
39
-
40
- #: ../restrict-widgets.php:264
41
- msgid "Categories"
42
- msgstr "分类"
43
-
44
- #: ../restrict-widgets.php:265
45
- msgid "Taxonomies"
46
- msgstr "分类法"
47
-
48
- #: ../restrict-widgets.php:266
49
- msgid "Others"
50
- msgstr "其他"
51
-
52
- #: ../restrict-widgets.php:267
53
- msgid "Users"
54
- msgstr "用户"
55
-
56
- #: ../restrict-widgets.php:268
57
- msgid "Languages"
58
- msgstr "语言"
59
-
60
- #: ../restrict-widgets.php:272
61
- msgid "Front Page"
62
- msgstr "主页"
63
-
64
- #: ../restrict-widgets.php:273
65
- msgid "Blog Page"
66
- msgstr "博客页面"
67
-
68
- #: ../restrict-widgets.php:274
69
- msgid "Single Posts"
70
- msgstr "所有文章"
71
-
72
- #: ../restrict-widgets.php:275
73
- msgid "Sticky Posts"
74
- msgstr "置顶文章"
75
-
76
- #: ../restrict-widgets.php:276
77
- msgid "Author Archive"
78
- msgstr "作者存档页"
79
-
80
- #: ../restrict-widgets.php:277
81
- msgid "Date Archive"
82
- msgstr "日期存档页"
83
-
84
- #: ../restrict-widgets.php:278
85
- msgid "404 Page"
86
- msgstr "404页面"
87
-
88
- #: ../restrict-widgets.php:279
89
- msgid "Search Page"
90
- msgstr "搜索结果页面"
91
-
92
- #: ../restrict-widgets.php:283
93
- msgid "Logged in users"
94
- msgstr "已登录用户"
95
-
96
- #: ../restrict-widgets.php:284
97
- msgid "Logged out users"
98
- msgstr "未登录用户"
99
-
100
- #: ../restrict-widgets.php:505
101
- msgid "Restrict widgets"
102
- msgstr "限制小工具"
103
-
104
- #: ../restrict-widgets.php:509
105
- msgid ""
106
- "Use this settings to manage access to widgets page and to restrict "
107
- "availability of certain widgets, sidebars and widgets options to site "
108
- "administrators only."
109
- msgstr ""
110
- "通过下面的设置,来管理小工具页面的访问权限,以及限制管理员使用哪些侧边栏区"
111
- "域、小工具、小工具选项等。"
112
-
113
- #: ../restrict-widgets.php:512
114
- msgid "Restrict Users"
115
- msgstr "限制用户"
116
-
117
- #: ../restrict-widgets.php:522
118
- msgid "Select user roles restricted to manage widgets."
119
- msgstr "选择限制用户角色管理小工具"
120
-
121
- #: ../restrict-widgets.php:526
122
- msgid "Restrict Sidebars"
123
- msgstr "限制侧边栏"
124
-
125
- #: ../restrict-widgets.php:541
126
- msgid "Select which sidebars will be restricted to admins only."
127
- msgstr "选择限制管理员使用哪些侧边栏区域"
128
-
129
- #: ../restrict-widgets.php:545
130
- msgid "Restrict Widgets"
131
- msgstr "限制小工具"
132
-
133
- #: ../restrict-widgets.php:557
134
- msgid "Select which widgets will be restricted to admins only."
135
- msgstr "选择限制管理员使用哪些小工具"
136
-
137
- #: ../restrict-widgets.php:561
138
- msgid "Restrict Widget Options"
139
- msgstr "限制小工具选项"
140
-
141
- #: ../restrict-widgets.php:571
142
- msgid "Select which widget options will be restricted to admins only."
143
- msgstr "选择限制管理员使用哪些小工具选项"
144
-
145
- #: ../restrict-widgets.php:575
146
- msgid "Restrict Option Groups"
147
- msgstr "限制选项组"
148
-
149
- #: ../restrict-widgets.php:578
150
- msgid "Display widget options in groups"
151
- msgstr "分组显示小工具选项"
152
-
153
- #: ../restrict-widgets.php:582
154
- msgid "Plugin Deactivation"
155
- msgstr "插件停用"
156
-
157
- #: ../restrict-widgets.php:585
158
- msgid "Remove all plugin data on deactivation"
159
- msgstr "停用该插件时,删除该插件数据"
160
-
161
- #: ../restrict-widgets.php:589
162
- msgid "Save settings"
163
- msgstr "保存设置"
164
-
165
- #: ../restrict-widgets.php:590
166
- msgid "Created by"
167
- msgstr ""
168
- "简体中文支持:<a href=\"http://www.cmhello.com\" target=\"_blank\">倡萌 </a> "
169
- "@<a href=\"http://www.wpdaxue.com\" target=\"_blank\">WordPress大学</a> | "
170
- "开发者:"
171
-
172
- #: ../restrict-widgets.php:764 ../restrict-widgets.php:774
173
- #, php-format
174
- msgid "Single %s"
175
- msgstr "单个 %s"
176
-
177
- #: ../restrict-widgets.php:804 ../restrict-widgets.php:814
178
- #, php-format
179
- msgid "%s Archive"
180
- msgstr "%s 存档页"
181
-
182
- #: ../restrict-widgets.php:1045
183
- msgid "Display / Hide Widget"
184
- msgstr "显示/隐藏小工具"
185
-
186
- #: ../restrict-widgets.php:1047
187
- msgid "Display widget on selected"
188
- msgstr "在所选项显示小工具"
189
-
190
- #: ../restrict-widgets.php:1048
191
- msgid "Hide widget on selected"
192
- msgstr "在所选项隐藏小工具"
193
-
194
- #~ msgid "Friends Notifications"
195
- #~ msgstr "好友通知"
196
-
197
- #~ msgid "Email Notification"
198
- #~ msgstr "邮件通知"
199
-
200
- #~ msgid "Yes"
201
- #~ msgstr "是"
202
-
203
- #~ msgid "No"
204
- #~ msgstr "否"
205
-
206
- #~ msgid "Receive an email when someone adds you as a friend"
207
- #~ msgstr "当有人添加你为好友,发送邮件通知"
208
-
209
- #~ msgid "Friends"
210
- #~ msgstr "好友"
211
-
212
- #~ msgid "Find Friends"
213
- #~ msgstr "找好友"
214
-
215
- #~ msgid "Friend Requests"
216
- #~ msgstr "好友请求"
217
-
218
- #~ msgid "Friends Settings"
219
- #~ msgstr "好友设置"
220
-
221
- #~ msgid "Cheatin&#8217; uh?"
222
- #~ msgstr "不忠&#8217; 呃?"
223
-
224
- #~ msgid "Friend Removed"
225
- #~ msgstr "删除好友"
226
-
227
- #~ msgid "Friend will be added pending approval."
228
- #~ msgstr "好友将在审核同意后添加"
229
-
230
- #~ msgid "Friend Request Approved"
231
- #~ msgstr "好友请求已同意"
232
-
233
- #~ msgid "Friend Request Rejected"
234
- #~ msgstr "好友请求被拒绝"
235
-
236
- #~ msgid "Quick Message Success."
237
- #~ msgstr "信息发送成功"
238
-
239
- #~ msgid "Quick Message Failed."
240
- #~ msgstr "信息发送失败"
241
-
242
- #~ msgid "Settings saved"
243
- #~ msgstr "保存设置"
244
-
245
- #~ msgid "Email Request Template"
246
- #~ msgstr "邮件请求模板"
247
-
248
- #~ msgid "Email Approval Template"
249
- #~ msgstr "邮件同意模板"
250
-
251
- #~ msgid "Email Rejection Template"
252
- #~ msgstr "邮件拒绝模板"
253
-
254
- #~ msgid ""
255
- #~ "The Friends plugin lets users connect with other users within the "
256
- #~ "WordPress Multisite environment. Once connected friends can send message "
257
- #~ "to each other. Also available is a handy widget to display a user's "
258
- #~ "friends listing"
259
- #~ msgstr ""
260
- #~ "这个好友插件可以让多站点之间的用户相互联系。一旦成为好友,就可以相互间发送"
261
- #~ "信息。当然,也包含一个不错的小工具,用来显示用户的好友列表。"
262
-
263
- #~ msgid ""
264
- #~ "The Friends listing page will show all user your have connections with. "
265
- #~ "From the listing you can send messages to users. Also you can remove "
266
- #~ "users who may have become unfriendly."
267
- #~ msgstr ""
268
- #~ "好友列表页面将显示你所添加的所有好友,你可以通过这个页面给好友发送信息,你"
269
- #~ "还可以删除那些不友好的用户。"
270
-
271
- #~ msgid "<strong>Friend</strong> - This is the user's display name."
272
- #~ msgstr "<strong>好友</strong> - 用户的昵称"
273
-
274
- #~ msgid "<strong>Avatar</strong> - The user's avatar"
275
- #~ msgstr "<strong>头像</strong> - 用户的头像"
276
-
277
- #~ msgid ""
278
- #~ "<strong>Send Message</strong> - Once you are connected to other friends "
279
- #~ "you can send them messages."
280
- #~ msgstr ""
281
- #~ "<strong>发送信息</strong> - 一旦你成功添加对方为好友,就可以给他们发送信息"
282
-
283
- #~ msgid "<strong>View Blog</strong> - View the user's blog"
284
- #~ msgstr "<strong>查看博客</strong> - 查看用户博客"
285
-
286
- #~ msgid "<strong>Remove</strong> - Allows you to remove the user as a friend."
287
- #~ msgstr "<strong>移除</strong> - 允许你删除好友"
288
-
289
- #~ msgid ""
290
- #~ "Using the search on this page you can search for other users within this "
291
- #~ "Multisite system. You can locate other user by searching for Name, Login "
292
- #~ "or Email. Click the Search button and all matching users will be listed. "
293
- #~ "Beside each user will be an Add link which will create a request to the "
294
- #~ "user. The user will need to accept the request to complete the friend "
295
- #~ "connection. Within the list if you see Pending instead of Add this means "
296
- #~ "the friend request has already been sent to this user."
297
- #~ msgstr ""
298
- #~ "通过这个页面搜索,你可以找到这个多站点网络中的其他用户。输入用户姓名、登录"
299
- #~ "名或电子邮件,点击“搜索”按钮,就可以显示符合条件的用户。每个用户都有一"
300
- #~ "个“加为好友”的链接,你可以快速提交好友申请,对方审核通过后就可以了。如果在"
301
- #~ "列表显示“审核中”,而不是“加为好友”,意味着你已经给该用户发送了好友请求。"
302
-
303
- #~ msgid ""
304
- #~ "When another user requests you to be their friend they will be listed on "
305
- #~ "this page. To complete the friend connection you must approve the "
306
- #~ "request. You may also opt to reject the request."
307
- #~ msgstr ""
308
- #~ "当其他用户求情加你为好友时,他们会显示在这个页面。你可以审核同意或者拒绝请"
309
- #~ "求。"
310
-
311
- #~ msgid ""
312
- #~ "This page contains various metaboxes to let you control the email "
313
- #~ "templates used during the friend connection processing."
314
- #~ msgstr ""
315
- #~ "该页面包含各种 Meta 模块,你可以通过它们设计邮件模板,以便在好友链接管理中"
316
- #~ "使用。"
317
-
318
- #~ msgid ""
319
- #~ "<strong>Email Request Template</strong> - This template contains the "
320
- #~ "Subject and Content used when one user requests to be friend's with "
321
- #~ "another user. "
322
- #~ msgstr ""
323
- #~ "<strong>邮件请求模板</strong> - 这个模板是给用户发送好友请求时用的,可以定"
324
- #~ "义邮件主题和内容。"
325
-
326
- #~ msgid ""
327
- #~ "<strong>Email Approval Template</strong> - This template contains the "
328
- #~ "Subject and Content used when one user approves a friend request from "
329
- #~ "another user. "
330
- #~ msgstr ""
331
- #~ "<strong>邮件同意模板</strong> - 这个模板是给用户同意好友请求时用的,可以定"
332
- #~ "义邮件主题和内容。"
333
-
334
- #~ msgid ""
335
- #~ "<strong>Email Rejection Template</strong> - This template contains the "
336
- #~ "Subject and Content used when one user rejects a friend request from "
337
- #~ "another user. "
338
- #~ msgstr ""
339
- #~ "<strong>邮件拒绝模板</strong> - 这个模板是给用户拒绝好友请求时用的,可以定"
340
- #~ "义邮件主题和内容。"
341
-
342
- #~ msgid "Overview"
343
- #~ msgstr "预览"
344
-
345
- #~ msgid "Friend Request"
346
- #~ msgstr "好友请求"
347
-
348
- #~ msgid "Previous Page"
349
- #~ msgstr "上一页"
350
-
351
- #~ msgid "Friend"
352
- #~ msgstr "好友"
353
-
354
- #~ msgid "Avatar"
355
- #~ msgstr "头像"
356
-
357
- #~ msgid "Actions"
358
- #~ msgstr "操作"
359
-
360
- #~ msgid "Send Message"
361
- #~ msgstr "发送信息"
362
-
363
- #~ msgid "View Blog"
364
- #~ msgstr "查看博客"
365
-
366
- #~ msgid "Remove"
367
- #~ msgstr "删除"
368
-
369
- #~ msgid "Your friends list is currently empty"
370
- #~ msgstr "你的好友列表目前是空的"
371
-
372
- #~ msgid "Send Message To"
373
- #~ msgstr "发送信息给"
374
-
375
- #~ msgid "Quick Message"
376
- #~ msgstr "快捷信息"
377
-
378
- #~ msgid "Message"
379
- #~ msgstr "信息"
380
-
381
- #~ msgid "Send"
382
- #~ msgstr "发送"
383
-
384
- #~ msgid "Search by friends display name, username or email address"
385
- #~ msgstr "通过好友的姓名、用户名或邮箱进行搜索"
386
-
387
- #~ msgid "Show existing friends"
388
- #~ msgstr "显示已有好友"
389
-
390
- #~ msgid "Pending"
391
- #~ msgstr "审核中"
392
-
393
- #~ msgid "Add"
394
- #~ msgstr "加为好友"
395
-
396
- #~ msgid "Nothing found"
397
- #~ msgstr "没有相关内容"
398
-
399
- #~ msgid "ID"
400
- #~ msgstr "ID"
401
-
402
- #~ msgid "Approve"
403
- #~ msgstr "同意"
404
-
405
- #~ msgid "Reject"
406
- #~ msgstr "拒绝"
407
-
408
- #~ msgid "No pending Friend requests"
409
- #~ msgstr "没有待审的好友请求"
410
-
411
- #~ msgctxt "Friends Plugin Page Title"
412
- #~ msgid "Friends Settings"
413
- #~ msgstr "好友设置"
414
-
415
- #~ msgid ""
416
- #~ "This Email template is used when one user requests to be friends with "
417
- #~ "another user."
418
- #~ msgstr "这个邮件模板是用来给用户发送好友请求时用的"
419
-
420
- #~ msgid "Save Changes"
421
- #~ msgstr "保存更改"
422
-
423
- #~ msgid "Reset to Default"
424
- #~ msgstr "恢复默认"
425
-
426
- #~ msgid ""
427
- #~ "This Email template is used when a user receives a request from another "
428
- #~ "user to become friends. And the user approves the friend request."
429
- #~ msgstr ""
430
- #~ "这个邮件模板是当一个用户接收到其他用户的好友请求,用户同意请求时用的。"
431
-
432
- #~ msgid ""
433
- #~ "This Email template is used when a user receives a request from another "
434
- #~ "user to become friends. And the user reject the friend request."
435
- #~ msgstr ""
436
- #~ "这个邮件模板是当一个用户接收到其他用户的好友请求,用户拒绝请求时用的。"
437
-
438
- #~ msgid ""
439
- #~ "Instructions: Use the following replaceable tokens in your message. These "
440
- #~ "will be replaced with the real information for user, site, content, etc.. "
441
- #~ "Note all tokens are wrapped in square brackets."
442
- #~ msgstr ""
443
- #~ "说明:在信息中使用以下可用变量,它们将在邮件中被替换为真正的用户、网站、内"
444
- #~ "容 等。注意:所有的变量都要放在方括号[ ]中。"
445
-
446
- #~ msgid "The name of the sender's primary site"
447
- #~ msgstr "发件人的主站点的名称"
448
-
449
- #~ msgid "The URL of the sender's primary site"
450
- #~ msgstr "发件人的主站点的URL"
451
-
452
- #~ msgid "The user name requesting friendship."
453
- #~ msgstr "好友请求的用户名"
454
-
455
- #~ msgid "The user name being friended."
456
- #~ msgstr "好友的用户名"
457
-
458
- #~ msgid "The TO_USER primary site admin page for the Friend Request."
459
- #~ msgstr "好友请求的TO_USER主站点的管理页面"
460
-
461
- #~ msgid "Display"
462
- #~ msgstr "显示"
463
-
464
- #~ msgid "Mosaic"
465
- #~ msgstr "嵌套"
466
-
467
- #~ msgid "List"
468
- #~ msgstr "列表"
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: restrict-widgets-zh_CN\n"
4
+ "POT-Creation-Date: 2013-06-18 08:22+0800\n"
5
+ "PO-Revision-Date: \n"
6
+ "Last-Translator: 倡萌@WordPress大学 <admin@cmhello.com>\n"
7
+ "Language-Team: 倡萌@WordPress大学 <admin@cmhello.com>\n"
8
+ "Language: zh_CN\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.5.5\n"
13
+ "Plural-Forms: nplurals=2; plural=(n!=1);\n"
14
+ "X-Poedit-SourceCharset: UTF-8\n"
15
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c\n"
16
+ "X-Poedit-Basepath: .\n"
17
+ "X-Poedit-SearchPath-0: ..\n"
18
+
19
+ #: ../restrict-widgets.php:103
20
+ msgid "Support"
21
+ msgstr "支持"
22
+
23
+ #: ../restrict-widgets.php:125 ../restrict-widgets.php:1436
24
+ #: ../restrict-widgets.php:1481
25
+ msgid "Widgets"
26
+ msgstr "小工具"
27
+
28
+ #: ../restrict-widgets.php:261
29
+ msgid "Pages"
30
+ msgstr "页面"
31
+
32
+ #: ../restrict-widgets.php:262
33
+ msgid "Custom Post Types"
34
+ msgstr "自定义文章类型"
35
+
36
+ #: ../restrict-widgets.php:263
37
+ msgid "Custom Post Type Archives"
38
+ msgstr "自定义文章类型存档页"
39
+
40
+ #: ../restrict-widgets.php:264
41
+ msgid "Categories"
42
+ msgstr "分类"
43
+
44
+ #: ../restrict-widgets.php:265
45
+ msgid "Taxonomies"
46
+ msgstr "分类法"
47
+
48
+ #: ../restrict-widgets.php:266
49
+ msgid "Others"
50
+ msgstr "其他"
51
+
52
+ #: ../restrict-widgets.php:267
53
+ msgid "Users"
54
+ msgstr "用户"
55
+
56
+ #: ../restrict-widgets.php:268
57
+ msgid "Languages"
58
+ msgstr "语言"
59
+
60
+ #: ../restrict-widgets.php:272
61
+ msgid "Front Page"
62
+ msgstr "主页"
63
+
64
+ #: ../restrict-widgets.php:273
65
+ msgid "Blog Page"
66
+ msgstr "博客页面"
67
+
68
+ #: ../restrict-widgets.php:274
69
+ msgid "Single Posts"
70
+ msgstr "所有文章"
71
+
72
+ #: ../restrict-widgets.php:275
73
+ msgid "Sticky Posts"
74
+ msgstr "置顶文章"
75
+
76
+ #: ../restrict-widgets.php:276
77
+ msgid "Author Archive"
78
+ msgstr "作者存档页"
79
+
80
+ #: ../restrict-widgets.php:277
81
+ msgid "Date Archive"
82
+ msgstr "日期存档页"
83
+
84
+ #: ../restrict-widgets.php:278
85
+ msgid "404 Page"
86
+ msgstr "404页面"
87
+
88
+ #: ../restrict-widgets.php:279
89
+ msgid "Search Page"
90
+ msgstr "搜索结果页面"
91
+
92
+ #: ../restrict-widgets.php:283
93
+ msgid "Logged in users"
94
+ msgstr "已登录用户"
95
+
96
+ #: ../restrict-widgets.php:284
97
+ msgid "Logged out users"
98
+ msgstr "未登录用户"
99
+
100
+ #: ../restrict-widgets.php:505
101
+ msgid "Restrict widgets"
102
+ msgstr "限制小工具"
103
+
104
+ #: ../restrict-widgets.php:509
105
+ msgid ""
106
+ "Use this settings to manage access to widgets page and to restrict "
107
+ "availability of certain widgets, sidebars and widgets options to site "
108
+ "administrators only."
109
+ msgstr ""
110
+ "通过下面的设置,来管理小工具页面的访问权限,以及限制管理员使用哪些侧边栏区"
111
+ "域、小工具、小工具选项等。"
112
+
113
+ #: ../restrict-widgets.php:512
114
+ msgid "Restrict Users"
115
+ msgstr "限制用户"
116
+
117
+ #: ../restrict-widgets.php:522
118
+ msgid "Select user roles restricted to manage widgets."
119
+ msgstr "选择限制用户角色管理小工具"
120
+
121
+ #: ../restrict-widgets.php:526
122
+ msgid "Restrict Sidebars"
123
+ msgstr "限制侧边栏"
124
+
125
+ #: ../restrict-widgets.php:541
126
+ msgid "Select which sidebars will be restricted to admins only."
127
+ msgstr "选择限制管理员使用哪些侧边栏区域"
128
+
129
+ #: ../restrict-widgets.php:545
130
+ msgid "Restrict Widgets"
131
+ msgstr "限制小工具"
132
+
133
+ #: ../restrict-widgets.php:557
134
+ msgid "Select which widgets will be restricted to admins only."
135
+ msgstr "选择限制管理员使用哪些小工具"
136
+
137
+ #: ../restrict-widgets.php:561
138
+ msgid "Restrict Widget Options"
139
+ msgstr "限制小工具选项"
140
+
141
+ #: ../restrict-widgets.php:571
142
+ msgid "Select which widget options will be restricted to admins only."
143
+ msgstr "选择限制管理员使用哪些小工具选项"
144
+
145
+ #: ../restrict-widgets.php:575
146
+ msgid "Restrict Option Groups"
147
+ msgstr "限制选项组"
148
+
149
+ #: ../restrict-widgets.php:578
150
+ msgid "Display widget options in groups"
151
+ msgstr "分组显示小工具选项"
152
+
153
+ #: ../restrict-widgets.php:582
154
+ msgid "Plugin Deactivation"
155
+ msgstr "插件停用"
156
+
157
+ #: ../restrict-widgets.php:585
158
+ msgid "Remove all plugin data on deactivation"
159
+ msgstr "停用该插件时,删除该插件数据"
160
+
161
+ #: ../restrict-widgets.php:589
162
+ msgid "Save settings"
163
+ msgstr "保存设置"
164
+
165
+ #: ../restrict-widgets.php:590
166
+ msgid "Created by"
167
+ msgstr ""
168
+ "简体中文支持:<a href=\"http://www.cmhello.com\" target=\"_blank\">倡萌 </a> "
169
+ "@<a href=\"http://www.wpdaxue.com\" target=\"_blank\">WordPress大学</a> | "
170
+ "开发者:"
171
+
172
+ #: ../restrict-widgets.php:764 ../restrict-widgets.php:774
173
+ #, php-format
174
+ msgid "Single %s"
175
+ msgstr "单个 %s"
176
+
177
+ #: ../restrict-widgets.php:804 ../restrict-widgets.php:814
178
+ #, php-format
179
+ msgid "%s Archive"
180
+ msgstr "%s 存档页"
181
+
182
+ #: ../restrict-widgets.php:1045
183
+ msgid "Display / Hide Widget"
184
+ msgstr "显示/隐藏小工具"
185
+
186
+ #: ../restrict-widgets.php:1047
187
+ msgid "Display widget on selected"
188
+ msgstr "在所选项显示小工具"
189
+
190
+ #: ../restrict-widgets.php:1048
191
+ msgid "Hide widget on selected"
192
+ msgstr "在所选项隐藏小工具"
193
+
194
+ #~ msgid "Friends Notifications"
195
+ #~ msgstr "好友通知"
196
+
197
+ #~ msgid "Email Notification"
198
+ #~ msgstr "邮件通知"
199
+
200
+ #~ msgid "Yes"
201
+ #~ msgstr "是"
202
+
203
+ #~ msgid "No"
204
+ #~ msgstr "否"
205
+
206
+ #~ msgid "Receive an email when someone adds you as a friend"
207
+ #~ msgstr "当有人添加你为好友,发送邮件通知"
208
+
209
+ #~ msgid "Friends"
210
+ #~ msgstr "好友"
211
+
212
+ #~ msgid "Find Friends"
213
+ #~ msgstr "找好友"
214
+
215
+ #~ msgid "Friend Requests"
216
+ #~ msgstr "好友请求"
217
+
218
+ #~ msgid "Friends Settings"
219
+ #~ msgstr "好友设置"
220
+
221
+ #~ msgid "Cheatin&#8217; uh?"
222
+ #~ msgstr "不忠&#8217; 呃?"
223
+
224
+ #~ msgid "Friend Removed"
225
+ #~ msgstr "删除好友"
226
+
227
+ #~ msgid "Friend will be added pending approval."
228
+ #~ msgstr "好友将在审核同意后添加"
229
+
230
+ #~ msgid "Friend Request Approved"
231
+ #~ msgstr "好友请求已同意"
232
+
233
+ #~ msgid "Friend Request Rejected"
234
+ #~ msgstr "好友请求被拒绝"
235
+
236
+ #~ msgid "Quick Message Success."
237
+ #~ msgstr "信息发送成功"
238
+
239
+ #~ msgid "Quick Message Failed."
240
+ #~ msgstr "信息发送失败"
241
+
242
+ #~ msgid "Settings saved"
243
+ #~ msgstr "保存设置"
244
+
245
+ #~ msgid "Email Request Template"
246
+ #~ msgstr "邮件请求模板"
247
+
248
+ #~ msgid "Email Approval Template"
249
+ #~ msgstr "邮件同意模板"
250
+
251
+ #~ msgid "Email Rejection Template"
252
+ #~ msgstr "邮件拒绝模板"
253
+
254
+ #~ msgid ""
255
+ #~ "The Friends plugin lets users connect with other users within the "
256
+ #~ "WordPress Multisite environment. Once connected friends can send message "
257
+ #~ "to each other. Also available is a handy widget to display a user's "
258
+ #~ "friends listing"
259
+ #~ msgstr ""
260
+ #~ "这个好友插件可以让多站点之间的用户相互联系。一旦成为好友,就可以相互间发送"
261
+ #~ "信息。当然,也包含一个不错的小工具,用来显示用户的好友列表。"
262
+
263
+ #~ msgid ""
264
+ #~ "The Friends listing page will show all user your have connections with. "
265
+ #~ "From the listing you can send messages to users. Also you can remove "
266
+ #~ "users who may have become unfriendly."
267
+ #~ msgstr ""
268
+ #~ "好友列表页面将显示你所添加的所有好友,你可以通过这个页面给好友发送信息,你"
269
+ #~ "还可以删除那些不友好的用户。"
270
+
271
+ #~ msgid "<strong>Friend</strong> - This is the user's display name."
272
+ #~ msgstr "<strong>好友</strong> - 用户的昵称"
273
+
274
+ #~ msgid "<strong>Avatar</strong> - The user's avatar"
275
+ #~ msgstr "<strong>头像</strong> - 用户的头像"
276
+
277
+ #~ msgid ""
278
+ #~ "<strong>Send Message</strong> - Once you are connected to other friends "
279
+ #~ "you can send them messages."
280
+ #~ msgstr ""
281
+ #~ "<strong>发送信息</strong> - 一旦你成功添加对方为好友,就可以给他们发送信息"
282
+
283
+ #~ msgid "<strong>View Blog</strong> - View the user's blog"
284
+ #~ msgstr "<strong>查看博客</strong> - 查看用户博客"
285
+
286
+ #~ msgid "<strong>Remove</strong> - Allows you to remove the user as a friend."
287
+ #~ msgstr "<strong>移除</strong> - 允许你删除好友"
288
+
289
+ #~ msgid ""
290
+ #~ "Using the search on this page you can search for other users within this "
291
+ #~ "Multisite system. You can locate other user by searching for Name, Login "
292
+ #~ "or Email. Click the Search button and all matching users will be listed. "
293
+ #~ "Beside each user will be an Add link which will create a request to the "
294
+ #~ "user. The user will need to accept the request to complete the friend "
295
+ #~ "connection. Within the list if you see Pending instead of Add this means "
296
+ #~ "the friend request has already been sent to this user."
297
+ #~ msgstr ""
298
+ #~ "通过这个页面搜索,你可以找到这个多站点网络中的其他用户。输入用户姓名、登录"
299
+ #~ "名或电子邮件,点击“搜索”按钮,就可以显示符合条件的用户。每个用户都有一"
300
+ #~ "个“加为好友”的链接,你可以快速提交好友申请,对方审核通过后就可以了。如果在"
301
+ #~ "列表显示“审核中”,而不是“加为好友”,意味着你已经给该用户发送了好友请求。"
302
+
303
+ #~ msgid ""
304
+ #~ "When another user requests you to be their friend they will be listed on "
305
+ #~ "this page. To complete the friend connection you must approve the "
306
+ #~ "request. You may also opt to reject the request."
307
+ #~ msgstr ""
308
+ #~ "当其他用户求情加你为好友时,他们会显示在这个页面。你可以审核同意或者拒绝请"
309
+ #~ "求。"
310
+
311
+ #~ msgid ""
312
+ #~ "This page contains various metaboxes to let you control the email "
313
+ #~ "templates used during the friend connection processing."
314
+ #~ msgstr ""
315
+ #~ "该页面包含各种 Meta 模块,你可以通过它们设计邮件模板,以便在好友链接管理中"
316
+ #~ "使用。"
317
+
318
+ #~ msgid ""
319
+ #~ "<strong>Email Request Template</strong> - This template contains the "
320
+ #~ "Subject and Content used when one user requests to be friend's with "
321
+ #~ "another user. "
322
+ #~ msgstr ""
323
+ #~ "<strong>邮件请求模板</strong> - 这个模板是给用户发送好友请求时用的,可以定"
324
+ #~ "义邮件主题和内容。"
325
+
326
+ #~ msgid ""
327
+ #~ "<strong>Email Approval Template</strong> - This template contains the "
328
+ #~ "Subject and Content used when one user approves a friend request from "
329
+ #~ "another user. "
330
+ #~ msgstr ""
331
+ #~ "<strong>邮件同意模板</strong> - 这个模板是给用户同意好友请求时用的,可以定"
332
+ #~ "义邮件主题和内容。"
333
+
334
+ #~ msgid ""
335
+ #~ "<strong>Email Rejection Template</strong> - This template contains the "
336
+ #~ "Subject and Content used when one user rejects a friend request from "
337
+ #~ "another user. "
338
+ #~ msgstr ""
339
+ #~ "<strong>邮件拒绝模板</strong> - 这个模板是给用户拒绝好友请求时用的,可以定"
340
+ #~ "义邮件主题和内容。"
341
+
342
+ #~ msgid "Overview"
343
+ #~ msgstr "预览"
344
+
345
+ #~ msgid "Friend Request"
346
+ #~ msgstr "好友请求"
347
+
348
+ #~ msgid "Previous Page"
349
+ #~ msgstr "上一页"
350
+
351
+ #~ msgid "Friend"
352
+ #~ msgstr "好友"
353
+
354
+ #~ msgid "Avatar"
355
+ #~ msgstr "头像"
356
+
357
+ #~ msgid "Actions"
358
+ #~ msgstr "操作"
359
+
360
+ #~ msgid "Send Message"
361
+ #~ msgstr "发送信息"
362
+
363
+ #~ msgid "View Blog"
364
+ #~ msgstr "查看博客"
365
+
366
+ #~ msgid "Remove"
367
+ #~ msgstr "删除"
368
+
369
+ #~ msgid "Your friends list is currently empty"
370
+ #~ msgstr "你的好友列表目前是空的"
371
+
372
+ #~ msgid "Send Message To"
373
+ #~ msgstr "发送信息给"
374
+
375
+ #~ msgid "Quick Message"
376
+ #~ msgstr "快捷信息"
377
+
378
+ #~ msgid "Message"
379
+ #~ msgstr "信息"
380
+
381
+ #~ msgid "Send"
382
+ #~ msgstr "发送"
383
+
384
+ #~ msgid "Search by friends display name, username or email address"
385
+ #~ msgstr "通过好友的姓名、用户名或邮箱进行搜索"
386
+
387
+ #~ msgid "Show existing friends"
388
+ #~ msgstr "显示已有好友"
389
+
390
+ #~ msgid "Pending"
391
+ #~ msgstr "审核中"
392
+
393
+ #~ msgid "Add"
394
+ #~ msgstr "加为好友"
395
+
396
+ #~ msgid "Nothing found"
397
+ #~ msgstr "没有相关内容"
398
+
399
+ #~ msgid "ID"
400
+ #~ msgstr "ID"
401
+
402
+ #~ msgid "Approve"
403
+ #~ msgstr "同意"
404
+
405
+ #~ msgid "Reject"
406
+ #~ msgstr "拒绝"
407
+
408
+ #~ msgid "No pending Friend requests"
409
+ #~ msgstr "没有待审的好友请求"
410
+
411
+ #~ msgctxt "Friends Plugin Page Title"
412
+ #~ msgid "Friends Settings"
413
+ #~ msgstr "好友设置"
414
+
415
+ #~ msgid ""
416
+ #~ "This Email template is used when one user requests to be friends with "
417
+ #~ "another user."
418
+ #~ msgstr "这个邮件模板是用来给用户发送好友请求时用的"
419
+
420
+ #~ msgid "Save Changes"
421
+ #~ msgstr "保存更改"
422
+
423
+ #~ msgid "Reset to Default"
424
+ #~ msgstr "恢复默认"
425
+
426
+ #~ msgid ""
427
+ #~ "This Email template is used when a user receives a request from another "
428
+ #~ "user to become friends. And the user approves the friend request."
429
+ #~ msgstr ""
430
+ #~ "这个邮件模板是当一个用户接收到其他用户的好友请求,用户同意请求时用的。"
431
+
432
+ #~ msgid ""
433
+ #~ "This Email template is used when a user receives a request from another "
434
+ #~ "user to become friends. And the user reject the friend request."
435
+ #~ msgstr ""
436
+ #~ "这个邮件模板是当一个用户接收到其他用户的好友请求,用户拒绝请求时用的。"
437
+
438
+ #~ msgid ""
439
+ #~ "Instructions: Use the following replaceable tokens in your message. These "
440
+ #~ "will be replaced with the real information for user, site, content, etc.. "
441
+ #~ "Note all tokens are wrapped in square brackets."
442
+ #~ msgstr ""
443
+ #~ "说明:在信息中使用以下可用变量,它们将在邮件中被替换为真正的用户、网站、内"
444
+ #~ "容 等。注意:所有的变量都要放在方括号[ ]中。"
445
+
446
+ #~ msgid "The name of the sender's primary site"
447
+ #~ msgstr "发件人的主站点的名称"
448
+
449
+ #~ msgid "The URL of the sender's primary site"
450
+ #~ msgstr "发件人的主站点的URL"
451
+
452
+ #~ msgid "The user name requesting friendship."
453
+ #~ msgstr "好友请求的用户名"
454
+
455
+ #~ msgid "The user name being friended."
456
+ #~ msgstr "好友的用户名"
457
+
458
+ #~ msgid "The TO_USER primary site admin page for the Friend Request."
459
+ #~ msgstr "好友请求的TO_USER主站点的管理页面"
460
+
461
+ #~ msgid "Display"
462
+ #~ msgstr "显示"
463
+
464
+ #~ msgid "Mosaic"
465
+ #~ msgstr "嵌套"
466
+
467
+ #~ msgid "List"
468
+ #~ msgstr "列表"
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: dfactory
3
  Donate link: http://www.dfactory.eu/
4
  Tags: widget, widgets, widget-only, cms, conditional tags, conditional, widget logic, widget context, restrict, manage, management, capability, capabilities, sidebar, sidebars, user, permission, permissions
5
- Requires at least: 3.8
6
- Tested up to: 4.1.2
7
- Stable tag: 1.2.9
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -59,6 +59,12 @@ No questions yet.
59
 
60
  == Changelog ==
61
 
 
 
 
 
 
 
62
  = 1.2.9 =
63
  * New: Italian translation by [Davide Pante](http://sododesign.it/)
64
 
@@ -129,5 +135,6 @@ Initial release
129
 
130
  == Upgrade Notice ==
131
 
132
- = 1.2.9 =
133
- * New: Italian translation by [Davide Pante](http://sododesign.it/)
 
2
  Contributors: dfactory
3
  Donate link: http://www.dfactory.eu/
4
  Tags: widget, widgets, widget-only, cms, conditional tags, conditional, widget logic, widget context, restrict, manage, management, capability, capabilities, sidebar, sidebars, user, permission, permissions
5
+ Requires at least: 3.0
6
+ Tested up to: 4.5.2
7
+ Stable tag: 1.3.0
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
59
 
60
  == Changelog ==
61
 
62
+ = 1.3.0 =
63
+ * New: Customizer support
64
+ * New: Dedicated options page
65
+ * Tweak: Switched from Chosen.js to Select2 script
66
+ * Tweak: General code cleanup
67
+
68
  = 1.2.9 =
69
  * New: Italian translation by [Davide Pante](http://sododesign.it/)
70
 
135
 
136
  == Upgrade Notice ==
137
 
138
+ = 1.3.0 =
139
+ * New: Customizer support
140
+ * New: Dedicated options page
restrict-widgets.php CHANGED
@@ -1,1820 +1,1659 @@
1
- <?php
2
- /*
3
- Plugin Name: Restrict Widgets
4
- Description: All in one solution for widget management in WordPress. Allows you to hide or display widgets on specified pages and restrict access for users.
5
- Version: 1.2.9
6
- Author: dFactory
7
- Author URI: http://www.dfactory.eu/
8
- Plugin URI: http://www.dfactory.eu/plugins/restrict-widgets/
9
- License: MIT License
10
- License URI: http://opensource.org/licenses/MIT
11
- Text Domain: restrict-widgets
12
- Domain Path: /languages
13
-
14
- Restrict Widgets
15
- Copyright (C) 2013, Digital Factory - info@digitalfactory.pl
16
-
17
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
18
-
19
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
- */
23
-
24
- if(!defined('ABSPATH')) exit; // Exit if accessed directly
25
-
26
- define('RESTRICT_WIDGETS_URL', plugins_url('', __FILE__));
27
- define('RESTRICT_WIDGETS_REL_PATH', dirname(plugin_basename(__FILE__)).'/');
28
-
29
- $restrict_widgets = new Restrict_Widgets();
30
-
31
- class Restrict_Widgets
32
- {
33
- private $pages = array();
34
- private $custom_post_types = array();
35
- private $custom_post_types_archives = array();
36
- private $categories = array();
37
- private $taxonomies = array();
38
- private $devices = array();
39
- private $bbpress = array();
40
- private $others = array();
41
- private $users = array();
42
- private $languages = array();
43
- private $options = array();
44
- private $hidden_widget = '';
45
- private $checked_widget = '';
46
- private $widgets = array();
47
- private $bbpress_active = false;
48
- private $polylang_active = false;
49
- private $wpml_active = false;
50
-
51
-
52
- public function __construct()
53
- {
54
- register_activation_hook(__FILE__, array(&$this, 'multisite_activation'));
55
- register_deactivation_hook(__FILE__, array(&$this, 'multisite_deactivation'));
56
-
57
- //actions
58
- add_action('wp_loaded', array(&$this, 'polylang_widgets'), 6);
59
- add_action('wp_head', array(&$this, 'restrict_sidebar_widgets'), 10);
60
- add_action('plugins_loaded', array(&$this, 'load_textdomain'));
61
- add_action('widgets_init', array(&$this, 'load_other_data'), 10);
62
- add_action('widgets_init', array(&$this, 'init_restrict_sidebars'), 11);
63
- add_action('admin_init', array(&$this, 'load_dynamic_data'));
64
- add_action('admin_init', array(&$this, 'save_restrict_options'));
65
- add_action('sidebar_admin_page', array(&$this, 'add_widgets_options_box'));
66
- add_action('in_widget_form', array(&$this, 'display_admin_widgets_options'), 99, 3);
67
- add_action('admin_enqueue_scripts', array(&$this, 'widgets_scripts_styles'));
68
- add_action('admin_menu', array(&$this, 'manage_widgets_menu'));
69
-
70
- //filters
71
- add_filter('widget_display_callback', array(&$this, 'display_frontend_widgets'), 10, 3);
72
- add_filter('widget_update_callback', array(&$this, 'update_admin_widgets_options'), 10, 3);
73
- add_filter('user_has_cap', array(&$this, 'manage_widgets_cap'), 10, 3);
74
- add_filter('dynamic_sidebar_params', array(&$this, 'restrict_sidebar_params'), 10, 3);
75
- add_filter('plugin_row_meta', array(&$this, 'plugin_extend_links'), 10, 2);
76
- add_filter('plugin_action_links', array(&$this, 'plugin_settings_link'), 10, 2);
77
- }
78
-
79
-
80
- /**
81
- * Multisite activation
82
- */
83
- public function multisite_activation($networkwide)
84
- {
85
- if(is_multisite() && $networkwide)
86
- {
87
- global $wpdb;
88
-
89
- $activated_blogs = array();
90
- $current_blog_id = get_current_blog_id();
91
- $blogs_ids = $wpdb->get_col($wpdb->prepare('SELECT blog_id FROM '.$wpdb->blogs, ''));
92
-
93
- foreach($blogs_ids as $blog_id)
94
- {
95
- switch_to_blog($blog_id);
96
- $this->activate_single();
97
- $activated_blogs[] = (int)$blog_id;
98
- }
99
-
100
- switch_to_blog($current_blog_id);
101
- update_site_option('restrict_widgets_activated_blogs', $activated_blogs, array());
102
- }
103
- else
104
- $this->activate_single();
105
- }
106
-
107
-
108
- /**
109
- * Activation
110
- */
111
- public function activate_single()
112
- {
113
- $role = get_role('administrator');
114
- $role->add_cap('manage_widgets');
115
-
116
- //default settings
117
- add_option(
118
- 'rw_widgets_options',
119
- array(
120
- 'available' => array(),
121
- 'selection' => array(),
122
- 'sidebars' => array(),
123
- 'groups' => true,
124
- 'deactivation' => false,
125
- ),
126
- '',
127
- 'no'
128
- );
129
- }
130
-
131
-
132
- /**
133
- * Multisite deactivation
134
- */
135
- public function multisite_deactivation($networkwide)
136
- {
137
- if(is_multisite() && $networkwide)
138
- {
139
- global $wpdb;
140
-
141
- $current_blog_id = get_current_blog_id();
142
- $blogs_ids = $wpdb->get_col($wpdb->prepare('SELECT blog_id FROM '.$wpdb->blogs, ''));
143
-
144
- if(($activated_blogs = get_site_option('restrict_widgets_activated_blogs', false, false)) === false)
145
- $activated_blogs = array();
146
-
147
- foreach($blogs_ids as $blog_id)
148
- {
149
- switch_to_blog($blog_id);
150
- $this->deactivate_single();
151
-
152
- if(in_array((int)$blog_id, $activated_blogs, true))
153
- unset($activated_blogs[array_search($blog_id, $activated_blogs)]);
154
- }
155
-
156
- switch_to_blog($current_blog_id);
157
- update_site_option('restrict_widgets_activated_blogs', $activated_blogs);
158
- }
159
- else
160
- $this->deactivate_single();
161
- }
162
-
163
-
164
- /**
165
- * Deactivation
166
- */
167
- public function deactivate_single()
168
- {
169
- $option = get_option('rw_widgets_options');
170
-
171
- if($option['deactivation'] === true)
172
- {
173
- global $wp_roles, $wp_registered_widgets;
174
-
175
- //removes roles
176
- foreach($wp_roles->roles as $role_name => $empty)
177
- {
178
- $role = get_role($role_name);
179
- $role->remove_cap('manage_widgets');
180
- }
181
-
182
- //clears all widgets
183
- foreach($wp_registered_widgets as $widget)
184
- {
185
- if(isset($widget['params'][0]['number']) && $widget['params'][0]['number'] !== -1)
186
- {
187
- $option = get_option($widget['callback'][0]->option_name);
188
- unset($option[$widget['params'][0]['number']]['rw_opt']);
189
- update_option($widget['callback'][0]->option_name, $option);
190
- }
191
- }
192
-
193
- delete_option('rw_widgets_options');
194
- }
195
- }
196
-
197
-
198
- /**
199
- * Fix for is_active_sidebar (all hidden widgets on sidebar = false)
200
- */
201
- public function restrict_sidebar_widgets()
202
- {
203
- if(!is_admin())
204
- {
205
- $options = get_option('rw_widgets_options');
206
-
207
- if(isset($options['sidebar']) && $options['sidebar'] === true)
208
- {
209
- global $wp_registered_widgets, $_wp_sidebars_widgets;
210
-
211
- $widgets_c = $instance = array();
212
-
213
- foreach($wp_registered_widgets as $widget)
214
- {
215
- if(isset($widget['callback'][0]->option_name) && $widget['callback'][0]->option_name !== '' && empty($widgets_classes[$widget['callback'][0]->option_name]))
216
- $widgets_c[$widget['callback'][0]->option_name] = get_option($widget['callback'][0]->option_name);
217
- }
218
-
219
- foreach($widgets_c as $widget_base_id => $widgets)
220
- {
221
- if(is_array($widgets))
222
- {
223
- foreach($widgets as $widget_id => $widget)
224
- {
225
- if(is_int($widget_id))
226
- $instance[$widget_base_id.'-'.$widget_id] = $widget;
227
- }
228
- }
229
- }
230
-
231
- if(!empty($instance))
232
- {
233
- foreach($instance as $widget_id => $widget)
234
- {
235
- $this->widgets[substr($widget_id, 7)] = $this->restrict_widget($widget, false, array('widget_id' => substr($widget_id, 7)));
236
- }
237
- }
238
-
239
- if(!empty($this->widgets))
240
- {
241
- $widgets_c = $_wp_sidebars_widgets;
242
-
243
- if(!empty($widgets_c))
244
- {
245
- foreach($widgets_c as $sidebar => $s_widgets)
246
- {
247
- if(!empty($s_widgets) && is_array($s_widgets))
248
- {
249
- foreach($s_widgets as $widget)
250
- {
251
- if($this->widgets[$widget] === false && ($widget_key = array_search($widget, $_wp_sidebars_widgets[$sidebar])) !== false)
252
- unset($_wp_sidebars_widgets[$sidebar][$widget_key]);
253
- }
254
- }
255
- }
256
- }
257
- }
258
- }
259
- }
260
- }
261
-
262
-
263
- /**
264
- * Fix for Polylang - removes language switcher in widgets
265
- */
266
- public function polylang_widgets()
267
- {
268
- if($this->polylang_active === true)
269
- {
270
- global $polylang;
271
-
272
- if(has_action('in_widget_form', array($polylang, 'in_widget_form')))
273
- remove_action('in_widget_form', array($polylang, 'in_widget_form'));
274
- }
275
- }
276
-
277
-
278
- /**
279
- * Loads textdomain
280
- */
281
- public function load_textdomain()
282
- {
283
- load_plugin_textdomain('restrict-widgets', false, RESTRICT_WIDGETS_REL_PATH.'languages/');
284
-
285
- if(class_exists('bbPress'))
286
- $this->bbpress_active = true;
287
-
288
- if(class_exists('Polylang'))
289
- $this->polylang_active = true;
290
-
291
- if(class_exists('SitePress'))
292
- $this->wpml_active = true;
293
- }
294
-
295
-
296
- /**
297
- * Add links to Support Forum
298
- */
299
- public function plugin_extend_links($links, $file)
300
- {
301
- if(!current_user_can('install_plugins'))
302
- return $links;
303
-
304
- $plugin = plugin_basename(__FILE__);
305
-
306
- if($file == $plugin)
307
- {
308
- return array_merge(
309
- $links,
310
- array(sprintf('<a href="http://www.dfactory.eu/support/forum/restrict-widgets/" target="_blank">%s</a>', __('Support', 'restrict-widgets')))
311
- );
312
- }
313
-
314
- return $links;
315
- }
316
-
317
-
318
- /**
319
- * Add links to Settings page
320
- */
321
- function plugin_settings_link($links, $file)
322
- {
323
- if(!is_admin() || !current_user_can('edit_theme_options'))
324
- return $links;
325
-
326
- static $plugin;
327
-
328
- $plugin = plugin_basename(__FILE__);
329
-
330
- if($file == $plugin)
331
- {
332
- $settings_link = sprintf('<a href="%s">%s</a>', admin_url('widgets.php'), __('Widgets', 'restrict-widgets'));
333
- array_unshift($links, $settings_link);
334
- }
335
-
336
- return $links;
337
- }
338
-
339
-
340
- /**
341
- * Hides widgets for users without admin privileges
342
- */
343
- public function restrict_sidebar_params($params)
344
- {
345
- if(!current_user_can('manage_options'))
346
- {
347
- global $wp_registered_widgets;
348
-
349
- $option = get_option('rw_widgets_options');
350
-
351
- if(
352
- //standard based widget class
353
- (isset($wp_registered_widgets[$params[0]['widget_id']]['callback'][0]) && is_object($wp_registered_widgets[$params[0]['widget_id']]['callback'][0]) && in_array(get_class($wp_registered_widgets[$params[0]['widget_id']]['callback'][0]), array_keys($option['available']))) ||
354
-
355
- //non-standard based widget
356
- (isset($wp_registered_widgets[$params[0]['widget_id']]['id']) && in_array($wp_registered_widgets[$params[0]['widget_id']]['id'], array_keys($option['available'])))
357
- )
358
- $params[0]['_hide'] = 1;
359
- }
360
-
361
- return $params;
362
- }
363
-
364
-
365
- /**
366
- * Loads dynamic data
367
- */
368
- public function load_dynamic_data()
369
- {
370
- $this->taxonomies = get_taxonomies(
371
- array(
372
- '_builtin' => false
373
- ),
374
- 'objects',
375
- 'and'
376
- );
377
-
378
- $this->categories = get_categories(
379
- array(
380
- 'hide_empty' => false
381
- )
382
- );
383
-
384
- $this->custom_post_types = get_post_types(
385
- array(
386
- 'public' => true,
387
- ),
388
- 'objects',
389
- 'and'
390
- );
391
-
392
- $this->custom_post_types_archives = get_post_types(
393
- array(
394
- 'public' => true,
395
- 'has_archive' => true
396
- ),
397
- 'objects',
398
- 'and'
399
- );
400
- }
401
-
402
-
403
- /**
404
- * Loads other data (dynamic data here too like get_pages() due to some WP restrictions) and languages
405
- */
406
- public function load_other_data()
407
- {
408
- $this->options = array(
409
- 'pages' => __('Pages', 'restrict-widgets'),
410
- 'custom_post_types' => __('Custom Post Types', 'restrict-widgets'),
411
- 'custom_post_types_archives' => __('Custom Post Type Archives', 'restrict-widgets'),
412
- 'categories' => __('Categories', 'restrict-widgets'),
413
- 'taxonomies' => __('Taxonomies', 'restrict-widgets'),
414
- 'others' => __('Others', 'restrict-widgets')
415
- );
416
-
417
- //bbPress support
418
- if($this->bbpress_active === true)
419
- {
420
- $this->bbpress = array(
421
- 'search' => __('Search', 'restrict-widgets'),
422
- 'single_user' => __('Single User', 'restrict-widgets'),
423
- 'topic_tag' => __('Topic Tag', 'restrict-widgets')
424
- );
425
-
426
- $this->options['bbpress'] = __('bbPress', 'restrict-widgets');
427
- }
428
-
429
- $this->options['devices'] = __('Devices', 'restrict-widgets');
430
- $this->options['users'] = __('Users', 'restrict-widgets');
431
- $this->options['languages'] = __('Languages', 'restrict-widgets');
432
-
433
- $this->others = array(
434
- 'front_page' => __('Front Page', 'restrict-widgets'),
435
- 'blog_page' => __('Blog Page', 'restrict-widgets'),
436
- 'single_post' => __('Single Posts', 'restrict-widgets'),
437
- 'sticky_post' => __('Sticky Posts', 'restrict-widgets'),
438
- 'author_archive' => __('Author Archive', 'restrict-widgets'),
439
- 'date_archive' => __('Date Archive', 'restrict-widgets'),
440
- '404_page' => __('404 Page', 'restrict-widgets'),
441
- 'search_page' => __('Search Page', 'restrict-widgets')
442
- );
443
-
444
- $this->users = array(
445
- 'logged_in' => __('Logged in users', 'restrict-widgets'),
446
- 'logged_out' => __('Logged out users', 'restrict-widgets')
447
- );
448
-
449
- $this->devices = array(
450
- 'mobile' => __('Mobile', 'restrict-widgets'),
451
- 'desktop' => __('Desktop, Laptop, etc.', 'restrict-widgets')
452
- );
453
-
454
- $this->pages = get_pages(
455
- array(
456
- 'sort_order' => 'ASC',
457
- 'sort_column' => 'post_title',
458
- 'number' => '',
459
- 'post_type' => 'page',
460
- 'post_status' => 'publish'
461
- )
462
- );
463
-
464
- //Polylang support
465
- if($this->polylang_active === true)
466
- {
467
- $languages = get_terms('language', array('hide_empty' => false));
468
-
469
- //we need to make WMPL style table
470
- foreach($languages as $language)
471
- {
472
- $this->languages[$language->slug] = array('native_name' => $language->name);
473
- }
474
- }
475
- //WMPL support
476
- elseif($this->wpml_active === true)
477
- $this->languages = icl_get_languages('skip_missing=0&orderby=native_name&order=asc');
478
- else
479
- $this->languages = false;
480
- }
481
-
482
-
483
- /**
484
- * Removes selected sidebars for users without edit_theme_options capability
485
- */
486
- public function init_restrict_sidebars()
487
- {
488
- if(!current_user_can('manage_options') && current_user_can('edit_theme_options'))
489
- {
490
- $option = get_option('rw_widgets_options');
491
-
492
- foreach(array_keys($option['sidebars']) as $sidebar_id)
493
- {
494
- unregister_sidebar($sidebar_id);
495
- }
496
- }
497
- }
498
-
499
-
500
- /**
501
- * Saves restrict widgets options
502
- */
503
- public function save_restrict_options()
504
- {
505
- //are we saving with administration privileges?
506
- if(current_user_can('manage_options') && isset($_POST['save-widgets-options']))
507
- {
508
- global $wp_roles;
509
-
510
- //what we wanna save?
511
- $save_widgets = array(
512
- 'available' => array(),
513
- 'selection' => array(),
514
- 'sidebars' => array(),
515
- 'groups' => false,
516
- 'sidebar' => false,
517
- 'deactivation' => false
518
- );
519
-
520
- //display groups?
521
- $save_widgets['groups'] = (isset($_POST['options-widgets-groups']) ? true : false);
522
-
523
- //modify is_active_sidebar?
524
- $save_widgets['sidebar'] = (isset($_POST['options-widgets-sidebar']) ? true : false);
525
-
526
- //remove plugin data?
527
- $save_widgets['deactivation'] = (isset($_POST['options-widgets-deactivation']) ? true : false);
528
-
529
- //do we have some available widgets?
530
- if(isset($_POST['options-available-widgets']))
531
- {
532
- foreach($_POST['options-available-widgets'] as $widget_class)
533
- {
534
- $save_widgets['available'][$widget_class] = true;
535
- }
536
- }
537
-
538
- //do we have some specific elements?
539
- if(isset($_POST['options-widgets-selection']))
540
- {
541
- $selected = $_POST['options-widgets-selection'];
542
-
543
- //only for custom post types (archives)
544
- foreach($selected as $element)
545
- {
546
- $tmp = explode('_', $element, 2);
547
-
548
- if(in_array($tmp[0], array('cpt', 'cpta'), true))
549
- $save_widgets['selection'][$tmp[0] === 'cpt' ? 'custom_post_types' : 'custom_post_types_archives'][$tmp[0].'_'.sanitize_key($tmp[1])] = true;
550
- }
551
-
552
- foreach($this->pages as $page)
553
- {
554
- if(in_array('pageid_'.$page->ID, $selected, true))
555
- $save_widgets['selection']['pages']['pageid_'.$page->ID] = true;
556
- }
557
-
558
- foreach($this->custom_post_types as $cpt)
559
- {
560
- if(in_array('cpt_'.$cpt->name, $selected, true))
561
- $save_widgets['selection']['custom_post_types']['cpt_'.$cpt->name] = true;
562
- }
563
-
564
- foreach($this->categories as $category)
565
- {
566
- if(in_array('category_'.$category->cat_ID, $selected, true))
567
- $save_widgets['selection']['categories']['category_'.$category->cat_ID] = true;
568
- }
569
-
570
- foreach($this->taxonomies as $taxonomy)
571
- {
572
- if(in_array('taxonomy_'.$taxonomy->name, $selected, true))
573
- $save_widgets['selection']['taxonomies']['taxonomy_'.$taxonomy->name] = true;
574
- }
575
-
576
- foreach($this->others as $key => $value)
577
- {
578
- if(in_array('others_'.$key, $selected, true))
579
- $save_widgets['selection']['others']['others_'.$key] = true;
580
- }
581
-
582
- foreach($this->users as $key => $value)
583
- {
584
- if(in_array('users_'.$key, $selected, true))
585
- $save_widgets['selection']['users']['users_'.$key] = true;
586
- }
587
-
588
- foreach($this->devices as $key => $value)
589
- {
590
- if(in_array('devices_'.$key, $selected, true))
591
- $save_widgets['selection']['devices']['devices_'.$key] = true;
592
- }
593
-
594
- if($this->bbpress_active === true)
595
- {
596
- foreach($this->bbpress as $key => $value)
597
- {
598
- if(in_array('bbpress_'.$key, $selected, true))
599
- $save_widgets['selection']['bbpress']['bbpress_'.$key] = true;
600
- }
601
- }
602
- }
603
-
604
- //do we have some sidebars?
605
- if(isset($_POST['options-widgets-sidebars']))
606
- {
607
- foreach($_POST['options-widgets-sidebars'] as $sidebar)
608
- {
609
- $save_widgets['sidebars'][$sidebar] = true;
610
- }
611
- }
612
-
613
- //do we have some roles?
614
- $roles_a = (isset($_POST['options-widgets-roles']) ? $_POST['options-widgets-roles'] : array());
615
-
616
- foreach($wp_roles->roles as $role_name => $role_array)
617
- {
618
- if($role_name !== 'administrator')
619
- {
620
- $role = get_role($role_name);
621
-
622
- if(in_array($role_name, $roles_a))
623
- $role->add_cap('manage_widgets');
624
- else
625
- $role->remove_cap('manage_widgets');
626
- }
627
- }
628
-
629
- update_option('rw_widgets_options', $save_widgets);
630
- }
631
- }
632
-
633
-
634
- /**
635
- * Displays restrict widgets options box
636
- */
637
- public function add_widgets_options_box()
638
- {
639
- if(!current_user_can('manage_options'))
640
- return;
641
-
642
- global $wp_roles, $wp_registered_widgets, $wp_registered_sidebars;
643
-
644
- $widgets_unique = array();
645
- $option = get_option('rw_widgets_options');
646
-
647
- if(isset($option['groups']) === false) $option['groups'] = false;
648
- if(isset($option['deactivation']) === false) $option['deactivation'] = false;
649
-
650
- //we need to make a copy for sorting
651
- $widgets = $wp_registered_widgets;
652
- usort($widgets, array(&$this, 'sort_widgets_by_name'));
653
-
654
- //we need to make unique array to avoid duplicated instances of widgets later
655
- foreach($widgets as $widget)
656
- {
657
- if(isset($widget['callback'][0]) && is_object($widget['callback'][0]))
658
- $widgets_unique[get_class($widget['callback'][0])] = $widget['name'];
659
- else
660
- $widgets_unique[$widget['id']] = $widget['name'];
661
- }
662
-
663
- echo '
664
- <div id="widgets-options" class="restrict-widgets widgets-holder-wrap">
665
- <div class="widgets-sortables">
666
- <div class="sidebar-name">
667
- <h3>'.__('Restrict widgets').'</h3>
668
- </div>
669
- <div class="sidebar-description">
670
- <p class="description">'.__('Use this settings to manage access to widgets page and to restrict availability of certain widgets, sidebars and widgets options to site administrators only.', 'restrict-widgets').'</p>
671
- </div>
672
- <form action="" method="post">
673
-
674
- <label>'.__('Restrict Users', 'restrict-widgets').'</label><br />
675
- <select name="options-widgets-roles[]" id="options-widgets-roles" multiple="multiple">';
676
-
677
- foreach($wp_roles->roles as $role_name => $role_array)
678
- {
679
- echo '<option value="'.$role_name.'" '.selected((in_array('manage_widgets', array_keys($role_array['capabilities']), true) ? true : false), true, false).' '.disabled(($role_name === 'administrator' ? true : false), true, false).'>'.$role_array['name'].'</option>';
680
- }
681
-
682
- echo '
683
- </select>
684
-
685
- <label>'.__('Restrict Sidebars', 'restrict-widgets').'</label><br />
686
- <select name="options-widgets-sidebars[]" id="options-widgets-sidebars" multiple="multiple">';
687
-
688
- foreach($wp_registered_sidebars as $sidebar)
689
- {
690
- if($sidebar['id'] !== 'wp_inactive_widgets')
691
- {
692
- if(isset($option['sidebars'][$sidebar['id']]) === false)
693
- $option['sidebars'][$sidebar['id']] = false;
694
-
695
- echo '<option value="'.$sidebar['id'].'" '.selected($option['sidebars'][$sidebar['id']], true, false).'>'.$sidebar['name'].'</option>';
696
- }
697
- }
698
-
699
- echo '
700
- </select>
701
- <p class="description">'.__('Select which sidebars will be restricted to admins only.', 'restrict-widgets').'</p>';
702
-
703
- echo '
704
- <label>'.__('Restrict Widgets', 'restrict-widgets').'</label><br />
705
- <select name="options-available-widgets[]" id="options-available-widgets" multiple="multiple">';
706
-
707
- foreach(array_unique($widgets_unique) as $widget_class => $widget_name)
708
- {
709
- if(isset($option['available'][$widget_class]) === false)
710
- $option['available'][$widget_class] = false;
711
-
712
- echo '<option value="'.$widget_class.'" '.selected($option['available'][$widget_class], true, false).'>'.$widget_name.'</option>';
713
- }
714
-
715
- echo '
716
- </select>
717
- <p class="description">'.__('Select which widgets will be restricted to admins only.', 'restrict-widgets').'</p>
718
-
719
- <label>'.__('Restrict Widget Options', 'restrict-widgets').'</label><br />
720
- <select name="options-widgets-selection[]" id="options-widgets-selection" multiple="multiple">';
721
-
722
- foreach($this->options as $group_name => $value)
723
- {
724
- echo $this->getSelectionGroup($group_name, 'option', '', '', $option);
725
- }
726
-
727
- echo '
728
- </select>
729
- <p class="description">'.__('Select which widget options will be restricted to admins only.', 'restrict-widgets').'</p>
730
- <table>
731
- <tr>
732
- <td><label>'.__('Restrict Option Groups', 'restrict-widgets').'</label></td>
733
- <td>
734
- <label for="options-widgets-groups">
735
- <input type="checkbox" name="options-widgets-groups" id="options-widgets-groups" value="1" '.checked($option['groups'], true, false).' />
736
- <span class="description">'.__('Display widget options in groups', 'restrict-widgets').'</span></label>
737
- </td>
738
- </tr>
739
- <tr>
740
- <td><label>'.__('Modify is_active_sidebar()', 'restrict-widgets').'</label></td>
741
- <td>
742
- <label for="options-widgets-sidebar">
743
- <input type="checkbox" name="options-widgets-sidebar" id="options-widgets-sidebar" value="1" '.checked(isset($option['sidebar']) ? $option['sidebar'] : false, true, false).' />
744
- <span class="description">'.__('By default is_active_sidebar() function returns true even if no widget is displayed in a sidebar. Check this if you want is_active_sidebar() to recognize Restrict Widgets display settings.', 'restrict-widgets').'</span></label>
745
- </td>
746
- </tr>
747
- <tr>
748
- <td><label>'.__('Plugin Deactivation', 'restrict-widgets').'</label></td>
749
- <td>
750
- <label for="options-widgets-deactivation">
751
- <input type="checkbox" name="options-widgets-deactivation" id="options-widgets-deactivation" value="1" '.checked($option['deactivation'], true, false).' />
752
- <span class="description">'.__('Remove all plugin data on deactivation', 'restrict-widgets').'</span></label>
753
- </td>
754
- </tr>
755
- </table>
756
- <input type="submit" value="'.__('Save settings', 'restrict-widgets').'" name="save-widgets-options" class="button button-primary" id="save-widgets-options" />
757
- <p id="df-credits">Created by<a href="http://www.dfactory.eu/?utm_source=restrict-widgets-settings&utm_medium=link&utm_campaign=created-by" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="'.RESTRICT_WIDGETS_URL.'/images/logo-dfactory.png'.'" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
758
- <br class="clear" />
759
- </form>
760
- </div>
761
- </div>';
762
- }
763
-
764
-
765
- /**
766
- * Sorts widgets by name
767
- */
768
- private function sort_widgets_by_name($element_a, $element_b)
769
- {
770
- return strnatcasecmp($element_a['name'], $element_b['name']);
771
- }
772
-
773
-
774
- /**
775
- * Loads scripts and styles
776
- */
777
- public function widgets_scripts_styles($page)
778
- {
779
- if($page !== 'widgets.php')
780
- return;
781
-
782
- wp_enqueue_script(
783
- 'chosen',
784
- RESTRICT_WIDGETS_URL.'/js/chosen.jquery.min.js',
785
- array('jquery')
786
- );
787
-
788
- wp_enqueue_script(
789
- 'restrict-widgets-admin',
790
- RESTRICT_WIDGETS_URL.'/js/admin.js',
791
- array('jquery', 'chosen')
792
- );
793
-
794
- $js_widgets = $js_class = $js_nonclass = array();
795
- $orphan_sidebar = 0;
796
-
797
- //only for users without admin privileges
798
- if(!current_user_can('manage_options'))
799
- {
800
- global $wp_registered_widgets;
801
-
802
- $option = get_option('rw_widgets_options');
803
- $restrict = array_keys($option['available']);
804
- $widgets = array();
805
- $orphan_sidebar = 1;
806
-
807
- foreach(wp_get_sidebars_widgets() as $sidebar)
808
- {
809
- foreach($sidebar as $widget)
810
- {
811
- $widgets[] = $widget;
812
- }
813
- }
814
-
815
- //which sidebars to hide
816
- foreach($widgets as $widget)
817
- {
818
- if(
819
- //standard based widget class
820
- (isset($wp_registered_widgets[$widget]['callback'][0]) && is_object($wp_registered_widgets[$widget]['callback'][0]) && in_array(get_class($wp_registered_widgets[$widget]['callback'][0]), $restrict)) ||
821
-
822
- //non-standard based widget
823
- (isset($wp_registered_widgets[$widget]['id']) && in_array($wp_registered_widgets[$widget]['id'], $restrict))
824
- )
825
- $js_widgets[] = $widget;
826
- }
827
-
828
- //which widgets to hide
829
- foreach($wp_registered_widgets as $widget)
830
- {
831
- //standard based widget class
832
- if(isset($widget['callback'][0]) && is_object($widget['callback'][0]) && in_array(get_class($widget['callback'][0]), $restrict))
833
- $js_class[] = $widget['callback'][0]->id_base;
834
- //non-standard based widget
835
- elseif(in_array($widget['id'], $restrict))
836
- $js_nonclass[] = $widget['id'];
837
- }
838
- }
839
-
840
- wp_localize_script(
841
- 'restrict-widgets-admin',
842
- 'rwArgs',
843
- array(
844
- 'placeholder_text' => esc_attr__('Select options', 'restrict-widgets'),
845
- 'restrict_available_widgets' => esc_attr__('Select widgets', 'restrict-widgets'),
846
- 'restrict_widgets_selection' => esc_attr__('Select widgets options', 'restrict-widgets'),
847
- 'restrict_sidebars' => esc_attr__('Select sidebars', 'restrict-widgets'),
848
- 'restrict_roles' => esc_attr__('Select roles', 'restrict-widgets'),
849
- 'restrict_languages' => esc_attr__('Select languages', 'restrict-widgets'),
850
- 'restrict_widgets' => $js_widgets,
851
- 'restrict_class' => array_unique($js_class),
852
- 'restrict_nonclass' => array_unique($js_nonclass),
853
- 'restrict_orphan_sidebar' => $orphan_sidebar
854
- )
855
- );
856
-
857
- wp_enqueue_style(
858
- 'chosen',
859
- RESTRICT_WIDGETS_URL.'/css/chosen.min.css'
860
- );
861
-
862
- wp_enqueue_style(
863
- 'restrict-widgets-admin',
864
- RESTRICT_WIDGETS_URL.'/css/admin.css'
865
- );
866
- }
867
-
868
-
869
- /**
870
- * Displays lists of data (pages, custom post types, categories, taxonomiex, ...) for options box and widget box
871
- */
872
- private function getSelectionGroup($group_name, $type, $widget = '', $instance = '', $option = '')
873
- {
874
- $rw_option = get_option('rw_widgets_options');
875
- $html = '';
876
-
877
- switch($group_name)
878
- {
879
- case 'pages':
880
- {
881
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
882
- $html .= '<optgroup label="'.$this->options['pages'].'">';
883
-
884
- foreach($this->pages as $page)
885
- {
886
- switch($type)
887
- {
888
- case 'option':
889
- {
890
- if(isset($option['selection']['pages']['pageid_'.$page->ID]) === false)
891
- $option['selection']['pages']['pageid_'.$page->ID] = false;
892
-
893
- $html .= '<option value="pageid_'.$page->ID.'" '.selected($option['selection']['pages']['pageid_'.$page->ID], true, false).'>'.$page->post_title.'</option>';
894
-
895
- break;
896
- }
897
- case 'widget':
898
- {
899
- if(!isset($rw_option['selection']['pages']['pageid_'.$page->ID]) || current_user_can('manage_options'))
900
- {
901
- if(isset($instance['rw_opt']['pageid_'.$page->ID]) === false)
902
- $instance['rw_opt']['pageid_'.$page->ID] = 0;
903
-
904
- $html .= '<option value="pageid_'.$page->ID.'" '.selected($instance['rw_opt']['pageid_'.$page->ID], true, false).'>'.apply_filters('rw_option_display_name', $page->post_title, 'page').'</option>';
905
- }
906
-
907
- break;
908
- }
909
- }
910
- }
911
-
912
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
913
- $html .= '</optgroup>';
914
-
915
- return $html;
916
- }
917
- case 'custom_post_types':
918
- {
919
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
920
- $html .= '<optgroup label="'.$this->options['custom_post_types'].'">';
921
-
922
- foreach($this->custom_post_types as $cpt)
923
- {
924
- switch($type)
925
- {
926
- case 'option':
927
- {
928
- if(isset($option['selection']['custom_post_types']['cpt_'.$cpt->name]) === false)
929
- $option['selection']['custom_post_types']['cpt_'.$cpt->name] = false;
930
-
931
- $html .= '<option value="cpt_'.$cpt->name.'" '.selected($option['selection']['custom_post_types']['cpt_'.$cpt->name], true, false).'>'.sprintf(__('Single %s','restrict-widgets'), $cpt->label).'</option>';
932
-
933
- break;
934
- }
935
- case 'widget':
936
- {
937
- if(!isset($rw_option['selection']['custom_post_types']['cpt_'.$cpt->name]) || current_user_can('manage_options'))
938
- {
939
- if(isset($instance['rw_opt']['cpt_'.$cpt->name]) === false)
940
- $instance['rw_opt']['cpt_'.$cpt->name] = 0;
941
-
942
- $html .= '<option value="cpt_'.$cpt->name.'" '.selected($instance['rw_opt']['cpt_'.$cpt->name], true, false).'>'.apply_filters('rw_option_display_name', sprintf(__('Single %s','restrict-widgets'), $cpt->label), 'custom_post_type').'</option>';
943
- }
944
-
945
- break;
946
- }
947
- }
948
- }
949
-
950
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
951
- $html .= '</optgroup>';
952
-
953
- return $html;
954
- }
955
- case 'custom_post_types_archives':
956
- {
957
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
958
- $html .= '<optgroup label="'.$this->options['custom_post_types_archives'].'">';
959
-
960
- foreach($this->custom_post_types_archives as $cpta)
961
- {
962
- switch($type)
963
- {
964
- case 'option':
965
- {
966
- if(isset($option['selection']['custom_post_types_archives']['cpta_'.$cpta->name]) === false)
967
- $option['selection']['custom_post_types_archives']['cpta_'.$cpta->name] = false;
968
-
969
- $html .= '<option value="cpta_'.$cpta->name.'" '.selected($option['selection']['custom_post_types_archives']['cpta_'.$cpta->name], true, false).'>'.sprintf(__('%s Archive','restrict-widgets'), $cpta->label).'</option>';
970
-
971
- break;
972
- }
973
- case 'widget':
974
- {
975
- if(!isset($rw_option['selection']['custom_post_types_archives']['cpta_'.$cpta->name]) || current_user_can('manage_options'))
976
- {
977
- if(isset($instance['rw_opt']['cpta_'.$cpta->name]) === false)
978
- $instance['rw_opt']['cpta_'.$cpta->name] = 0;
979
-
980
- $html .= '<option value="cpta_'.$cpta->name.'" '.selected($instance['rw_opt']['cpta_'.$cpta->name], true, false).'>'.apply_filters('rw_option_display_name', sprintf(__('%s Archive','restrict-widgets'), $cpta->label), 'custom_post_type_archive').'</option>';
981
- }
982
-
983
- break;
984
- }
985
- }
986
- }
987
-
988
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
989
- $html .= '</optgroup>';
990
-
991
- return $html;
992
- }
993
- case 'categories':
994
- {
995
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
996
- $html .= '<optgroup label="'.$this->options['categories'].'">';
997
-
998
- foreach($this->categories as $category)
999
- {
1000
- switch($type)
1001
- {
1002
- case 'option':
1003
- {
1004
- if(isset($option['selection']['categories']['category_'.$category->cat_ID]) === false)
1005
- $option['selection']['categories']['category_'.$category->cat_ID] = false;
1006
-
1007
- $html .= '<option value="category_'.$category->cat_ID.'" '.selected($option['selection']['categories']['category_'.$category->cat_ID], true, false).'>'.$category->cat_name.'</option>';
1008
-
1009
- break;
1010
- }
1011
- case 'widget':
1012
- {
1013
- if(!isset($rw_option['selection']['categories']['category_'.$category->cat_ID]) || current_user_can('manage_options'))
1014
- {
1015
- if(isset($instance['rw_opt']['category_'.$category->cat_ID]) === false)
1016
- $instance['rw_opt']['category_'.$category->cat_ID] = 0;
1017
-
1018
- $html .= '<option value="category_'.$category->cat_ID.'" '.selected($instance['rw_opt']['category_'.$category->cat_ID], true, false).'>'.apply_filters('rw_option_display_name', $category->cat_name, 'category').'</option>';
1019
- }
1020
-
1021
- break;
1022
- }
1023
- }
1024
- }
1025
-
1026
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
1027
- $html .= '</optgroup>';
1028
-
1029
- return $html;
1030
- }
1031
- case 'taxonomies':
1032
- {
1033
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
1034
- $html .= '<optgroup label="'.$this->options['taxonomies'].'">';
1035
-
1036
- foreach($this->taxonomies as $taxonomy)
1037
- {
1038
- switch($type)
1039
- {
1040
- case 'option':
1041
- {
1042
- if(isset($option['selection']['taxonomies']['taxonomy_'.$taxonomy->name]) === false)
1043
- $option['selection']['taxonomies']['taxonomy_'.$taxonomy->name] = false;
1044
-
1045
- $html .= '<option value="taxonomy_'.$taxonomy->name.'" '.selected($option['selection']['taxonomies']['taxonomy_'.$taxonomy->name], true, false).'>'.$taxonomy->label.'</option>';
1046
-
1047
- break;
1048
- }
1049
- case 'widget':
1050
- {
1051
- if(!isset($rw_option['selection']['taxonomies']['taxonomy_'.$taxonomy->name]) || current_user_can('manage_options'))
1052
- {
1053
- if(isset($instance['rw_opt']['taxonomy_'.$taxonomy->name]) === false)
1054
- $instance['rw_opt']['taxonomy_'.$taxonomy->name] = 0;
1055
-
1056
- $html .= '<option value="taxonomy_'.$taxonomy->name.'" '.selected($instance['rw_opt']['taxonomy_'.$taxonomy->name], true, false).'>'.apply_filters('rw_option_display_name', $taxonomy->label, 'taxonomy').'</option>';
1057
- }
1058
-
1059
- break;
1060
- }
1061
- }
1062
- }
1063
-
1064
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
1065
- $html .= '</optgroup>';
1066
-
1067
- return $html;
1068
- }
1069
- case 'others':
1070
- {
1071
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
1072
- $html .= '<optgroup label="'.$this->options['others'].'">';
1073
-
1074
- foreach($this->others as $key => $value)
1075
- {
1076
- switch($type)
1077
- {
1078
- case 'option':
1079
- {
1080
- if(isset($option['selection']['others']['others_'.$key]) === false)
1081
- $option['selection']['others']['others_'.$key] = false;
1082
-
1083
- $html .= '<option value="others_'.$key.'" '.selected($option['selection']['others']['others_'.$key], true, false).'>'.$value.'</option>';
1084
-
1085
- break;
1086
- }
1087
- case 'widget':
1088
- {
1089
- if(!isset($rw_option['selection']['others']['others_'.$key]) || current_user_can('manage_options'))
1090
- {
1091
- if(isset($instance['rw_opt']['others_'.$key]) === false)
1092
- $instance['rw_opt']['others_'.$key] = 0;
1093
-
1094
- $html .= '<option value="others_'.$key.'" '.selected($instance['rw_opt']['others_'.$key], true, false).'>'.apply_filters('rw_option_display_name', $value, 'other').'</option>';
1095
- }
1096
-
1097
- break;
1098
- }
1099
- }
1100
- }
1101
-
1102
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
1103
- $html .= '</optgroup>';
1104
-
1105
- return $html;
1106
- }
1107
- case 'devices':
1108
- {
1109
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
1110
- $html .= '<optgroup label="'.$this->options['devices'].'">';
1111
-
1112
- foreach($this->devices as $key => $value)
1113
- {
1114
- switch($type)
1115
- {
1116
- case 'option':
1117
- {
1118
- if(isset($option['selection']['devices']['devices_'.$key]) === false)
1119
- $option['selection']['devices']['devices_'.$key] = false;
1120
-
1121
- $html .= '<option value="devices_'.$key.'" '.selected($option['selection']['devices']['devices_'.$key], true, false).'>'.$value.'</option>';
1122
-
1123
- break;
1124
- }
1125
- case 'widget':
1126
- {
1127
- if(!isset($rw_option['selection']['devices']['devices_'.$key]) || current_user_can('manage_options'))
1128
- {
1129
- if(isset($instance['rw_opt']['devices_'.$key]) === false)
1130
- $instance['rw_opt']['devices_'.$key] = 0;
1131
-
1132
- $html .= '<option value="devices_'.$key.'" '.selected($instance['rw_opt']['devices_'.$key], true, false).'>'.apply_filters('rw_option_display_name', $value, 'device').'</option>';
1133
- }
1134
-
1135
- break;
1136
- }
1137
- }
1138
- }
1139
-
1140
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
1141
- $html .= '</optgroup>';
1142
-
1143
- return $html;
1144
- }
1145
- case 'bbpress':
1146
- {
1147
- if($this->bbpress_active === false)
1148
- return $html;
1149
-
1150
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
1151
- $html .= '<optgroup label="'.$this->options['bbpress'].'">';
1152
-
1153
- foreach($this->bbpress as $key => $value)
1154
- {
1155
- switch($type)
1156
- {
1157
- case 'option':
1158
- {
1159
- if(isset($option['selection']['bbpress']['bbpress_'.$key]) === false)
1160
- $option['selection']['bbpress']['bbpress_'.$key] = false;
1161
-
1162
- $html .= '<option value="bbpress_'.$key.'" '.selected($option['selection']['bbpress']['bbpress_'.$key], true, false).'>'.$value.'</option>';
1163
-
1164
- break;
1165
- }
1166
- case 'widget':
1167
- {
1168
- if(!isset($rw_option['selection']['bbpress']['bbpress_'.$key]) || current_user_can('manage_options'))
1169
- {
1170
- if(isset($instance['rw_opt']['bbpress_'.$key]) === false)
1171
- $instance['rw_opt']['bbpress_'.$key] = 0;
1172
-
1173
- $html .= '<option value="bbpress_'.$key.'" '.selected($instance['rw_opt']['bbpress_'.$key], true, false).'>'.apply_filters('rw_option_display_name', $value, 'bbpress').'</option>';
1174
- }
1175
-
1176
- break;
1177
- }
1178
- }
1179
- }
1180
-
1181
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
1182
- $html .= '</optgroup>';
1183
-
1184
- return $html;
1185
- }
1186
- case 'users':
1187
- {
1188
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
1189
- $html .= '<optgroup label="'.$this->options['users'].'">';
1190
-
1191
- foreach($this->users as $key => $value)
1192
- {
1193
- switch($type)
1194
- {
1195
- case 'option':
1196
- {
1197
- if(isset($option['selection']['users']['users_'.$key]) === false)
1198
- $option['selection']['users']['users_'.$key] = false;
1199
-
1200
- $html .= '<option value="users_'.$key.'" '.selected($option['selection']['users']['users_'.$key], true, false).'>'.$value.'</option>';
1201
-
1202
- break;
1203
- }
1204
- case 'widget':
1205
- {
1206
- if(!isset($rw_option['selection']['users']['users_'.$key]) || current_user_can('manage_options'))
1207
- {
1208
- if(isset($instance['rw_opt']['users_'.$key]) === false)
1209
- $instance['rw_opt']['users_'.$key] = 0;
1210
-
1211
- $html .= '<option value="users_'.$key.'" '.selected($instance['rw_opt']['users_'.$key], true, false).'>'.apply_filters('rw_option_display_name', $value, 'user').'</option>';
1212
- }
1213
-
1214
- break;
1215
- }
1216
- }
1217
- }
1218
-
1219
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
1220
- $html .= '</optgroup>';
1221
-
1222
- return $html;
1223
- }
1224
- case 'languages':
1225
- {
1226
- if($this->languages === false)
1227
- return $html;
1228
-
1229
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
1230
- $html .= '<optgroup label="'.$this->options['languages'].'">';
1231
-
1232
- foreach($this->languages as $key => $language)
1233
- {
1234
- switch($type)
1235
- {
1236
- case 'option':
1237
- {
1238
- if(isset($option['selection']['languages']['language_'.$key]) === false)
1239
- $option['selection']['languages']['language_'.$key] = false;
1240
-
1241
- $html .= '<option value="language_'.$key.'" '.selected($option['selection']['languages']['language_'.$key], true, false).'>'.$language['native_name'].'</option>';
1242
-
1243
- break;
1244
- }
1245
- case 'widget':
1246
- {
1247
- if(!isset($rw_option['selection']['languages']['language_'.$key]) || current_user_can('manage_options'))
1248
- {
1249
- if(isset($instance['rw_opt']['language_'.$key]) === false)
1250
- $instance['rw_opt']['language_'.$key] = 0;
1251
-
1252
- $html .= '<option value="language_'.$key.'" '.selected($instance['rw_opt']['language_'.$key], true, false).'>'.apply_filters('rw_option_display_name', $language['native_name'], 'language').'</option>';
1253
- }
1254
-
1255
- break;
1256
- }
1257
- }
1258
- }
1259
-
1260
- if(($rw_option['groups'] === true && $type === 'widget') || current_user_can('manage_options'))
1261
- $html .= '</optgroup>';
1262
-
1263
- return $html;
1264
- }
1265
- }
1266
- }
1267
-
1268
-
1269
- /**
1270
- * Displays widget box
1271
- */
1272
- public function display_admin_widgets_options($widget, $empty, $instance)
1273
- {
1274
- if(isset($instance['rw_opt']['widget_select']) === false)
1275
- $instance['rw_opt']['widget_select'] = false;
1276
-
1277
- echo '
1278
- <div class="restrict-widgets-hide-div restrict-widgets">
1279
- <p class="restrict-widgets-display-label">'.__('Display / Hide Widget', 'restrict-widgets').'</p>
1280
- <select name="'.$widget->get_field_name('widget_select').'" class="restrict-widgets-hide chosen-select">
1281
- <option value="yes" '.selected($instance['rw_opt']['widget_select'], true, false).'>'.__('Display widget on selected', 'restrict-widgets').'</option>
1282
- <option value="no" '.selected($instance['rw_opt']['widget_select'], false, false).'>'.__('Hide widget on selected', 'restrict-widgets').'</option>
1283
- </select>
1284
- </div>
1285
- <div class="restrict-widgets-select-div restrict-widgets">
1286
- <select class="restrict-widgets-select chosen-select" multiple="multiple" size="10" name="'.$widget->get_field_name('widget_multiselect').'[]">';
1287
-
1288
- foreach($this->options as $option => $text)
1289
- {
1290
- echo $this->getSelectionGroup($option, 'widget', $widget, $instance);
1291
- }
1292
-
1293
- echo '
1294
- </select>
1295
- </div>';
1296
- }
1297
-
1298
-
1299
- /**
1300
- * Saves widget box
1301
- */
1302
- public function update_admin_widgets_options($instance, $new_instance)
1303
- {
1304
- if(is_array($new_instance['widget_multiselect']))
1305
- {
1306
- $selected = $new_instance['widget_multiselect'];
1307
-
1308
- //pages
1309
- foreach($this->pages as $page)
1310
- {
1311
- if(in_array('pageid_'.$page->ID, $selected))
1312
- $instance['rw_opt']['pageid_'.$page->ID] = true;
1313
- else
1314
- unset($instance['rw_opt']['pageid_'.$page->ID]);
1315
- }
1316
-
1317
- //custom post types
1318
- foreach($this->custom_post_types as $cpt)
1319
- {
1320
- if(in_array('cpt_'.$cpt->name, $selected))
1321
- $instance['rw_opt']['cpt_'.$cpt->name] = true;
1322
- else
1323
- unset($instance['rw_opt']['cpt_'.$cpt->name]);
1324
- }
1325
-
1326
- //custom post types archives
1327
- foreach($this->custom_post_types_archives as $cpta)
1328
- {
1329
- if(in_array('cpta_'.$cpta->name, $selected))
1330
- $instance['rw_opt']['cpta_'.$cpta->name] = true;
1331
- else
1332
- unset($instance['rw_opt']['cpta_'.$cpta->name]);
1333
- }
1334
-
1335
- //categories
1336
- foreach($this->categories as $category)
1337
- {
1338
- if(in_array('category_'.$category->cat_ID, $selected))
1339
- $instance['rw_opt']['category_'.$category->cat_ID] = true;
1340
- else
1341
- unset($instance['rw_opt']['category_'.$category->cat_ID]);
1342
- }
1343
-
1344
- //taxonomies
1345
- foreach($this->taxonomies as $taxonomy)
1346
- {
1347
- if(in_array('taxonomy_'.$taxonomy->name, $selected))
1348
- $instance['rw_opt']['taxonomy_'.$taxonomy->name] = true;
1349
- else
1350
- unset($instance['rw_opt']['taxonomy_'.$taxonomy->name]);
1351
- }
1352
-
1353
- //others
1354
- foreach($this->others as $key => $value)
1355
- {
1356
- if(in_array('others_'.$key, $selected))
1357
- $instance['rw_opt']['others_'.$key] = true;
1358
- else
1359
- unset($instance['rw_opt']['others_'.$key]);
1360
- }
1361
-
1362
- //devices
1363
- foreach($this->devices as $key => $value)
1364
- {
1365
- if(in_array('devices_'.$key, $selected))
1366
- $instance['rw_opt']['devices_'.$key] = true;
1367
- else
1368
- unset($instance['rw_opt']['devices_'.$key]);
1369
- }
1370
-
1371
- //bbpress
1372
- if($this->bbpress_active === true)
1373
- {
1374
- foreach($this->bbpress as $key => $value)
1375
- {
1376
- if(in_array('bbpress_'.$key, $selected))
1377
- $instance['rw_opt']['bbpress_'.$key] = true;
1378
- else
1379
- unset($instance['rw_opt']['bbpress_'.$key]);
1380
- }
1381
- }
1382
-
1383
- //users
1384
- foreach($this->users as $key => $value)
1385
- {
1386
- if(in_array('users_'.$key, $selected))
1387
- $instance['rw_opt']['users_'.$key] = true;
1388
- else
1389
- unset($instance['rw_opt']['users_'.$key]);
1390
- }
1391
-
1392
- //languages
1393
- if($this->languages !== false)
1394
- {
1395
- foreach($this->languages as $key => $value)
1396
- {
1397
- if(in_array('language_'.$key, $selected))
1398
- $instance['rw_opt']['language_'.$key] = true;
1399
- else
1400
- unset($instance['rw_opt']['language_'.$key]);
1401
- }
1402
- }
1403
- }
1404
- //clear plugin-instance
1405
- else unset($instance['rw_opt']);
1406
-
1407
- //widget_multiselect
1408
- $instance['rw_opt']['widget_select'] = ($new_instance['widget_select'] === 'yes' ? true : false);
1409
-
1410
- return $instance;
1411
- }
1412
-
1413
-
1414
- private function is_widget_empty($widget, $type)
1415
- {
1416
- if(!empty($widget))
1417
- {
1418
- foreach($widget as $option => $bool)
1419
- {
1420
- $action = explode('_', $option, 2);
1421
-
1422
- if($type === 'main')
1423
- $array = array('category', 'taxonomy', 'cpt', 'cpta', 'pageid', 'others', 'bbpress');
1424
- elseif($type === 'device')
1425
- $array = array('devices');
1426
- elseif($type === 'lang')
1427
- $array = array('language');
1428
- elseif($type === 'user')
1429
- $array = array('users');
1430
-
1431
- if(in_array($action[0], $array))
1432
- return false;
1433
- }
1434
- }
1435
-
1436
- return true;
1437
- }
1438
-
1439
-
1440
- /**
1441
- * Manages front-end display of widgets
1442
- */
1443
- public function display_frontend_widgets($instance, $class, $args)
1444
- {
1445
- return $this->restrict_widget($instance, true, $args);
1446
- }
1447
-
1448
-
1449
- /**
1450
- * Displays or hides specific widget
1451
- */
1452
- private function restrict_widget($instance, $filter = true, $args = array())
1453
- {
1454
- global $wp_query;
1455
-
1456
- $display_lang = $display_user = $display_device = $display_main = '';
1457
- $empty_lang = $empty_user = $empty_device = $empty_main = true;
1458
- $return = false;
1459
-
1460
- $post_id = $wp_query->get_queried_object_id();
1461
-
1462
- $display_type = isset($instance['rw_opt']['widget_select']) ? $instance['rw_opt']['widget_select'] : false;
1463
-
1464
- //languages
1465
- if(isset($instance['rw_opt']) && $this->is_widget_empty($instance['rw_opt'], 'lang') === false)
1466
- {
1467
- if($this->polylang_active === true || $this->wpml_active === true)
1468
- {
1469
- $empty_lang = false;
1470
-
1471
- //fix for WPML
1472
- if(function_exists('icl_object_id'))
1473
- {
1474
- global $sitepress;
1475
-
1476
- if(isset($sitepress))
1477
- $post_id = icl_object_id($post_id, 'page', true, $sitepress->get_default_language());
1478
- else
1479
- $post_id = icl_object_id($post_id, 'page', false);
1480
- }
1481
-
1482
- $found_lang = (defined('ICL_LANGUAGE_CODE') && isset($instance['rw_opt']['language_'.ICL_LANGUAGE_CODE]) ? true : false);
1483
-
1484
- if($display_type === true)
1485
- {
1486
- if($found_lang === true)
1487
- $display_lang = true;
1488
- else
1489
- {
1490
- $return = true;
1491
- $display_lang = false;
1492
- }
1493
- }
1494
- else
1495
- $display_lang = ($found_lang === true ? false : true);
1496
- }
1497
- else
1498
- $display_lang = true;
1499
- }
1500
- else
1501
- $display_lang = true;
1502
-
1503
- //users
1504
- if($return === false)
1505
- {
1506
- if(isset($instance['rw_opt']) && $this->is_widget_empty($instance['rw_opt'], 'user') === false)
1507
- {
1508
- $empty_user = false;
1509
-
1510
- if(is_user_logged_in())
1511
- {
1512
- if(isset($instance['rw_opt']['users_logged_in'], $instance['rw_opt']['users_logged_out']) || isset($instance['rw_opt']['users_logged_in']))
1513
- $found_user = true;
1514
- elseif(isset($instance['rw_opt']['users_logged_out']))
1515
- $found_user = false;
1516
- }
1517
- else
1518
- {
1519
- if(isset($instance['rw_opt']['users_logged_out'], $instance['rw_opt']['users_logged_in']) || isset($instance['rw_opt']['users_logged_out']))
1520
- $found_user = true;
1521
- elseif(isset($instance['rw_opt']['users_logged_in']))
1522
- $found_user = false;
1523
- }
1524
-
1525
- if($display_type === true)
1526
- {
1527
- if($found_user === true)
1528
- $display_user = true;
1529
- else
1530
- {
1531
- $return = true;
1532
- $display_user = false;
1533
- }
1534
- }
1535
- else
1536
- $display_user = ($found_user === true ? false : true);
1537
- }
1538
- else
1539
- $display_user = true;
1540
- }
1541
-
1542
- //devices
1543
- if($return === false)
1544
- {
1545
- if(isset($instance['rw_opt']) && $this->is_widget_empty($instance['rw_opt'], 'device') === false)
1546
- {
1547
- $empty_device = false;
1548
-
1549
- if(wp_is_mobile())
1550
- {
1551
- if(isset($instance['rw_opt']['devices_mobile'], $instance['rw_opt']['devices_desktop']) || isset($instance['rw_opt']['devices_mobile']))
1552
- $found_device = true;
1553
- elseif(isset($instance['rw_opt']['devices_desktop']))
1554
- $found_device = false;
1555
- }
1556
- else
1557
- {
1558
- if(isset($instance['rw_opt']['devices_desktop'], $instance['rw_opt']['devices_mobile']) || isset($instance['rw_opt']['devices_desktop']))
1559
- $found_device = true;
1560
- elseif(isset($instance['rw_opt']['devices_mobile']))
1561
- $found_device = false;
1562
- }
1563
-
1564
- if($display_type === true)
1565
- {
1566
- if($found_device === true)
1567
- $display_device = true;
1568
- else
1569
- {
1570
- $return = true;
1571
- $display_device = false;
1572
- }
1573
- }
1574
- else
1575
- $display_device = ($found_device === true ? false : true);
1576
- }
1577
- else
1578
- $display_device = true;
1579
- }
1580
-
1581
- //others
1582
- if($return === false)
1583
- {
1584
- if(isset($instance['rw_opt']) && $this->is_widget_empty($instance['rw_opt'], 'main') === false)
1585
- {
1586
- $empty_main = false;
1587
-
1588
- if(is_front_page())
1589
- {
1590
- $found_main = isset($instance['rw_opt']['others_front_page']) ? true : false;
1591
-
1592
- if(is_home() && $found_main == false)
1593
- $found_main = isset($instance['rw_opt']['others_blog_page']) ? true : false;
1594
- }
1595
- elseif(is_home())
1596
- $found_main = isset($instance['rw_opt']['others_blog_page']) ? true : false;
1597
- elseif(is_singular())
1598
- {
1599
- if(is_page())
1600
- {
1601
- if(isset($instance['rw_opt']['cpt_'.get_post_type($post_id)]))
1602
- $found_main = true;
1603
- else
1604
- $found_main = isset($instance['rw_opt']['pageid_'.$post_id]) ? true : false;
1605
- }
1606
- else
1607
- {
1608
- $found_main = isset($instance['rw_opt']['cpt_'.get_post_type($post_id)]) ? true : false;
1609
-
1610
- if(is_single() && $found_main == false)
1611
- $found_main = isset($instance['rw_opt']['others_single_post']) ? true : false;
1612
- }
1613
- }
1614
- elseif(is_post_type_archive())
1615
- $found_main = isset($instance['rw_opt']['cpta_'.get_query_var('post_type')]) ? true : false;
1616
- elseif(is_category())
1617
- $found_main = isset($instance['rw_opt']['category_'.get_query_var('cat')]) ? true : false;
1618
- elseif(is_tag())
1619
- {
1620
- if(($object = get_queried_object()) !== NULL && isset($object->taxonomy) && $object->taxonomy === 'post_tag')
1621
- $tag = 'wp_log_type';
1622
- else
1623
- $tag = '';
1624
-
1625
- $found_main = isset($instance['rw_opt']['taxonomy_'.$tag]) ? true : false;
1626
- }
1627
- elseif(is_tax())
1628
- $found_main = isset($instance['rw_opt']['taxonomy_'.get_query_var('taxonomy')]) ? true : false;
1629
- elseif(is_404())
1630
- $found_main = isset($instance['rw_opt']['others_404_page']) ? true : false;
1631
- elseif(is_sticky())
1632
- $found_main = isset($instance['rw_opt']['others_sticky_post']) ? true : false;
1633
- elseif(is_search())
1634
- $found_main = isset($instance['rw_opt']['others_search_page']) ? true : false;
1635
- elseif(is_author())
1636
- $found_main = isset($instance['rw_opt']['others_author_archive']) ? true : false;
1637
- elseif(is_date())
1638
- $found_main = isset($instance['rw_opt']['others_date_archive']) ? true : false;
1639
- elseif(function_exists('bbp_is_search') && bbp_is_search())
1640
- $found_main = isset($instance['rw_opt']['bbpress_search']) ? true : false;
1641
- elseif(function_exists('bbp_is_single_user') && bbp_is_single_user())
1642
- $found_main = isset($instance['rw_opt']['bbpress_single_user']) ? true : false;
1643
- elseif(function_exists('bbp_is_topic_tag') && bbp_is_topic_tag())
1644
- $found_main = isset($instance['rw_opt']['bbpress_topic_tag']) ? true : false;
1645
-
1646
- $display_main = ($display_type === true ? ($found_main === true ? true : false) : ($found_main === true ? false : true));
1647
- }
1648
- else
1649
- $display_main = true;
1650
- }
1651
-
1652
- if($filter === false)
1653
- $instance = true;
1654
-
1655
- if($display_type === true)
1656
- $final_return = ($display_lang === true && $display_user === true && $display_device === true && $display_main === true ? $instance : false);
1657
- else
1658
- $final_return = (
1659
- (
1660
- //4
1661
- ($empty_lang === false && $empty_user === false && $empty_device === false && $empty_main === false && $display_lang === false && $display_user === false && $display_device === false && $display_main === false) ||
1662
-
1663
- //3
1664
- ($empty_lang === false && $empty_user === false && $empty_device === false && $display_lang === false && $display_user === false && $display_device === false) ||
1665
- ($empty_lang === false && $empty_user === false && $empty_main === false && $display_lang === false && $display_user === false && $display_main === false) ||
1666
- ($empty_lang === false && $empty_device === false && $empty_main === false && $display_lang === false && $display_device === false && $display_main === false) ||
1667
- ($empty_user === false && $empty_device === false && $empty_main === false && $display_user === false && $display_device === false && $display_main === false) ||
1668
-
1669
- //2
1670
- ($empty_lang === false && $empty_user === false && $display_lang === false && $display_user === false) ||
1671
- ($empty_lang === false && $empty_device === false && $display_lang === false && $display_device === false) ||
1672
- ($empty_lang === false && $empty_main === false && $display_lang === false && $display_main === false) ||
1673
- ($empty_user === false && $empty_device === false && $display_user === false && $display_device === false) ||
1674
- ($empty_user === false && $empty_main === false && $display_user === false && $display_main === false) ||
1675
- ($empty_device === false && $empty_main === false && $display_device === false && $display_main === false) ||
1676
-
1677
- //1
1678
- ($empty_lang === false && $display_lang === false) ||
1679
- ($empty_user === false && $display_user === false) ||
1680
- ($empty_device === false && $display_device === false) ||
1681
- ($empty_main === false && $display_main === false)
1682
- )
1683
- ? false : $instance
1684
- );
1685
-
1686
- //filter true or false
1687
- if($filter === true)
1688
- $final_return = apply_filters_ref_array('rw_display_widget', array($final_return, $instance));
1689
-
1690
- //if true return instance
1691
- $final_return = ($final_return === false) ? false : $instance;
1692
-
1693
- //display: return $instance, hide: return false
1694
- return $final_return;
1695
- }
1696
-
1697
-
1698
- /**
1699
- * Display Appearance menu and link to widgets.php if user can manage_widgets
1700
- */
1701
- public function manage_widgets_menu()
1702
- {
1703
- global $menu, $submenu;
1704
-
1705
- //if user can manage widgets but can't edit_theme_options, add widgets menu (appearance)
1706
- if(current_user_can('manage_widgets') && !current_user_can('edit_theme_options'))
1707
- {
1708
- foreach($menu as $menu_key => $menu_values)
1709
- {
1710
- if(isset($menu_values[5]) && $menu_values[5] === 'menu-appearance')
1711
- {
1712
- //if appearance menu not exists
1713
- if(empty($submenu[$menu_values[2]]))
1714
- {
1715
- $menu[$menu_key][1] = 'manage_widgets';
1716
- $menu[$menu_key][2] = 'widgets.php';
1717
- }
1718
- else
1719
- //if appearance menu exists
1720
- {
1721
- foreach($submenu[$menu_values[2]] as $submenu_key => $submenu_values)
1722
- {
1723
- $submenu[$menu_values[2]][7] = array(__('Widgets'), 'manage_widgets', 'widgets.php');
1724
- }
1725
- }
1726
- }
1727
- }
1728
- }
1729
- //if user can't manage widgets but can edit_theme_options, remove widgets from menu
1730
- elseif(!current_user_can('manage_widgets') && current_user_can('edit_theme_options'))
1731
- {
1732
- foreach($menu as $menu_key => $menu_values)
1733
- {
1734
- if(isset($menu_values[5]) && $menu_values[5] === 'menu-appearance')
1735
- {
1736
- foreach($submenu[$menu_values[2]] as $submenu_key => $submenu_values)
1737
- {
1738
- if(isset($submenu_values[2]) && $submenu_values[2] == 'widgets.php')
1739
- {
1740
- $submenu[$menu_values[2]][$submenu_key][1] = 'manage_widgets';
1741
- }
1742
- }
1743
- }
1744
- }
1745
- }
1746
- }
1747
-
1748
-
1749
- /**
1750
- * Fix for Appearance menu items on widgets.php if user can manage_widgets but can't edit theme options
1751
- */
1752
- public function manage_widgets_menu_fix()
1753
- {
1754
- global $menu, $submenu;
1755
-
1756
- foreach($menu as $menu_key => $menu_values)
1757
- {
1758
- if(isset($menu_values[5]) && $menu_values[5] === 'menu-appearance')
1759
- {
1760
- //if appearance menu not exists
1761
- if(empty($submenu[$menu_values[2]]))
1762
- {
1763
- $menu[$menu_key][1] = 'manage_widgets';
1764
- $menu[$menu_key][2] = 'widgets.php';
1765
- }
1766
- else
1767
- //if appearance menu exists
1768
- {
1769
- $submenu[$menu_values[2]][7] = array(__('Widgets'), 'manage_widgets', 'widgets.php');
1770
-
1771
- //remove menus with edit_theme_options capability
1772
- foreach($submenu[$menu_values[2]] as $submenu_key => $submenu_values)
1773
- {
1774
- if($submenu_values[1] == 'edit_theme_options')
1775
- unset($submenu[$menu_values[2]][$submenu_key]);
1776
- }
1777
-
1778
- //fix if appearance menu item is only 1, remove submenu
1779
- if(count($submenu[$menu_values[2]]) < 2)
1780
- {
1781
- unset($submenu[$menu_values[2]][7]);
1782
- $menu[$menu_key][1] = 'manage_widgets';
1783
- $menu[$menu_key][2] = 'widgets.php';
1784
- }
1785
- }
1786
- }
1787
- }
1788
- }
1789
-
1790
-
1791
- /**
1792
- * Manage Widgets Capability
1793
- */
1794
- public function manage_widgets_cap($allcaps, $cap, $args)
1795
- {
1796
- global $pagenow;
1797
-
1798
- if($pagenow === 'widgets.php' || (defined('DOING_AJAX') && DOING_AJAX))
1799
- {
1800
- //break if we're not asking to edit widgets
1801
- if(('edit_theme_options' != $args[0]) || empty($allcaps['manage_widgets']))
1802
- return $allcaps;
1803
- else
1804
- {
1805
- //if user can't edit_theme_options but can manage_widgets
1806
- if(empty($allcaps['edit_theme_options']))
1807
- {
1808
- //menu fix
1809
- add_action('admin_menu', array(&$this, 'manage_widgets_menu_fix'), 999);
1810
-
1811
- //add cap to edit widgets
1812
- $allcaps['edit_theme_options'] = true;
1813
- }
1814
- }
1815
- }
1816
-
1817
- return $allcaps;
1818
- }
1819
- }
1820
- ?>
1
+ <?php
2
+ /*
3
+ Plugin Name: Restrict Widgets
4
+ Description: All in one solution for widget management in WordPress. Allows you to hide or display widgets on specified pages and restrict access for users.
5
+ Version: 1.3.0
6
+ Author: dFactory
7
+ Author URI: http://www.dfactory.eu/
8
+ Plugin URI: http://www.dfactory.eu/plugins/restrict-widgets/
9
+ License: MIT License
10
+ License URI: http://opensource.org/licenses/MIT
11
+ Text Domain: restrict-widgets
12
+ Domain Path: /languages
13
+
14
+ Restrict Widgets
15
+ Copyright (C) 2013-2015, Digital Factory - info@digitalfactory.pl
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+
24
+ if ( ! defined( 'ABSPATH' ) )
25
+ exit; // Exit if accessed directly
26
+
27
+ define( 'RESTRICT_WIDGETS_URL', plugins_url( '', __FILE__ ) );
28
+ define( 'RESTRICT_WIDGETS_REL_PATH', dirname( plugin_basename( __FILE__ ) ) . '/' );
29
+
30
+ final class Restrict_Widgets {
31
+
32
+ const
33
+ VERSION = '1.3.0', // plugin version
34
+ ID = 'restrict-widgets';
35
+
36
+ private static $instance;
37
+ public $defaults = array(
38
+ 'groups' => false,
39
+ 'sidebar' => false,
40
+ 'deactivation' => false,
41
+ 'available' => array(),
42
+ 'selection' => array(),
43
+ 'sidebars' => array()
44
+ );
45
+ public $options;
46
+ private $widget_options = array();
47
+ private $pages = array();
48
+ private $custom_post_types = array();
49
+ private $custom_post_types_archives = array();
50
+ private $categories = array();
51
+ private $taxonomies = array();
52
+ private $devices = array();
53
+ private $bbpress = array();
54
+ private $others = array();
55
+ private $users = array();
56
+ private $languages = array();
57
+ private $hidden_widget = '';
58
+ private $checked_widget = '';
59
+ private $widgets = array();
60
+ private $bbpress_active = false;
61
+ private $polylang_active = false;
62
+ private $wpml_active = false;
63
+
64
+ /**
65
+ * Disable object clone.
66
+ */
67
+ private function __clone() {}
68
+
69
+ /**
70
+ * Disable unserializing of the class.
71
+ */
72
+ private function __wakeup() {}
73
+
74
+ /**
75
+ * Main Cookie_Notice_Pro instance,
76
+ * Insures that only one instance of Cookie_Notice_Pro exists in memory at one time.
77
+ *
78
+ * @return object
79
+ */
80
+ public static function instance() {
81
+ if ( self::$instance === null )
82
+ self::$instance = new self();
83
+
84
+ return self::$instance;
85
+ }
86
+
87
+ public function __construct() {
88
+ register_activation_hook( __FILE__, array( $this, 'multisite_activation' ) );
89
+ register_deactivation_hook( __FILE__, array( $this, 'multisite_deactivation' ) );
90
+
91
+ // settings
92
+ $this->options = array_merge( $this->defaults, get_option( 'rw_widgets_options', $this->defaults ) );
93
+
94
+ // actions
95
+ add_action( 'admin_init', array( $this, 'register_settings' ) );
96
+ add_action( 'admin_menu', array( $this, 'admin_menu_options' ) );
97
+ add_action( 'wp_loaded', array( $this, 'polylang_widgets' ), 6 );
98
+ add_action( 'wp_head', array( $this, 'restrict_sidebar_widgets' ), 10 );
99
+ add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
100
+ add_action( 'widgets_init', array( $this, 'load_other_data' ), 10 );
101
+ add_action( 'widgets_init', array( $this, 'init_restrict_sidebars' ), 11 );
102
+ add_action( 'admin_init', array( $this, 'load_dynamic_data' ) );
103
+ add_action( 'in_widget_form', array( $this, 'display_admin_widgets_options' ), 99, 3 );
104
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
105
+ add_action( 'admin_menu', array( $this, 'manage_widgets_menu' ) );
106
+
107
+ // filters
108
+ add_filter( 'widget_display_callback', array( $this, 'display_frontend_widgets' ), 10, 3 );
109
+ add_filter( 'widget_update_callback', array( $this, 'update_admin_widgets_options' ), 10, 3 );
110
+ add_filter( 'user_has_cap', array( $this, 'manage_widgets_cap' ), 10, 3 );
111
+ add_filter( 'dynamic_sidebar_params', array( $this, 'restrict_sidebar_params' ), 10, 3 );
112
+ add_filter( 'plugin_row_meta', array( $this, 'plugin_extend_links' ), 10, 2 );
113
+ add_filter( 'plugin_action_links', array( $this, 'plugin_settings_link' ), 10, 2 );
114
+ }
115
+
116
+ /**
117
+ * Add options page.
118
+ */
119
+ public function admin_menu_options() {
120
+ add_options_page( __( 'Restrict Widgets', self::ID ), __( 'Restrict Widgets', self::ID ), 'manage_options', self::ID, array( $this, 'options_page' ) );
121
+ }
122
+
123
+ /**
124
+ * Options page callback.
125
+ */
126
+ public function options_page() {
127
+ echo '
128
+ <div class="wrap">' . screen_icon() . '
129
+ <h1>' . __( 'Restrict Widgets', self::ID ) . '</h1>
130
+ <div class="restrict-widgets-settings">
131
+ <div class="df-credits">
132
+ <h3 class="hndle">' . __( 'Restrict Widgets', self::ID ) . ' ' . self::VERSION . '</h3>
133
+ <div class="inside">
134
+ <h4 class="inner">' . __( 'Need support?', self::ID ) . '</h4>
135
+ <p class="inner">' . __( 'If you are having problems with this plugin, please talk about them in the', self::ID ) . ' <a href="https://www.dfactory.eu/support/?utm_source=' . self::ID . '-settings&utm_medium=link&utm_campaign=support" target="_blank" title="' . __( 'Support forum', self::ID ) . '">' . __( 'Support forum', self::ID ) . '</a></p>
136
+ <hr />
137
+ <h4 class="inner">' . __( 'Do you like this plugin?', self::ID ) . '</h4>
138
+ <p class="inner"><a href="https://wordpress.org/support/view/plugin-reviews/' . self::ID . '" target="_blank" title="' . __( 'Rate it 5', self::ID ) . '">' . __( 'Rate it 5', self::ID ) . '</a> ' . __( 'on WordPress.org', self::ID ) . '<br />' .
139
+ __( 'Blog about it & link to the', self::ID ) . ' <a href="http://www.dfactory.eu/plugins/restrict-widgets/?utm_source=' . self::ID . '-settings&utm_medium=link&utm_campaign=blog-about" target="_blank" title="' . __( 'plugin page', self::ID ) . '">' . __( 'plugin page', self::ID ) . '</a><br/>' .
140
+ __( 'Check out our other', self::ID ) . ' <a href="http://www.dfactory.eu/plugins/?utm_source=' . self::ID . '-settings&utm_medium=link&utm_campaign=other-plugins" target="_blank" title="' . __( 'WordPress plugins', self::ID ) . '">' . __( 'WordPress plugins', self::ID ) . '</a>
141
+ </p>
142
+ <hr />
143
+ <p class="df-link inner">' . __( 'Created by', self::ID ) . ' <a href="http://www.dfactory.eu/?utm_source=' . self::ID . '-settings&utm_medium=link&utm_campaign=created-by" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="' . RESTRICT_WIDGETS_URL . '/images/logo-dfactory.png' . '" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
144
+ </div>
145
+ </div>
146
+ <form action="options.php" method="post">';
147
+
148
+ settings_fields( 'rw_widgets_options' );
149
+ do_settings_sections( 'rw_widgets_options' );
150
+
151
+ echo '
152
+ <p class="submit">';
153
+
154
+ submit_button( '', 'primary', 'save_rw_options', false );
155
+
156
+ echo ' ';
157
+
158
+ submit_button( __( 'Reset to defaults', self::ID ), 'secondary', 'reset_rw_options', false );
159
+
160
+ echo '
161
+ </p>
162
+ </form>
163
+ </div>
164
+ <div class="clear"></div>
165
+ </div>';
166
+ }
167
+
168
+ /**
169
+ * Register settings callback.
170
+ */
171
+ public function register_settings() {
172
+ register_setting( 'rw_widgets_options', 'rw_widgets_options', array( $this, 'validate_settings' ) );
173
+ add_settings_section( 'rw_widgets_options_general', '', array( $this, 'restrict_widgets_section' ), 'rw_widgets_options' );
174
+ add_settings_field( 'rw_restrict_roles', __( 'Restrict User Roles', self::ID ), array( $this, 'restrict_roles_field' ), 'rw_widgets_options', 'rw_widgets_options_general' );
175
+ add_settings_field( 'rw_restrict_sidebars', __( 'Restrict Sidebars', self::ID ), array( $this, 'restrict_sidebars_field' ), 'rw_widgets_options', 'rw_widgets_options_general' );
176
+ add_settings_field( 'rw_restrict_widgets', __( 'Restrict Widgets', self::ID ), array( $this, 'restrict_widgets_field' ), 'rw_widgets_options', 'rw_widgets_options_general' );
177
+ add_settings_field( 'rw_restrict_options', __( 'Restrict Widget Options', self::ID ), array( $this, 'restrict_options_field' ), 'rw_widgets_options', 'rw_widgets_options_general' );
178
+ add_settings_field( 'rw_option_groups', __( 'Option Groups', self::ID ), array( $this, 'option_groups_field' ), 'rw_widgets_options', 'rw_widgets_options_general' );
179
+ add_settings_field( 'rw_modify_is_sidebar', __( 'is_sidebar_active()', self::ID ), array( $this, 'modify_is_sidebar_field' ), 'rw_widgets_options', 'rw_widgets_options_general' );
180
+ add_settings_field( 'rw_delete_deactivation', __( 'Deactivation', self::ID ), array( $this, 'delete_deactivation_field' ), 'rw_widgets_options', 'rw_widgets_options_general' );
181
+
182
+ }
183
+
184
+ /**
185
+ * Restrict widgets section.
186
+ */
187
+ public function restrict_widgets_section() {
188
+ echo '
189
+ <p>' . __( 'Use this settings to manage access to widgets page and to restrict availability of widgets, sidebars and widget options to site administrators only.', self::ID ) . '</p>';
190
+ }
191
+
192
+ /**
193
+ * Restrict user roles option.
194
+ */
195
+ public function restrict_roles_field() {
196
+ global $wp_roles;
197
+
198
+ echo '
199
+ <div id="rw_restrict_roles">';
200
+
201
+ foreach ( $wp_roles->roles as $role_name => $role_array ) {
202
+ echo '
203
+ <label class="cb-checkbox"><input id="rw_restrict_roles-' . $role_name . '" type="checkbox" name="options-widgets-roles[' . esc_attr( $role_name ) . ']" value="1" ' . checked( (in_array( 'manage_widgets', array_keys( $role_array['capabilities'] ), true ) ? true : false ), true, false ) . ' ' . disabled( ($role_name === 'administrator' ? true : false ), true, false ) . '/>' . $role_array['name'] . '</label>';
204
+ }
205
+
206
+ echo '
207
+ <p class="description">' . esc_html__( 'Restrict access to widgets page to specific user roles.', self::ID ) . '</p>
208
+ </div>';
209
+ }
210
+
211
+ /**
212
+ * Restrict sidebars option.
213
+ */
214
+ public function restrict_sidebars_field() {
215
+ global $wp_registered_sidebars;
216
+
217
+ echo '
218
+ <div id="rw_restrict_sidebars">
219
+ <select name="options-widgets-sidebars[]" id="options-widgets-sidebars" multiple="multiple" class="select2">';
220
+
221
+ foreach ( $wp_registered_sidebars as $sidebar ) {
222
+ if ( $sidebar['id'] !== 'wp_inactive_widgets' ) {
223
+ if ( ! isset( $this->options['sidebars'][$sidebar['id']] ) )
224
+ $this->options['sidebars'][$sidebar['id']] = false;
225
+
226
+ echo '<option value="' . $sidebar['id'] . '" ' . selected( $this->options['sidebars'][$sidebar['id']], true, false ) . '>' . $sidebar['name'] . '</option>';
227
+ }
228
+ }
229
+
230
+ echo '
231
+ </select>
232
+ <p class="description">' . esc_html__( 'Select which sidebars will be restricted to admins only.', self::ID ) . '</p>
233
+ </div>';
234
+ }
235
+
236
+ /**
237
+ * Restricu widgets option.
238
+ */
239
+ public function restrict_widgets_field() {
240
+ global $wp_registered_widgets;
241
+
242
+ $widgets_unique = array();
243
+
244
+ // we need to make a copy for sorting
245
+ $widgets = $wp_registered_widgets;
246
+ usort( $widgets, array( $this, 'sort_widgets_by_name' ) );
247
+
248
+ // we need to make unique array to avoid duplicated instances of widgets later
249
+ foreach ( $widgets as $widget ) {
250
+ if ( isset( $widget['callback'][0] ) && is_object( $widget['callback'][0] ) )
251
+ $widgets_unique[get_class( $widget['callback'][0] )] = $widget['name'];
252
+ else
253
+ $widgets_unique[$widget['id']] = $widget['name'];
254
+ }
255
+
256
+ echo '
257
+ <div id="rw_restrict_widgets">
258
+ <select name="options-available-widgets[]" id="options-available-widgets" multiple="multiple" class="select2">';
259
+
260
+ foreach ( array_unique( $widgets_unique ) as $widget_class => $widget_name ) {
261
+ $this->options['available'][$widget_class] = (bool) isset( $this->options['available'][$widget_class] );
262
+
263
+ echo '<option value="' . $widget_class . '" ' . selected( $this->options['available'][$widget_class], true, false ) . '>' . $widget_name . '</option>';
264
+ }
265
+
266
+ echo '
267
+ </select>
268
+ <p class="description">' . esc_html__( 'Select which widgets will be restricted to admins only.', self::ID ) . '</p>
269
+ </div>';
270
+ }
271
+
272
+ /**
273
+ * Restricu widgets option.
274
+ */
275
+ public function restrict_options_field() {
276
+ echo '
277
+ <div id="rw_restrict_options">
278
+ <select name="options-widgets-selection[]" id="options-widgets-selection" multiple="multiple" class="select2">';
279
+
280
+ foreach ( $this->widget_options as $group_name => $value ) {
281
+ echo $this->get_selection_group( $group_name, 'option', '', '', $this->options );
282
+ }
283
+
284
+ echo '
285
+ </select>
286
+ <p class="description">' . esc_html__( 'Select which widget options will be restricted to admins only.', self::ID ) . '</p>
287
+ </div>';
288
+ }
289
+
290
+ /**
291
+ * Option groups option.
292
+ */
293
+ public function option_groups_field() {
294
+ echo '
295
+ <div id="rw_option_groups">
296
+ <label for="options-widgets-groups" class="cb-checkbox"><input type="checkbox" name="options-widgets-groups" id="options-widgets-groups" value="1" ' . checked( $this->options['groups'], true, false ) . ' />' . __( 'Display widget options in groups', self::ID ) . '</label>';
297
+
298
+ echo '
299
+ </div>';
300
+ }
301
+
302
+ /**
303
+ * Modify is_sidebar_active() option.
304
+ */
305
+ public function modify_is_sidebar_field() {
306
+ echo '
307
+ <div id="rw_modify_is_sidebar">
308
+ <label for="options-widgets-sidebar" class="cb-checkbox"><input type="checkbox" name="options-widgets-sidebar" id="options-widgets-sidebar" value="1" ' . checked( $this->options['sidebar'], true, false ) . ' />' . __( 'Modify is_sidebar_active() function', self::ID ) . '</label>';
309
+
310
+ echo '
311
+ <p class="description">' . __( 'By default is_active_sidebar() function returns true even if no widget is displayed in a sidebar. Check this if you want is_active_sidebar() to recognize Restrict Widgets display settings.', self::ID ) . '</p>
312
+ </div>';
313
+ }
314
+
315
+ /**
316
+ * Delete on deactivation option.
317
+ */
318
+ public function delete_deactivation_field() {
319
+ echo '
320
+ <div id="rw_delete_deactivation">
321
+ <label for="options-widgets-deactivation" class="cb-checkbox"><input type="checkbox" name="options-widgets-deactivation" id="options-widgets-deactivation" value="1" ' . checked( $this->options['deactivation'], true, false ) . ' />' . __( 'Remove all plugin data on deactivation', self::ID ) . '</label>';
322
+
323
+ echo '
324
+ </div>';
325
+ }
326
+
327
+ /**
328
+ * Save restrict widgets options.
329
+ *
330
+ * @global array $wp_roles
331
+ * @param array $input
332
+ * @return array
333
+ */
334
+ public function validate_settings( $input ) {
335
+ if ( ! check_admin_referer( 'rw_widgets_options-options') )
336
+ return $input;
337
+
338
+ if ( ! current_user_can( 'manage_options' ) )
339
+ return $input;
340
+
341
+ if ( isset( $_POST['save_rw_options'] ) ) {
342
+ global $wp_roles;
343
+
344
+ // display groups?
345
+ $input['groups'] = isset( $_POST['options-widgets-groups'] );
346
+
347
+ // modify is_active_sidebar?
348
+ $input['sidebar'] = isset( $_POST['options-widgets-sidebar'] );
349
+
350
+ // remove plugin data?
351
+ $input['deactivation'] = isset( $_POST['options-widgets-deactivation'] );
352
+
353
+ // any available widgets?
354
+ if ( isset( $_POST['options-available-widgets'] ) ) {
355
+ foreach ( $_POST['options-available-widgets'] as $widget_class ) {
356
+ $input['available'][$widget_class] = true;
357
+ }
358
+ } else
359
+ $input['available'] = array();
360
+
361
+ // any specific elements?
362
+ if ( isset( $_POST['options-widgets-selection'] ) ) {
363
+ $selected = $_POST['options-widgets-selection'];
364
+
365
+ // only for custom post types (archives)
366
+ foreach ( $selected as $element ) {
367
+ $tmp = explode( '_', $element, 2 );
368
+
369
+ if ( in_array( $tmp[0], array( 'cpt', 'cpta' ), true ) )
370
+ $input['selection'][$tmp[0] === 'cpt' ? 'custom_post_types' : 'custom_post_types_archives'][$tmp[0] . '_' . sanitize_key( $tmp[1] )] = true;
371
+ }
372
+
373
+ foreach ( $this->pages as $page ) {
374
+ if ( in_array( 'pageid_' . $page->ID, $selected, true ) )
375
+ $input['selection']['pages']['pageid_' . $page->ID] = true;
376
+ }
377
+
378
+ foreach ( $this->custom_post_types as $cpt ) {
379
+ if ( in_array( 'cpt_' . $cpt->name, $selected, true ) )
380
+ $input['selection']['custom_post_types']['cpt_' . $cpt->name] = true;
381
+ }
382
+
383
+ foreach ( $this->categories as $category ) {
384
+ if ( in_array( 'category_' . $category->cat_ID, $selected, true ) )
385
+ $input['selection']['categories']['category_' . $category->cat_ID] = true;
386
+ }
387
+
388
+ foreach ( $this->taxonomies as $taxonomy ) {
389
+ if ( in_array( 'taxonomy_' . $taxonomy->name, $selected, true ) )
390
+ $input['selection']['taxonomies']['taxonomy_' . $taxonomy->name] = true;
391
+ }
392
+
393
+ foreach ( $this->others as $key => $value ) {
394
+ if ( in_array( 'others_' . $key, $selected, true ) )
395
+ $input['selection']['others']['others_' . $key] = true;
396
+ }
397
+
398
+ foreach ( $this->users as $key => $value ) {
399
+ if ( in_array( 'users_' . $key, $selected, true ) )
400
+ $input['selection']['users']['users_' . $key] = true;
401
+ }
402
+
403
+ foreach ( $this->devices as $key => $value ) {
404
+ if ( in_array( 'devices_' . $key, $selected, true ) )
405
+ $input['selection']['devices']['devices_' . $key] = true;
406
+ }
407
+
408
+ if ( $this->bbpress_active ) {
409
+ foreach ( $this->bbpress as $key => $value ) {
410
+ if ( in_array( 'bbpress_' . $key, $selected, true ) )
411
+ $input['selection']['bbpress']['bbpress_' . $key] = true;
412
+ }
413
+ }
414
+
415
+ if ( ! empty ( $this->languages ) && ( $this->polylang_active || $this->wpml_active ) ) {
416
+ foreach ( $this->languages as $key => $value ) {
417
+ if ( in_array( 'language_' . $key, $selected, true ) )
418
+ $input['selection']['languages']['language_' . $key] = true;
419
+ }
420
+ }
421
+ } else
422
+ $input['selection'] = array();
423
+
424
+ // any sidebars?
425
+ if ( isset( $_POST['options-widgets-sidebars'] ) ) {
426
+ foreach ( $_POST['options-widgets-sidebars'] as $sidebar ) {
427
+ $input['sidebars'][$sidebar] = true;
428
+ }
429
+ } else
430
+ $input['sidebars'] = array();
431
+
432
+ // any user roles?
433
+ $roles = isset( $_POST['options-widgets-roles'] ) ? array_keys( $_POST['options-widgets-roles'] ) : array();
434
+
435
+ foreach ( $wp_roles->roles as $role_name => $role_array ) {
436
+ if ( $role_name !== 'administrator' ) {
437
+ $role = get_role( $role_name );
438
+
439
+ if ( in_array( $role_name, $roles ) )
440
+ $role->add_cap( 'manage_widgets' );
441
+ else
442
+ $role->remove_cap( 'manage_widgets' );
443
+ }
444
+ }
445
+ } elseif ( isset( $_POST['reset_rw_options'] ) ) {
446
+ global $wp_roles;
447
+
448
+ $input = $this->defaults;
449
+
450
+ // remove roles
451
+ foreach ( $wp_roles->roles as $role_name => $role_array ) {
452
+ if ( $role_name !== 'administrator' ) {
453
+ $role = get_role( $role_name );
454
+ $role->remove_cap( 'manage_widgets' );
455
+ }
456
+ }
457
+
458
+ add_settings_error( 'rw_widgets_options', 'settings_reset', __( 'Settings restored to defaults.', self::ID ), 'updated' );
459
+ }
460
+
461
+ return $input;
462
+ }
463
+
464
+ /**
465
+ * Multisite activation.
466
+ */
467
+ public function multisite_activation( $networkwide ) {
468
+ if ( is_multisite() && $networkwide ) {
469
+ global $wpdb;
470
+
471
+ $activated_blogs = array();
472
+ $current_blog_id = get_current_blog_id();
473
+ $blogs_ids = $wpdb->get_col( $wpdb->prepare( 'SELECT blog_id FROM ' . $wpdb->blogs, '' ) );
474
+
475
+ foreach ( $blogs_ids as $blog_id ) {
476
+ switch_to_blog( $blog_id );
477
+ $this->activate_single();
478
+ $activated_blogs[] = (int) $blog_id;
479
+ }
480
+
481
+ switch_to_blog( $current_blog_id );
482
+ update_site_option( 'restrict_widgets_activated_blogs', $activated_blogs, array() );
483
+ } else
484
+ $this->activate_single();
485
+ }
486
+
487
+ /**
488
+ * Activation.
489
+ */
490
+ public function activate_single() {
491
+ $role = get_role( 'administrator' );
492
+ $role->add_cap( 'manage_widgets' );
493
+
494
+ // default settings
495
+ add_option( 'rw_widgets_options', $this->defaults, '', 'no' );
496
+ }
497
+
498
+ /**
499
+ * Multisite deactivation.
500
+ */
501
+ public function multisite_deactivation( $networkwide ) {
502
+ if ( is_multisite() && $networkwide ) {
503
+ global $wpdb;
504
+
505
+ $current_blog_id = get_current_blog_id();
506
+ $blogs_ids = $wpdb->get_col( $wpdb->prepare( 'SELECT blog_id FROM ' . $wpdb->blogs, '' ) );
507
+
508
+ if ( ($activated_blogs = get_site_option( 'restrict_widgets_activated_blogs', false, false )) === false )
509
+ $activated_blogs = array();
510
+
511
+ foreach ( $blogs_ids as $blog_id ) {
512
+ switch_to_blog( $blog_id );
513
+ $this->deactivate_single();
514
+
515
+ if ( in_array( (int) $blog_id, $activated_blogs, true ) )
516
+ unset( $activated_blogs[array_search( $blog_id, $activated_blogs )] );
517
+ }
518
+
519
+ switch_to_blog( $current_blog_id );
520
+ update_site_option( 'restrict_widgets_activated_blogs', $activated_blogs );
521
+ } else
522
+ $this->deactivate_single();
523
+ }
524
+
525
+ /**
526
+ * Plugin deactivation function.
527
+ */
528
+ public function deactivate_single() {
529
+ if ( $this->options['deactivation'] === true ) {
530
+ global $wp_roles, $wp_registered_widgets;
531
+
532
+ // remove roles
533
+ foreach ( $wp_roles->roles as $role_name => $tmp ) {
534
+ $role = get_role( $role_name );
535
+ $role->remove_cap( 'manage_widgets' );
536
+ }
537
+
538
+ // clear all widgets
539
+ foreach ( $wp_registered_widgets as $widget ) {
540
+ if ( isset( $widget['params'][0]['number'] ) && $widget['params'][0]['number'] !== -1 ) {
541
+ $option = get_option( $widget['callback'][0]->option_name );
542
+
543
+ unset( $option[$widget['params'][0]['number']]['rw_opt'] );
544
+
545
+ update_option( $widget['callback'][0]->option_name, $option );
546
+ }
547
+ }
548
+
549
+ delete_option( 'rw_widgets_options' );
550
+ }
551
+ }
552
+
553
+ /**
554
+ * Fix for is_active_sidebar() function (all hidden widgets on sidebar = false).
555
+ */
556
+ public function restrict_sidebar_widgets() {
557
+ if ( ! is_admin() ) {
558
+ if ( $this->options['sidebar'] ) {
559
+ global $wp_registered_widgets, $_wp_sidebars_widgets;
560
+
561
+ $widgets_c = $instance = array();
562
+
563
+ foreach ( $wp_registered_widgets as $widget ) {
564
+ if ( isset( $widget['callback'][0]->option_name ) && $widget['callback'][0]->option_name !== '' && empty( $widgets_classes[$widget['callback'][0]->option_name] ) )
565
+ $widgets_c[$widget['callback'][0]->option_name] = get_option( $widget['callback'][0]->option_name );
566
+ }
567
+
568
+ foreach ( $widgets_c as $widget_base_id => $widgets ) {
569
+ if ( is_array( $widgets ) ) {
570
+ foreach ( $widgets as $widget_id => $widget ) {
571
+ if ( is_int( $widget_id ) )
572
+ $instance[$widget_base_id . '-' . $widget_id] = $widget;
573
+ }
574
+ }
575
+ }
576
+
577
+ if ( ! empty( $instance ) ) {
578
+ foreach ( $instance as $widget_id => $widget ) {
579
+ $this->widgets[substr( $widget_id, 7 )] = $this->restrict_widget( $widget, false, array( 'widget_id' => substr( $widget_id, 7 ) ) );
580
+ }
581
+ }
582
+
583
+ if ( ! empty( $this->widgets ) ) {
584
+ $widgets_c = $_wp_sidebars_widgets;
585
+
586
+ if ( ! empty( $widgets_c ) ) {
587
+ foreach ( $widgets_c as $sidebar => $s_widgets ) {
588
+ if ( ! empty( $s_widgets ) && is_array( $s_widgets ) ) {
589
+ foreach ( $s_widgets as $widget ) {
590
+ if ( $this->widgets[$widget] === false && ($widget_key = array_search( $widget, $_wp_sidebars_widgets[$sidebar] )) !== false )
591
+ unset( $_wp_sidebars_widgets[$sidebar][$widget_key] );
592
+ }
593
+ }
594
+ }
595
+ }
596
+ }
597
+ }
598
+ }
599
+ }
600
+
601
+ /**
602
+ * Fix for Polylang - remove language switcher from widgets.
603
+ */
604
+ public function polylang_widgets() {
605
+ if ( $this->polylang_active ) {
606
+ global $polylang;
607
+
608
+ if ( has_action( 'in_widget_form', array( $polylang, 'in_widget_form' ) ) )
609
+ remove_action( 'in_widget_form', array( $polylang, 'in_widget_form' ) );
610
+ }
611
+ }
612
+
613
+ /**
614
+ * Load textdomain.
615
+ */
616
+ public function load_textdomain() {
617
+ load_plugin_textdomain( self::ID, false, RESTRICT_WIDGETS_REL_PATH . 'languages/' );
618
+
619
+ if ( class_exists( 'bbPress' ) )
620
+ $this->bbpress_active = true;
621
+
622
+ if ( class_exists( 'Polylang' ) )
623
+ $this->polylang_active = true;
624
+
625
+ if ( class_exists( 'SitePress' ) )
626
+ $this->wpml_active = true;
627
+ }
628
+
629
+ /**
630
+ * Add links to Support Forum.
631
+ */
632
+ public function plugin_extend_links( $links, $file ) {
633
+ if ( ! current_user_can( 'install_plugins' ) )
634
+ return $links;
635
+
636
+ $plugin = plugin_basename( __FILE__ );
637
+
638
+ if ( $file == $plugin ) {
639
+ return array_merge(
640
+ $links, array( sprintf( '<a href="http://www.dfactory.eu/support/forum/restrict-widgets/" target="_blank">%s</a>', __( 'Support', self::ID ) ) )
641
+ );
642
+ }
643
+
644
+ return $links;
645
+ }
646
+
647
+ /**
648
+ * Add links to Settings page.
649
+ */
650
+ function plugin_settings_link( $links, $file ) {
651
+ if ( ! is_admin() || ! current_user_can( 'edit_theme_options' ) )
652
+ return $links;
653
+
654
+ static $plugin;
655
+
656
+ $plugin = plugin_basename( __FILE__ );
657
+
658
+ if ( $file == $plugin ) {
659
+ $settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'widgets.php' ), __( 'Widgets', self::ID ) );
660
+ array_unshift( $links, $settings_link );
661
+ }
662
+
663
+ return $links;
664
+ }
665
+
666
+ /**
667
+ * Hide widgets for users without admin privileges.
668
+ */
669
+ public function restrict_sidebar_params( $params ) {
670
+ if ( ! current_user_can( 'manage_options' ) ) {
671
+ global $wp_registered_widgets;
672
+
673
+ if (
674
+ // standard based widget class
675
+ (isset( $wp_registered_widgets[$params[0]['widget_id']]['callback'][0] ) && is_object( $wp_registered_widgets[$params[0]['widget_id']]['callback'][0] ) && in_array( get_class( $wp_registered_widgets[$params[0]['widget_id']]['callback'][0] ), array_keys( $this->options['available'] ) )) ||
676
+ // non-standard based widget
677
+ (isset( $wp_registered_widgets[$params[0]['widget_id']]['id'] ) && in_array( $wp_registered_widgets[$params[0]['widget_id']]['id'], array_keys( $this->options['available'] ) ))
678
+ )
679
+ $params[0]['_hide'] = 1;
680
+ }
681
+
682
+ return $params;
683
+ }
684
+
685
+ /**
686
+ * Load dynamic data.
687
+ */
688
+ public function load_dynamic_data() {
689
+ $this->taxonomies = get_taxonomies(
690
+ array(
691
+ '_builtin' => false,
692
+ 'public' => true,
693
+ ),
694
+ 'objects',
695
+ 'and'
696
+ );
697
+
698
+ if ( $this->polylang_active && isset( $this->taxonomies['language'] ) )
699
+ unset( $this->taxonomies['language'] );
700
+
701
+ $this->categories = get_categories(
702
+ array(
703
+ 'hide_empty' => false
704
+ )
705
+ );
706
+
707
+ $this->custom_post_types = get_post_types(
708
+ array(
709
+ 'public' => true
710
+ ),
711
+ 'objects',
712
+ 'and'
713
+ );
714
+
715
+ $this->custom_post_types_archives = get_post_types(
716
+ array(
717
+ 'public' => true,
718
+ 'has_archive' => true
719
+ ),
720
+ 'objects',
721
+ 'and'
722
+ );
723
+ }
724
+
725
+ /**
726
+ * Load other data (dynamic data here too like get_pages() due to some WP restrictions) and languages.
727
+ */
728
+ public function load_other_data() {
729
+ $this->widget_options = array(
730
+ 'pages' => __( 'Pages', self::ID ),
731
+ 'custom_post_types' => __( 'Custom Post Types', self::ID ),
732
+ 'custom_post_types_archives' => __( 'Custom Post Type Archives', self::ID ),
733
+ 'categories' => __( 'Categories', self::ID ),
734
+ 'taxonomies' => __( 'Taxonomies', self::ID ),
735
+ 'others' => __( 'Others', self::ID )
736
+ );
737
+
738
+ // bbPress support
739
+ if ( $this->bbpress_active === true ) {
740
+ $this->bbpress = array(
741
+ 'search' => __( 'Search', self::ID ),
742
+ 'single_user' => __( 'Single User', self::ID ),
743
+ 'topic_tag' => __( 'Topic Tag', self::ID )
744
+ );
745
+
746
+ $this->widget_options['bbpress'] = __( 'bbPress', self::ID );
747
+ }
748
+
749
+ $this->widget_options['devices'] = __( 'Devices', self::ID );
750
+ $this->widget_options['users'] = __( 'Users', self::ID );
751
+ $this->widget_options['languages'] = __( 'Languages', self::ID );
752
+
753
+ $this->others = array(
754
+ 'front_page' => __( 'Front Page', self::ID ),
755
+ 'blog_page' => __( 'Blog Page', self::ID ),
756
+ 'single_post' => __( 'Single Posts', self::ID ),
757
+ 'sticky_post' => __( 'Sticky Posts', self::ID ),
758
+ 'author_archive' => __( 'Author Archive', self::ID ),
759
+ 'date_archive' => __( 'Date Archive', self::ID ),
760
+ '404_page' => __( '404 Page', self::ID ),
761
+ 'search_page' => __( 'Search Page', self::ID )
762
+ );
763
+
764
+ $this->users = array(
765
+ 'logged_in' => __( 'Logged in users', self::ID ),
766
+ 'logged_out' => __( 'Logged out users', self::ID )
767
+ );
768
+
769
+ $this->devices = array(
770
+ 'mobile' => __( 'Mobile', self::ID ),
771
+ 'desktop' => __( 'Desktop, Laptop, etc.', self::ID )
772
+ );
773
+
774
+ $this->pages = get_pages(
775
+ array(
776
+ 'sort_order' => 'ASC',
777
+ 'sort_column' => 'post_title',
778
+ 'number' => '',
779
+ 'post_type' => 'page',
780
+ 'post_status' => 'publish'
781
+ )
782
+ );
783
+
784
+ // Polylang support
785
+ if ( $this->polylang_active ) {
786
+ $languages = get_terms( 'language', array( 'hide_empty' => false ) );
787
+
788
+ // we need to make WMPL style table
789
+ foreach ( $languages as $language ) {
790
+ $this->languages[$language->slug] = array( 'native_name' => $language->name );
791
+ }
792
+ }
793
+ // WMPL support
794
+ elseif ( $this->wpml_active )
795
+ $this->languages = icl_get_languages( 'skip_missing=0&orderby=native_name&order=asc' );
796
+ else
797
+ $this->languages = array();
798
+ }
799
+
800
+ /**
801
+ * Remove selected sidebars for users without edit_theme_options capability.
802
+ */
803
+ public function init_restrict_sidebars() {
804
+ if ( ! current_user_can( 'manage_options' ) && current_user_can( 'edit_theme_options' ) ) {
805
+ foreach ( array_keys( $this->options['sidebars'] ) as $sidebar_id ) {
806
+ unregister_sidebar( $sidebar_id );
807
+ }
808
+ }
809
+ }
810
+
811
+ /**
812
+ * Sort widgets by name.
813
+ */
814
+ private function sort_widgets_by_name( $element_a, $element_b ) {
815
+ return strnatcasecmp( $element_a['name'], $element_b['name'] );
816
+ }
817
+
818
+ /**
819
+ * Load scripts and styles.
820
+ */
821
+ public function admin_enqueue_scripts( $page ) {
822
+ if ( $page === 'widgets.php' ) {
823
+ $js_widgets = $js_class = $js_nonclass = array();
824
+ $orphan_sidebar = 0;
825
+
826
+ // only for users without admin privileges
827
+ if ( ! current_user_can( 'manage_options' ) ) {
828
+ global $wp_registered_widgets;
829
+
830
+ $restrict = array_keys( $this->options['available'] );
831
+ $widgets = array();
832
+ $orphan_sidebar = 1;
833
+
834
+ foreach ( wp_get_sidebars_widgets() as $sidebar ) {
835
+ foreach ( $sidebar as $widget ) {
836
+ $widgets[] = $widget;
837
+ }
838
+ }
839
+
840
+ // which sidebars to hide
841
+ foreach ( $widgets as $widget ) {
842
+ if (
843
+ // standard based widget class
844
+ (isset( $wp_registered_widgets[$widget]['callback'][0] ) && is_object( $wp_registered_widgets[$widget]['callback'][0] ) && in_array( get_class( $wp_registered_widgets[$widget]['callback'][0] ), $restrict )) ||
845
+ // non-standard based widget
846
+ (isset( $wp_registered_widgets[$widget]['id'] ) && in_array( $wp_registered_widgets[$widget]['id'], $restrict ))
847
+ )
848
+ $js_widgets[] = $widget;
849
+ }
850
+
851
+ // which widgets to hide
852
+ foreach ( $wp_registered_widgets as $widget ) {
853
+ // standard based widget class
854
+ if ( isset( $widget['callback'][0] ) && is_object( $widget['callback'][0] ) && in_array( get_class( $widget['callback'][0] ), $restrict ) )
855
+ $js_class[] = $widget['callback'][0]->id_base;
856
+ // non-standard based widget
857
+ elseif ( in_array( $widget['id'], $restrict ) )
858
+ $js_nonclass[] = $widget['id'];
859
+ }
860
+ }
861
+
862
+ wp_register_script( 'restrict-widgets-select2', RESTRICT_WIDGETS_URL . '/assets/select2.min.js', array( 'jquery' ) );
863
+
864
+ wp_enqueue_script( self::ID, RESTRICT_WIDGETS_URL . '/js/widgets.js', array( 'jquery', 'restrict-widgets-select2' ) );
865
+
866
+ wp_localize_script(
867
+ self::ID,
868
+ 'rwArgs',
869
+ array(
870
+ 'placeholder_text' => esc_attr__( 'Select options', self::ID ),
871
+ 'restrict_available_widgets' => esc_attr__( 'Select widgets', self::ID ),
872
+ 'restrict_widgets_selection' => esc_attr__( 'Select widgets options', self::ID ),
873
+ 'restrict_sidebars' => esc_attr__( 'Select sidebars', self::ID ),
874
+ 'restrict_roles' => esc_attr__( 'Select roles', self::ID ),
875
+ 'restrict_languages' => esc_attr__( 'Select languages', self::ID ),
876
+ 'restrict_widgets' => $js_widgets,
877
+ 'restrict_class' => array_unique( $js_class ),
878
+ 'restrict_nonclass' => array_unique( $js_nonclass ),
879
+ 'restrict_orphan_sidebar' => $orphan_sidebar
880
+ )
881
+ );
882
+
883
+ wp_enqueue_style(
884
+ 'restrict-widgets-select2', RESTRICT_WIDGETS_URL . '/assets/select2.min.css'
885
+ );
886
+
887
+ wp_enqueue_style(
888
+ 'restrict-widgets-admin', RESTRICT_WIDGETS_URL . '/css/admin.css'
889
+ );
890
+ } elseif ( $page === 'settings_page_restrict-widgets' ) {
891
+ wp_register_script( 'restrict-widgets-select2', RESTRICT_WIDGETS_URL . '/assets/select2.min.js', array( 'jquery' ) );
892
+ wp_enqueue_script( 'restrict-widgets-admin', RESTRICT_WIDGETS_URL . '/js/admin.js', array( 'jquery', 'restrict-widgets-select2' ) );
893
+
894
+ wp_localize_script(
895
+ 'restrict-widgets-admin',
896
+ 'rwArgs',
897
+ array(
898
+ 'resetToDefaults' => __( 'Are you sure you want to reset these settings to defaults?', self::ID )
899
+ )
900
+ );
901
+
902
+ wp_enqueue_style( 'restrict-widgets-select2', RESTRICT_WIDGETS_URL . '/assets/select2.min.css' );
903
+ wp_enqueue_style( 'restrict-widgets-admin', RESTRICT_WIDGETS_URL . '/css/admin.css' );
904
+ }
905
+ }
906
+
907
+ /**
908
+ * Display groups of data (pages, custom post types, categories, taxonomiex, ...) for options and widget display.
909
+ */
910
+ private function get_selection_group( $group_name, $type, $widget = '', $instance = '', $option = '' ) {
911
+ $html = '';
912
+
913
+ switch ( $group_name ) {
914
+ case 'pages': {
915
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
916
+ $html .= '<optgroup label="' . $this->widget_options['pages'] . '">';
917
+
918
+ foreach ( $this->pages as $page ) {
919
+ switch ( $type ) {
920
+ case 'option': {
921
+ if ( isset( $option['selection']['pages']['pageid_' . $page->ID] ) === false )
922
+ $option['selection']['pages']['pageid_' . $page->ID] = false;
923
+
924
+ $html .= '<option value="pageid_' . $page->ID . '" ' . selected( $option['selection']['pages']['pageid_' . $page->ID], true, false ) . '>' . $page->post_title . '</option>';
925
+
926
+ break;
927
+ }
928
+ case 'widget': {
929
+ if ( ! isset( $this->options['selection']['pages']['pageid_' . $page->ID] ) || current_user_can( 'manage_options' ) ) {
930
+ if ( isset( $instance['rw_opt']['pageid_' . $page->ID] ) === false )
931
+ $instance['rw_opt']['pageid_' . $page->ID] = 0;
932
+
933
+ $html .= '<option value="pageid_' . $page->ID . '" ' . selected( $instance['rw_opt']['pageid_' . $page->ID], true, false ) . '>' . apply_filters( 'rw_option_display_name', $page->post_title, 'page' ) . '</option>';
934
+ }
935
+
936
+ break;
937
+ }
938
+ }
939
+ }
940
+
941
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
942
+ $html .= '</optgroup>';
943
+
944
+ return $html;
945
+ }
946
+ case 'custom_post_types': {
947
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
948
+ $html .= '<optgroup label="' . $this->widget_options['custom_post_types'] . '">';
949
+
950
+ foreach ( $this->custom_post_types as $cpt ) {
951
+ switch ( $type ) {
952
+ case 'option': {
953
+ if ( isset( $option['selection']['custom_post_types']['cpt_' . $cpt->name] ) === false )
954
+ $option['selection']['custom_post_types']['cpt_' . $cpt->name] = false;
955
+
956
+ $html .= '<option value="cpt_' . $cpt->name . '" ' . selected( $option['selection']['custom_post_types']['cpt_' . $cpt->name], true, false ) . '>' . sprintf( __( 'Single %s', self::ID ), $cpt->label ) . '</option>';
957
+
958
+ break;
959
+ }
960
+ case 'widget': {
961
+ if ( ! isset( $this->options['selection']['custom_post_types']['cpt_' . $cpt->name] ) || current_user_can( 'manage_options' ) ) {
962
+ if ( isset( $instance['rw_opt']['cpt_' . $cpt->name] ) === false )
963
+ $instance['rw_opt']['cpt_' . $cpt->name] = 0;
964
+
965
+ $html .= '<option value="cpt_' . $cpt->name . '" ' . selected( $instance['rw_opt']['cpt_' . $cpt->name], true, false ) . '>' . apply_filters( 'rw_option_display_name', sprintf( __( 'Single %s', self::ID ), $cpt->label ), 'custom_post_type' ) . '</option>';
966
+ }
967
+
968
+ break;
969
+ }
970
+ }
971
+ }
972
+
973
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
974
+ $html .= '</optgroup>';
975
+
976
+ return $html;
977
+ }
978
+ case 'custom_post_types_archives': {
979
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
980
+ $html .= '<optgroup label="' . $this->widget_options['custom_post_types_archives'] . '">';
981
+
982
+ foreach ( $this->custom_post_types_archives as $cpta ) {
983
+ switch ( $type ) {
984
+ case 'option': {
985
+ if ( isset( $option['selection']['custom_post_types_archives']['cpta_' . $cpta->name] ) === false )
986
+ $option['selection']['custom_post_types_archives']['cpta_' . $cpta->name] = false;
987
+
988
+ $html .= '<option value="cpta_' . $cpta->name . '" ' . selected( $option['selection']['custom_post_types_archives']['cpta_' . $cpta->name], true, false ) . '>' . sprintf( __( '%s Archive', self::ID ), $cpta->label ) . '</option>';
989
+
990
+ break;
991
+ }
992
+ case 'widget': {
993
+ if ( ! isset( $this->options['selection']['custom_post_types_archives']['cpta_' . $cpta->name] ) || current_user_can( 'manage_options' ) ) {
994
+ if ( isset( $instance['rw_opt']['cpta_' . $cpta->name] ) === false )
995
+ $instance['rw_opt']['cpta_' . $cpta->name] = 0;
996
+
997
+ $html .= '<option value="cpta_' . $cpta->name . '" ' . selected( $instance['rw_opt']['cpta_' . $cpta->name], true, false ) . '>' . apply_filters( 'rw_option_display_name', sprintf( __( '%s Archive', self::ID ), $cpta->label ), 'custom_post_type_archive' ) . '</option>';
998
+ }
999
+
1000
+ break;
1001
+ }
1002
+ }
1003
+ }
1004
+
1005
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
1006
+ $html .= '</optgroup>';
1007
+
1008
+ return $html;
1009
+ }
1010
+ case 'categories': {
1011
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
1012
+ $html .= '<optgroup label="' . $this->widget_options['categories'] . '">';
1013
+
1014
+ foreach ( $this->categories as $category ) {
1015
+ switch ( $type ) {
1016
+ case 'option': {
1017
+ if ( isset( $option['selection']['categories']['category_' . $category->cat_ID] ) === false )
1018
+ $option['selection']['categories']['category_' . $category->cat_ID] = false;
1019
+
1020
+ $html .= '<option value="category_' . $category->cat_ID . '" ' . selected( $option['selection']['categories']['category_' . $category->cat_ID], true, false ) . '>' . $category->cat_name . '</option>';
1021
+
1022
+ break;
1023
+ }
1024
+ case 'widget': {
1025
+ if ( ! isset( $this->options['selection']['categories']['category_' . $category->cat_ID] ) || current_user_can( 'manage_options' ) ) {
1026
+ if ( isset( $instance['rw_opt']['category_' . $category->cat_ID] ) === false )
1027
+ $instance['rw_opt']['category_' . $category->cat_ID] = 0;
1028
+
1029
+ $html .= '<option value="category_' . $category->cat_ID . '" ' . selected( $instance['rw_opt']['category_' . $category->cat_ID], true, false ) . '>' . apply_filters( 'rw_option_display_name', $category->cat_name, 'category' ) . '</option>';
1030
+ }
1031
+
1032
+ break;
1033
+ }
1034
+ }
1035
+ }
1036
+
1037
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
1038
+ $html .= '</optgroup>';
1039
+
1040
+ return $html;
1041
+ }
1042
+ case 'taxonomies': {
1043
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
1044
+ $html .= '<optgroup label="' . $this->widget_options['taxonomies'] . '">';
1045
+
1046
+ foreach ( $this->taxonomies as $taxonomy ) {
1047
+ switch ( $type ) {
1048
+ case 'option': {
1049
+ if ( isset( $option['selection']['taxonomies']['taxonomy_' . $taxonomy->name] ) === false )
1050
+ $option['selection']['taxonomies']['taxonomy_' . $taxonomy->name] = false;
1051
+
1052
+ $html .= '<option value="taxonomy_' . $taxonomy->name . '" ' . selected( $option['selection']['taxonomies']['taxonomy_' . $taxonomy->name], true, false ) . '>' . $taxonomy->label . '</option>';
1053
+
1054
+ break;
1055
+ }
1056
+ case 'widget': {
1057
+ if ( ! isset( $this->options['selection']['taxonomies']['taxonomy_' . $taxonomy->name] ) || current_user_can( 'manage_options' ) ) {
1058
+ if ( isset( $instance['rw_opt']['taxonomy_' . $taxonomy->name] ) === false )
1059
+ $instance['rw_opt']['taxonomy_' . $taxonomy->name] = 0;
1060
+
1061
+ $html .= '<option value="taxonomy_' . $taxonomy->name . '" ' . selected( $instance['rw_opt']['taxonomy_' . $taxonomy->name], true, false ) . '>' . apply_filters( 'rw_option_display_name', $taxonomy->label, 'taxonomy' ) . '</option>';
1062
+ }
1063
+
1064
+ break;
1065
+ }
1066
+ }
1067
+ }
1068
+
1069
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
1070
+ $html .= '</optgroup>';
1071
+
1072
+ return $html;
1073
+ }
1074
+ case 'others': {
1075
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
1076
+ $html .= '<optgroup label="' . $this->widget_options['others'] . '">';
1077
+
1078
+ foreach ( $this->others as $key => $value ) {
1079
+ switch ( $type ) {
1080
+ case 'option': {
1081
+ if ( isset( $option['selection']['others']['others_' . $key] ) === false )
1082
+ $option['selection']['others']['others_' . $key] = false;
1083
+
1084
+ $html .= '<option value="others_' . $key . '" ' . selected( $option['selection']['others']['others_' . $key], true, false ) . '>' . $value . '</option>';
1085
+
1086
+ break;
1087
+ }
1088
+ case 'widget': {
1089
+ if ( ! isset( $this->options['selection']['others']['others_' . $key] ) || current_user_can( 'manage_options' ) ) {
1090
+ if ( isset( $instance['rw_opt']['others_' . $key] ) === false )
1091
+ $instance['rw_opt']['others_' . $key] = 0;
1092
+
1093
+ $html .= '<option value="others_' . $key . '" ' . selected( $instance['rw_opt']['others_' . $key], true, false ) . '>' . apply_filters( 'rw_option_display_name', $value, 'other' ) . '</option>';
1094
+ }
1095
+
1096
+ break;
1097
+ }
1098
+ }
1099
+ }
1100
+
1101
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
1102
+ $html .= '</optgroup>';
1103
+
1104
+ return $html;
1105
+ }
1106
+ case 'devices': {
1107
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
1108
+ $html .= '<optgroup label="' . $this->widget_options['devices'] . '">';
1109
+
1110
+ foreach ( $this->devices as $key => $value ) {
1111
+ switch ( $type ) {
1112
+ case 'option': {
1113
+ if ( isset( $option['selection']['devices']['devices_' . $key] ) === false )
1114
+ $option['selection']['devices']['devices_' . $key] = false;
1115
+
1116
+ $html .= '<option value="devices_' . $key . '" ' . selected( $option['selection']['devices']['devices_' . $key], true, false ) . '>' . $value . '</option>';
1117
+
1118
+ break;
1119
+ }
1120
+ case 'widget': {
1121
+ if ( ! isset( $this->options['selection']['devices']['devices_' . $key] ) || current_user_can( 'manage_options' ) ) {
1122
+ if ( isset( $instance['rw_opt']['devices_' . $key] ) === false )
1123
+ $instance['rw_opt']['devices_' . $key] = 0;
1124
+
1125
+ $html .= '<option value="devices_' . $key . '" ' . selected( $instance['rw_opt']['devices_' . $key], true, false ) . '>' . apply_filters( 'rw_option_display_name', $value, 'device' ) . '</option>';
1126
+ }
1127
+
1128
+ break;
1129
+ }
1130
+ }
1131
+ }
1132
+
1133
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
1134
+ $html .= '</optgroup>';
1135
+
1136
+ return $html;
1137
+ }
1138
+ case 'bbpress': {
1139
+ if ( $this->bbpress_active === false )
1140
+ return $html;
1141
+
1142
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
1143
+ $html .= '<optgroup label="' . $this->widget_options['bbpress'] . '">';
1144
+
1145
+ foreach ( $this->bbpress as $key => $value ) {
1146
+ switch ( $type ) {
1147
+ case 'option': {
1148
+ if ( isset( $option['selection']['bbpress']['bbpress_' . $key] ) === false )
1149
+ $option['selection']['bbpress']['bbpress_' . $key] = false;
1150
+
1151
+ $html .= '<option value="bbpress_' . $key . '" ' . selected( $option['selection']['bbpress']['bbpress_' . $key], true, false ) . '>' . $value . '</option>';
1152
+
1153
+ break;
1154
+ }
1155
+ case 'widget': {
1156
+ if ( ! isset( $this->options['selection']['bbpress']['bbpress_' . $key] ) || current_user_can( 'manage_options' ) ) {
1157
+ if ( isset( $instance['rw_opt']['bbpress_' . $key] ) === false )
1158
+ $instance['rw_opt']['bbpress_' . $key] = 0;
1159
+
1160
+ $html .= '<option value="bbpress_' . $key . '" ' . selected( $instance['rw_opt']['bbpress_' . $key], true, false ) . '>' . apply_filters( 'rw_option_display_name', $value, 'bbpress' ) . '</option>';
1161
+ }
1162
+
1163
+ break;
1164
+ }
1165
+ }
1166
+ }
1167
+
1168
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
1169
+ $html .= '</optgroup>';
1170
+
1171
+ return $html;
1172
+ }
1173
+ case 'users': {
1174
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
1175
+ $html .= '<optgroup label="' . $this->widget_options['users'] . '">';
1176
+
1177
+ foreach ( $this->users as $key => $value ) {
1178
+ switch ( $type ) {
1179
+ case 'option': {
1180
+ if ( isset( $option['selection']['users']['users_' . $key] ) === false )
1181
+ $option['selection']['users']['users_' . $key] = false;
1182
+
1183
+ $html .= '<option value="users_' . $key . '" ' . selected( $option['selection']['users']['users_' . $key], true, false ) . '>' . $value . '</option>';
1184
+
1185
+ break;
1186
+ }
1187
+ case 'widget': {
1188
+ if ( ! isset( $this->options['selection']['users']['users_' . $key] ) || current_user_can( 'manage_options' ) ) {
1189
+ if ( isset( $instance['rw_opt']['users_' . $key] ) === false )
1190
+ $instance['rw_opt']['users_' . $key] = 0;
1191
+
1192
+ $html .= '<option value="users_' . $key . '" ' . selected( $instance['rw_opt']['users_' . $key], true, false ) . '>' . apply_filters( 'rw_option_display_name', $value, 'user' ) . '</option>';
1193
+ }
1194
+
1195
+ break;
1196
+ }
1197
+ }
1198
+ }
1199
+
1200
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
1201
+ $html .= '</optgroup>';
1202
+
1203
+ return $html;
1204
+ }
1205
+ case 'languages': {
1206
+ if ( empty( $this->languages ) )
1207
+ return $html;
1208
+
1209
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
1210
+ $html .= '<optgroup label="' . $this->widget_options['languages'] . '">';
1211
+
1212
+ foreach ( $this->languages as $key => $language ) {
1213
+ switch ( $type ) {
1214
+ case 'option': {
1215
+ if ( isset( $option['selection']['languages']['language_' . $key] ) === false )
1216
+ $option['selection']['languages']['language_' . $key] = false;
1217
+
1218
+ $html .= '<option value="language_' . $key . '" ' . selected( $option['selection']['languages']['language_' . $key], true, false ) . '>' . $language['native_name'] . '</option>';
1219
+
1220
+ break;
1221
+ }
1222
+ case 'widget': {
1223
+ if ( ! isset( $this->options['selection']['languages']['language_' . $key] ) || current_user_can( 'manage_options' ) ) {
1224
+ if ( isset( $instance['rw_opt']['language_' . $key] ) === false )
1225
+ $instance['rw_opt']['language_' . $key] = 0;
1226
+
1227
+ $html .= '<option value="language_' . $key . '" ' . selected( $instance['rw_opt']['language_' . $key], true, false ) . '>' . apply_filters( 'rw_option_display_name', $language['native_name'], 'language' ) . '</option>';
1228
+ }
1229
+
1230
+ break;
1231
+ }
1232
+ }
1233
+ }
1234
+
1235
+ if ( ($this->options['groups'] === true && $type === 'widget') || current_user_can( 'manage_options' ) )
1236
+ $html .= '</optgroup>';
1237
+
1238
+ return $html;
1239
+ }
1240
+ }
1241
+ }
1242
+
1243
+ /**
1244
+ * Display widget display options.
1245
+ */
1246
+ public function display_admin_widgets_options( $widget, $empty, $instance ) {
1247
+ if ( isset( $instance['rw_opt']['widget_select'] ) === false )
1248
+ $instance['rw_opt']['widget_select'] = false;
1249
+
1250
+ echo '
1251
+ <p class="restrict-widgets-hide-div restrict-widgets">
1252
+ <label>' . __( 'Display / Hide Widget', self::ID ) . '</label>
1253
+ <select name="' . $widget->get_field_name( 'widget_select' ) . '" class="restrict-widgets-hide select2">
1254
+ <option value="yes" ' . selected( $instance['rw_opt']['widget_select'], true, false ) . '>' . __( 'Display widget on selected', self::ID ) . '</option>
1255
+ <option value="no" ' . selected( $instance['rw_opt']['widget_select'], false, false ) . '>' . __( 'Hide widget on selected', self::ID ) . '</option>
1256
+ </select>
1257
+ </p>
1258
+ <p class="restrict-widgets-select-div restrict-widgets">
1259
+ <select class="restrict-widgets-select select2" multiple="multiple" size="10" name="' . $widget->get_field_name( 'widget_multiselect' ) . '[]">';
1260
+
1261
+ foreach ( $this->widget_options as $option => $text ) {
1262
+ echo $this->get_selection_group( $option, 'widget', $widget, $instance );
1263
+ }
1264
+
1265
+ echo '
1266
+ </select>
1267
+ </p>';
1268
+ }
1269
+
1270
+ /**
1271
+ * Save widget display data.
1272
+ */
1273
+ public function update_admin_widgets_options( $instance, $new_instance ) {
1274
+ if ( is_array( $new_instance['widget_multiselect'] ) ) {
1275
+ $selected = $new_instance['widget_multiselect'];
1276
+
1277
+ // pages
1278
+ foreach ( $this->pages as $page ) {
1279
+ if ( in_array( 'pageid_' . $page->ID, $selected ) )
1280
+ $instance['rw_opt']['pageid_' . $page->ID] = true;
1281
+ else
1282
+ unset( $instance['rw_opt']['pageid_' . $page->ID] );
1283
+ }
1284
+
1285
+ // custom post types
1286
+ foreach ( $this->custom_post_types as $cpt ) {
1287
+ if ( in_array( 'cpt_' . $cpt->name, $selected ) )
1288
+ $instance['rw_opt']['cpt_' . $cpt->name] = true;
1289
+ else
1290
+ unset( $instance['rw_opt']['cpt_' . $cpt->name] );
1291
+ }
1292
+
1293
+ // custom post types archives
1294
+ foreach ( $this->custom_post_types_archives as $cpta ) {
1295
+ if ( in_array( 'cpta_' . $cpta->name, $selected ) )
1296
+ $instance['rw_opt']['cpta_' . $cpta->name] = true;
1297
+ else
1298
+ unset( $instance['rw_opt']['cpta_' . $cpta->name] );
1299
+ }
1300
+
1301
+ // categories
1302
+ foreach ( $this->categories as $category ) {
1303
+ if ( in_array( 'category_' . $category->cat_ID, $selected ) )
1304
+ $instance['rw_opt']['category_' . $category->cat_ID] = true;
1305
+ else
1306
+ unset( $instance['rw_opt']['category_' . $category->cat_ID] );
1307
+ }
1308
+
1309
+ // taxonomies
1310
+ foreach ( $this->taxonomies as $taxonomy ) {
1311
+ if ( in_array( 'taxonomy_' . $taxonomy->name, $selected ) )
1312
+ $instance['rw_opt']['taxonomy_' . $taxonomy->name] = true;
1313
+ else
1314
+ unset( $instance['rw_opt']['taxonomy_' . $taxonomy->name] );
1315
+ }
1316
+
1317
+ // others
1318
+ foreach ( $this->others as $key => $value ) {
1319
+ if ( in_array( 'others_' . $key, $selected ) )
1320
+ $instance['rw_opt']['others_' . $key] = true;
1321
+ else
1322
+ unset( $instance['rw_opt']['others_' . $key] );
1323
+ }
1324
+
1325
+ // devices
1326
+ foreach ( $this->devices as $key => $value ) {
1327
+ if ( in_array( 'devices_' . $key, $selected ) )
1328
+ $instance['rw_opt']['devices_' . $key] = true;
1329
+ else
1330
+ unset( $instance['rw_opt']['devices_' . $key] );
1331
+ }
1332
+
1333
+ // bbpress
1334
+ if ( $this->bbpress_active === true ) {
1335
+ foreach ( $this->bbpress as $key => $value ) {
1336
+ if ( in_array( 'bbpress_' . $key, $selected ) )
1337
+ $instance['rw_opt']['bbpress_' . $key] = true;
1338
+ else
1339
+ unset( $instance['rw_opt']['bbpress_' . $key] );
1340
+ }
1341
+ }
1342
+
1343
+ // users
1344
+ foreach ( $this->users as $key => $value ) {
1345
+ if ( in_array( 'users_' . $key, $selected ) )
1346
+ $instance['rw_opt']['users_' . $key] = true;
1347
+ else
1348
+ unset( $instance['rw_opt']['users_' . $key] );
1349
+ }
1350
+
1351
+ // languages
1352
+ if ( ! empty( $this->languages ) ) {
1353
+ foreach ( $this->languages as $key => $value ) {
1354
+ if ( in_array( 'language_' . $key, $selected ) )
1355
+ $instance['rw_opt']['language_' . $key] = true;
1356
+ else
1357
+ unset( $instance['rw_opt']['language_' . $key] );
1358
+ }
1359
+ }
1360
+ }
1361
+ // clear plugin-instance
1362
+ else
1363
+ unset( $instance['rw_opt'] );
1364
+
1365
+ // widget_multiselect
1366
+ $instance['rw_opt']['widget_select'] = ($new_instance['widget_select'] === 'yes' ? true : false);
1367
+
1368
+ return $instance;
1369
+ }
1370
+
1371
+ /**
1372
+ * Check if widget is empty.
1373
+ *
1374
+ * @param string $widget
1375
+ * @param string $type
1376
+ * @return boolean
1377
+ */
1378
+ private function is_widget_empty( $widget, $type ) {
1379
+ if ( ! empty( $widget ) ) {
1380
+ foreach ( $widget as $option => $tmp ) {
1381
+ $action = explode( '_', $option, 2 );
1382
+
1383
+ if ( $type === 'main' )
1384
+ $array = array( 'category', 'taxonomy', 'cpt', 'cpta', 'pageid', 'others', 'bbpress' );
1385
+ else
1386
+ $array = array( $type );
1387
+
1388
+ if ( in_array( $action[0], $array ) )
1389
+ return false;
1390
+ }
1391
+ }
1392
+
1393
+ return true;
1394
+ }
1395
+
1396
+ /**
1397
+ * Manage front-end display of widgets.
1398
+ */
1399
+ public function display_frontend_widgets( $instance, $class, $args ) {
1400
+ return $this->restrict_widget( $instance, true, $args );
1401
+ }
1402
+
1403
+ /**
1404
+ * Display or hide specific widget.
1405
+ */
1406
+ private function restrict_widget( $instance, $filter = true, $args = array() ) {
1407
+ // no restrict options?
1408
+ if ( empty( $instance['rw_opt'] ) || ! is_array( $instance['rw_opt'] ) )
1409
+ return $instance;
1410
+
1411
+ // get widget options
1412
+ $options = $instance['rw_opt'];
1413
+
1414
+ // get object id if available
1415
+ $post_id = get_queried_object_id();
1416
+
1417
+ // get widget type (display or hide)
1418
+ $display_type = isset( $options['widget_select'] ) ? $options['widget_select'] : false;
1419
+
1420
+ // no restrict options?
1421
+ if ( count( $options ) === 1 && isset( $options['widget_select'] ) )
1422
+ $access = ! $display_type;
1423
+ else {
1424
+ $access = true;
1425
+
1426
+ // check groups of options
1427
+ foreach( array( 'language', 'users', 'devices', 'main' ) as $group ) {
1428
+ $valid_option = true;
1429
+
1430
+ // check single group options
1431
+ if ( ! $this->is_widget_empty( $options, $group ) ) {
1432
+ switch( $group ) {
1433
+ case 'language':
1434
+ if ( $this->polylang_active || $this->wpml_active ) {
1435
+ // fix for WPML
1436
+ if ( function_exists( 'icl_object_id' ) ) {
1437
+ global $sitepress;
1438
+
1439
+ if ( isset( $sitepress ) )
1440
+ $post_id = icl_object_id( $post_id, 'page', true, $sitepress->get_default_language() );
1441
+ else
1442
+ $post_id = icl_object_id( $post_id, 'page', false );
1443
+ }
1444
+
1445
+ $valid_option = defined( 'ICL_LANGUAGE_CODE' ) && isset( $options['language_' . ICL_LANGUAGE_CODE] ) ? true : false;
1446
+ }
1447
+ break;
1448
+
1449
+ case 'users':
1450
+ if ( is_user_logged_in() )
1451
+ $valid_option = isset( $options['users_logged_in'] );
1452
+ else
1453
+ $valid_option = isset( $options['users_logged_out'] );
1454
+ break;
1455
+
1456
+ case 'devices':
1457
+ if ( wp_is_mobile() )
1458
+ $valid_option = isset( $options['devices_mobile'] );
1459
+ else
1460
+ $valid_option = isset( $options['devices_desktop'] );
1461
+ break;
1462
+
1463
+ case 'main':
1464
+ if ( is_front_page() ) {
1465
+ $valid_option = isset( $options['others_front_page'] );
1466
+
1467
+ if ( is_home() && ! $valid_option )
1468
+ $valid_option = isset( $options['others_blog_page'] );
1469
+ }
1470
+ elseif ( is_home() )
1471
+ $valid_option = isset( $options['others_blog_page'] );
1472
+ elseif ( is_singular() ) {
1473
+ if ( is_page() ) {
1474
+ if ( isset( $options['cpt_' . get_post_type( $post_id )] ) )
1475
+ $valid_option = true;
1476
+ else
1477
+ $valid_option = isset( $options['pageid_' . $post_id] );
1478
+ } else {
1479
+ $valid_option = isset( $options['cpt_' . get_post_type( $post_id )] );
1480
+
1481
+ if ( is_single() && ! $valid_option )
1482
+ $valid_option = isset( $options['others_single_post'] );
1483
+ }
1484
+ }
1485
+ elseif ( is_post_type_archive() )
1486
+ $valid_option = isset( $options['cpta_' . get_query_var( 'post_type' )] );
1487
+ elseif ( is_category() )
1488
+ $valid_option = isset( $options['category_' . get_query_var( 'cat' )] );
1489
+ elseif ( is_tag() ) {
1490
+ $object = get_queried_object();
1491
+
1492
+ if ( $object && isset( $object->taxonomy ) && $object->taxonomy === 'post_tag' )
1493
+ $tag = 'wp_log_type';
1494
+ else
1495
+ $tag = '';
1496
+
1497
+ $valid_option = isset( $options['taxonomy_' . $tag] );
1498
+ }
1499
+ elseif ( is_tax() ) {
1500
+ $object = get_queried_object();
1501
+
1502
+ if ( $object && ! empty( $object->taxonomy ) )
1503
+ $taxonomy = $object->taxonomy;
1504
+ else
1505
+ $taxonomy = '';
1506
+
1507
+ $valid_option = isset( $options['taxonomy_' . $taxonomy] );
1508
+ }
1509
+ elseif ( is_404() )
1510
+ $valid_option = isset( $options['others_404_page'] );
1511
+ elseif ( is_sticky() )
1512
+ $valid_option = isset( $options['others_sticky_post'] );
1513
+ elseif ( is_search() )
1514
+ $valid_option = isset( $options['others_search_page'] );
1515
+ elseif ( is_author() )
1516
+ $valid_option = isset( $options['others_author_archive'] );
1517
+ elseif ( is_date() )
1518
+ $valid_option = isset( $options['others_date_archive'] );
1519
+ elseif ( function_exists( 'bbp_is_search' ) && bbp_is_search() )
1520
+ $valid_option = isset( $options['bbpress_search'] );
1521
+ elseif ( function_exists( 'bbp_is_single_user' ) && bbp_is_single_user() )
1522
+ $valid_option = isset( $options['bbpress_single_user'] );
1523
+ elseif ( function_exists( 'bbp_is_topic_tag' ) && bbp_is_topic_tag() )
1524
+ $valid_option = isset( $options['bbpress_topic_tag'] );
1525
+ break;
1526
+ }
1527
+ }
1528
+
1529
+ // option failed?
1530
+ if ( ! $valid_option ) {
1531
+ $access = ! $display_type;
1532
+
1533
+ // finish foreach
1534
+ break;
1535
+ } else
1536
+ $access = $display_type;
1537
+ }
1538
+ }
1539
+
1540
+ // filter true or false
1541
+ if ( $filter )
1542
+ $access = apply_filters_ref_array( 'rw_display_widget', array( $access, $instance ) );
1543
+
1544
+ // display: return $instance, hide: return false
1545
+ return ( $access ? $instance : false );
1546
+ }
1547
+
1548
+ /**
1549
+ * Display Appearance menu and link to widgets.php if user can manage_widgets.
1550
+ */
1551
+ public function manage_widgets_menu() {
1552
+ global $menu, $submenu;
1553
+
1554
+ // if user can manage widgets but can't edit_theme_options, add widgets menu (appearance)
1555
+ if ( current_user_can( 'manage_widgets' ) && ! current_user_can( 'edit_theme_options' ) ) {
1556
+ foreach ( $menu as $menu_key => $menu_values ) {
1557
+ if ( isset( $menu_values[5] ) && $menu_values[5] === 'menu-appearance' ) {
1558
+ // if appearance menu not exists
1559
+ if ( empty( $submenu[$menu_values[2]] ) ) {
1560
+ $menu[$menu_key][1] = 'manage_widgets';
1561
+ $menu[$menu_key][2] = 'widgets.php';
1562
+ } else {
1563
+ // if appearance menu exists
1564
+ foreach ( $submenu[$menu_values[2]] as $submenu_key => $submenu_values ) {
1565
+ $submenu[$menu_values[2]][7] = array( __( 'Widgets' ), 'manage_widgets', 'widgets.php' );
1566
+ }
1567
+ }
1568
+ }
1569
+ }
1570
+ }
1571
+ // if user can't manage widgets but can edit_theme_options, remove widgets from menu
1572
+ elseif ( ! current_user_can( 'manage_widgets' ) && current_user_can( 'edit_theme_options' ) ) {
1573
+ foreach ( $menu as $menu_key => $menu_values ) {
1574
+ if ( isset( $menu_values[5] ) && $menu_values[5] === 'menu-appearance' ) {
1575
+ foreach ( $submenu[$menu_values[2]] as $submenu_key => $submenu_values ) {
1576
+ if ( isset( $submenu_values[2] ) && $submenu_values[2] == 'widgets.php' ) {
1577
+ $submenu[$menu_values[2]][$submenu_key][1] = 'manage_widgets';
1578
+ }
1579
+ }
1580
+ }
1581
+ }
1582
+ }
1583
+ }
1584
+
1585
+ /**
1586
+ * Fix for Appearance menu items on widgets.php if user can manage_widgets but can't edit theme options.
1587
+ */
1588
+ public function manage_widgets_menu_fix() {
1589
+ global $menu, $submenu;
1590
+
1591
+ foreach ( $menu as $menu_key => $menu_values ) {
1592
+ if ( isset( $menu_values[5] ) && $menu_values[5] === 'menu-appearance' ) {
1593
+ //if appearance menu not exists
1594
+ if ( empty( $submenu[$menu_values[2]] ) ) {
1595
+ $menu[$menu_key][1] = 'manage_widgets';
1596
+ $menu[$menu_key][2] = 'widgets.php';
1597
+ } else {
1598
+ //if appearance menu exists
1599
+ $submenu[$menu_values[2]][7] = array( __( 'Widgets' ), 'manage_widgets', 'widgets.php' );
1600
+
1601
+ //remove menus with edit_theme_options capability
1602
+ foreach ( $submenu[$menu_values[2]] as $submenu_key => $submenu_values ) {
1603
+ if ( $submenu_values[1] == 'edit_theme_options' )
1604
+ unset( $submenu[$menu_values[2]][$submenu_key] );
1605
+ }
1606
+
1607
+ //fix if appearance menu item is only 1, remove submenu
1608
+ if ( count( $submenu[$menu_values[2]] ) < 2 ) {
1609
+ unset( $submenu[$menu_values[2]][7] );
1610
+ $menu[$menu_key][1] = 'manage_widgets';
1611
+ $menu[$menu_key][2] = 'widgets.php';
1612
+ }
1613
+ }
1614
+ }
1615
+ }
1616
+ }
1617
+
1618
+ /**
1619
+ * Manage widgets capability.
1620
+ */
1621
+ public function manage_widgets_cap( $allcaps, $cap, $args ) {
1622
+ global $pagenow;
1623
+
1624
+ if ( $pagenow === 'widgets.php' || (defined( 'DOING_AJAX' ) && DOING_AJAX) ) {
1625
+ //break if we're not asking to edit widgets
1626
+ if ( ('edit_theme_options' != $args[0]) || empty( $allcaps['manage_widgets'] ) )
1627
+ return $allcaps;
1628
+ else {
1629
+ //if user can't edit_theme_options but can manage_widgets
1630
+ if ( empty( $allcaps['edit_theme_options'] ) ) {
1631
+ //menu fix
1632
+ add_action( 'admin_menu', array( $this, 'manage_widgets_menu_fix' ), 999 );
1633
+
1634
+ //add cap to edit widgets
1635
+ $allcaps['edit_theme_options'] = true;
1636
+ }
1637
+ }
1638
+ }
1639
+
1640
+ return $allcaps;
1641
+ }
1642
+ }
1643
+
1644
+ /**
1645
+ * Initialize Restrict Widgets.
1646
+ *
1647
+ * @return object
1648
+ */
1649
+ function Restrict_Widgets() {
1650
+ static $instance;
1651
+
1652
+ // first call to instance() initializes the plugin
1653
+ if ( $instance === null || ! ( $instance instanceof Restrict_Widgets ) )
1654
+ $instance = Restrict_Widgets::instance();
1655
+
1656
+ return $instance;
1657
+ }
1658
+
1659
+ Restrict_Widgets();