File manager - Edit - /home/rangceb/diohome.com/wp-includes6790ed/fonts/common.tar
Back
README.md 0000644 00000000661 15222641013 0006022 0 ustar 00 # Common - Anything here should be pure and not rely on anything from VB, TB, Core, so it can be reused wherever, even outside Divi. - Only external dependencies allowed. # Storybook 1. Go into common submodule directory 2. Switch to node version 20 e.g `nvm use 20` 3. Run `corepack enable` to activate [Corepack](https://nodejs.org/api/corepack.html) 4. Run `yarn set version berry` 5. Run `yarn install` 6. Run `yarn storybook` constants/colors.js 0000644 00000002056 15222641013 0010416 0 ustar 00 const colors = { black: '#000000', white: '#FFFFFF', default: '#F1F5F9', checkMark: '#37C4AA', success: '#29C4A9', successAlt: '#70C3A9', primary: '#6C2EB9', primaryAlt: '#7D3BCF', info: '#2B87DA', infoAlt: '#00B9DC', danger: '#EF5555', dangerAlt: '#EB3D00', inverse: '#4C5866', warning: '#FF9232', warningAlt: '#F3CB57', globalitem: '#97d000', optionTabIcon: '#BEC9D5', activeTabIcon: '#2B96E1', abTestingTimeFilter: '#A1A9B2', disabledSubject: '#E1E4EA', inactiveGrey: '#BEC9D6', shuttleGrey: '#5C6978', fiord: '#3E5062', uploadImagePreview: '#333B44', bfbPreviewActive: '#5C6979', bfbPreview: '#9FA5AC', enabledDeviceIcon: '#42E1A7', disabledDeviceIcon: '#EF5555', coreModalButtonBlue: '#008BDA', historyActiveButton: '#99CF02', uiActiveIcon: '#4191DE', uiInactiveIcon: '#bec9d6', moduleItemControlIcons: '#737e89', selectPositionGray: '#E6ECF2', cadetBlue: '#A2B0C1', layerBackground: '#f0f5f9', activeCloud: '#0088E1', activeFav: '#FF454E', button: '#a3b0c2', }; export default colors; init.php 0000644 00000006417 15222641013 0006224 0 ustar 00 <?php if ( ! defined( 'ET_COMMON_DIR' ) ) { define( 'ET_COMMON_DIR', get_template_directory() . '/common/' ); } if ( ! function_exists( 'et_common_setup' ) ) : /** * Setup Common const. * * @since ?? */ function et_common_setup() { if ( defined( 'ET_COMMON_URL' ) ) { return; } $common_path = _et_core_normalize_path( trailingslashit( dirname( __FILE__ ) ) ); $theme_dir = _et_core_normalize_path( trailingslashit( realpath( get_template_directory() ) ) ); if ( 0 === strpos( $common_path, $theme_dir ) ) { $url = get_template_directory_uri() . '/common/'; } else { $url = plugin_dir_url( __FILE__ ); } define( 'ET_COMMON_URL', $url ); require_once ET_COMMON_DIR . 'admin.php'; require_once ET_COMMON_DIR . 'library.php'; } endif; if ( ! function_exists( 'et_fb_enqueue_react' ) ): /** * Load React. Use react from cdn server in debug mode or local version in production. * * @since ?? * */ function et_fb_enqueue_react() { if ( ! et_common_should_enqueue_react() ) { return; } $DEBUG = defined( 'ET_DEBUG' ) && ET_DEBUG; $common_scripts = ET_COMMON_URL . 'scripts'; $react_version = '16.14.0'; wp_dequeue_script( 'react' ); wp_dequeue_script( 'react-dom' ); wp_deregister_script( 'react' ); wp_deregister_script( 'react-dom' ); if ( $DEBUG || DiviExtensions::is_debugging_extension() ) { wp_enqueue_script( 'react', "https://cdn.jsdelivr.net/npm/react@{$react_version}/umd/react.development.js", array(), $react_version, true ); wp_enqueue_script( 'react-dom', "https://cdn.jsdelivr.net/npm/react-dom@{$react_version}/umd/react-dom.development.js", array( 'react' ), $react_version, true ); add_filter( 'script_loader_tag', 'et_core_add_crossorigin_attribute', 10, 3 ); } else { wp_enqueue_script( 'react', "{$common_scripts}/react.production.min.js", array(), $react_version, true ); wp_enqueue_script( 'react-dom', "{$common_scripts}/react-dom.production.min.js", array( 'react' ), $react_version, true ); } } endif; if ( ! function_exists( 'et_common_should_enqueue_react' ) ) : /** * Determine whether React should be enqueued or not. * * @since 4.20.1 * * @return bool */ function et_common_should_enqueue_react() { $page = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification -- This function does not change any state, and is therefore not susceptible to CSRF. $post_type = isset( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification -- This function does not change any state, and is therefore not susceptible to CSRF. $is_fb = et_core_is_fb_enabled(); $is_tb = et_pb_is_allowed( 'theme_builder' ) && 'et_theme_builder' === $page; $is_epanel = et_pb_is_allowed( 'theme_options' ) && 'et_divi_options' === $page; $is_divi_library = et_pb_is_allowed( 'divi_library' ) && 'et_pb_layout' === $post_type; $should_enqueue = $is_fb || $is_tb || $is_epanel || $is_divi_library; /** * Filter whether React should be enqueued or not. * * @since 4.20.1 * * @param string $should_enqueue Enqueue status. */ return apply_filters( 'et_common_should_enqueue_react', $should_enqueue ); } endif; utils/html-utils.js 0000644 00000012540 15222641013 0010342 0 ustar 00 import { isString } from 'lodash'; // import ETBuilderStore from '../stores/et-builder-store'; /** * Get the HTML of the current page. * * @returns {string} Page's HTML string. */ export function getPageHTML() { return document.getElementById('et-boc').innerHTML || ''; } /** * Strip Style tags in a HTML string. * * @param {string} htmlString HTML string. * @returns {string} HTML string. */ export function stripStyleTag(htmlString) { // Create a new DOMParser instance const parser = new DOMParser(); // Parse the HTML string into a DOM document const doc = parser.parseFromString(htmlString, 'text/html'); // Remove all nested <style> nodes const styleNodes = doc.getElementsByTagName('style'); for (let i = styleNodes.length - 1; i >= 0; i--) { const styleNode = styleNodes[i]; styleNode.parentNode.removeChild(styleNode); } // Get the modified HTML string without nested <style> nodes return doc.documentElement.innerHTML; } /** * Strip attributes from heading tags. * * @param {string} htmlString HTML string. * @returns {string} HTML string. */ export function stripHeadingAttributes(htmlString) { // Create a new DOMParser instance const parser = new DOMParser(); // Parse the HTML string into a DOM document const doc = parser.parseFromString(htmlString, 'text/html'); // Strip HTML tags, except for heading tags, and remove attributes within heading tags const elements = doc.body.childNodes; for (let i = elements.length - 1; i >= 0; i--) { const element = elements[i]; if (element.nodeType === Node.ELEMENT_NODE) { if (element.tagName !== 'H1' && element.tagName !== 'H2' && element.tagName !== 'H3' && element.tagName !== 'H4' && element.tagName !== 'H5' && element.tagName !== 'H6') { while (element.firstChild) { element.parentNode.insertBefore(element.firstChild, element); } element.parentNode.removeChild(element); } else { // Remove attributes within heading tags const { attributes } = element; for (let j = attributes.length - 1; j >= 0; j--) { element.removeAttribute(attributes[j].name); } } } } // Get the modified HTML string without HTML tags, except for heading tags return doc.body.innerHTML; } /** * Strip HTML Tags except heading tags. * * @param {string} htmlString HTML string. * @returns {string} HTML string. */ export function stripHTML(htmlString) { // String style tags along w/ the content. let strippedHTML = stripStyleTag(htmlString); // Remove all HTML tags except heading tags. strippedHTML = strippedHTML.replace(/<(?!\/?(h[1-6]))[^<>]*>/gi, ''); // Remove all attributes in heading tags. strippedHTML = stripHeadingAttributes(strippedHTML); // Replace any encoded HTML entities. strippedHTML = strippedHTML.replace(/&([a-z\d]+|#[xX][a-f\d]+);/ig, ''); // Replace any new line characters. strippedHTML = strippedHTML.replace(/(\r\n|\n|\r|\t)/gm, ''); return strippedHTML; } /** * Gets HTML content of the given class name. * @param {string} className Class name. * @returns {string} */ export function getHTMLByClassName(className) { // Create a new DOMParser instance const parser = new DOMParser(); const htmlString = getPageHTML(); // Parse the HTML string into a DOM document const doc = parser.parseFromString(htmlString, 'text/html'); // Get HTML content by class name using getElementsByClassName() const elementsByClass = doc.getElementsByClassName(className); for (let j = 0; j < elementsByClass.length; j++) { const htmlContentByClass = elementsByClass[j].innerHTML; if (htmlContentByClass) { return htmlContentByClass; } } return ''; } /** * Gets section HTML. * * @param {string} componentAddress Component Address. * @returns {string} Section HTML. */ // export function getSectionHTML(componentAddress) { // const sections = ETBuilderStore.getSections(); // const addresses = componentAddress.split('.'); // if (! addresses.length) { // return ''; // } // const sectionShortcodeObj = sections[addresses[0]]; // const sectionClass = `${sectionShortcodeObj.type}_${sectionShortcodeObj.address}`; // return getHTMLByClassName(sectionClass); // } // export function getModuleHTML(componentAddress) { // const component = ETBuilderStore.getShortcodeObjAtAddress(componentAddress); // const moduleClass = `${component.type}_${component._order}`; // return getHTMLByClassName(moduleClass); // } export function stripDefaultValues(value) { if ('string' !== typeof value) { return value; } Object.entries(ETBuilderBackend.defaults).forEach(([moduleType, moduleFields]) => { Object.entries(moduleFields).forEach(([field, content]) => { if (isString(content) && value.includes(content)) { value = value.replace(content, ''); } }); }); return value; } export function getMaxCharacterLimit(textbox) { const style = getComputedStyle(textbox); const width = parseInt(style.width); const font = style.font; const characterWidth = getCharacterWidth(font); const characterLimit = Math.floor(width / characterWidth); return characterLimit + 20; } function getCharacterWidth(font) { const canvas = document.createElement("canvas"); const context = canvas.getContext("2d"); context.font = font; const metrics = context.measureText("A"); return metrics.width; } images/no-color.png 0000644 00000006511 15222641013 0010246 0 ustar 00 �PNG IHDR 4 4 �+} sRGB ��� IDATh�ZilU�����cl�R��i���@�AT���,��FjU�RhKK���6AY���J�"h5�*��,�%��*"*@P6� �dc�0ޟo��}������#�g�,�;�93g��g�����s���z�ɹS�N����˗���� hY�����XBGzh8�r�J�(�3�����g��������ڵk��AQ͎���H��������UTT�����y N�r����֭[�644�}h���������?�ڌ����w�����F�h��T���866�9s&0�.]�� �J&�nƌ���:������I�w�L�ܹs��`�=K�,�>U�I<k֬$ PPP�*++�I�vU��h4��J��N� ���`��U~�W����s�}�nlt� J��V��������;WYSmu�1�����s�k�n(���y���蕉1�����j�x��F�}�:3��ӧ�ޞ����~�c�b]��*�RCEEE�����Jp��E�H@���'O����;D^3g�t%%%�KKK�����ƶ��� ��H��Lf��QW��M��}��D��� \aa�M��m��X8a���hNݸq�a����Z�$� ���p\qX�2G�+8*ERl��X�7C�� �2�tb,QIk��h~�� ����1 2���e�N���Ȉkjj�����f��`��nd��Q�ܹsV��T��h�o}��|E�������-�'�E�&��ˈG>���ʑIjT������n�2���>�_���g�G x����;��v�ϟ��*�JYȠ?��5 ���p�����m}ɏ�2������m71�� \UeƟk{� d7><����z}g[� Ml4 �Z����i.� ��>�l��+;3`�?�Q��ẃI�k!p?���,�� �ب��7�X�,�߰P��l�:�T`�F@��B6�,��ʰo��.7cU Z���~��H�@c�V�����`���!+2���@�C��!d)����3Fڌd����Rp�w�6@a���QC9���y��g-y���ig��fQ�(���oyӝ���jk"m|#��C �A�q�x˺^4���4��^WPRlf��鱶Фx���Ȁ 4�T��_�� �����%%�Z�4+�hZ?�� ����C �� �N���(�I��Ȋ���;kjj����y�8���I��ڂLg�� �b v�9o�l��J2a�&��d^�Ȉ&Ø �]ȅ� �1q�X�} �0)p`30f8�.z�z��X��Y!J��Yf�&o>����ߤ@ ��rH��q�1뙥ư��}�+;���L��M�0s�bp)��yD�� 3��@OܰZ}s~�K�<)k^~0����р��V�����%��T��2����g����'\�KV���#8��D@�9і�E�X�܍>���$Ab�qCJ��5N�O���� ��]��g���%H�7 �9��邸g~���݀���|˒r������^D8�O��l�3q+�^x��qo���˜9s~ЉU������c}�d~���|�C�����2����U�3�Oh�\I�2����pyS�皧M��x9�&F-s^�D?΄�/^V�"P]��y�s1`/}�T��5'�� �*�K�e��}������e�~9�O��c��GDr�hѢ�$�` ��*��J>� Β�P�6�u��|�� w|�䃈 eq�2�ɢ7V0B|�]���Pfp�=�yh�P��0Xg&