├── LICENSE ├── README.md ├── changelog.md ├── files ├── multisitefiles.xml └── template │ └── html │ └── com_modules │ └── module │ └── edit_assignment.php ├── language ├── en-GB │ └── en-GB.pkg_multisite.sys.ini └── ru-RU │ └── ru-RU.pkg_multisite.sys.ini ├── modules └── mod_geolocation │ ├── LICENSE │ ├── helper.php │ ├── language │ ├── en-GB │ │ ├── en-GB.mod_geolocation.ini │ │ └── en-GB.mod_geolocation.sys.ini │ └── ru-RU │ │ ├── ru-RU.mod_geolocation.ini │ │ └── ru-RU.mod_geolocation.sys.ini │ ├── mod_geolocation.php │ ├── mod_geolocation.xml │ └── tmpl │ └── default.php ├── pkg_multisite.xml ├── plugins ├── content │ └── multisiteswitchform │ │ ├── contentmultiswitch.xml │ │ ├── language │ │ ├── en-GB │ │ │ ├── en-GB.plg_content_multisiteswitchform.ini │ │ │ └── en-GB.plg_content_multisiteswitchform.sys.ini │ │ └── ru-RU │ │ │ ├── ru-RU.plg_content_multisiteswitchform.ini │ │ │ └── ru-RU.plg_content_multisiteswitchform.sys.ini │ │ ├── multisiteswitchform.php │ │ ├── multisiteswitchform.xml │ │ └── script.php ├── multisite │ └── redirectmenus │ │ ├── fields │ │ └── listsubdomains.php │ │ ├── language │ │ ├── en-GB │ │ │ ├── en-GB.plg_multisite_redirectmenus.ini │ │ │ └── en-GB.plg_multisite_redirectmenus.sys.ini │ │ └── ru-RU │ │ │ ├── ru-RU.plg_multisite_redirectmenus.ini │ │ │ └── ru-RU.plg_multisite_redirectmenus.sys.ini │ │ ├── redirectmenus.php │ │ ├── redirectmenus.xml │ │ └── script.php └── system │ ├── jlsitemap_cron_multisite │ ├── fields │ │ ├── date.php │ │ ├── key.php │ │ └── link.php │ ├── jlsitemap_cron_multisite.php │ ├── jlsitemap_cron_multisite.xml │ ├── language │ │ ├── en-GB │ │ │ ├── en-GB.plg_system_jlsitemap_cron_multisite.ini │ │ │ └── en-GB.plg_system_jlsitemap_cron_multisite.sys.ini │ │ └── ru-RU │ │ │ ├── ru-RU.plg_system_jlsitemap_cron_multisite.ini │ │ │ └── ru-RU.plg_system_jlsitemap_cron_multisite.sys.ini │ ├── layouts │ │ └── fields │ │ │ ├── date.php │ │ │ ├── key.php │ │ │ └── link.php │ ├── media │ │ ├── css │ │ │ ├── link.css │ │ │ └── link.min.css │ │ └── js │ │ │ ├── cron.js │ │ │ ├── cron.min.js │ │ │ ├── key.js │ │ │ ├── key.min.js │ │ │ ├── link.js │ │ │ └── link.min.js │ └── script.php │ ├── modulelabel │ ├── form │ │ ├── form.xml │ │ └── modulelabels.php │ ├── language │ │ ├── en-GB │ │ │ ├── en-GB.plg_system_modulelabel.ini │ │ │ └── en-GB.plg_system_modulelabel.sys.ini │ │ └── ru-RU │ │ │ ├── ru-RU.plg_system_modulelabel.ini │ │ │ └── ru-RU.plg_system_modulelabel.sys.ini │ ├── media │ │ ├── css │ │ │ ├── admin-module.css │ │ │ └── admin-module.min.css │ │ └── js │ │ │ ├── admin-module.js │ │ │ ├── admin-module.min.js │ │ │ ├── admin-modules.js │ │ │ └── admin-modules.min.js │ ├── modulelabel.php │ ├── modulelabel.xml │ └── script.php │ └── multisiteswitch │ ├── helper.php │ ├── helpers │ ├── ConfigHelper.php │ └── positions │ │ ├── yootheme1x.php │ │ └── yootheme2x.php │ ├── language │ ├── en-GB │ │ ├── en-GB.plg_system_multisiteswitch.ini │ │ └── en-GB.plg_system_multisiteswitch.sys.ini │ └── ru-RU │ │ ├── ru-RU.plg_system_multisiteswitch.ini │ │ └── ru-RU.plg_system_multisiteswitch.sys.ini │ ├── multisiteswitch.php │ ├── multisiteswitch.xml │ └── script.php └── script.php /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # multisiting for Joomla! 2 | Мультисайтинг для Joomla! 3 | 4 | Скачать пакет для установки https://github.com/Delo-Design/multisite/releases/latest 5 | Снимок экрана 2023-03-16 в 09 54 43 6 | 7 | 8 | изображение 9 | 10 | пример рабочего сайта https://spb.region-zoloto.ru/ 11 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | 1.4.3 2 | - Добавлено исключение мултисайтинга в основной плагин 3 | 4 | 1.4.2 5 | - Исправлена генерация карт сайтов мультисайтинга 6 | 7 | 1.4.1 8 | - Добавлено событие для редиректов RadicalMart 9 | 10 | 1.4.0 11 | - Добавлена новая опция для модуля mod_geolocation выключения отображения субдоменов 12 | 13 | 1.3.3 14 | - Сделаны исключения для плагина redirectmenus 15 | - Переписана регулярка на подчистку мусора, она была не оптимизирована написана 16 | 17 | 1.3.2 18 | - Поправлена генерация адресов в buildRoute в плагине redirectmenus 19 | 20 | 1.3.1 21 | - Поправлена генерация sitemap 22 | 23 | 1.3 24 | - Перенес код редиректов в плагин редиректов 25 | - Добавлены настройки в плагин редиректов по меню, можно меню исключать 26 | 27 | 1.2 28 | - Переделана структура пакета, разнесено все типам расширений 29 | - Плагин мультисайтинга вклинивается теперь в сборку роутера и вырезает субдомены. Это позволяет отрабатывает другим расширениям правильно при редиректах. Резка буфера регулярным выражением была сохранена, потому что не все расширения правильно генерируют ссылки. 30 | - Добавлен плагин отдельный редиректа по меню, его можно выключить, чтобы отменить преобразования вида: spb.site.ru -> site.ru/spb 31 | - В релиз добавлены сразу расширения jl sitemap и znatok 32 | - Добавлен сервер обновлений пакета 33 | -------------------------------------------------------------------------------- /files/multisitefiles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | FILES_MULTISITEFILES 4 | 15.08.2020 5 | Cymbal 6 | cymbal@delo-design.ru 7 | https://delo-design.ru 8 | Copyright © 2020 Delo Design. All rights reserved. 9 | GNU General Public License version 2 or later; see LICENSE.txt 10 | 1.0 11 | FILES_MULTISITEFILES_XML_DESCRIPTION 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /files/template/html/com_modules/module/edit_assignment.php: -------------------------------------------------------------------------------- 1 | 'auto', 'relative' => true)); 17 | 18 | $script = " 19 | jQuery(document).ready(function() 20 | { 21 | menuHide(jQuery('#jform_assignment').val()); 22 | jQuery('#jform_assignment').change(function() 23 | { 24 | menuHide(jQuery(this).val()); 25 | }) 26 | }); 27 | function menuHide(val) 28 | { 29 | if (val == 0 || val == '-') 30 | { 31 | jQuery('#menuselect-group').hide(); 32 | } 33 | else 34 | { 35 | jQuery('#menuselect-group').show(); 36 | } 37 | } 38 | "; 39 | 40 | // Add the script to the document head 41 | JFactory::getDocument()->addScriptDeclaration($script); 42 | ?> 43 |
44 | 45 | 46 |
47 | 50 |
51 |
52 | 53 | 205 | -------------------------------------------------------------------------------- /language/en-GB/en-GB.pkg_multisite.sys.ini: -------------------------------------------------------------------------------- 1 | PKG_MULTISITE="Multisite" 2 | PKG_MULTISITE_DESCRIPTION="Multisite site package" 3 | 4 | PKG_MULTISITE_ERROR_COMPATIBLE_PHP="This version is compatible only with PHP %s and later" 5 | PKG_MULTISITE_ERROR_COMPATIBLE_JOOMLA="This version is compatible only with Joomla %s and later" -------------------------------------------------------------------------------- /language/ru-RU/ru-RU.pkg_multisite.sys.ini: -------------------------------------------------------------------------------- 1 | PKG_MULTISITE = "Multisite" 2 | PKG_MULTISITE_DESCRIPTION = "Пакет расширений для сайта Multisite" 3 | 4 | PKG_MULTISITE_ERROR_COMPATIBLE_PHP = "Данная версия совместима только с PHP %s и более поздними версиями" 5 | PKG_MULTISITE_ERROR_COMPATIBLE_JOOMLA = "Данная версия совместима только с Joomla %s и более поздними версиями" -------------------------------------------------------------------------------- /modules/mod_geolocation/LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /modules/mod_geolocation/helper.php: -------------------------------------------------------------------------------- 1 | $value) 18 | { 19 | $findRegion = $current['region'] === $value['region']; 20 | $findCity = $current['city'] === $value['city']; 21 | if($findRegion || $findCity) 22 | { 23 | $findSubDomain = $value['object']; 24 | } 25 | } 26 | 27 | if(isset($findSubDomain->subdomain)) 28 | { 29 | if($findSubDomain->subdomain !== plgSystemMultisiteswitch::$subDomain) 30 | { 31 | return $findSubDomain; 32 | } 33 | } 34 | 35 | 36 | return false; 37 | } 38 | 39 | /** 40 | * 41 | * @return mixed 42 | * 43 | * @since version 44 | */ 45 | public static function getDomain() 46 | { 47 | JLoader::register('plgSystemMultisiteswitchHelper', JPATH_ROOT . '/plugins/system/multisiteswitch/helper.php'); 48 | return plgSystemMultisiteswitchHelper::getDomain(); 49 | } 50 | 51 | /** 52 | * 53 | * @return string 54 | * 55 | * @since version 56 | */ 57 | public static function getActive() 58 | { 59 | JLoader::register('plgSystemMultisiteswitch', JPATH_ROOT . '/plugins/system/multisiteswitch/multisiteswitch.php'); 60 | return plgSystemMultisiteswitch::$activeItem; 61 | } 62 | 63 | /** 64 | * 65 | * @return mixed 66 | * 67 | * @since version 68 | */ 69 | public static function getAllSubdomains() 70 | { 71 | JLoader::register('plgSystemMultisiteswitch', JPATH_ROOT . '/plugins/system/multisiteswitch/multisiteswitch.php'); 72 | return plgSystemMultisiteswitch::$listSubdomains; 73 | } 74 | 75 | 76 | /** 77 | * 78 | * @return array 79 | * 80 | * @since version 81 | */ 82 | public static function getRouteRegionsAndCityFromParams() 83 | { 84 | $output = []; 85 | $db = Factory::getDbo(); 86 | $query = $db->getQuery(true) 87 | ->select($db->quoteName(array('params'))) 88 | ->from('#__extensions') 89 | ->where( 'element=' . $db->quote('multisiteswitch')); 90 | $extension = $db->setQuery( $query )->loadObject(); 91 | $params = new \Joomla\Registry\Registry($extension->params); 92 | $subDomains = $params->get('subdomains', []); 93 | 94 | foreach ($subDomains as $subDomain) 95 | { 96 | $output[$subDomain->subdomain] = [ 97 | 'object' => $subDomain 98 | ]; 99 | 100 | if(!empty($subDomain->region)) 101 | { 102 | $output[$subDomain->subdomain]['region'] = JIpgeobase::getRegionFromId((int)$subDomain->region); 103 | } 104 | else 105 | { 106 | $output[$subDomain->subdomain]['region'] = ''; 107 | } 108 | 109 | if(!empty($subDomain->city)) 110 | { 111 | $output[$subDomain->subdomain]['city'] = JIpgeobase::getCityFromId((int)$subDomain->city); 112 | } 113 | else 114 | { 115 | $output[$subDomain->subdomain]['city'] = ''; 116 | } 117 | 118 | } 119 | 120 | return $output; 121 | } 122 | 123 | } -------------------------------------------------------------------------------- /modules/mod_geolocation/language/en-GB/en-GB.mod_geolocation.ini: -------------------------------------------------------------------------------- 1 | MOD_GEOLOCATION="Selecting a Subdomain by Geolocation" 2 | MOD_GEOLOCATION_XML_DESCRIPTION="Uploads a list of subdomains and suggests switching to a region" -------------------------------------------------------------------------------- /modules/mod_geolocation/language/en-GB/en-GB.mod_geolocation.sys.ini: -------------------------------------------------------------------------------- 1 | MOD_GEOLOCATION="Selecting a Subdomain by Geolocation" 2 | MOD_GEOLOCATION_XML_DESCRIPTION="Uploads a list of subdomains and suggests switching to a region" -------------------------------------------------------------------------------- /modules/mod_geolocation/language/ru-RU/ru-RU.mod_geolocation.ini: -------------------------------------------------------------------------------- 1 | MOD_GEOLOCATION="Выбор субдомена по геолокации" 2 | MOD_GEOLOCATION_XML_DESCRIPTION="Выгружает список субдоменов и предлагает переключиться по региону" 3 | MOD_GEOLOCATION_CONFIG_SUBDOMAINS="Отображение субдоменов" 4 | MOD_GEOLOCATION_CONFIG_SUBDOMAINS_NAME="Субдомен" 5 | MOD_GEOLOCATION_CONFIG_SUBDOMAINS_ENABLE="Включить" -------------------------------------------------------------------------------- /modules/mod_geolocation/language/ru-RU/ru-RU.mod_geolocation.sys.ini: -------------------------------------------------------------------------------- 1 | MOD_GEOLOCATION="Выбор субдомена по геолокации" 2 | MOD_GEOLOCATION_XML_DESCRIPTION="Выгружает список субдоменов и предлагает переключиться по региону" -------------------------------------------------------------------------------- /modules/mod_geolocation/mod_geolocation.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright A copyright 7 | * @license GNU General Public License version 2 or later; see LICENSE.txt 8 | * @link http://your.url.com 9 | */ 10 | 11 | use Joomla\CMS\Helper\ModuleHelper; 12 | 13 | defined('_JEXEC') or die; 14 | 15 | $moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx')); 16 | 17 | require_once __DIR__ . '/helper.php'; 18 | require ModuleHelper::getLayoutPath('mod_geolocation', $params->get('layout', 'default')); 19 | -------------------------------------------------------------------------------- /modules/mod_geolocation/mod_geolocation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | MOD_GEOLOCATION 4 | 08.12.2019 5 | Cymbal 6 | cymbal@delo-design.ru 7 | https://delo-design.ru 8 | Copyright © 2020 Delo Design. All rights reserved. 9 | GNU General Public License version 2 or later; see LICENSE.txt 10 | 1.1 11 | MOD_GEOLOCATION_XML_DESCRIPTION 12 | 13 | 14 | mod_geolocation.php 15 | helper.php 16 | tmpl 17 | language 18 | mod_geolocation.xml 19 | 20 | 21 | 22 | 23 | 24 |
26 | 33 |
34 | 38 | 44 | 51 | 52 | 53 | 54 | 55 | 56 |
57 | 58 |
60 | 61 | 67 | 68 | 73 | 74 |
75 |
76 |
77 |
78 | -------------------------------------------------------------------------------- /modules/mod_geolocation/tmpl/default.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright A copyright 7 | * @license GNU General Public License version 2 or later; see LICENSE.txt 8 | * @link http://your.url.com 9 | */ 10 | 11 | use Joomla\CMS\Factory; 12 | 13 | defined('_JEXEC') or die; 14 | 15 | $find = ModGeolocationHelper::findRoute(); 16 | $list = ModGeolocationHelper::getAllSubdomains(); 17 | $active = ModGeolocationHelper::getActive(); 18 | $domain = ModGeolocationHelper::getDomain(); 19 | $config = Factory::getConfig(); 20 | $https = (int) $config->get('force_ssl', 0) === 2 ? 'https://' : 'http://'; 21 | $list_subdomains = $params->get('subdomains', []); 22 | $list_enables = []; 23 | foreach ($list_subdomains as $list_subdomain) 24 | { 25 | $list_enables[$list_subdomain->subdomain] = (int) $list_subdomain->enable; 26 | } 27 | 28 | if ( 29 | isset($list_enables[$active->subdomain]) && 30 | !$list_enables[$active->subdomain]) 31 | { 32 | return; 33 | } 34 | 35 | ?> 36 | 37 |
38 | 39 | Ваш город 40 | subdomain])) || 43 | ($find && isset($list_enables[$find->subdomain]) && $list_enables[$find->subdomain]) 44 | ) : 45 | ?> 46 |
47 | 48 |
49 |
Это ваш город?
50 |
name ?>
51 |
52 |
53 | default) : ?> 54 | Да 56 | 57 | Да 59 | 60 |
61 |
62 | 64 |
65 |
66 |
67 |
68 | 81 | 82 |
83 | 85 |
86 |
    87 | 88 | subdomain]) && 91 | !$list_enables[$item->subdomain] 92 | ) 93 | { 94 | continue; 95 | } 96 | ?> 97 | 98 | default) : ?> 99 |
  • name ?>
  • 100 | 101 |
  • 102 | name ?> 103 |
  • 104 | 105 | 106 |
107 |
108 |
109 |
110 | 111 | 112 | -------------------------------------------------------------------------------- /pkg_multisite.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PKG_MULTISITE 4 | multisite 5 | 08.12.2019 6 | Cymbal 7 | cymbal@delo-design.ru 8 | https://delo-design.ru 9 | Copyright © 2020 Delo Design. All rights reserved. 10 | GNU General Public License version 2 or later; see LICENSE.txt 11 | 1.4.3 12 | PKG_MULTISITE_DESCRIPTION 13 | script.php 14 | 15 | 16 | https://hika.su/update/free/pkg_multisite.xml 17 | 18 | 19 | 20 | en-GB/en-GB.pkg_multisite.sys.ini 21 | ru-RU/ru-RU.pkg_multisite.sys.ini 22 | 23 | 24 | 25 | libraries/lib_fields.zip 26 | plugins/system/jlsitemap_cron_multisite 27 | plugins/system/modulelabel 28 | plugins/system/multisiteswitch 29 | plugins/content/multisiteswitchform 30 | plugins/multisite/redirectmenus 31 | modules/mod_geolocation 32 | packages/pkg_jlsitemap.zip 33 | packages/pkg_ipgeobase.zip 34 | files 35 | 36 | 37 | -------------------------------------------------------------------------------- /plugins/content/multisiteswitchform/contentmultiswitch.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 14 | 15 | 16 |
17 | 18 | 19 | 20 |
21 | 27 | 28 | 33 | 39 | 40 | 41 | 42 | 48 | 56 | 63 | 64 | 65 | 72 |
73 | 78 | 84 | 85 | 86 | 87 |
88 |
89 | -------------------------------------------------------------------------------- /plugins/content/multisiteswitchform/language/en-GB/en-GB.plg_content_multisiteswitchform.ini: -------------------------------------------------------------------------------- 1 | PLG_MULTISITESWITCHFORM="Content - Multisite Form" 2 | PLG_MULTISITESWITCHFORM_XML_DESCRIPTION="Additional form for the menu item to implement multisiting" 3 | COM_MENUS_MULTISWITCH_FIELDSET_LABEL="Multisite" 4 | PLG_MULTISITESWITCHFORM_FORM_FILES="Files" 5 | PLG_MULTISITESWITCHFORM_FORM_FILES_URL="Address" 6 | PLG_MULTISITESWITCHFORM_FORM_FILES_TYPE="Type" 7 | PLG_MULTISITESWITCHFORM_FORM_FILES_TYPE_FILE="File" 8 | PLG_MULTISITESWITCHFORM_FORM_FILES_TYPE_TEXT="Text" 9 | PLG_MULTISITESWITCHFORM_FORM_FILES_HEADERCONTENTTYPE="Header for Recoil" 10 | PLG_MULTISITESWITCHFORM_FORM_FILES_TEXT="Text" 11 | PLG_MULTISITESWITCHFORM_FORM_FILES_FILE="File" 12 | PLG_MULTISITESWITCHFORM_METAS="File" 13 | PLG_MULTISITESWITCHFORM_METAS_NAME="Title" 14 | PLG_MULTISITESWITCHFORM_METAS_CONTENT="Value" -------------------------------------------------------------------------------- /plugins/content/multisiteswitchform/language/en-GB/en-GB.plg_content_multisiteswitchform.sys.ini: -------------------------------------------------------------------------------- 1 | PLG_MULTISITESWITCHFORM="Content - Multisite Form" 2 | PLG_MULTISITESWITCHFORM_XML_DESCRIPTION="Additional form for the menu item to implement multisiting" -------------------------------------------------------------------------------- /plugins/content/multisiteswitchform/language/ru-RU/ru-RU.plg_content_multisiteswitchform.ini: -------------------------------------------------------------------------------- 1 | PLG_MULTISITESWITCHFORM="Контент - Форма для мультисайтинга" 2 | PLG_MULTISITESWITCHFORM_XML_DESCRIPTION="Дополнительная форма для пункта меню для реализации мультисайтинга" 3 | COM_MENUS_MULTISWITCH_FIELDSET_LABEL="Мультисайтинг" 4 | PLG_MULTISITESWITCHFORM_FORM_FILES="Файлы" 5 | PLG_MULTISITESWITCHFORM_FORM_FILES_URL="Адрес" 6 | PLG_MULTISITESWITCHFORM_FORM_FILES_TYPE="Тип" 7 | PLG_MULTISITESWITCHFORM_FORM_FILES_TYPE_FILE="Файл" 8 | PLG_MULTISITESWITCHFORM_FORM_FILES_TYPE_TEXT="Текст" 9 | PLG_MULTISITESWITCHFORM_FORM_FILES_HEADERCONTENTTYPE="Заголовок для отдачи" 10 | PLG_MULTISITESWITCHFORM_FORM_FILES_TEXT="Текст" 11 | PLG_MULTISITESWITCHFORM_FORM_FILES_FILE="Файл" 12 | PLG_MULTISITESWITCHFORM_METAS="Файл" 13 | PLG_MULTISITESWITCHFORM_METAS_NAME="Название" 14 | PLG_MULTISITESWITCHFORM_METAS_CONTENT="Значение" -------------------------------------------------------------------------------- /plugins/content/multisiteswitchform/language/ru-RU/ru-RU.plg_content_multisiteswitchform.sys.ini: -------------------------------------------------------------------------------- 1 | PLG_MULTISITESWITCHFORM="Контент - Форма для мультисайтинга" 2 | PLG_MULTISITESWITCHFORM_XML_DESCRIPTION="Дополнительная форма для пункта меню для реализации мультисайтинга" 3 | -------------------------------------------------------------------------------- /plugins/content/multisiteswitchform/multisiteswitchform.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright A copyright 7 | * @license GNU General Public License version 2 or later; see LICENSE.txt 8 | * @link http://your.url.com 9 | */ 10 | 11 | use Joomla\CMS\Application\CMSApplication; 12 | use Joomla\CMS\Factory; 13 | use Joomla\CMS\Form\Form; 14 | use Joomla\CMS\Plugin\CMSPlugin; 15 | use Joomla\Database\DatabaseDriver; 16 | 17 | defined('_JEXEC') or die; 18 | 19 | /** 20 | * Multisiteswitchform plugin. 21 | * 22 | * @package multisiteswitch 23 | * @since 1.0.0 24 | */ 25 | class plgContentMultisiteswitchform extends CMSPlugin 26 | { 27 | /** 28 | * Application object 29 | * 30 | * @var CMSApplication 31 | * @since 1.0.0 32 | */ 33 | protected $app; 34 | 35 | /** 36 | * Database object 37 | * 38 | * @var DatabaseDriver 39 | * @since 1.0.0 40 | */ 41 | protected $db; 42 | 43 | /** 44 | * Affects constructor behavior. If true, language files will be loaded automatically. 45 | * 46 | * @var boolean 47 | * @since 1.0.0 48 | */ 49 | protected $autoloadLanguage = true; 50 | 51 | /** 52 | * Adds addition meta title 53 | * 54 | * @param JForm $form The form to be altered. 55 | * @param mixed $data The associated data for the form. 56 | * 57 | * @return boolean 58 | * 59 | * @since 1.0 60 | */ 61 | function onContentPrepareForm($form, $data) 62 | { 63 | $app = Factory::getApplication(); 64 | $component = $app->input->get('option'); 65 | $layout = $app->input->get('layout'); 66 | if ($app->isClient('administrator') && $component === 'com_menus' && $layout === 'edit') 67 | { 68 | Form::addFormPath(__DIR__); 69 | $form->loadFile('contentmultiswitch', true); 70 | } 71 | 72 | return true; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /plugins/content/multisiteswitchform/multisiteswitchform.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PLG_MULTISITESWITCHFORM 4 | 08.12.2019 5 | Cymbal 6 | cymbal@delo-design.ru 7 | https://delo-design.ru 8 | Copyright © 2020 Delo Design. All rights reserved. 9 | GNU General Public License version 2 or later; see LICENSE.txt 10 | 1.0 11 | PLG_MULTISITESWITCHFORM_XML_DESCRIPTION 12 | script.php 13 | 14 | 15 | en-GB/en-GB.plg_content_multisiteswitchform.ini 16 | en-GB/en-GB.plg_content_multisiteswitchform.sys.ini 17 | ru-RU/ru-RU.plg_content_multisiteswitchform.ini 18 | ru-RU/ru-RU.plg_content_multisiteswitchform.sys.ini 19 | 20 | 21 | 22 | multisiteswitchform.php 23 | contentmultiswitch.xml 24 | language 25 | 26 | 27 | -------------------------------------------------------------------------------- /plugins/content/multisiteswitchform/script.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright A copyright 7 | * @license GNU General Public License version 2 or later; see LICENSE.txt 8 | * @link http://your.url.com 9 | */ 10 | 11 | use Joomla\CMS\Factory; 12 | 13 | /** 14 | * Multisiteswitch script file. 15 | * 16 | * @package multisiteswitch 17 | * @since 1.0.0 18 | */ 19 | class plgSystemMultisiteswitchformInstallerScript 20 | { 21 | 22 | 23 | public function postflight($type, $parent) 24 | { 25 | // Enable plugin 26 | if ($type === 'install') 27 | { 28 | $this->enablePlugin($parent); 29 | } 30 | 31 | return true; 32 | } 33 | 34 | 35 | protected function enablePlugin($parent) 36 | { 37 | // Prepare plugin object 38 | $plugin = new stdClass(); 39 | $plugin->type = 'plugin'; 40 | $plugin->element = $parent->getElement(); 41 | $plugin->folder = (string) $parent->getParent()->manifest->attributes()['group']; 42 | $plugin->enabled = 1; 43 | 44 | // Update record 45 | Factory::getDbo()->updateObject('#__extensions', $plugin, ['type', 'element', 'folder']); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /plugins/multisite/redirectmenus/fields/listsubdomains.php: -------------------------------------------------------------------------------- 1 | $subdomain->subdomain, 20 | 'name' => $subdomain->name, 21 | 'enable' => 1, 22 | ]; 23 | $i++; 24 | } 25 | 26 | if (!empty($this->value)) 27 | { 28 | foreach ($values as &$value) 29 | { 30 | foreach ($this->value as $value_saved) 31 | { 32 | 33 | if ($value['subdomain'] === $value_saved['subdomain']) 34 | { 35 | $value['enable'] = $value_saved['enable']; 36 | } 37 | 38 | } 39 | 40 | } 41 | } 42 | 43 | 44 | $this->value = $values; 45 | 46 | return parent::getInput(); 47 | } 48 | 49 | 50 | } -------------------------------------------------------------------------------- /plugins/multisite/redirectmenus/language/en-GB/en-GB.plg_multisite_redirectmenus.ini: -------------------------------------------------------------------------------- 1 | PLG_REDIRECTMENUS="Multisiting - Redirect subdomain by menu" 2 | PLG_REDIRECTMENUS_XML_DESCRIPTION="Assigns a subdomain for addresses inside Joomla!. How it works, for example: spb.site.ru/about inside Joomla! Is converted to site.ru/spb/about. This allows you to enter different menus for different subdomains." 3 | PLG_REDIRECTMENUS_CONFIG_SUBDOMAINS="Subdomains" 4 | PLG_REDIRECTMENUS_CONFIG_SUBDOMAINS_NAME="Subdomain" 5 | PLG_REDIRECTMENUS_CONFIG_SUBDOMAINS_ENABLE="Enable" 6 | PLG_REDIRECTMENUS_CONFIG_EXCLUSION_LABEL="Exceptions" 7 | PLG_REDIRECTMENUS_CONFIG_EXCLUSION_URL_LABEL="Exception address" -------------------------------------------------------------------------------- /plugins/multisite/redirectmenus/language/en-GB/en-GB.plg_multisite_redirectmenus.sys.ini: -------------------------------------------------------------------------------- 1 | PLG_REDIRECTMENUS="Multisiting - Redirect subdomain by menu" 2 | PLG_REDIRECTMENUS_XML_DESCRIPTION="Assigns a subdomain for addresses inside Joomla!. How it works, for example: spb.site.ru/about inside Joomla! Is converted to site.ru/spb/about. This allows you to enter different menus for different subdomains." -------------------------------------------------------------------------------- /plugins/multisite/redirectmenus/language/ru-RU/ru-RU.plg_multisite_redirectmenus.ini: -------------------------------------------------------------------------------- 1 | PLG_REDIRECTMENUS="Мультисайтинг - Редирект поддомена по меню" 2 | PLG_REDIRECTMENUS_XML_DESCRIPTION="Присваивает внутри Joomla! для адресов поддомен. Как это работает, пример: spb.site.ru/about внутри Joomla! преобразуется в site.ru/spb/about. Это позволяет ввести разное меню для разных поддоменов" 3 | PLG_REDIRECTMENUS_CONFIG_SUBDOMAINS="Субдомены" 4 | PLG_REDIRECTMENUS_CONFIG_SUBDOMAINS_NAME="Субдомен" 5 | PLG_REDIRECTMENUS_CONFIG_SUBDOMAINS_ENABLE="Включить" 6 | PLG_REDIRECTMENUS_CONFIG_EXCLUSION_LABEL="Исключения" 7 | PLG_REDIRECTMENUS_CONFIG_EXCLUSION_URL_LABEL="Адрес исключения" -------------------------------------------------------------------------------- /plugins/multisite/redirectmenus/language/ru-RU/ru-RU.plg_multisite_redirectmenus.sys.ini: -------------------------------------------------------------------------------- 1 | PLG_REDIRECTMENUS="Мультисайтинг - Редирект поддомена по меню" 2 | PLG_REDIRECTMENUS_XML_DESCRIPTION="Присваивает внутри Joomla! для адресов поддомен. Как это работает, пример: spb.site.ru/about внутри Joomla! преобразуется в site.ru/spb/about. Это позволяет ввести разное меню для разных поддоменов" -------------------------------------------------------------------------------- /plugins/multisite/redirectmenus/redirectmenus.php: -------------------------------------------------------------------------------- 1 | 7 | * @copyright A copyright 8 | * @license GNU General Public License version 2 or later; see LICENSE.txt 9 | * @link http://your.url.com 10 | */ 11 | 12 | use Joomla\CMS\Factory; 13 | use Joomla\CMS\Plugin\CMSPlugin; 14 | use Joomla\Database\DatabaseDriver; 15 | 16 | JLoader::register('ConfigHelper', JPATH_PLUGINS . '/system/multisiteswitch/helpers/ConfigHelper.php'); 17 | 18 | /** 19 | * Multisiteswitch plugin. 20 | * 21 | * @package multisiteswitch 22 | * @since 1.0.0 23 | */ 24 | class plgMultisiteRedirectmenus extends CMSPlugin 25 | { 26 | 27 | /** 28 | * Application object 29 | * 30 | * @var CMSApplication 31 | * @since 1.0.0 32 | */ 33 | protected $app; 34 | 35 | /** 36 | * Database object 37 | * 38 | * @var DatabaseDriver 39 | * @since 1.0.0 40 | */ 41 | protected $db; 42 | 43 | 44 | /** 45 | * Affects constructor behavior. If true, language files will be loaded automatically. 46 | * 47 | * @var boolean 48 | * @since 1.0.0 49 | */ 50 | protected $autoloadLanguage = true; 51 | 52 | 53 | public function onMultisiteAfterInit(&$subDomain, &$defaultMenu, &$defaultMenuItem, &$activeItem, &$sourceURI) 54 | { 55 | 56 | $nomultisite = $this->app->get('nomultisite', 0); 57 | $nomultisite_input = $this->app->input->get('nomultisite', 0); 58 | 59 | if ($nomultisite || $nomultisite_input) 60 | { 61 | return; 62 | } 63 | 64 | $exclusions = [ 65 | '/component' 66 | ]; 67 | 68 | $exclusion_params = $this->params->get('exclusion', []); 69 | 70 | foreach ($exclusion_params as $exclusion_param) 71 | { 72 | $exclusions[] = str_replace('//', '', '/' . $exclusion_param->url); 73 | } 74 | 75 | foreach ($exclusions as $exclusion) 76 | { 77 | if (strpos($sourceURI, $exclusion) === 0) 78 | { 79 | return; 80 | } 81 | } 82 | 83 | 84 | $subDomains = $this->params->get('subdomains', []); 85 | 86 | foreach ($subDomains as $subDomain_current) 87 | { 88 | if ( 89 | $subDomain_current->subdomain === $subDomain && 90 | !(int) $subDomain_current->enable 91 | ) 92 | { 93 | return; 94 | } 95 | } 96 | 97 | if (substr_count($_SERVER['REQUEST_URI'], 'index.php') === 0) 98 | { 99 | $_SERVER['REQUEST_URI'] = '/' . $subDomain . $_SERVER['REQUEST_URI']; 100 | } 101 | else 102 | { 103 | $_SERVER['REQUEST_URI'] = '/' . $subDomain . str_replace('index.php', '', $_SERVER['REQUEST_URI']); 104 | } 105 | 106 | 107 | $router = JApplicationCms::getInstance('site')->getRouter('site'); 108 | $router->attachBuildRule(array($this, 'postprocessBuildRule'), JRouter::PROCESS_AFTER); 109 | $router->attachParseRule(array($this, 'postprocessParseRule'), JRouter::PROCESS_BEFORE); 110 | 111 | } 112 | 113 | 114 | public function postprocessBuildRule(&$router, &$uri) 115 | { 116 | $admin = $this->app->isClient('administrator'); 117 | //$customizer = !empty($this->app->input->get('customizer')); 118 | $customizer = false; 119 | 120 | if ($admin || $customizer) 121 | { 122 | return false; 123 | } 124 | 125 | $nomultisite = $this->app->get('nomultisite', 0); 126 | 127 | if ($nomultisite) 128 | { 129 | return; 130 | } 131 | 132 | $subDomains = ConfigHelper::get('subdomains', []); 133 | 134 | foreach ($subDomains as $subDomain) 135 | { 136 | $uri->setPath(str_replace('index.php/' . $subDomain->subdomain, 'index.php', $uri->getPath())); 137 | } 138 | 139 | } 140 | 141 | 142 | public function postprocessParseRule(&$router, &$uri) 143 | { 144 | $admin = $this->app->isClient('administrator'); 145 | //$customizer = !empty($this->app->input->get('customizer')); 146 | $customizer = false; 147 | 148 | $nomultisite = $this->app->get('nomultisite', 0); 149 | 150 | if ($nomultisite) 151 | { 152 | return; 153 | } 154 | 155 | if ($admin || $customizer) 156 | { 157 | return false; 158 | } 159 | 160 | $path = preg_replace("#\?.*$#isu", '', $_SERVER['REQUEST_URI']); 161 | $uri->setPath(substr($path, 1)); 162 | 163 | } 164 | 165 | 166 | public function onMultisiteAfterRoute(&$subDomain, &$defaultMenu, &$defaultMenuItem, &$activeItem, &$sourceURI) 167 | { 168 | $subDomains = $this->params->get('subdomains', []); 169 | 170 | foreach ($subDomains as $subDomain_current) 171 | { 172 | if ( 173 | $subDomain_current->subdomain === $subDomain && 174 | !(int) $subDomain_current->enable 175 | ) 176 | { 177 | 178 | // поиск на редирект 179 | $split = explode('/', $sourceURI); 180 | 181 | if (!isset($split[1])) 182 | { 183 | return; 184 | } 185 | 186 | $subdomain_for_redirect = $split[1]; 187 | 188 | // проверяем является ли субдоменом 189 | $sub_domains_all = ConfigHelper::get('subdomains', []); 190 | $find = false; 191 | 192 | foreach ($sub_domains_all as $subdomain_current) 193 | { 194 | if ($subdomain_for_redirect === $subdomain_current->subdomain) 195 | { 196 | $find = true; 197 | break; 198 | } 199 | } 200 | 201 | if (!$find) 202 | { 203 | return; 204 | } 205 | 206 | $active = ''; 207 | $menu = $this->app->getMenu(); 208 | $tmp = $menu->getActive(); 209 | 210 | if (!is_string($tmp)) 211 | { 212 | $tmp = (array) $tmp; 213 | 214 | if (isset($tmp['menutype'])) 215 | { 216 | $active = $tmp['menutype']; 217 | } 218 | 219 | } 220 | else 221 | { 222 | $active = $tmp; 223 | } 224 | 225 | if (empty($active)) 226 | { 227 | return; 228 | } 229 | 230 | if ($defaultMenu === $active) 231 | { 232 | return; 233 | } 234 | 235 | $config = Factory::getConfig(); 236 | $https = (int) $config->get('force_ssl', 0) === 2 ? 'https://' : 'http://'; 237 | $domain = $_SERVER['SERVER_NAME']; 238 | $domainSplit = explode('.', $domain); 239 | 240 | if (count($domainSplit) === 3) 241 | { 242 | array_shift($domainSplit); 243 | } 244 | 245 | array_splice($split, 0, 2); 246 | 247 | $this->app->redirect( 248 | $https . $subdomain_for_redirect . '.' . implode('.', $domainSplit) . '/' . implode('/', $split), 249 | 301 250 | ); 251 | 252 | return; 253 | } 254 | } 255 | } 256 | 257 | 258 | } -------------------------------------------------------------------------------- /plugins/multisite/redirectmenus/redirectmenus.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PLG_REDIRECTMENUS 4 | 16.06.2021 5 | Cymbal 6 | cymbal@delo-design.ru 7 | https://delo-design.ru 8 | Copyright © 2020 Delo Design. All rights reserved. 9 | GNU General Public License version 2 or later; see LICENSE.txt 10 | 1.3 11 | PLG_REDIRECTMENUS_XML_DESCRIPTION 12 | 13 | script.php 14 | 15 | 16 | en-GB/en-GB.plg_multisite_redirectmenus.ini 17 | en-GB/en-GB.plg_multisite_redirectmenus.sys.ini 18 | ru-RU/ru-RU.plg_multisite_redirectmenus.ini 19 | ru-RU/ru-RU.plg_multisite_redirectmenus.sys.ini 20 | 21 | 22 | 23 | redirectmenus.php 24 | fields 25 | language 26 | 27 | 28 | 29 | 30 |
31 | 38 |
39 | 43 | 49 | 56 | 57 | 58 | 59 | 60 | 61 | 68 |
69 | 74 | 75 |
76 |
77 |
78 |
79 |
-------------------------------------------------------------------------------- /plugins/multisite/redirectmenus/script.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright A copyright 7 | * @license GNU General Public License version 2 or later; see LICENSE.txt 8 | * @link http://your.url.com 9 | */ 10 | 11 | use Joomla\CMS\Factory; 12 | 13 | /** 14 | * Redirectmenus script file. 15 | * 16 | * @package multisiteswitch 17 | * @since 1.0.0 18 | */ 19 | class plgMultisiteRedirectmenusInstallerScript 20 | { 21 | 22 | 23 | public function postflight($type, $parent) 24 | { 25 | // Enable plugin 26 | if ($type === 'install') 27 | { 28 | $this->enablePlugin($parent); 29 | } 30 | 31 | return true; 32 | } 33 | 34 | 35 | protected function enablePlugin($parent) 36 | { 37 | // Prepare plugin object 38 | $plugin = new stdClass(); 39 | $plugin->type = 'plugin'; 40 | $plugin->element = $parent->getElement(); 41 | $plugin->folder = (string) $parent->getParent()->manifest->attributes()['group']; 42 | $plugin->enabled = 1; 43 | 44 | // Update record 45 | Factory::getDbo()->updateObject('#__extensions', $plugin, ['type', 'element', 'folder']); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/fields/date.php: -------------------------------------------------------------------------------- 1 | getRouter(); 48 | $link = 'index.php?option=com_ajax&plugin=jlsitemap_cron&group=system&format=raw'; 49 | $link = str_replace('administrator/', '', $router->build($link)->toString()); 50 | $link = str_replace('/?', '?', $link); 51 | $link = trim(Uri::root(), '/') . '/' . trim($link, '/'); 52 | 53 | $data = parent::getLayoutData(); 54 | $data['link'] = $link; 55 | 56 | return $data; 57 | } 58 | } -------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/jlsitemap_cron_multisite.php: -------------------------------------------------------------------------------- 1 | params->get('client_enable') && $this->checkCacheTime()) 57 | { 58 | $app = Factory::getApplication(); 59 | $mode = $this->params->get('client_mode', 'all'); 60 | if ($mode === 'all' || ($mode === 'admin' && $app->isClient('administrator')) || ($mode === 'site' && $app->isClient('site'))) 61 | { 62 | // Set params 63 | $site = SiteApplication::getInstance('site'); 64 | $router = $site->getRouter(); 65 | $link = 'index.php?option=com_ajax&plugin=jlsitemap_cron_multisite&group=system&format=json'; 66 | $link = str_replace('administrator/', '', $router->build($link)->toString()); 67 | $link = str_replace('/?', '?', $link); 68 | $link = trim(Uri::root(true), '/') . '/' . trim($link, '/'); 69 | 70 | $params = array('ajax_url' => $link); 71 | Factory::getDocument()->addScriptOptions('jlsitemap_cron_multisite', $params); 72 | 73 | // Add script 74 | HTMLHelper::_('script', 'media/plg_system_jlsitemap_cron_multisite/js/cron.min.js', array('version' => 'auto')); 75 | } 76 | } 77 | } 78 | 79 | /** 80 | * Method to run cron 81 | * 82 | * @return mixed 83 | * 84 | * @since 0.0.2 85 | */ 86 | public function onAjaxJLSitemap_Cron_Multisite() 87 | { 88 | $app = Factory::getApplication(); 89 | $generate = false; 90 | $error = ''; 91 | $clientRun = $this->params->get('client_enable'); 92 | 93 | // Client checks 94 | if ($clientRun) 95 | { 96 | if ($this->checkCacheTime()) 97 | { 98 | $generate = true; 99 | } 100 | else 101 | { 102 | $error = Text::_('PLG_SYSTEM_JLSITEMAP_GENERATION_ERROR_CACHE'); 103 | } 104 | } 105 | 106 | // Server checks 107 | if (!$clientRun) 108 | { 109 | if (!$this->params->get('key_enabled')) 110 | { 111 | $generate = true; 112 | } 113 | elseif (!$generate = ($app->input->get('key', '') == $this->params->get('key'))) 114 | { 115 | $error = Text::_('PLG_SYSTEM_JLSITEMAP_GENERATION_ERROR_KEY'); 116 | } 117 | } 118 | 119 | $error = ''; 120 | $generate = true; 121 | $this->app->set('nomultisite', 1); 122 | 123 | // Run generation 124 | if (!$error && $generate && $urls = $this->generate()) 125 | { 126 | $success = Text::sprintf('PLG_SYSTEM_JLSITEMAP_GENERATION_SUCCESS', count($urls->includes), 127 | count($urls->excludes), count($urls->all)); 128 | 129 | // Prepare json response 130 | if ($app->input->get('format', 'raw') === 'json') 131 | { 132 | $success = explode('
', $success); 133 | } 134 | 135 | return $success; 136 | } 137 | elseif ($error) 138 | { 139 | throw new Exception(Text::sprintf('PLG_SYSTEM_JLSITEMAP_GENERATION_FAILURE', $error)); 140 | } 141 | 142 | return false; 143 | } 144 | 145 | /** 146 | * Method to generate site map 147 | * 148 | * @return boolean|object 149 | * 150 | * @since 0.0.2 151 | */ 152 | protected function generate() 153 | { 154 | try 155 | { 156 | // Update last run 157 | $this->params->set('last_run', Factory::getDate()->toSql()); 158 | $plugin = new stdClass(); 159 | $plugin->type = 'plugin'; 160 | $plugin->element = 'jlsitemap_cron_multisite'; 161 | $plugin->folder = 'system'; 162 | $plugin->params = (string) $this->params; 163 | Factory::getDbo()->updateObject('#__extensions', $plugin, array('type', 'element', 'folder')); 164 | 165 | // Run generation 166 | BaseDatabaseModel::addIncludePath(JPATH_SITE . '/components/com_jlsitemap/models'); 167 | $model = BaseDatabaseModel::getInstance('Sitemap', 'JLSitemapModel', array('ignore_request' => true)); 168 | 169 | if (!$urls = $model->generate()) 170 | { 171 | throw new Exception(Text::sprintf('PLG_SYSTEM_JLSITEMAP_GENERATION_FAILURE', $model->getError())); 172 | } 173 | 174 | $this->splitUrlsForSubdomain($urls); 175 | 176 | return $urls; 177 | } 178 | catch (Exception $e) 179 | { 180 | throw new Exception(Text::sprintf('PLG_SYSTEM_JLSITEMAP_GENERATION_FAILURE', $e->getMessage())); 181 | } 182 | } 183 | 184 | protected function splitUrlsForSubdomain(&$urls) 185 | { 186 | $maps = []; 187 | $includes = $urls->includes; 188 | $subDomains = ConfigHelper::get('subdomains', []); 189 | $domains = []; 190 | 191 | $db = Factory::getDbo(); 192 | $query = $db->getQuery(true); 193 | $query->select('params'); 194 | $query->from('#__extensions'); 195 | $query->where($db->qn('element') . ' = ' . $db->q('redirectmenus')); 196 | $element = $db->setQuery($query)->loadObject(); 197 | $enableds = []; 198 | 199 | if (!empty($element->params)) 200 | { 201 | $params = new Registry($element->params); 202 | $subDomains_enabled = $params->get('subdomains', []); 203 | foreach ($subDomains_enabled as $subDomains_enable) 204 | { 205 | $enableds[$subDomains_enable->subdomain] = (int) $subDomains_enable->enable; 206 | } 207 | } 208 | 209 | foreach ($subDomains as $subDomain) 210 | { 211 | $domains[$subDomain->subdomain] = 1; 212 | 213 | if (isset($enableds[$subDomain->subdomain])) 214 | { 215 | $domains[$subDomain->subdomain] = $enableds[$subDomain->subdomain]; 216 | } 217 | 218 | } 219 | 220 | foreach ($includes as $url) 221 | { 222 | $locSplits = explode('/', $url->get('link')); 223 | unset($locSplits[0]); 224 | $mapIterator = &$maps; 225 | 226 | if (isset($domains[$locSplits[1]])) 227 | { 228 | foreach ($locSplits as $locSplit) 229 | { 230 | 231 | if (empty($locSplit)) 232 | { 233 | continue; 234 | } 235 | 236 | if (!isset($mapIterator[$locSplit])) 237 | { 238 | $mapIterator[$locSplit] = [ 239 | 's' => $url, 240 | 'i' => [] 241 | ]; 242 | } 243 | 244 | $mapIterator = &$mapIterator[$locSplit]['i']; 245 | } 246 | } 247 | else 248 | { 249 | foreach ($domains as $domain => $enabled) 250 | { 251 | if ($enabled) 252 | { 253 | continue; 254 | } 255 | 256 | array_unshift($locSplits, $domain); 257 | foreach ($locSplits as $locSplit) 258 | { 259 | 260 | if (empty($locSplit)) 261 | { 262 | continue; 263 | } 264 | 265 | if (!isset($mapIterator[$locSplit])) 266 | { 267 | $mapIterator[$locSplit] = [ 268 | 's' => $url, 269 | 'i' => [] 270 | ]; 271 | } 272 | 273 | $mapIterator = &$mapIterator[$locSplit]['i']; 274 | } 275 | } 276 | } 277 | 278 | 279 | } 280 | 281 | 282 | $sitemapSource = JPATH_ROOT . DIRECTORY_SEPARATOR . 'sitemap.xml'; 283 | if (file_exists($sitemapSource)) 284 | { 285 | File::delete($sitemapSource); 286 | } 287 | 288 | $sitemapFolder = JPATH_ROOT . DIRECTORY_SEPARATOR . 'sitemaps'; 289 | 290 | if (!file_exists($sitemapFolder)) 291 | { 292 | Folder::create($sitemapFolder); 293 | } 294 | 295 | 296 | foreach ($maps as $domain => $map) 297 | { 298 | $sitemapFile = $sitemapFolder . DIRECTORY_SEPARATOR . $domain . '.xml'; 299 | $rows = $this->buildMap($map); 300 | 301 | if (file_exists($sitemapFile)) 302 | { 303 | File::delete($sitemapFile); 304 | } 305 | 306 | $xml = $this->getXml($rows); 307 | file_put_contents($sitemapFile, $xml); 308 | } 309 | 310 | } 311 | 312 | protected function buildMap($map) 313 | { 314 | JLoader::register('plgSystemMultisiteswitchHelper', JPATH_PLUGINS . '/system/multisiteswitch/helper.php'); 315 | 316 | $config = Factory::getConfig(); 317 | $https = (int) $config->get('force_ssl', 0) === 2 ? 'https://' : 'http://'; 318 | $subdomainDefault = plgSystemMultisiteswitchHelper::getSubdomainDefault(); 319 | $subDomains = ConfigHelper::get('subdomains', []); 320 | $output = []; 321 | $domains = []; 322 | 323 | $db = Factory::getDbo(); 324 | $query = $db->getQuery(true); 325 | $query->select('params'); 326 | $query->from('#__extensions'); 327 | $query->where($db->qn('element') . ' = ' . $db->q('redirectmenus')); 328 | $element = $db->setQuery($query)->loadObject(); 329 | $enableds = []; 330 | 331 | if (!empty($element->params)) 332 | { 333 | $params = new Registry($element->params); 334 | $subDomains_enabled = $params->get('subdomains', []); 335 | foreach ($subDomains_enabled as $subDomains_enable) 336 | { 337 | $enableds[$subDomains_enable->subdomain] = (int) $subDomains_enable->enable; 338 | } 339 | } 340 | 341 | foreach ($subDomains as $subDomain) 342 | { 343 | $domains[$subDomain->subdomain] = 1; 344 | 345 | if (isset($enableds[$subDomain->subdomain])) 346 | { 347 | $domains[$subDomain->subdomain] = $enableds[$subDomain->subdomain]; 348 | } 349 | 350 | } 351 | 352 | 353 | $build = static function ($splitMap) use (&$output, &$build, $https, $subdomainDefault, $domains) { 354 | $item = $splitMap['s']; 355 | $link = ''; 356 | $subdomain = ''; 357 | $linkSource = explode('/', $item->get('link', '')); 358 | $serverName = $_SERVER['SERVER_NAME']; 359 | 360 | if (isset($linkSource[1])) 361 | { 362 | if (isset($domains[$linkSource[1]])) 363 | { 364 | $subdomain = $linkSource[1]; 365 | unset($linkSource[1]); 366 | if ($subdomainDefault->subdomain === $subdomain) 367 | { 368 | $subdomain = ''; 369 | } 370 | else 371 | { 372 | $subdomain .= '.'; 373 | $serverName = str_replace('www.', '', $serverName); 374 | } 375 | 376 | } 377 | } 378 | 379 | $link = implode('/', $linkSource); 380 | $loc = $https . $subdomain . $serverName . $link; 381 | $item->set('link', $link); 382 | $item->set('loc', $loc); 383 | 384 | $output[] = $item; 385 | 386 | if (isset($splitMap['i'])) 387 | { 388 | foreach ($splitMap['i'] as $split) 389 | { 390 | $build($split); 391 | } 392 | } 393 | 394 | }; 395 | 396 | $build($map); 397 | 398 | return $output; 399 | } 400 | 401 | /** 402 | * Method to get sitemap xml string 403 | * 404 | * @param array $rows Include urls array 405 | * 406 | * @return string 407 | * 408 | * @throws Exception 409 | * 410 | * @since 1.1.0 411 | */ 412 | protected function getXML($rows = array()) 413 | { 414 | $rows = (empty($rows)) ? $this->getUrls()->includes : $rows; 415 | 416 | // Create sitemap 417 | $sitemap = new SimpleXMLElement('' 418 | . '' 419 | . ''); 426 | 427 | // Add urls 428 | foreach ($rows as $row) 429 | { 430 | if ($loc = $row->get('loc', false)) 431 | { 432 | $url = $sitemap->addChild('url'); 433 | 434 | // Loc 435 | $url->addChild('loc', $loc); 436 | 437 | // Changefreq 438 | if ($changefreq = $row->get('changefreq', false)) 439 | { 440 | $url->addChild('changefreq', $changefreq); 441 | } 442 | 443 | // Priority 444 | if ($priority = $row->get('priority', false)) 445 | { 446 | $url->addChild('priority', $row->get('priority')); 447 | } 448 | 449 | // Lastmod 450 | if ($lastmod = $row->get('lastmod', false)) 451 | { 452 | $url->addChild('lastmod', Factory::getDate($lastmod)->toISO8601()); 453 | } 454 | 455 | // Alternates 456 | if ($alternates = $row->get('alternates', false)) 457 | { 458 | // Add x-default 459 | if (!isset($alternates['x-default']) && isset($alternates[Factory::getLanguage()->getDefault()])) 460 | { 461 | $alternates['x-default'] = $alternates[Factory::getLanguage()->getDefault()]; 462 | } 463 | 464 | foreach ($alternates as $lang => $href) 465 | { 466 | $alternate = $url->addChild('xhtml:link', '', 'http://www.w3.org/1999/xhtml'); 467 | $alternate->addAttribute('rel', 'alternate'); 468 | $alternate->addAttribute('hreflang', $lang); 469 | $alternate->addAttribute('href', $href); 470 | } 471 | } 472 | } 473 | } 474 | $xml = $sitemap->asXML(); 475 | 476 | return $xml; 477 | } 478 | 479 | /** 480 | * Method to check client cache time 481 | * 482 | * @return bool True if run. False if don't run 483 | * 484 | * @since 0.0.2 485 | */ 486 | protected function checkCacheTime() 487 | { 488 | if (!$lastRun = $this->params->get('last_run', false)) 489 | { 490 | return true; 491 | } 492 | 493 | // Prepare cache time 494 | $offset = ' + ' . $this->params->get('client_cache_number', 1) . ' ' . 495 | $this->params->get('client_cache_value', 'day'); 496 | $cache = new Date($lastRun . $offset); 497 | 498 | return (Factory::getDate()->toUnix() >= $cache->toUnix()); 499 | } 500 | } -------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/jlsitemap_cron_multisite.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PLG_SYSTEM_JLSITEMAP_CRON 4 | Joomline 5 | @date@ 6 | Copyright (c) 2010 - 2019 Joomline. All rights reserved. 7 | http://www.gnu.org/copyleft/gpl.html GNU/GPL 8 | sale@joomline.ru 9 | https://joomline.ru/ 10 | @version@ 11 | PLG_SYSTEM_JLSITEMAP_CRON_MULTISITE_DESCRIPTION 12 | script.php 13 | 14 | en-GB/en-GB.plg_system_jlsitemap_cron_multisite.ini 15 | en-GB/en-GB.plg_system_jlsitemap_cron_multisite.sys.ini 16 | ru-RU/ru-RU.plg_system_jlsitemap_cron_multisite.ini 17 | ru-RU/ru-RU.plg_system_jlsitemap_cron_multisite.sys.ini 18 | 19 | 20 | jlsitemap_cron_multisite.php 21 | fields 22 | 23 | 24 | 25 |
26 | 27 | 31 | 36 | 37 | 38 | 39 | 40 | 44 | 45 | 46 | 47 | 52 | 53 | 54 | 55 | 56 | 62 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 |
74 |
75 |
76 | 77 | css 78 | js 79 | 80 | 81 | fields 82 | 83 |
-------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/language/en-GB/en-GB.plg_system_jlsitemap_cron_multisite.ini: -------------------------------------------------------------------------------- 1 | ; @package System - JLSitemap Cron Plugin 2 | ; @version @version@ 3 | ; @author Joomline - joomline.ru 4 | ; @copyright Copyright (c) 2010 - 2019 Joomline. All rights reserved. 5 | ; @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html 6 | ; @link https://joomline.ru/ 7 | ; Note : All ini files need to be saved as UTF-8 8 | 9 | PLG_SYSTEM_JLSITEMAP_CRON = "System - JLSitemap Cron" 10 | PLG_SYSTEM_JLSITEMAP_CRON_DESCRIPTION = "Cron plugin for JLSitemap." 11 | 12 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_LAST_RUN = "Last run" 13 | 14 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT = "Run on client side" 15 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_DESC = "Write about AJAX." 16 | 17 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_MODE = "Start" 18 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_MODE_ALL = "Everywhere" 19 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_MODE_ADMIN = "Admin" 20 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_MODE_SITE = "Site" 21 | 22 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_CACHE = "Run time" 23 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_CACHE_MINUTES = "Minute" 24 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_CACHE_HOURS = "Hours" 25 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_CACHE_DAY = "Day" 26 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_CACHE_WEEK = "Week" 27 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_CACHE_MONTH = "Month" 28 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_CACHE_YEAR = "Year" 29 | 30 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_LINK = "Link" 31 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_LINK_DESC = "Reference for Сron. More information about the work of the Cron can be found in the documentation." 32 | 33 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_KEY = "Secret Key" 34 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_KEY_GENERATE = "Generate" 35 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_KEY_DESC = "Secret key for server Cron run." 36 | 37 | PLG_SYSTEM_JLSITEMAP_GENERATION_SUCCESS = "Sitemap generation completed.
Add %s urls.
Exclude %s urls.
Total %s urls." 38 | PLG_SYSTEM_JLSITEMAP_GENERATION_FAILURE = "Failed sitemap generation: %s" 39 | PLG_SYSTEM_JLSITEMAP_GENERATION_ERROR_KEY = "Incorrect key" 40 | PLG_SYSTEM_JLSITEMAP_GENERATION_ERROR_CACHE = "The start time has not come" -------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/language/en-GB/en-GB.plg_system_jlsitemap_cron_multisite.sys.ini: -------------------------------------------------------------------------------- 1 | ; @package System - JLSitemap Cron Plugin 2 | ; @version @version@ 3 | ; @author Joomline - joomline.ru 4 | ; @copyright Copyright (c) 2010 - 2019 Joomline. All rights reserved. 5 | ; @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html 6 | ; @link https://joomline.ru/ 7 | ; Note : All ini files need to be saved as UTF-8 8 | 9 | PLG_SYSTEM_JLSITEMAP_CRON = "System - JLSitemap Cron" 10 | PLG_SYSTEM_JLSITEMAP_CRON_DESCRIPTION = "Cron plugin for JLSitemap." -------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/language/ru-RU/ru-RU.plg_system_jlsitemap_cron_multisite.ini: -------------------------------------------------------------------------------- 1 | ; @package System - JLSitemap Cron Plugin 2 | ; @version @version@ 3 | ; @author Joomline - joomline.ru 4 | ; @copyright Copyright (c) 2010 - 2019 Joomline. All rights reserved. 5 | ; @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html 6 | ; @link https://joomline.ru/ 7 | ; Note : All ini files need to be saved as UTF-8 8 | 9 | PLG_SYSTEM_JLSITEMAP_CRON = "Система - JLSitemap планировщик" 10 | PLG_SYSTEM_JLSITEMAP_CRON_DESCRIPTION = "Плагин планировщика для JLSitemap." 11 | 12 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_LAST_RUN = "Последний запуск" 13 | 14 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT = "Запускать пользователями" 15 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_DESC = "Написать про AJAX." 16 | 17 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_MODE = "Запускать" 18 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_MODE_ALL = "Везде" 19 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_MODE_ADMIN = "Админка" 20 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_MODE_SITE = "Сайт" 21 | 22 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_CACHE = "Время запуска" 23 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_CACHE_MINUTES = "Минута" 24 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_CACHE_HOURS = "Час" 25 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_CACHE_DAY = "День" 26 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_CACHE_WEEK = "Неделя" 27 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_CACHE_MONTH = "Месяц" 28 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_CLIENT_CACHE_YEAR = "Год" 29 | 30 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_LINK = "Ссылка" 31 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_LINK_DESC = "Ссылка для планировщика. Подробнее о работе планировщика можете прочитать в документации." 32 | 33 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_KEY = "Секретный ключ" 34 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_KEY_GENERATE = "Сгенирировать" 35 | PLG_SYSTEM_JLSITEMAP_CRON_PARAMS_KEY_DESC = "Секретный ключ для серверного запуска планировщика." 36 | 37 | PLG_SYSTEM_JLSITEMAP_GENERATION_SUCCESS = "Генерация карты сайта завершена.
Добавлено %s ссылок.
Исключено %s ссылок.
Всего %s ссылок." 38 | PLG_SYSTEM_JLSITEMAP_GENERATION_FAILURE = "Не удалось сгенерировать карту сайта: %s" 39 | PLG_SYSTEM_JLSITEMAP_GENERATION_ERROR_KEY = "Неверный ключ" 40 | PLG_SYSTEM_JLSITEMAP_GENERATION_ERROR_CACHE = "Время запуска не наступило" -------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/language/ru-RU/ru-RU.plg_system_jlsitemap_cron_multisite.sys.ini: -------------------------------------------------------------------------------- 1 | ; @package System - JLSitemap Cron Plugin 2 | ; @version @version@ 3 | ; @author Joomline - joomline.ru 4 | ; @copyright Copyright (c) 2010 - 2019 Joomline. All rights reserved. 5 | ; @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html 6 | ; @link https://joomline.ru/ 7 | ; Note : All ini files need to be saved as UTF-8 8 | 9 | PLG_SYSTEM_JLSITEMAP_CRON = "Система - JLSitemap планировщик" 10 | PLG_SYSTEM_JLSITEMAP_CRON_DESCRIPTION = "Плагин планировщика для JLSitemap." -------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/layouts/fields/date.php: -------------------------------------------------------------------------------- 1 | get('offset') . ')' 29 | ?> 30 |
31 | 32 | 33 |
-------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/layouts/fields/key.php: -------------------------------------------------------------------------------- 1 | 'auto')); 28 | 29 | ?> 30 |
31 | 32 | 33 |
-------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/layouts/fields/link.php: -------------------------------------------------------------------------------- 1 | 'auto')); 28 | HTMLHelper::_('script', 'media/plg_system_jlsitemap_cron/js/link.min.js', array('version' => 'auto')); 29 | 30 | ?> 31 |
32 |
33 | 34 |
35 |
36 | 37 | 38 |
39 |
40 | 41 |
42 |
-------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/media/css/link.css: -------------------------------------------------------------------------------- 1 | /* 2 | * @package System - JLSitemap Cron Plugin 3 | * @version @version@ 4 | * @author Joomline - joomline.ru 5 | * @copyright Copyright (c) 2010 - 2019 Joomline. All rights reserved. 6 | * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html 7 | * @link https://joomline.ru/ 8 | */ 9 | 10 | [data-input-link] { 11 | display: block; 12 | padding: 10px; 13 | background: #fff; 14 | color: #666; 15 | box-shadow: 0 5px 15px rgba(0, 0, 0, .08); 16 | } 17 | 18 | [data-input-link] .title { 19 | font-size: 16px; 20 | font-weight: bold; 21 | margin-bottom: 10px; 22 | } 23 | 24 | [data-input-link] .input code { 25 | display: block; 26 | width: 100%; 27 | padding: 5px 10px; 28 | box-sizing: border-box; 29 | } 30 | 31 | [data-input-link] .description { 32 | margin-top: 10px; 33 | } -------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/media/css/link.min.css: -------------------------------------------------------------------------------- 1 | [data-input-link]{display:block;padding:10px;background:#fff;color:#666;box-shadow:0 5px 15px rgba(0,0,0,.08)}[data-input-link] .title{font-size:16px;font-weight:700;margin-bottom:10px}[data-input-link] .input code{display:block;width:100%;padding:5px 10px;box-sizing:border-box}[data-input-link] .description{margin-top:10px} -------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/media/js/cron.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @package System - JLSitemap Cron Plugin 3 | * @version @version@ 4 | * @author Joomline - joomline.ru 5 | * @copyright Copyright (c) 2010 - 2019 Joomline. All rights reserved. 6 | * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html 7 | * @link https://joomline.ru/ 8 | */ 9 | 10 | try { 11 | document.addEventListener('DOMContentLoaded', function () { 12 | let xhr = new XMLHttpRequest(), 13 | params = Joomla.getOptions('jlsitemap_cron', ''); 14 | xhr.open('GET', params.ajax_url, false); 15 | xhr.send(); 16 | if (xhr.status !== 200) { 17 | console.error('Sitemap cron error:' + xhr.status + ': ' + xhr.statusText); 18 | } else { 19 | console.debug('Sitemap cron success'); 20 | } 21 | }); 22 | } catch (e) { 23 | console.error('Sitemap cron error: ', e); 24 | } -------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/media/js/cron.min.js: -------------------------------------------------------------------------------- 1 | try{document.addEventListener("DOMContentLoaded",function(){let xhr=new XMLHttpRequest(),params=Joomla.getOptions("jlsitemap_cron","");xhr.open("GET",params.ajax_url,false);xhr.send();if(xhr.status!==200){console.error("Sitemap cron error:"+xhr.status+": "+xhr.statusText)}else{console.debug("Sitemap cron success")}})}catch(e){console.error("Sitemap cron error: ",e)}; -------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/media/js/key.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @package System - JLSitemap Cron Plugin 3 | * @version @version@ 4 | * @author Joomline - joomline.ru 5 | * @copyright Copyright (c) 2010 - 2019 Joomline. All rights reserved. 6 | * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html 7 | * @link https://joomline.ru/ 8 | */ 9 | 10 | (function ($) { 11 | $(document).ready(function () { 12 | $('[data-input-key]').each(function () { 13 | let field = $(this), 14 | input = $(field).find('input'), 15 | keyEnable = $('[name="jform[params][key_enabled]"]'), 16 | clientEnable = $('[name="jform[params][client_enable]"]'), 17 | generate = $(field).find('.generate'); 18 | 19 | // Set required 20 | function setRequired() { 21 | let keyEnable_val = $(keyEnable).filter(':checked').val() * 1, 22 | clientEnable_val = $(clientEnable).filter(':checked').val() * 1; 23 | 24 | if (keyEnable_val === 1 && clientEnable_val === 0) { 25 | $(input).attr('required', 'true'); 26 | } else { 27 | $(input).removeAttr('required'); 28 | } 29 | } 30 | 31 | $(keyEnable).on('change', function () { 32 | setRequired(); 33 | }); 34 | $(clientEnable).on('change', function () { 35 | setRequired(); 36 | }); 37 | setRequired(); 38 | 39 | // Generate token 40 | $(generate).on('click', function () { 41 | let a = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'.split(''), 42 | b = []; 43 | for (let i = 0; i < 15; i++) { 44 | let j = (Math.random() * (a.length - 1)).toFixed(0); 45 | b[i] = a[j]; 46 | } 47 | $(input).val(b.join('')); 48 | $(input).trigger('change'); 49 | }); 50 | }); 51 | }); 52 | })(jQuery); -------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/media/js/key.min.js: -------------------------------------------------------------------------------- 1 | (function(c){c(document).ready(function(){c("[data-input-key]").each(function(){let field=c(this),input=c(field).find("input"),keyEnable=c('[name="jform[params][key_enabled]"]'),clientEnable=c('[name="jform[params][client_enable]"]'),generate=c(field).find(".generate");function d(){let keyEnable_val=c(keyEnable).filter(":checked").val()*1,clientEnable_val=c(clientEnable).filter(":checked").val()*1;if(keyEnable_val===1&&clientEnable_val===0){c(input).attr("required","true")}else{c(input).removeAttr("required")}}c(keyEnable).on("change",function(){d()});c(clientEnable).on("change",function(){d()});d();c(generate).on("click",function(){let a="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".split(""),b=[];for(let i=0;i<15;i++){let j=(Math.random()*(a.length-1)).toFixed(0);b[i]=a[j]}c(input).val(b.join(""));c(input).trigger("change")})})})})(jQuery); -------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/media/js/link.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @package System - JLSitemap Cron Plugin 3 | * @version @version@ 4 | * @author Joomline - joomline.ru 5 | * @copyright Copyright (c) 2010 - 2019 Joomline. All rights reserved. 6 | * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html 7 | * @link https://joomline.ru/ 8 | */ 9 | 10 | (function ($) { 11 | $(document).ready(function () { 12 | $('[data-input-link]').each(function () { 13 | let field = $(this), 14 | input = $(field).find('input'), 15 | code = $(field).find('code'), 16 | baseLink = $(field).data('input-link'), 17 | group = $(field).closest('.control-group'), 18 | keyEnable = $('[name="jform[params][key_enabled]"]'), 19 | clientEnable = $('[name="jform[params][client_enable]"]'), 20 | key = $('[name="jform[params][key]"]'); 21 | 22 | // Remove label & remove margin 23 | $(group).find('.control-label').remove(); 24 | $(group).find('.controls').removeClass('controls'); 25 | 26 | // Set link 27 | function setLink() { 28 | let link = baseLink, 29 | keyEnable_val = $(keyEnable).filter(':checked').val() * 1, 30 | clientEnable_val = $(clientEnable).filter(':checked').val() * 1; 31 | 32 | if (keyEnable_val === 1 && clientEnable_val === 0) { 33 | link += '&key=' + $(key).val(); 34 | } 35 | (input).val(link); 36 | $(code).html(link); 37 | } 38 | 39 | $(keyEnable).on('change', function () { 40 | setLink() 41 | }); 42 | $(clientEnable).on('change', function () { 43 | setLink() 44 | }); 45 | $(key).on('change', function () { 46 | setLink() 47 | }); 48 | setLink(); 49 | }); 50 | }); 51 | })(jQuery); -------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/media/js/link.min.js: -------------------------------------------------------------------------------- 1 | (function(a){a(document).ready(function(){a("[data-input-link]").each(function(){let field=a(this),input=a(field).find("input"),code=a(field).find("code"),baseLink=a(field).data("input-link"),group=a(field).closest(".control-group"),keyEnable=a('[name="jform[params][key_enabled]"]'),clientEnable=a('[name="jform[params][client_enable]"]'),key=a('[name="jform[params][key]"]');a(group).find(".control-label").remove();a(group).find(".controls").removeClass("controls");function b(){let link=baseLink,keyEnable_val=a(keyEnable).filter(":checked").val()*1,clientEnable_val=a(clientEnable).filter(":checked").val()*1;if(keyEnable_val===1&&clientEnable_val===0){link+="&key="+a(key).val()}(input).val(link);a(code).html(link)}a(keyEnable).on("change",function(){b()});a(clientEnable).on("change",function(){b()});a(key).on("change",function(){b()});b()})})})(jQuery); -------------------------------------------------------------------------------- /plugins/system/jlsitemap_cron_multisite/script.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright A copyright 7 | * @license GNU General Public License version 2 or later; see LICENSE.txt 8 | * @link http://your.url.com 9 | */ 10 | 11 | use Joomla\CMS\Factory; 12 | 13 | 14 | /** 15 | * Multisiteswitch script file. 16 | * 17 | * @package multisiteswitch 18 | * @since 1.0.0 19 | */ 20 | class plgSystemJlsitemap_cron_multisiteInstallerScript 21 | { 22 | 23 | 24 | public function postflight($type, $parent) 25 | { 26 | // Enable plugin 27 | if ($type === 'install') 28 | { 29 | $this->enablePlugin($parent); 30 | } 31 | 32 | return true; 33 | } 34 | 35 | 36 | protected function enablePlugin($parent) 37 | { 38 | // Prepare plugin object 39 | $plugin = new stdClass(); 40 | $plugin->type = 'plugin'; 41 | $plugin->element = $parent->getElement(); 42 | $plugin->folder = (string) $parent->getParent()->manifest->attributes()['group']; 43 | $plugin->enabled = 1; 44 | 45 | // Update record 46 | Factory::getDbo()->updateObject('#__extensions', $plugin, ['type', 'element', 'folder']); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /plugins/system/modulelabel/form/form.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 8 |
9 |
-------------------------------------------------------------------------------- /plugins/system/modulelabel/form/modulelabels.php: -------------------------------------------------------------------------------- 1 | ` tag for the form field object. 38 | * @param mixed $value The form field value to validate. 39 | * @param string $group The field name group control value. This acts as an array container for the field. 40 | * For example if the field has name="foo" and the group value is set to "bar" then the 41 | * full field name would end up being "bar[foo]". 42 | * 43 | * @return boolean True on success. 44 | * 45 | * @see JFormField::setup() 46 | * 47 | * @since 1.0.0 48 | */ 49 | public function setup(SimpleXMLElement $element, $value, $group = null) 50 | { 51 | $return = parent::setup($element, $value, $group); 52 | 53 | $this->value = (!is_array($this->value)) ? (array) $this->value : $this->value; 54 | 55 | return $return; 56 | } 57 | 58 | /** 59 | * Method to get the field options. 60 | * 61 | * @return array The field option objects. 62 | * 63 | * @since 1.0.0 64 | */ 65 | protected function getOptions() 66 | { 67 | if (!is_array($this->options)) 68 | { 69 | $db = Factory::getDbo(); 70 | $query = $db->getQuery(true) 71 | ->select('title') 72 | ->from('#__modules'); 73 | $db->setQuery($query); 74 | $titles = $db->loadColumn(); 75 | 76 | $labels = array(); 77 | preg_match_all('/\[.*?]/', implode(' ', $titles), $matches); 78 | if (!empty($matches[0])) 79 | { 80 | foreach ($matches[0] as $label) 81 | { 82 | $labels[] = trim(str_replace(array('[', ']'), '', $label)); 83 | } 84 | } 85 | 86 | $options = array(); 87 | foreach (array_unique($labels) as $label) 88 | { 89 | $option = new stdClass(); 90 | $option->value = $label; 91 | $option->text = $label; 92 | $option->selected = (in_array($label, $this->value)); 93 | 94 | $options[] = $option; 95 | } 96 | 97 | $this->options = $options; 98 | } 99 | 100 | return $this->options; 101 | } 102 | } -------------------------------------------------------------------------------- /plugins/system/modulelabel/language/en-GB/en-GB.plg_system_modulelabel.ini: -------------------------------------------------------------------------------- 1 | ; @package System - Module Label Plugin 2 | ; @version 1.1.0 3 | ; @author Nerudas - nerudas.ru 4 | ; @copyright Copyright (c) 2013 - 2018 Nerudas. All rights reserved. 5 | ; @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html 6 | ; @link https://nerudas.ru 7 | ; Note : All ini files need to be saved as UTF-8 8 | 9 | PLG_SYSTEM_MODULELABEL = "System - Module Label" 10 | PLG_SYSTEM_MODULELABEL_DESCRIPTION = "The plugin allows you to make a labels in the module title" 11 | 12 | PLG_SYSTEM_MODULELABEL_FIELD_LABEL = "Label" -------------------------------------------------------------------------------- /plugins/system/modulelabel/language/en-GB/en-GB.plg_system_modulelabel.sys.ini: -------------------------------------------------------------------------------- 1 | ; @package System - Module Label Plugin 2 | ; @version 1.1.0 3 | ; @author Nerudas - nerudas.ru 4 | ; @copyright Copyright (c) 2013 - 2018 Nerudas. All rights reserved. 5 | ; @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html 6 | ; @link https://nerudas.ru 7 | ; Note : All ini files need to be saved as UTF-8 8 | 9 | PLG_SYSTEM_MODULELABEL = "System - Module Label" 10 | PLG_SYSTEM_MODULELABEL_DESCRIPTION = "The plugin allows you to make a labels in the module title" -------------------------------------------------------------------------------- /plugins/system/modulelabel/language/ru-RU/ru-RU.plg_system_modulelabel.ini: -------------------------------------------------------------------------------- 1 | ; @package System - Module Label Plugin 2 | ; @version 1.1.0 3 | ; @author Nerudas - nerudas.ru 4 | ; @copyright Copyright (c) 2013 - 2018 Nerudas. All rights reserved. 5 | ; @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html 6 | ; @link https://nerudas.ru 7 | ; Note : All ini files need to be saved as UTF-8 8 | 9 | PLG_SYSTEM_MODULELABEL = "Система - Метка модуля" 10 | PLG_SYSTEM_MODULELABEL_DESCRIPTION = "Плагин позволяет делать мекти в заголовке модуля" 11 | 12 | PLG_SYSTEM_MODULELABEL_FIELD_LABEL = "Метка" -------------------------------------------------------------------------------- /plugins/system/modulelabel/language/ru-RU/ru-RU.plg_system_modulelabel.sys.ini: -------------------------------------------------------------------------------- 1 | ; @package System - Module Label Plugin 2 | ; @version 1.1.0 3 | ; @author Nerudas - nerudas.ru 4 | ; @copyright Copyright (c) 2013 - 2018 Nerudas. All rights reserved. 5 | ; @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html 6 | ; @link https://nerudas.ru 7 | ; Note : All ini files need to be saved as UTF-8 8 | 9 | PLG_SYSTEM_MODULELABEL = "Система - Метка модуля" 10 | PLG_SYSTEM_MODULELABEL_DESCRIPTION = "Плагин позволяет делать мекти в заголовке модуля" -------------------------------------------------------------------------------- /plugins/system/modulelabel/media/css/admin-module.css: -------------------------------------------------------------------------------- 1 | /* 2 | * @package System - Module Label Plugin 3 | * @version 1.1.0 4 | * @author Nerudas - nerudas.ru 5 | * @copyright Copyright (c) 2013 - 2018 Nerudas. All rights reserved. 6 | * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html 7 | * @link https://nerudas.ru 8 | */ 9 | 10 | #jform_labels_chzn .search-field { 11 | width: auto !important; 12 | } 13 | 14 | #jform_labels_chzn li.search-choice { 15 | background-color: #333; 16 | } -------------------------------------------------------------------------------- /plugins/system/modulelabel/media/css/admin-module.min.css: -------------------------------------------------------------------------------- 1 | #jform_labels_chzn .search-field{width:auto !important}#jform_labels_chzn li.search-choice{background-color:#333} -------------------------------------------------------------------------------- /plugins/system/modulelabel/media/js/admin-module.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @package System - Module Label Plugin 3 | * @version 1.1.0 4 | * @author Nerudas - nerudas.ru 5 | * @copyright Copyright (c) 2013 - 2018 Nerudas. All rights reserved. 6 | * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html 7 | * @link https://nerudas.ru 8 | */ 9 | 10 | (function ($) { 11 | $(document).ready(function () { 12 | // Add labels to head 13 | $('#jform_labels').closest('.control-group').appendTo('.form-inline.form-inline-header'); 14 | 15 | // Remove labels tab 16 | var removeLabelsTab = setInterval(function () { 17 | var labels = $('#myTabTabs').find('a[href="#attrib-labels"]'); 18 | if ($(labels).length > 0) { 19 | $(labels).parent().remove(); 20 | clearInterval(removeLabelsTab); 21 | } 22 | }, 3); 23 | }); 24 | })(jQuery); -------------------------------------------------------------------------------- /plugins/system/modulelabel/media/js/admin-module.min.js: -------------------------------------------------------------------------------- 1 | (function(a){a(document).ready(function(){a("#jform_labels").closest(".control-group").appendTo(".form-inline.form-inline-header");var b=setInterval(function(){var c=a("#myTabTabs").find('a[href="#attrib-labels"]');if(a(c).length>0){a(c).parent().remove();clearInterval(b)}},3)})})(jQuery); -------------------------------------------------------------------------------- /plugins/system/modulelabel/media/js/admin-modules.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @package System - Module Label Plugin 3 | * @version 1.1.0 4 | * @author Nerudas - nerudas.ru 5 | * @copyright Copyright (c) 2013 - 2018 Nerudas. All rights reserved. 6 | * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html 7 | * @link https://nerudas.ru 8 | */ 9 | 10 | (function ($) { 11 | $(document).ready(function () { 12 | $('#moduleList').find('tr a').each(function () { 13 | var pattern = /\[(.*?)]/g, 14 | html = $(this).html(); 15 | if (pattern.test(html)) { 16 | $(this).html(html.replace(pattern, '$1')); 17 | } 18 | }); 19 | }); 20 | })(jQuery); 21 | -------------------------------------------------------------------------------- /plugins/system/modulelabel/media/js/admin-modules.min.js: -------------------------------------------------------------------------------- 1 | (function(a){a(document).ready(function(){a("#moduleList").find("tr a").each(function(){var c=/\[(.*?)]/g,b=a(this).html();if(c.test(b)){a(this).html(b.replace(c,'$1'))}})})})(jQuery); -------------------------------------------------------------------------------- /plugins/system/modulelabel/modulelabel.php: -------------------------------------------------------------------------------- 1 | input->get('option', '') == 'com_modules' && $form->getName() == 'com_modules.module'); 42 | 43 | if ($app->isAdmin() && $check) 44 | { 45 | // Prepare title 46 | if (is_object($data) && !empty($data->title)) 47 | { 48 | $data->labels = array(); 49 | preg_match_all('/\[.*?]/', $data->title, $matches); 50 | if (!empty($matches[0])) 51 | { 52 | foreach ($matches[0] as $label) 53 | { 54 | $data->labels[] = trim(str_replace(array('[', ']'), '', $label));; 55 | $data->title = trim(str_replace($label, '', $data->title)); 56 | } 57 | } 58 | } 59 | 60 | // Add filed to form 61 | Form::addFormPath(__DIR__ . '/form'); 62 | Form::addFieldPath(__DIR__ . '/form'); 63 | $form->loadFile('form', false); 64 | } 65 | 66 | return true; 67 | } 68 | 69 | /** 70 | * Add labels to title 71 | * 72 | * @param Form $form The form to be altered. 73 | * @param mixed $data The associated data for the form. 74 | * 75 | * @return bool 76 | * 77 | * @since 1.0.0 78 | */ 79 | function onUserBeforeDataValidation($form, &$data) 80 | { 81 | if ($form->getName() == 'com_modules.module' && is_array($data) && !empty($data['labels'])) 82 | { 83 | $labels = array(); 84 | foreach (str_replace('#new#', '', $data['labels']) as $label) 85 | { 86 | $labels[] = '[' . $label . ']'; 87 | } 88 | 89 | $data['title'] = trim(implode(' ', $labels) . ' ' . $data['title']); 90 | } 91 | 92 | return true; 93 | } 94 | 95 | /** 96 | * Add scripts & styles 97 | * 98 | * @return void 99 | * 100 | * @since 1.0.0 101 | */ 102 | function onBeforeRender() 103 | { 104 | $app = Factory::getApplication(); 105 | $component = $app->input->get('option', ''); 106 | if ($app->isAdmin() && $component == 'com_modules') 107 | { 108 | $view = $app->input->get('view', ''); 109 | 110 | if ($view == 'modules' || empty($view)) 111 | { 112 | HTMLHelper::script('media/plg_system_modulelabel/js/admin-modules.min.js', array('version' => 'auto')); 113 | } 114 | 115 | if ($view == 'module') 116 | { 117 | HTMLHelper::script('media/plg_system_modulelabel/js/admin-module.min.js', array('version' => 'auto')); 118 | HTMLHelper::stylesheet('media/plg_system_modulelabel/css/admin-module.min.css', array('version' => 'auto')); 119 | } 120 | } 121 | } 122 | 123 | /** 124 | * Replace labels in modules array 125 | * 126 | * @param $modules The module object. 127 | * 128 | * @return void 129 | * 130 | * @since 1.0.0 131 | */ 132 | function onAfterModuleList(&$modules) 133 | { 134 | foreach ($modules as $key => &$module) 135 | { 136 | $module->title = trim(preg_replace('~\[(.?)*\]~', '', $module->title)); 137 | } 138 | } 139 | 140 | /** 141 | * Replace labels on module render 142 | * 143 | * @param object $module The module object. 144 | * @param array $attribs The render attributes 145 | * 146 | * @return void 147 | * 148 | * @since 1.0.0 149 | */ 150 | function onRenderModule(&$module, &$attribs) 151 | { 152 | $module->title = trim(preg_replace('~\[(.?)*\]~', '', $module->title)); 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /plugins/system/modulelabel/modulelabel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PLG_SYSTEM_MODULELABEL 4 | Nerudas 5 | September 2018 6 | Copyright (c) 2015 - 2018 Nerudas. All rights reserved. 7 | http://www.gnu.org/copyleft/gpl.html GNU/GPL 8 | support@nerudas.ru 9 | nerudas.ru 10 | 1.1.0 11 | PLG_SYSTEM_MODULELABEL_DESCRIPTION 12 | script.php 13 | 14 | en-GB/en-GB.plg_system_modulelabel.ini 15 | en-GB/en-GB.plg_system_modulelabel.sys.ini 16 | ru-RU/ru-RU.plg_system_modulelabel.ini 17 | ru-RU/ru-RU.plg_system_modulelabel.sys.ini 18 | 19 | 20 | modulelabel.php 21 | form 22 | 23 | 24 | css 25 | js 26 | 27 | 28 | 29 |
30 |
31 |
32 |
33 |
-------------------------------------------------------------------------------- /plugins/system/modulelabel/script.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright A copyright 7 | * @license GNU General Public License version 2 or later; see LICENSE.txt 8 | * @link http://your.url.com 9 | */ 10 | 11 | use Joomla\CMS\Factory; 12 | 13 | 14 | /** 15 | * Multisiteswitch script file. 16 | * 17 | * @package multisiteswitch 18 | * @since 1.0.0 19 | */ 20 | class plgSystemModulelabelInstallerScript 21 | { 22 | 23 | 24 | public function postflight($type, $parent) 25 | { 26 | // Enable plugin 27 | if ($type === 'install') 28 | { 29 | $this->enablePlugin($parent); 30 | } 31 | 32 | return true; 33 | } 34 | 35 | 36 | protected function enablePlugin($parent) 37 | { 38 | // Prepare plugin object 39 | $plugin = new stdClass(); 40 | $plugin->type = 'plugin'; 41 | $plugin->element = $parent->getElement(); 42 | $plugin->folder = (string) $parent->getParent()->manifest->attributes()['group']; 43 | $plugin->enabled = 1; 44 | 45 | // Update record 46 | Factory::getDbo()->updateObject('#__extensions', $plugin, ['type', 'element', 'folder']); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /plugins/system/multisiteswitch/helper.php: -------------------------------------------------------------------------------- 1 | default) 29 | { 30 | return $sudomain; 31 | } 32 | } 33 | } 34 | 35 | 36 | /** 37 | * 38 | * @return mixed 39 | * 40 | * @since version 41 | */ 42 | public static function getSubdomains() 43 | { 44 | $output = []; 45 | $db = Factory::getDbo(); 46 | $query = $db->getQuery(true) 47 | ->select($db->quoteName(array('params'))) 48 | ->from('#__extensions') 49 | ->where( 'element=' . $db->quote('multisiteswitch')); 50 | $extension = $db->setQuery( $query )->loadObject(); 51 | $params = new \Joomla\Registry\Registry($extension->params); 52 | $subDomains = $params->get('subdomains', []); 53 | return $subDomains; 54 | } 55 | 56 | 57 | /** 58 | * @param null $host 59 | * 60 | * @return string 61 | * 62 | * @since version 63 | */ 64 | public static function getDomain($host = null) 65 | { 66 | if($host === null) 67 | { 68 | $host = 'http://' . $_SERVER['SERVER_NAME']; 69 | } 70 | 71 | $pieces = parse_url($host); 72 | $domain = isset($pieces['host']) ? $pieces['host'] : ''; 73 | if (preg_match('/(?P[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) 74 | { 75 | return $regs['domain']; 76 | } 77 | 78 | return false; 79 | } 80 | 81 | 82 | } -------------------------------------------------------------------------------- /plugins/system/multisiteswitch/helpers/ConfigHelper.php: -------------------------------------------------------------------------------- 1 | get($name, $default); 39 | } 40 | 41 | 42 | public static function set($name, $value) 43 | { 44 | return self::getConfig()->set($name, $value); 45 | } 46 | 47 | 48 | public static function autoSet() 49 | { 50 | $db = Factory::getDbo(); 51 | $query = $db->getQuery(true); 52 | $query->select('params'); 53 | $query->from('#__extensions'); 54 | $query->where($db->qn('element') . ' = ' . $db->q('multisiteswitch')); 55 | $element = $db->setQuery($query)->loadObject(); 56 | 57 | if (!empty($element->params)) 58 | { 59 | self::setConfig(new Registry($element->params)); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /plugins/system/multisiteswitch/helpers/positions/yootheme1x.php: -------------------------------------------------------------------------------- 1 | set('menu.positions.navbar', $menu); 13 | $theme->set('menu.positions.mobile', $menu); 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /plugins/system/multisiteswitch/helpers/positions/yootheme2x.php: -------------------------------------------------------------------------------- 1 | set('~theme.menu.positions.navbar', $menu); 12 | app(Config::class)->set('~theme.menu.positions.mobile', $menu); 13 | } 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /plugins/system/multisiteswitch/language/en-GB/en-GB.plg_system_multisiteswitch.ini: -------------------------------------------------------------------------------- 1 | PLG_MULTISITESWITCH="System - Multisite" 2 | PLG_MULTISITESWITCH_XML_DESCRIPTION="Plugin for implementing multisiting" 3 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS="List of subdomains" 4 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_NAME="Title" 5 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_SUBDOMAIN="Subdomain" 6 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_DEFAULT="Main" 7 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_MENU="Menu" 8 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_MENUITEM="Main menu item" 9 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_CITYREGIONS="Enable domain binding to regions and cities" 10 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_CITYREGIONS_CITY="City" 11 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_CITYREGIONS_REGION="Region" -------------------------------------------------------------------------------- /plugins/system/multisiteswitch/language/en-GB/en-GB.plg_system_multisiteswitch.sys.ini: -------------------------------------------------------------------------------- 1 | PLG_MULTISITESWITCH="System - Multisite" 2 | PLG_MULTISITESWITCH_XML_DESCRIPTION="Plugin for implementing multisiting" -------------------------------------------------------------------------------- /plugins/system/multisiteswitch/language/ru-RU/ru-RU.plg_system_multisiteswitch.ini: -------------------------------------------------------------------------------- 1 | PLG_MULTISITESWITCH="Система - Мультисайтинг" 2 | PLG_MULTISITESWITCH_XML_DESCRIPTION="Плагин для реализации мультисайтинга" 3 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS="Список субдоменов" 4 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_NAME="Название" 5 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_SUBDOMAIN="Субдомен" 6 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_WWW="Есть www" 7 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_DEFAULT="Главный" 8 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_MENU="Меню" 9 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_MENUITEM="Главный пункт меню" 10 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_CITYREGIONS="Включить привязку доменов к регионам и городам" 11 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_CITYREGIONS_CITY="Город" 12 | PLG_MULTISITESWITCH_CONFIG_SUBDOMAINS_CITYREGIONS_REGION="Регион" -------------------------------------------------------------------------------- /plugins/system/multisiteswitch/language/ru-RU/ru-RU.plg_system_multisiteswitch.sys.ini: -------------------------------------------------------------------------------- 1 | PLG_MULTISITESWITCH="Система - Мультисайтинг" 2 | PLG_MULTISITESWITCH_XML_DESCRIPTION="Плагин для реализации мультисайтинга" -------------------------------------------------------------------------------- /plugins/system/multisiteswitch/multisiteswitch.php: -------------------------------------------------------------------------------- 1 | app; 101 | $admin = $app->isClient('administrator'); 102 | 103 | if ($admin) 104 | { 105 | return false; 106 | } 107 | 108 | $config = Factory::getConfig(); 109 | $https = (int) $config->get('force_ssl', 0) === 2 ? 'https://' : 'http://'; 110 | $domain = $_SERVER['SERVER_NAME']; 111 | $domainSplit = explode('.', $domain); 112 | $subDomains = $this->params->get('subdomains', []); 113 | $defaultSubDomain = false; 114 | self::$listSubdomains = $subDomains; 115 | self::$sourceURI = $_SERVER['REQUEST_URI']; 116 | 117 | 118 | //ищем дефолтный субдомен 119 | foreach ($subDomains as $subDomain) 120 | { 121 | if ((int) $subDomain->default) 122 | { 123 | $defaultSubDomain = $subDomain; 124 | } 125 | } 126 | 127 | 128 | if (count($domainSplit) === 3) 129 | { 130 | $subDomainFromUrl = array_shift($domainSplit); 131 | 132 | if ($defaultSubDomain) 133 | { 134 | if ($defaultSubDomain->subdomain === $subDomainFromUrl) 135 | { 136 | $app->redirect($https . implode('.', $domainSplit), 301); 137 | } 138 | } 139 | 140 | } 141 | else 142 | { 143 | if ($defaultSubDomain) 144 | { 145 | $subDomainFromUrl = $defaultSubDomain->subdomain; 146 | } 147 | } 148 | 149 | self::$subDomain = $subDomainFromUrl; 150 | 151 | if ((int) $defaultSubDomain->www && $subDomainFromUrl === 'www') 152 | { 153 | self::$subDomain = $defaultSubDomain->subdomain; 154 | } 155 | 156 | 157 | foreach ($subDomains as $subDomain) 158 | { 159 | $signSub = $subDomain->subdomain === self::$subDomain; 160 | $signEmpty = empty(self::$subDomain) && (int) $subDomain->default; 161 | 162 | if ($signSub || $signEmpty) 163 | { 164 | self::$defaultMenu = $subDomain->menu; 165 | self::$defaultMenuItem = $subDomain->menuitem; 166 | self::$activeItem = $subDomain; 167 | break; 168 | } 169 | } 170 | 171 | //вызов триггера 172 | PluginHelper::importPlugin('multisite'); 173 | $this->app->triggerEvent('onMultisiteAfterInit', [ 174 | &self::$subDomain, 175 | &self::$defaultMenu, 176 | &self::$defaultMenuItem, 177 | &self::$activeItem, 178 | &self::$sourceURI 179 | ]); 180 | 181 | $this->loadFilesFromMenu(); 182 | 183 | if (self::$sourceURI === '/') 184 | { 185 | $menu = $this->app->getMenu(); 186 | $menu->setDefault(self::$defaultMenuItem); 187 | } 188 | 189 | } 190 | 191 | 192 | public function onZnatokRedirectPrepare($params, &$redirect, &$current) 193 | { 194 | $admin = $this->app->isClient('administrator'); 195 | //$customizer = !empty($this->app->input->get('customizer')); 196 | $customizer = false; 197 | 198 | if ($admin || $customizer) 199 | { 200 | return false; 201 | } 202 | 203 | $subDomains = $this->params->get('subdomains', []); 204 | 205 | foreach ($subDomains as $subDomain) 206 | { 207 | $current = str_replace('/' . $subDomain->subdomain, '', $current); 208 | } 209 | 210 | } 211 | 212 | 213 | public function onRadicalMartRedirectPrepare(&$redirect, &$current) 214 | { 215 | $admin = $this->app->isClient('administrator'); 216 | 217 | if ($admin) 218 | { 219 | return false; 220 | } 221 | 222 | $subDomains = $this->params->get('subdomains', []); 223 | 224 | foreach ($subDomains as $subDomain) 225 | { 226 | $current = str_replace('/' . $subDomain->subdomain, '', $current); 227 | } 228 | 229 | } 230 | 231 | 232 | public function onAfterRoute() 233 | { 234 | $admin = $this->app->isClient('administrator'); 235 | 236 | if ($admin) 237 | { 238 | return false; 239 | } 240 | 241 | $this->app->triggerEvent('onMultisiteAfterRoute', [ 242 | &self::$subDomain, 243 | &self::$defaultMenu, 244 | &self::$defaultMenuItem, 245 | &self::$activeItem, 246 | &self::$sourceURI 247 | ]); 248 | 249 | $db = Factory::getDbo(); 250 | $query = $db->getQuery(true); 251 | $query->select('manifest_cache'); 252 | $query->from('#__extensions'); 253 | $query->where($db->qn('folder') . ' = ' . $db->q('system')); 254 | $query->where($db->qn('element') . ' = ' . $db->q('yootheme')); 255 | $element = $db->setQuery($query)->loadObject(); 256 | 257 | if (empty($element->manifest_cache)) 258 | { 259 | return false; 260 | } 261 | 262 | $params = new Registry($element->manifest_cache); 263 | $version = $params->get('version'); 264 | 265 | if (version_compare((string) $version, '2.0', '>=')) 266 | { 267 | JLoader::register('Yootheme2xHelper', JPATH_PLUGINS . '/system/multisiteswitch/helpers/positions/yootheme2x.php'); 268 | Yootheme2xHelper::set(self::$defaultMenu); 269 | } 270 | else 271 | { 272 | JLoader::register('Yootheme1xHelper', JPATH_PLUGINS . '/system/multisiteswitch/helpers/positions/yootheme1x.php'); 273 | Yootheme1xHelper::set(self::$defaultMenu); 274 | } 275 | 276 | } 277 | 278 | 279 | public function onAfterRender() 280 | { 281 | $admin = $this->app->isClient('administrator'); 282 | $customizer = !empty($this->app->input->get('customizer')); 283 | 284 | if ($admin || $customizer) 285 | { 286 | return false; 287 | } 288 | 289 | $domain = $_SERVER['SERVER_NAME']; 290 | 291 | $body = $this->app->getBody(); 292 | $subDomains = $this->params->get('subdomains', []); 293 | 294 | 295 | foreach ($subDomains as $subDomain) 296 | { 297 | 298 | if ($subDomain->subdomain !== self::$subDomain) 299 | { 300 | continue; 301 | } 302 | 303 | $body = preg_replace_callback("#(\/?\[s\])?(https?:\/\/)?(" . $domain . ")?(\/[a-zA-Z0-9\-\_]+?\/)?(" . $subDomain->subdomain . "\/?)(.)#i", static function ($matches) use ($subDomain, $domain) { 304 | 305 | $sep = substr_count($matches[5], '/') ? '/' : ''; 306 | 307 | $matches[1] = str_replace('/', '', $matches[1]); 308 | 309 | if ($matches[1] === '[s]') 310 | { 311 | return str_replace('[s]', '', $matches[0]); 312 | } 313 | 314 | $dic = []; 315 | 316 | $check = empty($matches[3]) || strpos($matches[3], $domain) !== false; 317 | 318 | if (!empty($matches[4]) && $matches[4] !== $domain . '/') 319 | { 320 | $check = false; 321 | } 322 | 323 | if ($check) 324 | { 325 | if ((int) $subDomain->default) 326 | { 327 | $dic = ['.', '/', '"', '?']; 328 | } 329 | else 330 | { 331 | $dic = ['/', '"', '?']; 332 | } 333 | 334 | if (in_array($matches[6], $dic) || $sep === '/') 335 | { 336 | $matches[5] = ''; 337 | } 338 | } 339 | 340 | 341 | $link = str_replace('//', '/', $matches[3] . $matches[4] . $matches[5] . $matches[6]); 342 | 343 | return $matches[2] . $link; 344 | 345 | }, $body); 346 | } 347 | 348 | $this->app->setBody($body); 349 | } 350 | 351 | 352 | private function loadFilesFromMenu() 353 | { 354 | $url = preg_replace('#\?.*$#i', '', self::$sourceURI); 355 | 356 | $query = $this->db->getQuery(true) 357 | ->select($this->db->quoteName(['alias', 'params'])) 358 | ->from('#__menu') 359 | ->where('id =' . (int) self::$defaultMenuItem); 360 | $extension = $this->db->setQuery($query)->loadObject(); 361 | $params = new Registry($extension->params); 362 | $document = Factory::getDocument(); 363 | $files = $params->get('files', []); 364 | $metas = $params->get('metas', []); 365 | 366 | $sitemapDefault = new stdClass(); 367 | $sitemapDefault->type = 'file'; 368 | $sitemapDefault->url = 'sitemap.xml'; 369 | $sitemapDefault->headercontenttype = 'text/xml'; 370 | $sitemapDefault->file = '/sitemaps/' . self::$subDomain . '.xml'; 371 | 372 | $files = (array) $files; 373 | $files[] = $sitemapDefault; 374 | 375 | foreach ($files as $file) 376 | { 377 | 378 | if ($url === ('/' . $file->url)) 379 | { 380 | 381 | if ($file->type === 'text') 382 | { 383 | if (!empty($file->headercontenttype)) 384 | { 385 | header("Content-Type: " . $file->headercontenttype); 386 | } 387 | 388 | echo $file->text; 389 | $this->app->close(); 390 | } 391 | 392 | if ($file->type === 'file') 393 | { 394 | 395 | $path = str_replace(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, JPATH_ROOT . $file->file); 396 | 397 | if (file_exists($path)) 398 | { 399 | if (!empty($file->headercontenttype)) 400 | { 401 | header("Content-Type: " . $file->headercontenttype); 402 | } 403 | echo file_get_contents($path); 404 | } 405 | else 406 | { 407 | throw new Exception(Text::_('JERROR_LAYOUT_PAGE_NOT_FOUND'), 404); 408 | } 409 | 410 | $this->app->close(); 411 | } 412 | } 413 | 414 | } 415 | 416 | 417 | if (method_exists($document, 'addCustomTag')) 418 | { 419 | foreach ($metas as $meta) 420 | { 421 | $document->addCustomTag(''); 422 | } 423 | } 424 | 425 | } 426 | 427 | } -------------------------------------------------------------------------------- /plugins/system/multisiteswitch/multisiteswitch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PLG_MULTISITESWITCH 4 | 08.12.2019 5 | Cymbal 6 | cymbal@delo-design.ru 7 | https://delo-design.ru 8 | Copyright © 2020 Delo Design. All rights reserved. 9 | GNU General Public License version 2 or later; see LICENSE.txt 10 | 1.3.4 11 | PLG_MULTISITESWITCH_XML_DESCRIPTION 12 | 13 | script.php 14 | 15 | 16 | en-GB/en-GB.plg_system_multisiteswitch.ini 17 | en-GB/en-GB.plg_system_multisiteswitch.sys.ini 18 | ru-RU/ru-RU.plg_system_multisiteswitch.ini 19 | ru-RU/ru-RU.plg_system_multisiteswitch.sys.ini 20 | 21 | 22 | 23 | multisiteswitch.php 24 | helper.php 25 | helpers 26 | language 27 | 28 | 29 | 30 | 31 |
32 | 33 | 38 |
39 | 44 | 49 | 56 | 57 | 58 | 59 | 66 | 67 | 68 | 69 | 75 | 80 | 87 | 88 | 89 | 90 | 99 | 108 | 109 | 110 | 111 |
112 |
113 |
114 |
-------------------------------------------------------------------------------- /plugins/system/multisiteswitch/script.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright A copyright 7 | * @license GNU General Public License version 2 or later; see LICENSE.txt 8 | * @link http://your.url.com 9 | */ 10 | 11 | use Joomla\CMS\Factory; 12 | 13 | defined('_JEXEC') or die; 14 | 15 | /** 16 | * Multisiteswitch script file. 17 | * 18 | * @package multisiteswitch 19 | * @since 1.0.0 20 | */ 21 | class plgSystemMultisiteswitchInstallerScript 22 | { 23 | 24 | 25 | public function postflight($type, $parent) 26 | { 27 | // Enable plugin 28 | if ($type === 'install') 29 | { 30 | $this->enablePlugin($parent); 31 | } 32 | 33 | return true; 34 | } 35 | 36 | 37 | protected function enablePlugin($parent) 38 | { 39 | // Prepare plugin object 40 | $plugin = new stdClass(); 41 | $plugin->type = 'plugin'; 42 | $plugin->element = $parent->getElement(); 43 | $plugin->folder = (string) $parent->getParent()->manifest->attributes()['group']; 44 | $plugin->enabled = 1; 45 | 46 | // Update record 47 | Factory::getDbo()->updateObject('#__extensions', $plugin, ['type', 'element', 'folder']); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /script.php: -------------------------------------------------------------------------------- 1 | checkCompatible()) return false; 46 | 47 | // Download remote source 48 | $this->downloadRemotes($parent); 49 | } 50 | 51 | /** 52 | * Method to download remotes. 53 | * 54 | * @param InstallerAdapter $parent Parent object calling object. 55 | * 56 | * @throws Exception 57 | * 58 | * @since 1.0.0 59 | */ 60 | protected function downloadRemotes($parent) 61 | { 62 | $attributes = $parent->getParent()->manifest->xpath('files'); 63 | $source = $parent->getParent()->getPath('source'); 64 | 65 | if (!is_array($attributes) || empty($attributes[0])) return; 66 | foreach ($attributes[0] as $type => $value) 67 | { 68 | if (!empty($value->attributes()->download) && !empty($value[0])) 69 | { 70 | $src = htmlspecialchars_decode((string) $value->attributes()->download); 71 | $dest = $source . '/' . $value[0]; 72 | @file_put_contents($dest, file_get_contents($src)); 73 | } 74 | } 75 | } 76 | 77 | /** 78 | * Method to check compatible. 79 | * 80 | * @throws Exception 81 | * 82 | * @return bool True if compatible. 83 | * 84 | * @since 1.0.0 85 | */ 86 | protected function checkCompatible() 87 | { 88 | // Check old Joomla 89 | if (!class_exists('Joomla\CMS\Version')) 90 | { 91 | JFactory::getApplication()->enqueueMessage(JText::sprintf('PKG_MULTISITE_ERROR_COMPATIBLE_JOOMLA', 92 | $this->minimumJoomla), 'error'); 93 | 94 | return false; 95 | } 96 | 97 | $app = Factory::getApplication(); 98 | $jversion = new Version(); 99 | 100 | // Check PHP 101 | if (!(version_compare(PHP_VERSION, $this->minimumPhp) >= 0)) 102 | { 103 | $app->enqueueMessage(Text::sprintf('PKG_MULTISITE_ERROR_COMPATIBLE_PHP', $this->minimumPhp), 104 | 'error'); 105 | 106 | return false; 107 | } 108 | 109 | // Check joomla version 110 | if (!$jversion->isCompatible($this->minimumJoomla)) 111 | { 112 | $app->enqueueMessage(Text::sprintf('PKG_MULTISITE_ERROR_COMPATIBLE_JOOMLA', $this->minimumJoomla), 113 | 'error'); 114 | 115 | return false; 116 | } 117 | 118 | return true; 119 | } 120 | } --------------------------------------------------------------------------------