modified file plugins

This commit is contained in:
2023-10-22 22:21:44 +00:00
committed by Gitium
parent c72a65abc1
commit 96c0ee892f
4817 changed files with 752216 additions and 0 deletions

View File

@ -0,0 +1,23 @@
<?php
/**
* Misc. functions for backward-compatibility.
*/
if ( ! function_exists( 'wp_get_attachment_image_url' ) ) {
/**
* Get the URL of an image attachment.
*
* @since 4.4.0
*
* @param int $attachment_id Image attachment ID.
* @param string|array $size Optional. Image size to retrieve. Accepts any valid image size, or an array
* of width and height values in pixels (in that order). Default 'thumbnail'.
* @param bool $icon Optional. Whether the image should be treated as an icon. Default false.
* @return string|false Attachment URL or false if no image is available.
*/
function wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon = false ) {
$image = wp_get_attachment_image_src( $attachment_id, $size, $icon );
return isset( $image['0'] ) ? $image['0'] : false;
}
}

View File

@ -0,0 +1,484 @@
<?php
/**
* Font awesome 5 helper functions
*
* @package Menu_Icons
*/
// phpcs:disable WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned
if ( ! function_exists( 'font_awesome_backward_compatible' ) ) {
/**
* Font awesome 5 backward compatible.
*
* @return array
*/
function font_awesome_backward_compatible() {
$font_awesome_icon = array(
'fa-fa-500px' => 'fab fa-500px',
'fa-fa-address-book-o' => 'far fa-address-book',
'fa-fa-address-card-o' => 'far fa-address-card',
'fa-fa-adn' => 'fab fa-adn',
'fa-fa-amazon' => 'fab fa-amazon',
'fa-fa-android' => 'fab fa-android',
'fa-fa-angellist' => 'fab fa-angellist',
'fa-fa-apple' => 'fab fa-apple',
'fa-fa-area-chart' => 'fas fa-chart-area',
'fa-fa-arrow-circle-o-down' => 'far fa-arrow-alt-circle-down',
'fa-fa-arrow-circle-o-left' => 'far fa-arrow-alt-circle-left',
'fa-fa-arrow-circle-o-right' => 'far fa-arrow-alt-circle-right',
'fa-fa-arrow-circle-o-up' => 'far fa-arrow-alt-circle-up',
'fa-fa-arrows-alt' => 'fas fa-expand-arrows-alt',
'fa-fa-arrows-h' => 'fas fa-arrows-alt-h',
'fa-fa-arrows-v' => 'fas fa-arrows-alt-v',
'fa-fa-arrows' => 'fas fa-arrows-alt',
'fa-fa-asl-interpreting' => 'fas fa-american-sign-language-interpreting',
'fa-fa-automobile' => 'fas fa-car',
'fa-fa-bandcamp' => 'fab fa-bandcamp',
'fa-fa-bank' => 'fas fa-university',
'fa-fa-bar-chart-o' => 'far fa-chart-bar',
'fa-fa-bar-chart' => 'far fa-chart-bar',
'fa-fa-bathtub' => 'fas fa-bath',
'fa-fa-battery-0' => 'fas fa-battery-empty',
'fa-fa-battery-1' => 'fas fa-battery-quarter',
'fa-fa-battery-2' => 'fas fa-battery-half',
'fa-fa-battery-3' => 'fas fa-battery-three-quarters',
'fa-fa-battery-4' => 'fas fa-battery-full',
'fa-fa-battery' => 'fas fa-battery-full',
'fa-fa-behance' => 'fab fa-behance',
'fa-fa-behance-square' => 'fab fa-behance-square',
'fa-fa-bell-o' => 'far fa-bell',
'fa-fa-bell-slash-o' => 'far fa-bell-slash',
'fa-fa-bitbucket-square' => 'fab fa-bitbucket',
'fa-fa-bitbucket' => 'fab fa-bitbucket',
'fa-fa-bitcoin' => 'fab fa-btc',
'fa-fa-black-tie' => 'fab fa-black-tie',
'fa-fa-bluetooth-b' => 'fab fa-bluetooth-b',
'fa-fa-bluetooth' => 'fab fa-bluetooth',
'fa-fa-bookmark-o' => 'far fa-bookmark',
'fa-fa-btc' => 'fab fa-btc',
'fa-fa-building-o' => 'far fa-building',
'fa-fa-buysellads' => 'fab fa-buysellads',
'fa-fa-cab' => 'fas fa-taxi',
'fa-fa-calendar-check-o' => 'far fa-calendar-check',
'fa-fa-calendar-minus-o' => 'far fa-calendar-minus',
'fa-fa-calendar-o' => 'far fa-calendar',
'fa-fa-calendar-plus-o' => 'far fa-calendar-plus',
'fa-fa-calendar-times-o' => 'far fa-calendar-times',
'fa-fa-calendar' => 'fas fa-calendar-alt',
'fa-fa-caret-square-o-down' => 'far fa-caret-square-down',
'fa-fa-caret-square-o-left' => 'far fa-caret-square-left',
'fa-fa-caret-square-o-right' => 'far fa-caret-square-right',
'fa-fa-caret-square-o-up' => 'far fa-caret-square-up',
'fa-fa-cc-amex' => 'fab fa-cc-amex',
'fa-fa-cc-diners-club' => 'fab fa-cc-diners-club',
'fa-fa-cc-discover' => 'fab fa-cc-discover',
'fa-fa-cc-jcb' => 'fab fa-cc-jcb',
'fa-fa-cc-mastercard' => 'fab fa-cc-mastercard',
'fa-fa-cc-paypal' => 'fab fa-cc-paypal',
'fa-fa-cc-stripe' => 'fab fa-cc-stripe',
'fa-fa-cc-visa' => 'fab fa-cc-visa',
'fa-fa-cc' => 'far fa-closed-captioning',
'fa-fa-chain-broken' => 'fas fa-unlink',
'fa-fa-chain' => 'fas fa-link',
'fa-fa-check-circle-o' => 'far fa-check-circle',
'fa-fa-check-square-o' => 'far fa-check-square',
'fa-fa-chrome' => 'fab fa-chrome',
'fa-fa-circle-o-notch' => 'fas fa-circle-notch',
'fa-fa-circle-o' => 'far fa-circle',
'fa-fa-circle-thin' => 'far fa-circle',
'fa-fa-clipboard' => 'far fa-clipboard',
'fa-fa-clock-o' => 'far fa-clock',
'fa-fa-clone' => 'far fa-clone',
'fa-fa-close' => 'fas fa-times',
'fa-fa-cloud-download' => 'fas fa-cloud-download-alt',
'fa-fa-cloud-upload' => 'fas fa-cloud-upload-alt',
'fa-fa-cny' => 'fas fa-yen-sign',
'fa-fa-code-fork' => 'fas fa-code-branch',
'fa-fa-codepen' => 'fab fa-codepen',
'fa-fa-codiepie' => 'fab fa-codiepie',
'fa-fa-comment-o' => 'far fa-comment',
'fa-fa-commenting-o' => 'far fa-comment-dots',
'fa-fa-commenting' => 'fas fa-comment-dots',
'fa-fa-comments-o' => 'far fa-comments',
'fa-fa-compass' => 'far fa-compass',
'fa-fa-connectdevelop' => 'fab fa-connectdevelop',
'fa-fa-contao' => 'fab fa-contao',
'fa-fa-copyright' => 'far fa-copyright',
'fa-fa-creative-commons' => 'fab fa-creative-commons',
'fa-fa-credit-card-alt' => 'fas fa-credit-card',
'fa-fa-credit-card' => 'far fa-credit-card',
'fa-fa-css3' => 'fab fa-css3',
'fa-fa-cutlery' => 'fas fa-utensils',
'fa-fa-dashboard' => 'fas fa-tachometer-alt',
'fa-fa-dashcube' => 'fab fa-dashcube',
'fa-fa-deafness' => 'fas fa-deaf',
'fa-fa-dedent' => 'fas fa-outdent',
'fa-fa-delicious' => 'fab fa-delicious',
'fa-fa-deviantart' => 'fab fa-deviantart',
'fa-fa-diamond' => 'far fa-gem',
'fa-fa-digg' => 'fab fa-digg',
'fa-fa-dollar' => 'fas fa-dollar-sign',
'fa-fa-dot-circle-o' => 'far fa-dot-circle',
'fa-fa-dribbble' => 'fab fa-dribbble',
'fa-fa-drivers-license-o' => 'far fa-id-card',
'fa-fa-drivers-license' => 'fas fa-id-card',
'fa-fa-dropbox' => 'fab fa-dropbox',
'fa-fa-drupal' => 'fab fa-drupal',
'fa-fa-edge' => 'fab fa-edge',
'fa-fa-eercast' => 'fab fa-sellcast',
'fa-fa-empire' => 'fab fa-empire',
'fa-fa-envelope-open-o' => 'far fa-envelope-open',
'fa-fa-envelope-o' => 'far fa-envelope',
'fa-fa-envira' => 'fab fa-envira',
'fa-fa-etsy' => 'fab fa-etsy',
'fa-fa-euro' => 'fas fa-euro-sign',
'fa-fa-eur' => 'fas fa-euro-sign',
'fa-fa-exchange' => 'fas fa-exchange-alt',
'fa-fa-expeditedssl' => 'fab fa-expeditedssl',
'fa-fa-external-link-square' => 'fas fa-external-link-square-alt',
'fa-fa-external-link' => 'fas fa-external-link-alt',
'fa-fa-eye-slash' => 'far fa-eye-slash',
'fa-fa-eyedropper' => 'fas fa-eye-dropper',
'fa-fa-eye' => 'far fa-eye',
'fa-fa-facebook-f' => 'fab fa-facebook-f',
'fa-fa-facebook-official' => 'fab fa-facebook',
'fa-fa-facebook-square' => 'fab fa-facebook-square',
'fa-fa-facebook' => 'fab fa-facebook-f',
'fa-fa-feed' => 'fas fa-rss',
'fa-fa-file-archive-o' => 'far fa-file-archive',
'fa-fa-file-audio-o' => 'far fa-file-audio',
'fa-fa-file-code-o' => 'far fa-file-code',
'fa-fa-file-excel-o' => 'far fa-file-excel',
'fa-fa-file-image-o' => 'far fa-file-image',
'fa-fa-file-movie-o' => 'far fa-file-video',
'fa-fa-file-o' => 'far fa-file',
'fa-fa-file-pdf-o' => 'far fa-file-pdf',
'fa-fa-file-photo-o' => 'far fa-file-image',
'fa-fa-file-picture-o' => 'far fa-file-image',
'fa-fa-file-powerpoint-o' => 'far fa-file-powerpoint',
'fa-fa-file-sound-o' => 'far fa-file-audio',
'fa-fa-file-text-o' => 'far fa-file-alt',
'fa-fa-file-text' => 'fas fa-file-alt',
'fa-fa-file-video-o' => 'far fa-file-video',
'fa-fa-file-word-o' => 'far fa-file-word',
'fa-fa-file-zip-o' => 'far fa-file-archive',
'fa-fa-files-o' => 'far fa-copy',
'fa-fa-firefox' => 'fab fa-firefox',
'fa-fa-first-order' => 'fab fa-first-order',
'fa-fa-flag-o' => 'far fa-flag',
'fa-fa-flash' => 'fas fa-bolt',
'fa-fa-flickr' => 'fab fa-flickr',
'fa-fa-floppy-o' => 'far fa-save',
'fa-fa-folder-o' => 'far fa-folder',
'fa-fa-folder-open-o' => 'far fa-folder-open',
'fa-fa-font-awesome' => 'fab fa-font-awesome',
'fa-fa-fonticons' => 'fab fa-fonticons',
'fa-fa-fort-awesome' => 'fab fa-fort-awesome',
'fa-fa-forumbee' => 'fab fa-forumbee',
'fa-fa-foursquare' => 'fab fa-foursquare',
'fa-fa-free-code-camp' => 'fab fa-free-code-camp',
'fa-fa-frown-o' => 'far fa-frown',
'fa-fa-futbol-o' => 'far fa-futbol',
'fa-fa-gbp' => 'fas fa-pound-sign',
'fa-fa-gears' => 'fas fa-cogs',
'fa-fa-gear' => 'fas fa-cog',
'fa-fa-get-pocket' => 'fab fa-get-pocket',
'fa-fa-ge' => 'fab fa-empire',
'fa-fa-gg-circle' => 'fab fa-gg-circle',
'fa-fa-gg' => 'fab fa-gg',
'fa-fa-git-square' => 'fab fa-git-square',
'fa-fa-github-alt' => 'fab fa-github-alt',
'fa-fa-github-square' => 'fab fa-github-square',
'fa-fa-github' => 'fab fa-github',
'fa-fa-gitlab' => 'fab fa-gitlab',
'fa-fa-gittip' => 'fab fa-gratipay',
'fa-fa-git' => 'fab fa-git',
'fa-fa-glass' => 'fas fa-glass-martini',
'fa-fa-glide-g' => 'fab fa-glide-g',
'fa-fa-glide' => 'fab fa-glide',
'fa-fa-google-plus-circle' => 'fab fa-google-plus',
'fa-fa-google-plus-official' => 'fab fa-google-plus',
'fa-fa-google-plus-square' => 'fab fa-google-plus-square',
'fa-fa-google-plus' => 'fab fa-google-plus-g',
'fa-fa-google-wallet' => 'fab fa-google-wallet',
'fa-fa-google' => 'fab fa-google',
'fa-fa-gratipay' => 'fab fa-gratipay',
'fa-fa-grav' => 'fab fa-grav',
'fa-fa-group' => 'fas fa-users',
'fa-fa-hacker-news' => 'fab fa-hacker-news',
'fa-fa-hand-grab-o' => 'far fa-hand-rock',
'fa-fa-hand-lizard-o' => 'far fa-hand-lizard',
'fa-fa-hand-o-down' => 'far fa-hand-point-down',
'fa-fa-hand-o-left' => 'far fa-hand-point-left',
'fa-fa-hand-o-right' => 'far fa-hand-point-right',
'fa-fa-hand-o-up' => 'far fa-hand-point-up',
'fa-fa-hand-paper-o' => 'far fa-hand-paper',
'fa-fa-hand-peace-o' => 'far fa-hand-peace',
'fa-fa-hand-pointer-o' => 'far fa-hand-pointer',
'fa-fa-hand-rock-o' => 'far fa-hand-rock',
'fa-fa-hand-scissors-o' => 'far fa-hand-scissors',
'fa-fa-hand-spock-o' => 'far fa-hand-spock',
'fa-fa-hand-stop-o' => 'far fa-hand-paper',
'fa-fa-handshake-o' => 'far fa-handshake',
'fa-fa-hard-of-hearing' => 'fas fa-deaf',
'fa-fa-hdd-o' => 'far fa-hdd',
'fa-fa-header' => 'fas fa-heading',
'fa-fa-heart-o' => 'far fa-heart',
'fa-fa-hospital-o' => 'far fa-hospital',
'fa-fa-hotel' => 'fas fa-bed',
'fa-fa-hourglass-1' => 'fas fa-hourglass-start',
'fa-fa-hourglass-2' => 'fas fa-hourglass-half',
'fa-fa-hourglass-3' => 'fas fa-hourglass-end',
'fa-fa-hourglass-o' => 'far fa-hourglass',
'fa-fa-houzz' => 'fab fa-houzz',
'fa-fa-html5' => 'fab fa-html5',
'fa-fa-id-badge' => 'far fa-id-badge',
'fa-fa-id-card-o' => 'far fa-id-card',
'fa-fa-ils' => 'fas fa-shekel-sign',
'fa-fa-image' => 'far fa-image',
'fa-fa-imdb' => 'fab fa-imdb',
'fa-fa-inr' => 'fas fa-rupee-sign',
'fa-fa-instagram' => 'fab fa-instagram',
'fa-fa-institution' => 'fas fa-university',
'fa-fa-internet-explorer' => 'fab fa-internet-explorer',
'fa-fa-intersex' => 'fas fa-transgender',
'fa-fa-ioxhost' => 'fab fa-ioxhost',
'fa-fa-joomla' => 'fab fa-joomla',
'fa-fa-jpy' => 'fas fa-yen-sign',
'fa-fa-jsfiddle' => 'fab fa-jsfiddle',
'fa-fa-keyboard-o' => 'far fa-keyboard',
'fa-fa-krw' => 'fas fa-won-sign',
'fa-fa-lastfm-square' => 'fab fa-lastfm-square',
'fa-fa-lastfm' => 'fab fa-lastfm',
'fa-fa-leanpub' => 'fab fa-leanpub',
'fa-fa-legal' => 'fas fa-gavel',
'fa-fa-lemon-o' => 'far fa-lemon',
'fa-fa-level-down' => 'fas fa-level-down-alt',
'fa-fa-level-up' => 'fas fa-level-up-alt',
'fa-fa-life-bouy' => 'far fa-life-ring',
'fa-fa-life-buoy' => 'far fa-life-ring',
'fa-fa-life-ring' => 'far fa-life-ring',
'fa-fa-life-saver' => 'far fa-life-ring',
'fa-fa-lightbulb-o' => 'far fa-lightbulb',
'fa-fa-line-chart' => 'fas fa-chart-line',
'fa-fa-linkedin-square' => 'fab fa-linkedin',
'fa-fa-linkedin' => 'fab fa-linkedin-in',
'fa-fa-linode' => 'fab fa-linode',
'fa-fa-linux' => 'fab fa-linux',
'fa-fa-list-alt' => 'far fa-list-alt',
'fa-fa-long-arrow-down' => 'fas fa-long-arrow-alt-down',
'fa-fa-long-arrow-left' => 'fas fa-long-arrow-alt-left',
'fa-fa-long-arrow-right' => 'fas fa-long-arrow-alt-right',
'fa-fa-long-arrow-up' => 'fas fa-long-arrow-alt-up',
'fa-fa-mail-forward' => 'fas fa-share',
'fa-fa-mail-reply-all' => 'fas fa-reply-all',
'fa-fa-mail-reply' => 'fas fa-reply',
'fa-fa-map-marker' => 'fas fa-map-marker-alt',
'fa-fa-map-o' => 'far fa-map',
'fa-fa-maxcdn' => 'fab fa-maxcdn',
'fa-fa-meanpath' => 'fab fa-font-awesome',
'fa-fa-medium' => 'fab fa-medium',
'fa-fa-meetup' => 'fab fa-meetup',
'fa-fa-meh-o' => 'far fa-meh',
'fa-fa-minus-square-o' => 'far fa-minus-square',
'fa-fa-mixcloud' => 'fab fa-mixcloud',
'fa-fa-mobile-phone' => 'fas fa-mobile-alt',
'fa-fa-mobile' => 'fas fa-mobile-alt',
'fa-fa-modx' => 'fab fa-modx',
'fa-fa-moon-o' => 'far fa-moon',
'fa-fa-money' => 'far fa-money-bill-alt',
'fa-fa-mortar-board' => 'fas fa-graduation-cap',
'fa-fa-navicon' => 'fas fa-bars',
'fa-fa-newspaper-o' => 'far fa-newspaper',
'fa-fa-object-group' => 'far fa-object-group',
'fa-fa-object-ungroup' => 'far fa-object-ungroup',
'fa-fa-odnoklassniki-square' => 'fab fa-odnoklassniki-square',
'fa-fa-odnoklassniki' => 'fab fa-odnoklassniki',
'fa-fa-opencart' => 'fab fa-opencart',
'fa-fa-openid' => 'fab fa-openid',
'fa-fa-opera' => 'fab fa-opera',
'fa-fa-optin-monster' => 'fab fa-optin-monster',
'fa-fa-pagelines' => 'fab fa-pagelines',
'fa-fa-paper-plane-o' => 'far fa-paper-plane',
'fa-fa-paste' => 'far fa-clipboard',
'fa-fa-pause-circle-o' => 'far fa-pause-circle',
'fa-fa-paypal' => 'fab fa-paypal',
'fa-fa-pencil-square' => 'fas fa-pen-square',
'fa-fa-pencil-square-o' => 'far fa-edit',
'fa-fa-pencil' => 'fas fa-pencil-alt',
'fa-fa-photo' => 'far fa-image',
'fa-fa-picture-o' => 'far fa-image',
'fa-fa-pie-chart' => 'fas fa-chart-pie',
'fa-fa-pied-piper-alt' => 'fab fa-pied-piper-alt',
'fa-fa-pied-piper-pp' => 'fab fa-pied-piper-pp',
'fa-fa-pied-piper' => 'fab fa-pied-piper',
'fa-fa-pinterest-p' => 'fab fa-pinterest-p',
'fa-fa-pinterest-square' => 'fab fa-pinterest-square',
'fa-fa-pinterest' => 'fab fa-pinterest',
'fa-fa-play-circle-o' => 'far fa-play-circle',
'fa-fa-plus-square-o' => 'far fa-plus-square',
'fa-fa-product-hunt' => 'fab fa-product-hunt',
'fa-fa-qq' => 'fab fa-qq',
'fa-fa-question-circle-o' => 'far fa-question-circle',
'fa-fa-quora' => 'fab fa-quora',
'fa-fa-ravelry' => 'fab fa-ravelry',
'fa-fa-ra' => 'fab fa-rebel',
'fa-fa-rebel' => 'fab fa-rebel',
'fa-fa-reddit-alien' => 'fab fa-reddit-alien',
'fa-fa-reddit-square' => 'fab fa-reddit-square',
'fa-fa-reddit' => 'fab fa-reddit',
'fa-fa-refresh' => 'fas fa-sync',
'fa-fa-registered' => 'far fa-registered',
'fa-fa-remove' => 'fas fa-times',
'fa-fa-renren' => 'fab fa-renren',
'fa-fa-reorder' => 'fas fa-bars',
'fa-fa-repeat' => 'fas fa-redo',
'fa-fa-resistance' => 'fab fa-rebel',
'fa-fa-rmb' => 'fas fa-yen-sign',
'fa-fa-rotate-left' => 'fas fa-undo',
'fa-fa-rotate-right' => 'fas fa-redo',
'fa-fa-rouble' => 'fas fa-ruble-sign',
'fa-fa-ruble' => 'fas fa-ruble-sign',
'fa-fa-rub' => 'fas fa-ruble-sign',
'fa-fa-rupee' => 'fas fa-rupee-sign',
'fa-fa-s15' => 'fas fa-bath',
'fa-fa-safari' => 'fab fa-safari',
'fa-fa-scissors' => 'fas fa-cut',
'fa-fa-scribd' => 'fab fa-scribd',
'fa-fa-sellsy' => 'fab fa-sellsy',
'fa-fa-send-o' => 'far fa-paper-plane',
'fa-fa-send' => 'fas fa-paper-plane',
'fa-fa-share-square-o' => 'far fa-share-square',
'fa-fa-shekel' => 'fas fa-shekel-sign',
'fa-fa-sheqel' => 'fas fa-shekel-sign',
'fa-fa-shield' => 'fas fa-shield-alt',
'fa-fa-shirtsinbulk' => 'fab fa-shirtsinbulk',
'fa-fa-sign-in' => 'fas fa-sign-in-alt',
'fa-fa-sign-out' => 'fas fa-sign-out-alt',
'fa-fa-signing' => 'fas fa-sign-language',
'fa-fa-simplybuilt' => 'fab fa-simplybuilt',
'fa-fa-skyatlas' => 'fab fa-skyatlas',
'fa-fa-skype' => 'fab fa-skype',
'fa-fa-slack' => 'fab fa-slack',
'fa-fa-sliders' => 'fas fa-sliders-h',
'fa-fa-slideshare' => 'fab fa-slideshare',
'fa-fa-smile-o' => 'far fa-smile',
'fa-fa-snapchat-ghost' => 'fab fa-snapchat-ghost',
'fa-fa-snapchat-square' => 'fab fa-snapchat-square',
'fa-fa-snapchat' => 'fab fa-snapchat',
'fa-fa-snowflake-o' => 'far fa-snowflake',
'fa-fa-soccer-ball-o' => 'far fa-futbol',
'fa-fa-sort-alpha-asc' => 'fas fa-sort-alpha-down',
'fa-fa-sort-alpha-desc' => 'fas fa-sort-alpha-up',
'fa-fa-sort-amount-asc' => 'fas fa-sort-amount-down',
'fa-fa-sort-amount-desc' => 'fas fa-sort-amount-up',
'fa-fa-sort-asc' => 'fas fa-sort-up',
'fa-fa-sort-desc' => 'fas fa-sort-down',
'fa-fa-sort-numeric-asc' => 'fas fa-sort-numeric-down',
'fa-fa-sort-numeric-desc' => 'fas fa-sort-numeric-up',
'fa-fa-soundcloud' => 'fab fa-soundcloud',
'fa-fa-spoon' => 'fas fa-utensil-spoon',
'fa-fa-spotify' => 'fab fa-spotify',
'fa-fa-square-o' => 'far fa-square',
'fa-fa-stack-exchange' => 'fab fa-stack-exchange',
'fa-fa-stack-overflow' => 'fab fa-stack-overflow',
'fa-fa-star-half-empty' => 'far fa-star-half',
'fa-fa-star-half-full' => 'far fa-star-half',
'fa-fa-star-half-o' => 'far fa-star-half',
'fa-fa-star-o' => 'far fa-star',
'fa-fa-steam-square' => 'fab fa-steam-square',
'fa-fa-steam' => 'fab fa-steam',
'fa-fa-sticky-note-o' => 'far fa-sticky-note',
'fa-fa-stop-circle-o' => 'far fa-stop-circle',
'fa-fa-stumbleupon-circle' => 'fab fa-stumbleupon-circle',
'fa-fa-stumbleupon' => 'fab fa-stumbleupon',
'fa-fa-sun-o' => 'far fa-sun',
'fa-fa-superpowers' => 'fab fa-superpowers',
'fa-fa-support' => 'far fa-life-ring',
'fa-fa-tablet' => 'fas fa-tablet-alt',
'fa-fa-tachometer' => 'fas fa-tachometer-alt',
'fa-fa-telegram' => 'fab fa-telegram',
'fa-fa-television' => 'fas fa-tv',
'fa-fa-tencent-weibo' => 'fab fa-tencent-weibo',
'fa-fa-themeisle' => 'fab fa-themeisle',
'fa-fa-thermometer-0' => 'fas fa-thermometer-empty',
'fa-fa-thermometer-1' => 'fas fa-thermometer-quarter',
'fa-fa-thermometer-2' => 'fas fa-thermometer-half',
'fa-fa-thermometer-3' => 'fas fa-thermometer-three-quarters',
'fa-fa-thermometer-4' => 'fas fa-thermometer-full',
'fa-fa-thermometer' => 'fas fa-thermometer-full',
'fa-fa-thumb-tack' => 'fas fa-thumbtack',
'fa-fa-thumbs-o-down' => 'far fa-thumbs-down',
'fa-fa-thumbs-o-up' => 'far fa-thumbs-up',
'fa-fa-ticket' => 'fas fa-ticket-alt',
'fa-fa-times-circle-o' => 'far fa-times-circle',
'fa-fa-times-rectangle-o' => 'far fa-window-close',
'fa-fa-times-rectangle' => 'fas fa-window-close',
'fa-fa-toggle-down' => 'far fa-caret-square-down',
'fa-fa-toggle-left' => 'far fa-caret-square-left',
'fa-fa-toggle-right' => 'far fa-caret-square-right',
'fa-fa-toggle-up' => 'far fa-caret-square-up',
'fa-fa-trash-o' => 'far fa-trash-alt',
'fa-fa-trash' => 'fas fa-trash-alt',
'fa-fa-trello' => 'fab fa-trello',
'fa-fa-tripadvisor' => 'fab fa-tripadvisor',
'fa-fa-try' => 'fas fa-lira-sign',
'fa-fa-tumblr-square' => 'fab fa-tumblr-square',
'fa-fa-tumblr' => 'fab fa-tumblr',
'fa-fa-turkish-lira' => 'fas fa-lira-sign',
'fa-fa-twitch' => 'fab fa-twitch',
'fa-fa-twitter-square' => 'fab fa-twitter-square',
'fa-fa-twitter' => 'fab fa-twitter',
'fa-fa-unsorted' => 'fas fa-sort',
'fa-fa-usb' => 'fab fa-usb',
'fa-fa-usd' => 'fas fa-dollar-sign',
'fa-fa-user-circle-o' => 'far fa-user-circle',
'fa-fa-user-o' => 'far fa-user',
'fa-fa-vcard-o' => 'far fa-address-card',
'fa-fa-vcard' => 'fas fa-address-card',
'fa-fa-viacoin' => 'fab fa-viacoin',
'fa-fa-viadeo-square' => 'fab fa-viadeo-square',
'fa-fa-viadeo' => 'fab fa-viadeo',
'fa-fa-video-camera' => 'fas fa-video',
'fa-fa-vimeo-square' => 'fab fa-vimeo-square',
'fa-fa-vimeo' => 'fab fa-vimeo-v',
'fa-fa-vine' => 'fab fa-vine',
'fa-fa-vk' => 'fab fa-vk',
'fa-fa-volume-control-phone' => 'fas fa-phone-volume',
'fa-fa-warning' => 'fas fa-exclamation-triangle',
'fa-fa-wechat' => 'fab fa-weixin',
'fa-fa-weibo' => 'fab fa-weibo',
'fa-fa-weixin' => 'fab fa-weixin',
'fa-fa-whatsapp' => 'fab fa-whatsapp',
'fa-fa-wheelchair-alt' => 'fab fa-accessible-icon',
'fa-fa-wikipedia-w' => 'fab fa-wikipedia-w',
'fa-fa-window-close-o' => 'far fa-window-close',
'fa-fa-window-maximize' => 'far fa-window-maximize',
'fa-fa-window-restore' => 'far fa-window-restore',
'fa-fa-windows' => 'fab fa-windows',
'fa-fa-won' => 'fas fa-won-sign',
'fa-fa-wordpress' => 'fab fa-wordpress',
'fa-fa-wpbeginner' => 'fab fa-wpbeginner',
'fa-fa-wpexplorer' => 'fab fa-wpexplorer',
'fa-fa-wpforms' => 'fab fa-wpforms',
'fa-fa-xing-square' => 'fab fa-xing-square',
'fa-fa-xing' => 'fab fa-xing',
'fa-fa-y-combinator-square' => 'fab fa-hacker-news',
'fa-fa-y-combinator' => 'fab fa-y-combinator',
'fa-fa-yahoo' => 'fab fa-yahoo',
'fa-fa-yc' => 'fab fa-y-combinator',
'fa-fa-yc-square' => 'fab fa-hacker-news',
'fa-fa-yelp' => 'fab fa-yelp',
'fa-fa-yen' => 'fas fa-yen-sign',
'fa-fa-yoast' => 'fab fa-yoast',
'fa-fa-youtube-play' => 'fab fa-youtube',
'fa-fa-youtube-square' => 'fab fa-youtube-square',
'fa-fa-youtube' => 'fab fa-youtube',
'fa-fa-fa' => 'fab fa-font-awesome',
);
$font_awesome_icon = apply_filters( 'menu_icons_backward_compatibility_icons', $font_awesome_icon );
return $font_awesome_icon;
}
}

View File

@ -0,0 +1,122 @@
<?php
/**
* Font awesome 5 icons support.
*
* @package Menu_Icons
*/
final class Menu_Icons_Font_Awesome {
/**
* Font Awesome version
*
* @access static
* @var string
*/
public static $version = '5.15.4';
/**
* Init hooks.
*/
public static function init() {
add_filter( 'icon_picker_icon_type_stylesheet_uri', array( __CLASS__, '_icon_type_stylesheet_uri' ), 10, 3 );
add_filter( 'icon_picker_fa_items', array( __CLASS__, '_icon_picker_fa_items' ) );
add_filter( 'icon_picker_font_media_templates', array( __CLASS__, '_icon_picker_font_media_templates' ) );
}
/**
* Font Awesome's stylesheet.
*
* @param string $stylesheet_uri Icon type's stylesheet URI.
* @param string $icon_type_id Icon type's ID.
* @param Icon_Picker_Type_Font $icon_type Icon type's instance.
*
* @return string
*/
public static function _icon_type_stylesheet_uri( $stylesheet_uri, $icon_type_id, $icon_type ) {
if ( 'fa' === $icon_type_id ) {
$url = Menu_Icons::get( 'url' );
$stylesheet_uri = sprintf(
"{$url}css/fontawesome/css/all.min.css",
$icon_type->version
);
}
return $stylesheet_uri;
}
/**
* Icon picker fontawesome items.
*
* @param array $icons Icons.
* @return array Icons.
*/
public static function _icon_picker_fa_items( $icons ) {
if ( empty( $icons ) ) {
return $icons;
}
$deprecated_icons = array_search( 'fa-tripadvisor', array_column( $icons, 'id' ), true );
if ( false !== $deprecated_icons ) {
unset( $icons[ $deprecated_icons ] );
$icons = array_values( $icons );
}
$font_awesome = font_awesome_backward_compatible();
foreach ( $icons as $key => $icon ) {
$old_fa_icon = sprintf( 'fa-%s', $icons[ $key ]['id'] );
if ( array_key_exists( $old_fa_icon, $font_awesome ) ) {
$icons[ $key ]['id'] = trim( $font_awesome[ $old_fa_icon ] );
} else {
$icons[ $key ]['id'] = sprintf( 'fa %s', trim( $icons[ $key ]['id'] ) );
}
}
// Fa5 extra icons support.
$global_settins = get_option( 'menu-icons', false );
if ( ! empty( $global_settins['global']['fa5_extra_icons'] ) ) {
$fa5_extra_icons = $global_settins['global']['fa5_extra_icons'];
$fa5_extra_icons = explode( ',', $fa5_extra_icons );
$fa5_extra_icons = array_map( 'trim', $fa5_extra_icons );
if ( ! empty( $fa5_extra_icons ) ) {
foreach ( $fa5_extra_icons as $fa5_icon ) {
$icon_name = explode( '-', $fa5_icon );
$icon_name = end( $icon_name );
$icons[] = array(
'group' => 'all',
'id' => $fa5_icon,
'name' => $icon_name,
);
}
}
}
return $icons;
}
/**
* Icon picker font media template.
*
* @param string $template Media template.
* @return string Media template.
*/
public static function _icon_picker_font_media_templates( $template ) {
$templates = array(
'icon' => '<i class="_icon {{data.type}} {{ data.icon }}"></i>',
'item' => sprintf(
'<div class="attachment-preview js--select-attachment">
<div class="thumbnail">
<span class="_icon"><i class="{{"fa" == data.type ? "" : data.type}} {{ data.id }}"></i></span>
<div class="filename"><div>{{ data.name }}</div></div>
</div>
</div>
<a class="check" href="#" title="%s"><div class="media-modal-icon"></div></a>',
esc_attr__( 'Deselect', 'icon-picker' )
),
);
return $templates;
}
}

View File

@ -0,0 +1,575 @@
<?php
/**
* Form Fields
*
* A prototype for the new "Form Fields" plugin, a standalone plugin and
* extension for the upcoming "Settings" plugin, a rewrite of KC Settings.
*
* @author Dzikri Aziz <kvcrvt@gmail.com>
*/
/**
* Form Fields
*/
abstract class Kucrut_Form_Field {
/**
* Holds field & argument defaults
*
* @since 0.1.0
* @var array
* @access protected
*/
protected static $defaults = array(
'field' => array(
'id' => '',
'type' => 'text',
'value' => null,
'default' => null,
'attributes' => array(),
'description' => '',
'choices' => array(),
),
'args' => array(
'keys' => array(),
'inline_description' => false,
),
);
/**
* Holds field attributes
*
* @since 0.1.0
* @var array
* @access protected
*/
protected static $types = array(
'text' => 'Kucrut_Form_Field_Text',
'number' => 'Kucrut_Form_Field_Text',
'url' => 'Kucrut_Form_Field_Text',
'color' => 'Kucrut_Form_Field_Text',
'date' => 'Kucrut_Form_Field_Text',
'hidden' => 'Kucrut_Form_Field_Text',
'checkbox' => 'Kucrut_Form_Field_Checkbox',
'radio' => 'Kucrut_Form_Field_Radio',
'textarea' => 'Kucrut_Form_Field_Textarea',
'select' => 'Kucrut_Form_Field_Select',
'select_multiple' => 'Kucrut_Form_Field_Select_Multiple',
'select_pages' => 'Kucrut_Form_Field_Select_Pages',
'special' => 'Kucrut_Form_Field_Special',
);
/**
* Holds forbidden attributes
*
* @since 0.1.0
* @var array
* @access protected
*/
protected static $forbidden_attributes = array(
'id',
'name',
'value',
'checked',
'multiple',
);
/**
* Holds allowed html tags
*
* @since 0.1.0
* @var array
* @access protected
*/
protected $allowed_html = array(
'a' => array(
'href' => true,
'target' => true,
'title' => true,
),
'code' => true,
'em' => true,
'p' => array( 'class' => true ),
'span' => array( 'class' => true ),
'strong' => true,
);
/**
* Holds constructed field
*
* @since 0.1.0
* @var array
* @access protected
*/
protected $field;
/**
* Holds field attributes
*
* @since 0.1.0
* @var array
* @access protected
*/
protected $attributes = array();
/**
* Loader
*
* @param string URL path to this directory
*/
final public static function load( $url_path = null ) {
// Set URL path for assets
if ( ! is_null( $url_path ) ) {
self::$url_path = $url_path;
} else {
self::$url_path = plugin_dir_url( __FILE__ );
}
// Supported field types
self::$types = apply_filters(
'form_field_types',
self::$types
);
}
/**
* Create field
*
* @param array $field Field array
* @param array $args Extra field arguments
*/
final public static function create( array $field, $args = array() ) {
$field = wp_parse_args( $field, self::$defaults['field'] );
if ( ! isset( self::$types[ $field['type'] ] )
|| ! is_subclass_of( self::$types[ $field['type'] ], __CLASS__ )
) {
trigger_error(
sprintf(
esc_html__( '%1$s: Type %2$s is not supported, reverting to text.', 'menu-icons' ),
__CLASS__,
esc_html( $field['type'] )
),
E_USER_WARNING
);
$field['type'] = 'text';
}
if ( is_null( $field['value'] ) && ! is_null( $field['default'] ) ) {
$field['value'] = $field['default'];
}
foreach ( self::$forbidden_attributes as $key ) {
unset( $field['attributes'][ $key ] );
}
$args = (object) wp_parse_args( $args, self::$defaults['args'] );
$class = self::$types[ $field['type'] ];
return new $class( $field, $args );
}
/**
* Constructor
*
* @since 0.1.0
* @param array $field Field array
* @param object $args Extra field arguments
*/
public function __construct( $field, $args ) {
$this->field = $field;
$this->args = $args;
if ( ! is_array( $this->args->keys ) ) {
$this->args->keys = array();
}
$this->args->keys[] = $field['id'];
$this->attributes['id'] = $this->create_id();
$this->attributes['name'] = $this->create_name();
$this->attributes = wp_parse_args(
$this->attributes,
(array) $field['attributes']
);
$this->set_properties();
}
/**
* Attribute
*
* @since 0.1.0
* @param string $key Attribute key
* @return mixed NULL if attribute doesn't exist
*/
public function __get( $key ) {
foreach ( array( 'attributes', 'field' ) as $group ) {
if ( isset( $this->{$group}[ $key ] ) ) {
return $this->{$group}[ $key ];
}
}
return null;
}
/**
* Create id/name attribute
*
* @since 0.1.0
* @param string $format Attribute format
*/
protected function create_id_name( $format ) {
return call_user_func_array(
'sprintf',
array_merge(
array( $format ),
$this->args->keys
)
);
}
/**
* Create id attribute
*
* @since 0.1.0
* @access protected
* @return string
*/
protected function create_id() {
$format = implode( '-', $this->args->keys );
return $this->create_id_name( $format );
}
/**
* Create name attribute
*
* @since 0.1.0
* @access protected
* @return string
*/
protected function create_name() {
$format = '%s';
$format .= str_repeat( '[%s]', ( count( $this->args->keys ) - 1 ) );
return $this->create_id_name( $format );
}
/**
* Set field properties
*
* @since 0.1.0
*/
protected function set_properties() {}
/**
* Build field attributes
*
* @since 0.1.0
* @param array $excludes Attributes to be excluded
* @return string
*/
protected function build_attributes( $excludes = array() ) {
$excludes = array_filter( (array) $excludes );
$attributes = '';
foreach ( $this->attributes as $key => $value ) {
if ( in_array( $key, $excludes, true ) ) {
continue;
}
if ( 'class' === $key ) {
$value = implode( ' ', (array) $value );
}
$attributes .= sprintf(
' %s="%s"',
esc_attr( $key ),
esc_attr( $value )
);
}
return $attributes;
}
/**
* Print field
*
* @since 0.1.0
*/
abstract public function render();
/**
* Print field description
*
* @since 0.1.0
*/
public function description() {
if ( ! empty( $this->field['description'] ) ) {
$tag = ( ! empty( $this->args->inline_description ) ) ? 'span' : 'p';
printf( // WPCS: XSS ok.
'<%1$s class="description">%2$s</%1$s>',
$tag,
wp_kses( $this->field['description'], $this->allowed_html )
);
}
}
}
/**
* Field: text
*/
class Kucrut_Form_Field_Text extends Kucrut_Form_Field {
protected $template = '<input type="%s" value="%s"%s />';
protected function set_properties() {
if ( ! is_string( $this->field['value'] ) ) {
$this->field['value'] = '';
}
if ( in_array( $this->field['type'], array( 'text', 'url' ), true ) ) {
if ( ! isset( $this->attributes['class'] ) ) {
$this->attributes['class'] = array();
}
$this->attributes['class'] = array_unique(
array_merge(
array( 'regular-text' ),
$this->attributes['class']
)
);
}
}
public function render() {
printf( // WPCS: xss ok
$this->template,
esc_attr( $this->field['type'] ),
esc_attr( $this->field['value'] ),
$this->build_attributes()
);
$this->description();
}
}
/**
* Field: Textarea
*/
class Kucrut_Form_Field_Textarea extends Kucrut_Form_Field {
protected $template = '<textarea%s>%s</textarea>';
protected $attributes = array(
'class' => 'widefat',
'cols' => 50,
'rows' => 5,
);
public function render() {
printf( // WPCS: XSS ok.
$this->template,
$this->build_attributes(),
esc_textarea( $this->field['value'] )
);
}
}
/**
* Field: Checkbox
*/
class Kucrut_Form_Field_Checkbox extends Kucrut_Form_Field {
protected $template = '<label><input type="%s" value="%s"%s%s /> %s</label><br />';
protected function set_properties() {
$this->field['value'] = array_filter( (array) $this->field['value'] );
$this->attributes['name'] .= '[]';
}
protected function checked( $value ) {
return checked( in_array( $value, $this->field['value'], true ), true, false );
}
public function render() {
foreach ( $this->field['choices'] as $value => $label ) {
printf( // WPCS: XSS ok.
$this->template,
$this->field['type'],
esc_attr( $value ),
$this->checked( $value ),
$this->build_attributes( 'id' ),
esc_html( $label )
);
}
}
}
/**
* Field: Radio
*/
class Kucrut_Form_Field_Radio extends Kucrut_Form_Field_Checkbox {
protected function set_properties() {
if ( ! is_string( $this->field['value'] ) ) {
$this->field['value'] = '';
}
}
protected function checked( $value ) {
return checked( $value, $this->field['value'], false );
}
}
/**
* Field: Select
*/
class Kucrut_Form_Field_Select extends Kucrut_Form_Field {
protected $template = '<option value="%s"%s>%s</option>';
protected function set_properties() {
if ( ! is_string( $this->field['value'] ) ) {
$this->field['value'] = '';
}
}
protected function selected( $value ) {
return selected( ( $value === $this->field['value'] ), true, false );
}
public function render() {
?>
<select<?php echo $this->build_attributes() // xss ok ?>>
<?php foreach ( $this->field['choices'] as $index => $choice ) : ?>
<?php
if ( is_array( $choice ) ) {
$value = $choice['value'];
$label = $choice['label'];
} else {
$value = $index;
$label = $choice;
}
?>
<?php
printf( // WPCS: XSS ok.
$this->template,
esc_attr( $value ),
$this->selected( $value ),
esc_html( $label )
);
?>
<?php endforeach; ?>
</select>
<?php
}
}
/**
* Field: Multiple Select
*/
class Kucrut_Form_Field_Select_Multiple extends Kucrut_Form_Field_Select {
protected function set_properties() {
$this->field['value'] = array_filter( (array) $this->field['value'] );
$this->attributes['name'] .= '[]';
$this->attributes['multiple'] = 'multiple';
}
protected function selected( $value ) {
return selected( in_array( $value, $this->field['value'], true ), true, false );
}
}
/**
* Field: Select Pages
*/
class Kucrut_Form_Field_Select_Pages extends Kucrut_Form_Field_Select {
protected $wp_dropdown_pages_args = array(
'depth' => 0,
'child_of' => 0,
'option_none_value' => '',
);
public function __construct( $field, $args ) {
$this->wp_dropdown_pages_args['show_option_none'] = __( '&mdash; Select &mdash;', 'menu-icons' );
parent::__construct( $field, $args );
}
public function set_properties() {
parent::set_properties();
if ( empty( $this->args->wp_dropdown_pages_args ) ) {
$this->args->wp_dropdown_pages_args = array();
}
// Apply defeaults
$this->args->wp_dropdown_pages_args = wp_parse_args(
$this->args->wp_dropdown_pages_args,
$this->wp_dropdown_pages_args
);
// Force some args
$this->args->wp_dropdown_pages_args = array_merge(
$this->args->wp_dropdown_pages_args,
array(
'echo' => true,
'name' => $this->attributes['name'],
'id' => $this->attributes['id'],
'selected' => $this->field['value'],
)
);
}
public function render() {
wp_dropdown_pages( $this->args->wp_dropdown_pages_args ); // WPCS: XSS ok.
}
}
/**
* Field: Special (Callback)
*/
class Kucrut_Form_Field_Special extends Kucrut_Form_Field {
public function render() {
call_user_func_array(
$this->field['render_cb'],
array( $this )
);
}
}

View File

@ -0,0 +1,111 @@
<?php
/**
* Misc. helper functions
*
* @author Dzikri Aziz <kvcrvt@gmail.com>
*/
if ( ! function_exists( 'kucrut_get_array_value_deep' ) ) {
/**
* Get value of a multidimensional array
*
* @since 0.1.0
* @param array $array Haystack
* @param array $keys Needles
* @return mixed
*/
function kucrut_get_array_value_deep( array $array, array $keys ) {
if ( empty( $array ) || empty( $keys ) ) {
return $array;
}
foreach ( $keys as $idx => $key ) {
unset( $keys[ $idx ] );
if ( ! isset( $array[ $key ] ) ) {
return null;
}
if ( ! empty( $keys ) ) {
$array = $array[ $key ];
}
}
if ( ! isset( $array[ $key ] ) ) {
return null;
}
return $array[ $key ];
}
}
if ( ! function_exists( 'kucrut_validate' ) ) {
/**
* Validate settings values
*
* @param array $values Settings values
* @return array
*/
function kucrut_validate( $values, $sanitize_cb = 'wp_kses_data' ) {
foreach ( $values as $key => $value ) {
if ( is_array( $value ) ) {
$values[ $key ] = kucrut_validate( $value );
} else {
$values[ $key ] = call_user_func_array(
$sanitize_cb,
array( $value )
);
}
}
return $values;
}
}
if ( ! function_exists( 'kucrut_get_image_sizes' ) ) {
/**
* Get image sizes
*
* @since 0.9.0
* @access protected
* @return array
*/
function kucrut_get_image_sizes() {
$_sizes = array(
'thumbnail' => __( 'Thumbnail', 'menu-icons' ),
'medium' => __( 'Medium', 'menu-icons' ),
'large' => __( 'Large', 'menu-icons' ),
'full' => __( 'Full Size', 'menu-icons' ),
);
$_sizes = apply_filters( 'image_size_names_choose', $_sizes );
$sizes = array();
foreach ( $_sizes as $value => $label ) {
$sizes[] = array(
'value' => $value,
'label' => $label,
);
}
return $sizes;
}
}
if ( ! function_exists( 'kucrut_get_script_suffix' ) ) {
/**
* Get script & style suffix
*
* When SCRIPT_DEBUG is defined true, this will return '.min'.
*
* @return string
*/
function kucrut_get_script_suffix() {
return ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
}
}