This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <? | |
| // bitrix/php_interface/init.php | |
| if (!function_exists('mb_ucfirst') && extension_loaded('mbstring')): | |
| /** | |
| * mb_ucfirst - преобразует первый символ в верхний регистр | |
| * @param string $str - строка | |
| * @param string $encoding - кодировка, по-умолчанию UTF-8 | |
| * @return string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <? | |
| require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); | |
| set_time_limit(0); | |
| ini_set('max_execution_time', '3600'); | |
| ini_set('memory_limit', '512M'); | |
| $c_elem = 0; | |
| $c_sect = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <? | |
| /* | |
| * Убирает дублирующиеся элементы в многомерном массиве по одному ключу. | |
| * | |
| * @param {array} - многомерный массив; | |
| * @param [key] - ключ по которому нужно убрать дубликаты. | |
| */ | |
| function dropsDuplicates($array, $key) { | |
| $tmp = $key_array = array(); | |
| $i = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <? | |
| AddEventHandler("iblock", "OnBeforeIBlockElementAdd", array("CodeUpdate", "IBlockElementUpdate")); | |
| AddEventHandler("iblock", "OnBeforeIBlockElementUpdate", array("CodeUpdate", "IBlockElementUpdate")); | |
| AddEventHandler("iblock", "OnBeforeIBlockSectionUpdate", array("CodeUpdate", "IBlockElementUpdate")); | |
| AddEventHandler("iblock", "OnBeforeIBlockSectionAdd", array("CodeUpdate", "IBlockElementUpdate")); | |
| AddEventHandler("catalog", "OnPriceAdd", array("CodeUpdate", "IBlockElementUpdate")); | |
| AddEventHandler("catalog", "OnPriceUpdate", array("CodeUpdate", "IBlockElementUpdate")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery('.wpcf7-submit').click(function (e) { | |
| var submit = jQuery(this), | |
| wrongInputs = [], | |
| reqInputs = submit.parents('form.wpcf7-form').find('[aria-required=true]'), | |
| testPhone = /^\d\s\(\d{3}\)\s\d{3}\-\d{2}\-\d{2}$/, | |
| testMail = /^[\w-\.]+@[\w-]+\.[a-z]{2,4}$/i; | |
| reqInputs.each(function () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| define("NEED_AUTH", true); | |
| global $USER; | |
| if (!$USER -> IsAdmin()) LocalRedirect("/"); | |
| set_time_limit(600); // Limits the execution time | |
| $IBLOCK_TYPE = 'catalog'; // Put one IBlock or an array of types | |
| function repSymCode($code) { | |
| if(strripos($code, '_') !== false) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function cl_print_r ($var, $label = '') { | |
| $str = json_encode(print_r ($var, true)); | |
| echo "<script>console.group('".$label."');console.log('".$str."');console.groupEnd();</script>"; | |
| } | |
| function cl_var_dump ($var, $label = '') { | |
| ob_start(); | |
| var_dump($var); | |
| $result = json_encode(ob_get_clean()); | |
| echo "<script>console.group('".$label."');console.log('".$result."');console.groupEnd();</script>"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RewriteEngine On | |
| # WWW to non-WWW redirect | |
| RewriteCond %{HTTP_HOST} ^www.SITE.ru$ [NC] | |
| RewriteRule ^(.*)$ http://SITE.ru/$1 [R=301,L] | |
| # HTTP to HTTPS redirect | |
| RewriteCond %{HTTPS} off | |
| RewriteCond %{HTTP:X-Forwarded-Proto} !https | |
| RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Create init.php, or just open it in '/bitrix/php_interface' and put this script in EOF; | |
| // Replaces type="text/javascript" with empty string. | |
| AddEventHandler("main", "OnEndBufferContent", "ChangeMyContent"); | |
| function ChangeMyContent(&$content) { | |
| $content = sanitize_output($content); | |
| } | |
| function sanitize_output($buffer) { | |
| $buffer = str_replace('type="text/javascript"', '', $buffer); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Removes type from css linked styles. | |
| add_filter('style_loader_tag', 'clean_style_tag'); | |
| function clean_style_tag($src) { | |
| return str_replace("type='text/css'", '', $src); | |
| } | |
| // Removes type from linked scripts. | |
| add_filter('script_loader_tag', 'clean_script_tag'); |