From 4cc50c8d04154b8f0ead849c864034f140eeeca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ri=C4=8Dards=20Mucel=C4=81ns?= Date: Sun, 16 Jan 2022 16:29:15 +0200 Subject: [PATCH] =?UTF-8?q?=EF=BF=BD=20remastered=20project?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 0 LICENSE.txt | 339 +++++++++++++++++++++++++++ apsfc.php | 47 ++++ assets/index.php | 1 + assets/js/apsfc.js | 68 ++++++ assets/js/index.php | 1 + includes/class-apsfc.php | 443 ++++++++++++++++++++++++++++++++++++ includes/class-settings.php | 117 ++++++++++ includes/index.php | 1 + index.php | 1 + languages/apsfc-en_GB.mo | Bin 0 -> 458 bytes languages/apsfc-en_GB.po | 47 ++++ languages/apsfc-en_US.mo | Bin 0 -> 481 bytes languages/apsfc-en_US.po | 47 ++++ languages/apsfc-es_ES.mo | Bin 0 -> 837 bytes languages/apsfc-es_ES.po | 52 +++++ languages/apsfc-hi_IN.mo | Bin 0 -> 1076 bytes languages/apsfc-hi_IN.po | 52 +++++ languages/apsfc-lv.mo | Bin 0 -> 962 bytes languages/apsfc-lv.po | 53 +++++ languages/apsfc-pt_PT.mo | Bin 0 -> 943 bytes languages/apsfc-pt_PT.po | 52 +++++ languages/apsfc-zh_CN.mo | Bin 0 -> 868 bytes languages/apsfc-zh_CN.po | 52 +++++ languages/apsfc.pot | 53 +++++ languages/index.php | 1 + readme.MD | 65 ++++++ readme.txt | 120 ++++++++++ 28 files changed, 1612 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE.txt create mode 100644 apsfc.php create mode 100644 assets/index.php create mode 100644 assets/js/apsfc.js create mode 100644 assets/js/index.php create mode 100644 includes/class-apsfc.php create mode 100644 includes/class-settings.php create mode 100644 includes/index.php create mode 100644 index.php create mode 100644 languages/apsfc-en_GB.mo create mode 100644 languages/apsfc-en_GB.po create mode 100644 languages/apsfc-en_US.mo create mode 100644 languages/apsfc-en_US.po create mode 100644 languages/apsfc-es_ES.mo create mode 100644 languages/apsfc-es_ES.po create mode 100644 languages/apsfc-hi_IN.mo create mode 100644 languages/apsfc-hi_IN.po create mode 100644 languages/apsfc-lv.mo create mode 100644 languages/apsfc-lv.po create mode 100644 languages/apsfc-pt_PT.mo create mode 100644 languages/apsfc-pt_PT.po create mode 100644 languages/apsfc-zh_CN.mo create mode 100644 languages/apsfc-zh_CN.po create mode 100644 languages/apsfc.pot create mode 100644 languages/index.php create mode 100644 readme.MD create mode 100644 readme.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..ecbc059 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. \ No newline at end of file diff --git a/apsfc.php b/apsfc.php new file mode 100644 index 0000000..ae16071 --- /dev/null +++ b/apsfc.php @@ -0,0 +1,47 @@ +Polylang plugin must be activated for Add Polylang support for Customizer plugin to work. Please activate it now!', 'sample-text-domain'); + + printf('

%2$s

', esc_attr($class), $message); + } + add_action('admin_notices', 'apsfc_error_notice__error'); +} else { + /** + * Currently plugin version. + * Start at version 1.0.2 and use SemVer - https://semver.org + * Rename this for your plugin and update it as you release new versions. + */ + define('APSFC_VERSION', '1.4.4'); + define('APSFC_BASENAME', plugin_basename(__FILE__)); + + require_once plugin_dir_path(__FILE__) . '/includes/class-apsfc.php'; +} \ No newline at end of file diff --git a/assets/index.php b/assets/index.php new file mode 100644 index 0000000..e71af0e --- /dev/null +++ b/assets/index.php @@ -0,0 +1 @@ +' + pcLangTrans + ': '; + html += ''; + $(html).prependTo('#customize-header-actions'); + + + $('body').on('change', '#pll-language-select', function () { + var language = $(this).val(); + var old_url = window.location.href; + window.location.href = updateQueryStringParameter(window.location.href, 'lang', language); + }); + }); + + function updateQueryStringParameter(uri, key, value) { + var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); + var separator = uri.indexOf('?') !== -1 ? "&" : "?"; + if (uri.match(re)) { + return uri.replace(re, '$1' + key + "=" + value + '$2'); + } else { + return uri + separator + key + "=" + value; + } + } + }; + + return component; +} ( wp.customize, jQuery ) ); \ No newline at end of file diff --git a/assets/js/index.php b/assets/js/index.php new file mode 100644 index 0000000..e71af0e --- /dev/null +++ b/assets/js/index.php @@ -0,0 +1 @@ +Settings->URL modifications) + */ + if (get_option('apsfc_force_lang') == "on") { + if (isset($options['force_lang']) && 0 !== $options['force_lang']) { + $options['force_lang'] = 0; + update_option('polylang', $options); + } + } + + /** + * Disable detect browser language, will return default language instead. + */ + // add_filter( 'pll_preferred_language', '__return_false' ); + + \add_action('customize_controls_enqueue_scripts', [$self, 'add_lang_to_customizer_previewer'], 9); + \add_action('wp_before_admin_bar_render', [$self, 'on_wp_before_admin_bar_render'], 100); + \add_action('admin_menu', [$self, 'on_admin_menu'], 100); + + $theme_stylesheet_slug = get_option('stylesheet'); + $option_types = ['blogname', 'blogdescription', 'site_icon']; + + // Get theme mod options. + add_filter('option_theme_mods_' . $theme_stylesheet_slug, [$self, 'on_option_theme_mods_get'], 10, 1); + // Update theme mod options. + add_filter('pre_update_option_theme_mods_' . $theme_stylesheet_slug, [$self, 'on_option_theme_mods_update'], 10, 2); + + foreach ($option_types as $option_type) { + add_filter('pre_option_' . $option_type, [$self, 'on_wp_option_get'], 10, 3); // get_option hook. + add_filter('pre_update_option_' . $option_type, [$self, 'on_wp_option_update'], 10, 3); // update_option hook. + } + + return $self; + } + + /** + * Initialize Polylang API so we can call some function prematurely its initialization. + * + * @return void + */ + public function premature_initialization() + { + if (!function_exists('pll_current_language')) { + $poly_file = WP_PLUGIN_DIR . '/polylang/include/api.php'; + if (!file_exists($poly_file)) { + $poly_file = WP_PLUGIN_DIR . '/polylang-pro/include/api.php'; + if (!file_exists($poly_file)) $poly_file = WP_PLUGIN_DIR . '/polylang-pro/vendor/wpsyntex/polylang/include/api.php'; + } + + require $poly_file; + if (!isset($GLOBALS['polylang'])) $GLOBALS['polylang'] = null; + } + } + + /** + * Load plugin textdomain. + * + * @since 1.0.2 + */ + public function pc_load_textdomain() + { + load_plugin_textdomain('apsfc', false, basename(dirname(__FILE__)) . '/languages'); + } + + + /** + * Constructor. + */ + private function __construct() + { + /** + * Prematurely initialize Polylang API + */ + add_action('plugins_loaded', [$this, 'premature_initialization']); + + /** + * Load plugin text domain (l10n) + */ + add_action('plugins_loaded', [$this, 'pc_load_textdomain'], 0); + $this->setup_settings(); + } + + /** + * Setup settings & pages + */ + function setup_settings() + { + require_once dirname(__FILE__) . '/class-settings.php'; + $settings = new ApsfcSettings(); + } + + /** + * Helper to fetch custom customizer db content. + * + * @return mixed Customizer array or false. + */ + protected function get_custom_customizer_option() + { + $current_language = pll_current_language(); + $theme_slug = get_option('template'); + $option_prefix = \str_replace('-', '_', $theme_slug); + $option_name = $option_prefix . '_apsfc_settings_' . $current_language; + + return get_option($option_name, false); + } + + /** + * Helper to update custom customizer db content. + * + * @param mixed $data Data to insert. + * + * @return bool Success. + */ + protected function update_custom_customizer_option($data) + { + $current_language = pll_current_language(); + $theme_slug = get_option('template'); + $option_prefix = \str_replace('-', '_', $theme_slug); + $option_name = $option_prefix . '_apsfc_settings_' . $current_language; + + return update_option($option_name, $data); + } + + /** + * Helper + * + * @return bool If the current language is the default language. + */ + protected function current_lang_not_default() + { + if (function_exists('pll_current_language')) return pll_current_language() !== pll_default_language(); + return false; + } + + /** + * Check the custom db field on get_option hook to be able to return custom language value. + * If the current language is default, then return from default wp option + * + * @param bool $pre_option This is false. If something else is returned wp exits the check in db and uses this value. + * @param string $option Option name asked for. + * @param mixed $default Default value, second args when asking for options. + * + * @return mixed + */ + public function on_wp_option_get($pre_option, $option, $default) + { + + // If not the default language, then skip the custom check and wp will the use default options. + if ($this->current_lang_not_default()) { + $data = $this->get_custom_customizer_option(); + + // Found the custom option. Move on. + if (is_array($data) && isset($data['options']) && isset($data['options'][$option])) { + return $data['options'][$option]; + } + } + + return $default; + } + + /** + * Update the custom db field on get_option hook. + * If the current language is not default, then return old value to prevent from saving to default wp option. + * + * @param mixed $value The new, unserialized option value. + * @param mixed $old_value The old option value. + * @param string $option Option name. + * + * @return mixed + */ + public function on_wp_option_update($value, $old_value, $option) + { + // Fetch custom option db field. + $data = $this->get_custom_customizer_option(); + $theme_slug = get_option('template'); + // If false, the field hasn't been created yet, so it must be created. + if (false === $data) { + $data = [ + 'template' => $theme_slug, + 'mods' => [], + 'options' => [], + ]; + } + + // Make sure the options array exists. We are going to use it soon. + if (!isset($data['options'])) { + $data['options'] = []; + } + + $data['options'][$option] = $value; + + // Update option value in custom db field. (Not necessary to save for default language since it uses default wp option fields for values when get option). + $this->update_custom_customizer_option($data); + + // If the current language is not the default language, prevent saving to option table by passing the old value back. It will then exit after the filter. + if ($this->current_lang_not_default()) { + return $old_value; + } + + return $value; + } + + /** + * Check the custom db field on get_option customizer field option name hook to be able to return custom language value. + * Parse arguments with default wp customizer values to make sure all are present in the return. + * + * @param array $value The customizer settings. + * + * @return array + */ + public function on_option_theme_mods_get($value) + { + $data = $this->get_custom_customizer_option(); + + if (isset($data['mods']) && is_array($data['mods']) && !empty($data['mods'])) { + $value = wp_parse_args($data['mods'], $value); + } + + // Remove members with integer key from mods. + foreach ($value as $key => $mod) { + if (is_numeric($key)) { + unset($value[$key]); + } + } + + return $value; + } + + /** + * Update custom customizer option. + * If the current language is not default, then return old value to prevent from saving to customizer wp option. + * + * @param mixed $value The new, unserialized option value. + * @param mixed $old_value The old option value. + */ + public function on_option_theme_mods_update($value, $old_value) + { + + $current_data = $this->get_custom_customizer_option(); + $theme_slug = get_option('template'); + + $data = [ + 'template' => $theme_slug, + 'mods' => isset($current_data['mods']) ? $current_data['mods'] : [], + 'options' => isset($current_data['options']) ? $current_data['options'] : [], + ]; + + if (is_array($value) && !empty($value)) { + foreach ($value as $key => $val) { + $data['mods'][$key] = $val; + } + } + $this->update_custom_customizer_option($data); + + if ($this->current_lang_not_default()) { + return $old_value; + } + + return $value; + } + + /** + * If Polylang activated, set the preview url and add select language control + * + * @author soderlind + * @version 1.0.0 + * @link https://gist.github.com/soderlind/1908634f5eb0c1f69428666dd2a291d0 + */ + public function add_lang_to_customizer_previewer() + { + $language = (empty($_REQUEST['lang'])) ? pll_current_language() : $_REQUEST['lang']; + if (empty($language)) $language = pll_default_language(); + + if (is_customize_preview() && (!isset($_REQUEST['lang']) || $_REQUEST['lang'] == 'all' || empty($_REQUEST['lang']))) { + $url = get_admin_url() . 'customize.php?lang=' . $language; // EDIT this to your needs + wp_safe_redirect($url); + var_dump($url); + exit(); + } + + $handle = 'dss-add-lang-to-template'; + $src = plugin_dir_url(dirname(__FILE__)) . 'assets/js/apsfc.js'; + $deps = ['customize-controls']; + $version = rand(); + $in_footer = 1; + wp_enqueue_script($handle, $src, $deps, $version, $in_footer); + + if (empty($language)) { + $language = pll_default_language(); + } + + if (!empty($_REQUEST['url'])) { + $current_url = add_query_arg('lang', $language, $_REQUEST['url']); + } else { + $current_url = add_query_arg('lang', $language, pll_home_url($language)); + } + wp_add_inline_script( + $handle, + sprintf( + 'var pcLangTrans = "' . __('Language', 'apsfc') . '";' . + 'PSPolyLang.init( %s );', + wp_json_encode( + [ + 'url' => $current_url, + 'languages' => get_transient('pll_languages_list'), + 'current_language' => $language, + ] + ) + ), + 'after' + ); + } + + /** + * Append lang="contrycode" to the customizer url in the adminbar + * + * @return void + */ + public function on_wp_before_admin_bar_render() + { + global $wp_admin_bar; + $customize_node = $wp_admin_bar->get_node('customize'); + if (!empty($customize_node)) { + $customize_node->href = add_query_arg('lang', pll_current_language(), $customize_node->href); + $wp_admin_bar->add_node($customize_node); + } + } + + /** + * Append lang="contrycode" to the customizer url in the Admin->Apperance->Customize menu + * + * @return void + */ + public function on_admin_menu() + { + global $submenu; + $parent = 'themes.php'; + if (!isset($submenu[$parent])) { + return; + } + foreach ($submenu[$parent] as $k => $d) { + if ('customize' === $d['1']) { + $submenu[$parent][$k]['2'] = add_query_arg('lang', pll_current_language(), $submenu[$parent][$k]['2']); + break; + } + } + } +} + +if (class_exists('WP_Customize_Setting')) { + /** + * A class that extends WP_Customize_Setting so we can access + * the protected updated method when importing options. + * + * @since 0.3 + */ + final class CustomizerPolylangOption extends \WP_Customize_Setting + { + + + /** + * Import an option value for this setting. + * + * @since 0.3 + * + * @param mixed $value The option value. + * + * @return void + */ + public function import($value) + { + $this->update($value); + } + } +} + +/** + * Polylang register strings. + */ + +if (function_exists('pll_register_string')) { + + /** + * Register fields for Polylang string translations + * + * @param string $option_name Option name + * @param array $fields Field names + * + * @return void + */ + function register_polylang_column_strings($option_name, $fields) + { + $columns = get_option($option_name); + $theme_name = wp_get_theme()->get('Name'); + if (!empty($columns)) : + for ($i = 0; $i < $columns; $i++) : + foreach ($fields as $field) { + pll_register_string($option_name . '_' . $i . '_' . $field, get_option($option_name . '_' . $i . '_' . $field), $theme_name, true); + } + endfor; + endif; + } + + register_polylang_column_strings('options_footer_columns', ['title', 'text']); + register_polylang_column_strings('options_footer_logos', ['image', 'url']); +} diff --git a/includes/class-settings.php b/includes/class-settings.php new file mode 100644 index 0000000..3ada014 --- /dev/null +++ b/includes/class-settings.php @@ -0,0 +1,117 @@ +" . __('Settings') . ''; + // Adds the link to the end of the array. + array_push( + $links, + $settings_link + ); + return $links; + } //end nc_settings_link() + + /** + * Display submenu page contents + */ + public function submenu_page() + { + $this->options = get_option('apsfc_force_lang'); + if (isset($_POST)) { + if (isset($_POST['apsfc_force_lang'])) { + update_option('apsfc_force_lang', "on"); + } else { + if (isset($_POST['submit'])) { + update_option('apsfc_force_lang', "off"); + } + } + } +?> +
+

+
+ + + + + + + + + +

+
+
+V=6;%lE)M$ikPt<;XN}HLf{1+dIR+P z;15G@c;i`EA+G41H-`V~My+naw82y{p-X0@vK9-Qs%8aYN^JLshd|G2Tqs9hRD<-Lzd5{=+ZvfBY7^ zkjTZCOs22%(s{2xXQy8^hZ9%lt}ZL$aC>O`{_TcX@u^mClvo_4_)OXeB^lhMDNI$q z&AH6LltrPmg_Y9KFO5|ju_NuxsJg|8$wZ3xWo9r|47}-6jD1bqx`*(ATVfCeQGh`U z!zP4n7PM~y2PecCy^Ct$|GLgWH|EA-thqEfw@SMeW9O>m8DUI(!(bq@T$nXnEu^rN z!rZ#8=K4>@faL39?oIPj^BjjtZwv!j?5XKRT{s+j5-xfWcD>1HGC2N4=m%b3NlVh% z*cL92rB7QgaxP>Sk~PGorP$S-t{NUaM1I3>bm61Gmf!Tl+AjqCkJ|tM literal 0 HcmV?d00001 diff --git a/languages/apsfc-en_US.po b/languages/apsfc-en_US.po new file mode 100644 index 0000000..1ebedd0 --- /dev/null +++ b/languages/apsfc-en_US.po @@ -0,0 +1,47 @@ +msgid "" +msgstr "" +"Project-Id-Version: Add Polylang support for Customizer\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-05-14 17:07+0000\n" +"PO-Revision-Date: 2020-05-14 17:08+0000\n" +"Last-Translator: \n" +"Language-Team: English (United States)\n" +"Language: en_US\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Loco https://localise.biz/\n" +"X-Loco-Version: 2.3.3; wp-5.4.1" + +#: includes/class-apsfc.php:294 +msgid "Language" +msgstr "" + +#: includes/class-settings.php:56 +msgid "Customizer Support Settings" +msgstr "" + +#: includes/class-settings.php:66 +msgid "Language setup" +msgstr "" + +#. Name of the plugin +msgid "Add Polylang support for Customizer" +msgstr "" + +#. Description of the plugin +msgid "This plugin adds Polylang support for Customizer." +msgstr "" + +#. URI of the plugin +msgid "https://wordpress.org/plugins/add-polylang-support-for-customizer" +msgstr "" + +#. Author of the plugin +msgid "richardev" +msgstr "" + +#. Author URI of the plugin +msgid "https://richardev.com" +msgstr "" diff --git a/languages/apsfc-es_ES.mo b/languages/apsfc-es_ES.mo new file mode 100644 index 0000000000000000000000000000000000000000..e348381dedfe27cdef56e27c93cc8d2ef710a488 GIT binary patch literal 837 zcmah{&x;c=6pp%x%)!H+6g@moDw1iZ-Nj`}L9JaWv{<&Ic$4hR>oiLy2}wrXqW^;z z{{gRh6K~%1@9^Z!yJz26ZCNN7_~v_=_vQUczVGh5W3(<3t`o-1hSuv9{o!4*-w>`5 z-V!bmJ`yeyJ`)ncH^PT=jQt|MN_c;sv75wSh@03yh_4X;B)&(ybAdjC+6Pm~B|4bZ z)*2VK{DK*VAa&{4Sm?4AC9Vzd7;4M1h4f%mT}ln2C_GG!I#nbFzlsWT<6x64W>aTQ zFb{lG@Tcg!G&+U*Me)Cb(GfO9@`*2H!5`G6=b1?%nm*3>z@Z2fh(8noQ|PoiZQkDJ z$sQzk)1-5!O^by52w%u1;dWhjr5g($c;;b`LhC)puC*yx%v=jixQ=cb^GO5xyGhUgi8gc{wd{;|moEJCn8ZMBri zg_0iQW4UaRu5oT^=)~Q)+k=;u@5g&_!e*wKIYNP8>8^~XvrADJ$Eeb|EUBGbe*L5y vf&Z&LBV?mOno4Yu%avp3DSU1!tFWTZ4T#cVDb~@}&&diW02NHn)Dg4awc7z_ literal 0 HcmV?d00001 diff --git a/languages/apsfc-es_ES.po b/languages/apsfc-es_ES.po new file mode 100644 index 0000000..d2a2de4 --- /dev/null +++ b/languages/apsfc-es_ES.po @@ -0,0 +1,52 @@ +msgid "" +msgstr "" +"Project-Id-Version: Add Polylang support for Customizer\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-05-14 17:12+0000\n" +"PO-Revision-Date: 2020-05-14 17:13+0000\n" +"Last-Translator: \n" +"Language-Team: Spanish (Spain)\n" +"Language: es_ES\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Loco https://localise.biz/\n" +"X-Loco-Version: 2.3.3; wp-5.4.1" + +#: includes/class-apsfc.php:294 +msgid "Language" +msgstr "Idioma" + +#. Third party plugin Slug +#: includes/class-settings.php:31 includes/class-settings.php:32 +msgid "Customizer Support" +msgstr "Soporte de personalizador" + +#: includes/class-settings.php:56 +msgid "Customizer Support Settings" +msgstr "Configuración de soporte personalizado" + +#: includes/class-settings.php:66 +msgid "Language setup" +msgstr "Configuración de idioma" + +#. Name of the plugin +msgid "Add Polylang support for Customizer" +msgstr "" + +#. Description of the plugin +msgid "This plugin adds Polylang support for Customizer." +msgstr "Este complemento agrega soporte Polylang para el Personalizador." + +#. URI of the plugin +msgid "https://wordpress.org/plugins/add-polylang-support-for-customizer" +msgstr "" + +#. Author of the plugin +msgid "richardev" +msgstr "" + +#. Author URI of the plugin +msgid "https://richardev.com" +msgstr "" diff --git a/languages/apsfc-hi_IN.mo b/languages/apsfc-hi_IN.mo new file mode 100644 index 0000000000000000000000000000000000000000..a1ae5ec0cd135e65f5a276a5e16afd87bca43427 GIT binary patch literal 1076 zcmbVLO>5LZ7#=@B*@K5(Jm_J>n=;wWw$+kl4_aHTw7Rsbc$0K9-HoI(Av00ilN6+a z7Eh&@f)pmQ6x8a)7NlPE=5LU>`VTz%B#Yfz3W@_yo;UM8@7GN7ec<>i!8!q)1)BK_ z){7n$d>-}+FaW#<&H!J4lYj+I0Y3m2_z7$rA>;yZ6ZW^Ggp7bsA0y-vxB;f%WpG}v z3l`w7U~(l0XhTK|kuTa*rEx41P3L4nM^mNce7MLH(l_Z$PjSc=o#9%CqOHgzQl);I z?-^8aoyMfu2^Ec_v>giS2Z8!qU57Lh`GB`Hn+Vulo~Td?kN!i$rD>jz!KPF@4A|AQ ztyoifwA8rWWTOf9H4?FFzUCgSR;m?N8D{PfbuW8v^>1+UocT&bfZ4InGAq*&?w4-&bymC2`Ek6nscV@%IGIY7K-$T_IbOvkmQOt&& zA;;bS9ayt!vt??{2WviC^Rj=v)@)nz)|xGwtyq&;(}il?X3wqJu;vq@tXU#?JcPOA zRUzNC29EVyVYUzf_b%vQu0MM?=q&>B0?3K3maJJTN^GOv8zi*mBc2{)JB6TIcwgJ> q$sdCKX`WiM3FkY6V0*I&z|3n!yIs2PZ~6ZtF{U@{j?JFg%#dFXaz$r*@K6Ic+kTqVnHRdGusx+l%>?QmBJR6b}U}gophR-O@<`1+P&4Y z9=+??lmEl^%ey)0e%8sE->~0Xd(V_k+GZL`R~2BP~opzA8)W0_|HzoyrG0P$TKsETo-@<1e3RM~0wG;aL}3Ricom0eKm!l4S?V zQ>m*$84`K!&pS6_J!cPPKk&_*?@H&DH7Wf^!i{ZNm%+Dup>qDXDm>3@N{!yLjCY(A z0UPlrBFL0laVzHW5>FN>d6XuthcO0>d|M7xec(TRUEu@IoG@OCU>%P5Q#;S37^Kt{ zVW@;T{hX2>HhQ{pLh}vl20kT&jzIeM!b;s7gl$9jD2b`vriA9_X(D5~1D((+#e`M0 ziXjq+)=Fb*b8CIpqa=zO9czL#Nbjgbok6}1%~A_xR;Yg<9B!ojJlo*QGhbcCzI1%u z^lgrdOlf&fg~kj1R2u0f^>uCE(m@ENPn%6``$8)(qdhfh!dFkua%e>h5lVVh@}+1o zN?1>!qte(gyLJ)wPay1eHqa@o`~KJ_;jLy<{dmP3@j-PVHx>tC0`m<9z(- luo@_~E40nUlsuiCJo$i^=u0Q6+|+M!n%X2Y{0HYH_6s3mDxUxV literal 0 HcmV?d00001 diff --git a/languages/apsfc-lv.po b/languages/apsfc-lv.po new file mode 100644 index 0000000..fd3eb69 --- /dev/null +++ b/languages/apsfc-lv.po @@ -0,0 +1,53 @@ +msgid "" +msgstr "" +"Project-Id-Version: Add Polylang support for Customizer\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-05-14 17:12+0000\n" +"PO-Revision-Date: 2020-05-14 17:12+0000\n" +"Last-Translator: \n" +"Language-Team: Latvian\n" +"Language: lv\n" +"Plural-Forms: nplurals=3; plural=n % 10 == 1 && n % 100 != 11 ? 0 : n != 0 ? " +"1 : 2;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Loco https://localise.biz/\n" +"X-Loco-Version: 2.3.3; wp-5.4.1" + +#: includes/class-apsfc.php:294 +msgid "Language" +msgstr "Valoda" + +#. Third party plugin Slug +#: includes/class-settings.php:31 includes/class-settings.php:32 +msgid "Customizer Support" +msgstr "Pielāgošanas atbalsts" + +#: includes/class-settings.php:56 +msgid "Customizer Support Settings" +msgstr "Izskata ielāgošanas uzstādījumi" + +#: includes/class-settings.php:66 +msgid "Language setup" +msgstr "Valodas uzstādījumi" + +#. Name of the plugin +msgid "Add Polylang support for Customizer" +msgstr "Pievienot Polylang atbalstu izskata pielāgošanai" + +#. Description of the plugin +msgid "This plugin adds Polylang support for Customizer." +msgstr "Šis spraudnis pievieno Polylng atbalstu izskata pielāgošanai" + +#. URI of the plugin +msgid "https://wordpress.org/plugins/add-polylang-support-for-customizer" +msgstr "" + +#. Author of the plugin +msgid "richardev" +msgstr "" + +#. Author URI of the plugin +msgid "https://richardev.com" +msgstr "" diff --git a/languages/apsfc-pt_PT.mo b/languages/apsfc-pt_PT.mo new file mode 100644 index 0000000000000000000000000000000000000000..a4afc83cd7ef3dabff33230d714d833021e0994e GIT binary patch literal 943 zcma)4%Zd|06fGa1wBTY^iY~5*;Hx_6%mjxHS!m42K!PFDinx)Q?n-~}zd=v2p zU;{V;t^wbGi@;CdGVlwCfZxE;8OH7cA>!|68M_L;bdIt6;9KB2*BE>S{1V&&J1~2g zWi&FyK_PTbt}07oJxz?IUgf-*sY7YmI;6d&;)GAMC%soXcWi*GDv`@oKu-FqWXV)H zDvK&tnnael|K$zY$ePzO^?Wzu&!u(B=$KAXa4?p28+_<;mGMVa?s#Hi3Pw*8-m_A8 zT*My>FJo#oTTR|<^Jt5r2XWN8*TjO5kL4RxCp=l#Ug`$Id7fCIT_L=&Nb$FKo=7o^ z(V_KKUP&kE_A(a5os}r2(!Uxd!KkRLDEN-CGZ&M_h_H3tR;Qj8!mg$pU5YxvaCg{W zPa+DNLC&C(`o1PECgAifMaa`QQbA zBDJ*3E(RtwH1)o8aidX~R20g|a94mb@Kqg%RweQcO+ORzmNR zgjqjxDXbv#ud`sMg(`yz4{S729g57rb4E{8j_&85=U=6xY<(rf<#F*~{-w6uu|uCs XeMV)<%mnK@l(MqkqC|1J5<~U}{p%#{ literal 0 HcmV?d00001 diff --git a/languages/apsfc-pt_PT.po b/languages/apsfc-pt_PT.po new file mode 100644 index 0000000..5726b23 --- /dev/null +++ b/languages/apsfc-pt_PT.po @@ -0,0 +1,52 @@ +msgid "" +msgstr "" +"Project-Id-Version: Add Polylang support for Customizer\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-05-14 17:12+0000\n" +"PO-Revision-Date: 2020-05-14 17:15+0000\n" +"Last-Translator: \n" +"Language-Team: Portuguese (Portugal)\n" +"Language: pt_PT\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Loco https://localise.biz/\n" +"X-Loco-Version: 2.3.3; wp-5.4.1" + +#: includes/class-apsfc.php:294 +msgid "Language" +msgstr "Língua" + +#. Third party plugin Slug +#: includes/class-settings.php:31 includes/class-settings.php:32 +msgid "Customizer Support" +msgstr "Suporte do Personalizador" + +#: includes/class-settings.php:56 +msgid "Customizer Support Settings" +msgstr "Configurações de suporte do personalizador" + +#: includes/class-settings.php:66 +msgid "Language setup" +msgstr "Configuração de idioma" + +#. Name of the plugin +msgid "Add Polylang support for Customizer" +msgstr "Adicione suporte ao Polylang para o Customizer" + +#. Description of the plugin +msgid "This plugin adds Polylang support for Customizer." +msgstr "Este plugin adiciona suporte ao Polylang para o Customizer." + +#. URI of the plugin +msgid "https://wordpress.org/plugins/add-polylang-support-for-customizer" +msgstr "" + +#. Author of the plugin +msgid "richardev" +msgstr "" + +#. Author URI of the plugin +msgid "https://richardev.com" +msgstr "" diff --git a/languages/apsfc-zh_CN.mo b/languages/apsfc-zh_CN.mo new file mode 100644 index 0000000000000000000000000000000000000000..71f4fe872612269cc3bdebfe84e71de7c97b7361 GIT binary patch literal 868 zcma))O>5LZ7{^B|DnUH-B-q11J@~?8lie0emObd&N?})*Hi|cyZl>8tb|%bB)b6Q@ zh-gbe^wL8S1z82_%b`L`Z+-#4fCzS9`~u?9C&q0+3OexP|I9N_o|nmd89wk7!8!zt z0B*8@wUo+l9R+(C7zW-0$AM44Vc;up6!;FvKC&2!^AE6_lKR}Ox4hGtvSd_4B65Lh=HR@Qw}>@P>@jSgb?p2Z3l;>D8Fn*B3ho^@p2k(E z(!`aNtB`6Tp~PTz;xgKFaJdn1rWih%81&Tcv4dNU>*Y&EEsP}%$&`>y}zu4}zA9XfYQdhtIrnkM0 r`mfje?ZrO=KKKgtUw!DVJl@&b=saJ8Iy;;92dV!qnWp--co+Qw+D9nk literal 0 HcmV?d00001 diff --git a/languages/apsfc-zh_CN.po b/languages/apsfc-zh_CN.po new file mode 100644 index 0000000..3ca1cf4 --- /dev/null +++ b/languages/apsfc-zh_CN.po @@ -0,0 +1,52 @@ +msgid "" +msgstr "" +"Project-Id-Version: Add Polylang support for Customizer\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-05-14 17:12+0000\n" +"PO-Revision-Date: 2020-05-14 17:15+0000\n" +"Last-Translator: \n" +"Language-Team: Chinese (China)\n" +"Language: zh_CN\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Loco https://localise.biz/\n" +"X-Loco-Version: 2.3.3; wp-5.4.1" + +#: includes/class-apsfc.php:294 +msgid "Language" +msgstr "語言" + +#. Third party plugin Slug +#: includes/class-settings.php:31 includes/class-settings.php:32 +msgid "Customizer Support" +msgstr "定制支持" + +#: includes/class-settings.php:56 +msgid "Customizer Support Settings" +msgstr "定製程序支持設置" + +#: includes/class-settings.php:66 +msgid "Language setup" +msgstr "語言設定" + +#. Name of the plugin +msgid "Add Polylang support for Customizer" +msgstr "添加對Customizer的Polylang支持" + +#. Description of the plugin +msgid "This plugin adds Polylang support for Customizer." +msgstr "該插件增加了Polylang對Customizer的支持。" + +#. URI of the plugin +msgid "https://wordpress.org/plugins/add-polylang-support-for-customizer" +msgstr "" + +#. Author of the plugin +msgid "richardev" +msgstr "" + +#. Author URI of the plugin +msgid "https://richardev.com" +msgstr "" diff --git a/languages/apsfc.pot b/languages/apsfc.pot new file mode 100644 index 0000000..a1729d6 --- /dev/null +++ b/languages/apsfc.pot @@ -0,0 +1,53 @@ +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Add Polylang support for Customizer\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-05-14 17:12+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: \n" +"Language: \n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Loco https://localise.biz/\n" +"X-Loco-Version: 2.3.1; wp-5.3.2" + +#: includes/class-apsfc.php:294 +msgid "Language" +msgstr "" + +#. Third party plugin Slug +#: includes/class-settings.php:31 includes/class-settings.php:32 +msgid "Customizer Support" +msgstr "" + +#: includes/class-settings.php:56 +msgid "Customizer Support Settings" +msgstr "" + +#: includes/class-settings.php:66 +msgid "Language setup" +msgstr "" + +#. Name of the plugin +msgid "Add Polylang support for Customizer" +msgstr "" + +#. Description of the plugin +msgid "This plugin adds Polylang support for Customizer." +msgstr "" + +#. URI of the plugin +msgid "https://wordpress.org/plugins/add-polylang-support-for-customizer" +msgstr "" + +#. Author of the plugin +msgid "richardev" +msgstr "" + +#. Author URI of the plugin +msgid "https://richardev.com" +msgstr "" diff --git a/languages/index.php b/languages/index.php new file mode 100644 index 0000000..e71af0e --- /dev/null +++ b/languages/index.php @@ -0,0 +1 @@ + `Settings` > `URL modifications` + +## Prerequisite + +1. Polylang must be installed and activated. +2. Languages must be set in **Admin > Languages**. +3. _If you have a static front page_: + 1. _Create a front page per each language._ + 2. _Select the front page in **Admin > Settings > Reading** per language._ +4. Expect customizer to use setting type = `theme_mod` (default) as in: + +`$wp_customize->add_setting( 'setting_id', [ 'type' => 'theme_mod', ] );` + +## Installation + +This plugin can be installed directly into your plugins folder "as-is"
+or: + +- go to **Plugins > Add new** and type in Search `Add Polylang support for Customizer` and click **Install** and then **Activate** buttons. +- if you go to **Admin panel > Plugins > Add new > Upload Plugin** and select the archive containing this plugin. + +It's safe to activate the plugin at this point. Because the plugin just injects some functionality - there will be no plugin menus or settings to play with. +License + +## License + +This plugin is licensed under the GPL v2 or later. + +> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. + +> This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +> You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +A copy of the license is included in the root of the plugin’s directory. The file is named `LICENSE`. + +## Important Notes + +### Licensing + +This plugin is licensed under the GPL v2 or later; however, if you opt to use third-party code that is not compatible with v2, then you may need to switch to using code that is GPL v3 compatible. + +For reference, [here's a discussion](http://make.wordpress.org/themes/2013/03/04/licensing-note-apache-and-gpl/) that covers the Apache 2.0 License used by [Bootstrap](http://twitter.github.io/bootstrap/). + +# Credits + +Original solution made by [@soderlind](https://github.com/soderlind) is available [here](https://github.com/soderlind/customizer-polylang). Share some love! This is WordPress plugin version of his solution. diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..21a4c51 --- /dev/null +++ b/readme.txt @@ -0,0 +1,120 @@ +=== Add Polylang support for Customizer === +Contributors: richardevcom,pers +Tags: polylang,customizer,support,translate,wordpress +Donate link: paypal.me/ricardsmucelans +Requires at least: 4.7 +Tested up to: 5.8 +Requires PHP: 5.6 +Stable tag: trunk +License: GPL-2.0+ +License URI: http://www.gnu.org/licenses/gpl-2.0.txt + +This plugin adds Polylang support for WordPress Customizer. + +== Description == +# Add Polylang support for Customizer + +This plugin adds Polylang support for WordPress Customizer. + +## Support + +We provide direct support via our [Frontbee Discord server](https://discord.gg/ZptSdXMPrM) + +## Features + +* Language switcher in Customizer. +* Localized theme_mods and options for both default and custom made Customizer values. +* Enable/disable forcing "The language is set from content" setting in Language->Settings->URL modifications + +## Prerequisite + +1. Polylang must be installed and activated. +2. Languages must be set in **Admin > Languages**. +3. _If you have a static front page_: + 1. _Create a front page per each language._ + 2. _Select the front page in **Admin > Settings > Reading** per language._ +5. Expect customizer to use setting type = `theme_mod` (default) as in: + +`$wp_customize->add_setting( 'setting_id', [ 'type' => 'theme_mod', ] );` + +## Installation + +This plugin can be installed directly into your plugins folder \"as-is\" + +or if you go to **Admin panel > Plugins > Add new > Upload Plugin** and select the archive containing this plugin. + +It\'s safe to activate the plugin at this point. Because the plugin just injects some functionality - there will be no plugin menus or settings to play with. + +## License + +This plugin is licensed under the GPL v2 or later. + +> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. + +> This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +> You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +A copy of the license is included in the root of the plugin’s directory. The file is named `LICENSE`. + +## Important Notes + +### Licensing + +This plugin is licensed under the GPL v2 or later; however, if you opt to use third-party code that is not compatible with v2, then you may need to switch to using code that is GPL v3 compatible. + +# Credits + +Original solution made by [@soderlind](https://github.com/soderlind) is available [here](https://github.com/soderlind/customizer-polylang). Share some love! This is WordPress plugin version of his solution. + + +== Installation == +This plugin can be installed directly into your plugins folder \"as-is\" +or if you go to Admin panel > Plugins > Add new > Upload Plugin and select the archive containing this plugin. + +== Screenshots == +1. Polylang language dropdown in Customizer + +== Changelog == += 1.0.1 = +* First release += 1.0.2 = +* Fixed issues with option rewriting and polylang translatable strings. += 1.1.2 = +* Fixed issues with pll_current_language() missing due to Polylang API being not included. += 1.1.2 = +* Added settings page & Enable/disable forcing "The language is set from content" setting in Language->Settings->URL modifications += 1.1.2 = +* Added quick settings link += 1.1.2 = +* Fixed missing includes += 1.2.0 = +* Fixed 404 page & removed prefered language dismissal. Thanks @penhtech += 1.3.0 = +* If Polylang is not active, don't run the app and throw an error notice += 1.3.1 = +* Changed way Polylang API is called += 1.3.2 = +* fixed API.php location error for multisites. += 1.3.3 = +* Changed how API.php is included. += 1.3.4 = +* Added Polylang PRO dir check += 1.3.5 = +* Added Polylang PRO dir check += 1.3.6 = +* Added Polylang PRO dir check += 1.3.7 = +* Fixed no language selection issue on customizer. += 1.3.8 = +* Fixed no language selection issue on customizer. += 1.4.0 = +* Fixed premature Polylang API initialization error while activating/deactivating Polylang. += 1.4.1 = +* Fixed non existing function (early) call for some 3rd party plugins. += 1.4.2 = +* Added support up to WordPress 5.8 += 1.4.3 = +* Workaround for update version mismatch += 1.4.4 = +* Added support URL \ No newline at end of file