partials
1 month ago
ads.php
1 month ago
bnr-img.png
11 months ago
calendly.php
1 month ago
custom-logo.php
1 month ago
dailymotion.php
2 years ago
elements.php
4 days ago
general.php
6 months ago
go-premium.php
7 months ago
google-calendar.php
1 month ago
hub.php
4 days ago
instagram.php
1 month ago
license.php
5 years ago
main-template.php
1 month ago
opensea.php
2 years ago
player-engagement.php
2 months ago
premium.php
2 years ago
settings.php
1 month ago
shortcode.php
1 month ago
soundcloud.php
2 years ago
sources.php
9 months ago
spotify.php
2 years ago
twitch.php
2 years ago
vimeo.php
2 years ago
wistia.php
1 month ago
youtube.php
1 year ago
custom-logo.php
234 lines
| 1 | <?php |
| 2 | /* |
| 3 | * Custom Logo Settings page |
| 4 | * All undefined vars comes from 'render_settings_page' method |
| 5 | * |
| 6 | * */ |
| 7 | |
| 8 | use EmbedPress\Includes\Classes\Helper; |
| 9 | |
| 10 | $option_name = EMBEDPRESS_PLG_NAME . ':youtube'; |
| 11 | $yt_settings = get_option( $option_name); |
| 12 | $gen_settings = get_option( EMBEDPRESS_PLG_NAME); |
| 13 | $yt_logo_xpos = isset( $yt_settings['logo_xpos']) ? intval( $yt_settings['logo_xpos']) : 10; |
| 14 | $yt_logo_ypos = isset( $yt_settings['logo_ypos']) ? intval( $yt_settings['logo_ypos']) : 10; |
| 15 | $yt_logo_opacity = isset( $yt_settings['logo_opacity']) ? intval( $yt_settings['logo_opacity']) : 50; |
| 16 | $yt_logo_id = isset( $yt_settings['logo_id']) ? intval( $yt_settings['logo_id']) : 0; |
| 17 | $yt_logo_url = isset( $yt_settings['logo_url']) ? esc_url( $yt_settings['logo_url']) : ''; |
| 18 | $yt_cta_url = isset( $yt_settings['cta_url']) ? esc_url( $yt_settings['cta_url']) : ''; |
| 19 | $yt_branding = isset( $yt_settings['branding']) ? sanitize_text_field( $yt_settings['branding']) : (!empty( $yt_logo_url) ? 'yes': 'no'); |
| 20 | |
| 21 | |
| 22 | $embedpress_document_powered_by = isset( $gen_settings['embedpress_document_powered_by']) ? sanitize_text_field( $gen_settings['embedpress_document_powered_by']) : 'yes'; |
| 23 | |
| 24 | // Vimeo branding |
| 25 | $vm_settings = get_option( EMBEDPRESS_PLG_NAME.':vimeo'); |
| 26 | $vm_branding = isset( $vm_settings['branding']) ? sanitize_text_field( $vm_settings['branding']) : 'no'; |
| 27 | $vm_logo_xpos = isset( $vm_settings['logo_xpos']) ? intval( $vm_settings['logo_xpos']) : 10; |
| 28 | $vm_logo_ypos = isset( $vm_settings['logo_ypos']) ? intval( $vm_settings['logo_ypos']) : 10; |
| 29 | $vm_logo_opacity = isset( $vm_settings['logo_opacity']) ? intval( $vm_settings['logo_opacity']) : 50; |
| 30 | $vm_logo_id = isset( $vm_settings['logo_id']) ? intval( $vm_settings['logo_id']) : 0; |
| 31 | $vm_logo_url = isset( $vm_settings['logo_url']) ? esc_url( $vm_settings['logo_url']) : ''; |
| 32 | $vm_cta_url = isset( $vm_settings['cta_url']) ? esc_url( $vm_settings['cta_url']) : 'no'; |
| 33 | |
| 34 | |
| 35 | ?> |
| 36 | |
| 37 | <div class="embedpress__settings background__white radius-16 p-24"> |
| 38 | <h3><?php esc_html_e( "Global Branding Settings", "embedpress" ); ?></h3> |
| 39 | <div class="embedpress__settings__form"> |
| 40 | <form action="" method="post" enctype="multipart/form-data" class="embedpress-settings-form"> |
| 41 | <?php |
| 42 | do_action( 'embedpress_before_custom_branding_settings_fields'); |
| 43 | echo $nonce_field ; ?> |
| 44 | <div class="form__group"> |
| 45 | <p class="form__label"><?php esc_html_e('Powered by EmbedPress', 'embedpress'); ?></p> |
| 46 | <div class="form__control__wrap"> |
| 47 | <label class="input__switch switch__text"> |
| 48 | <input type="checkbox" data-default="<?php echo esc_attr( $embedpress_document_powered_by ); ?>" data-value="<?php echo esc_attr( $embedpress_document_powered_by ); ?>" value="yes" name="embedpress_document_powered_by" <?php checked( 'yes', $embedpress_document_powered_by );?>> |
| 49 | <span></span> |
| 50 | </label> |
| 51 | </div> |
| 52 | </div> |
| 53 | <h3><?php esc_html_e( "Custom Logo", "embedpress" ); ?></h3> |
| 54 | <?php |
| 55 | embedpress_print_branding_controls('youtube', 'yt'); |
| 56 | embedpress_print_branding_controls('vimeo', 'vm'); |
| 57 | embedpress_print_branding_controls('wistia', 'wis'); |
| 58 | embedpress_print_branding_controls('twitch', 'tw'); |
| 59 | embedpress_print_branding_controls('dailymotion', 'dm'); |
| 60 | embedpress_print_branding_controls('document', 'doc'); |
| 61 | do_action( 'embedpress_after_custom_branding_settings_fields'); |
| 62 | ?> |
| 63 | <button class="button button__themeColor radius-10 embedpress-submit-btn" name="submit" value="custom_logo"><?php esc_html_e( 'Save Changes', 'embedpress'); ?></button> |
| 64 | </form> |
| 65 | </div> |
| 66 | </div> |
| 67 | |
| 68 | |
| 69 | <?php |
| 70 | /** |
| 71 | * @param string $provider this is the provider name eg. youtube and vimeo etc. It should be lowercase generally or the same as the key we use to save data in the database. We save data like eg. EMBEDPRESS_PLG_NAME.':youtube'. Here youtube is the provider. |
| 72 | * @param string $prefix It is a prefix for field name eg. yt or vm etc. |
| 73 | */ |
| 74 | function embedpress_print_branding_controls($provider='', $prefix='') { |
| 75 | global $pro_active; |
| 76 | $settings = get_option( EMBEDPRESS_PLG_NAME.':'.$provider, []); |
| 77 | |
| 78 | // Get global brand settings |
| 79 | $global_brand_settings = get_option(EMBEDPRESS_PLG_NAME . ':global_brand', []); |
| 80 | $global_brand_logo_url = isset($global_brand_settings['logo_url']) ? $global_brand_settings['logo_url'] : ''; |
| 81 | $global_brand_logo_id = isset($global_brand_settings['logo_id']) ? $global_brand_settings['logo_id'] : 0; |
| 82 | |
| 83 | // Check if provider has custom settings or should use global brand |
| 84 | $has_custom_logo = isset($settings['logo_url']) && !empty($settings['logo_url']); |
| 85 | $should_use_global = !$has_custom_logo && !empty($global_brand_logo_url); |
| 86 | |
| 87 | // If global brand exists and no custom logo is set, auto-enable branding with global settings |
| 88 | if ($should_use_global) { |
| 89 | $branding = 'yes'; |
| 90 | $logo_url = $global_brand_logo_url; |
| 91 | $logo_id = $global_brand_logo_id; |
| 92 | } else { |
| 93 | $branding = isset( $settings['branding']) ? $settings['branding'] : 'no'; |
| 94 | $logo_url = isset( $settings['logo_url']) ? esc_url( $settings['logo_url']) : ''; |
| 95 | $logo_id = isset( $settings['logo_id']) ? intval( $settings['logo_id']) : 0; |
| 96 | } |
| 97 | |
| 98 | $logo_xpos = isset( $settings['logo_xpos']) ? intval( $settings['logo_xpos']) : 10; |
| 99 | $logo_ypos = isset( $settings['logo_ypos']) ? intval( $settings['logo_ypos']) : 10; |
| 100 | $logo_opacity = isset( $settings['logo_opacity']) ? intval( $settings['logo_opacity']) : 50; |
| 101 | $cta_url = isset( $settings['cta_url']) ? esc_url( $settings['cta_url']) : ''; |
| 102 | |
| 103 | // prepare prefixed field name |
| 104 | $px_branding = "{$prefix}_branding"; |
| 105 | $px_logo_xpos = "{$prefix}_logo_xpos"; |
| 106 | $px_logo_ypos = "{$prefix}_logo_ypos"; |
| 107 | $px_logo_opacity = "{$prefix}_logo_opacity"; |
| 108 | $px_logo_id = "{$prefix}_logo_id"; |
| 109 | $px_logo_url = "{$prefix}_logo_url"; |
| 110 | $px_cta_url = "{$prefix}_cta_url"; |
| 111 | switch ($provider){ |
| 112 | case 'vimeo': |
| 113 | $preview_video = '<iframe title="" loading="lazy" src="'.esc_url('https://player.vimeo.com/video/463346733').'" frameborder="0"></iframe>'; |
| 114 | break; |
| 115 | case 'wistia': |
| 116 | |
| 117 | $preview_video=<<<KAMAL |
| 118 | <div class="ose-wistia--inc. ose-uid-0869333898f94a99ed20457fc4b79d88 ose-embedpress-responsive" style="width:500px; max-width:100%; height: 300px"><iframe loading="lazy" title="Best Embedding Solution For Elementor, Gutenberg & Classic Editor - EmbedPress Video" src="https://fast.wistia.net/embed/iframe/u7eq83w1cg?dnt=1" allow="autoplay; fullscreen" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen msallowfullscreen width="500" height="300"></iframe><script src="https://fast.wistia.net/assets/external/E-v1.js" async></script></div> |
| 119 | KAMAL; |
| 120 | |
| 121 | break; |
| 122 | case 'twitch': |
| 123 | $parent = wp_parse_url( site_url(), 1); |
| 124 | $preview_video = <<<KAMAL |
| 125 | <div class="embedpress_wrapper" data-url="https://www.twitch.tv/wpdeveloperdotnet" style="width:90%; height:360px;"> |
| 126 | <iframe loading="lazy" src="https://embed.twitch.tv?autoplay=true&channel=wpdeveloperdotnet&height=360&layout=video&migration=true&muted=false&theme=dark&time=0h0m0s&video=&width=600&allowfullscreen=true&parent={$parent}" allowfullscreen="" scrolling="no" frameborder="0" allow="autoplay; fullscreen" title="Twitch" sandbox="allow-modals allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox" ></iframe> |
| 127 | </div> |
| 128 | KAMAL; |
| 129 | |
| 130 | break; |
| 131 | case 'dailymotion': |
| 132 | $parent = wp_parse_url( site_url(), 1); |
| 133 | $preview_video = <<<KAMAL |
| 134 | <div class="embedpress_wrapper" style="width:90%; height:360px;"> |
| 135 | <iframe title="Sample video" frameborder="0" width="640" height="400" src="https://www.dailymotion.com/embed/video/x7qvzya?ui-highlight=dd3333&start=0&mute=0&autoplay=0&controls=1&ui-start-screen-info=1&endscreen-enable=0&ui-logo=1" allowfullscreen="" allow="autoplay" loading="lazy" style="max-width: 100%; max-height: 400px;"></iframe> |
| 136 | </div> |
| 137 | KAMAL; |
| 138 | |
| 139 | break; |
| 140 | case 'document': |
| 141 | $pdf_url = EMBEDPRESS_URL_ASSETS . 'embedpress.pdf'; |
| 142 | $renderer = Helper::get_pdf_renderer(); |
| 143 | $src = $renderer . ((strpos($renderer, '?') == false) ? '?' : '&') . 'file=' . urlencode($pdf_url); |
| 144 | ob_start(); ?> |
| 145 | <iframe class="embedpress-embed-document-pdf ep-pdf-sample" style="width:500px; max-width:100%; height: 300px; display: inline-block" src="<?php echo esc_url( $src); ?>" ></iframe> |
| 146 | <?php |
| 147 | $preview_video = ob_get_clean(); |
| 148 | break; |
| 149 | default: |
| 150 | $preview_video = '<iframe height="300px" src="https://www.youtube.com/embed/2u0HRUdLHxo" frameborder="0"></iframe>'; |
| 151 | break; |
| 152 | } |
| 153 | ?> |
| 154 | <div class="form__group"> |
| 155 | <p class="form__label"><?php |
| 156 | $provider_name = $provider === 'youtube' ? 'YouTube' : ucfirst( $provider); |
| 157 | printf( esc_html__( '%s Custom Branding', 'embedpress'), $provider_name); |
| 158 | echo $pro_active ? '' : ' <span class="isPro">' . esc_html__('Pro', 'embedpress') . '</span>'; |
| 159 | |
| 160 | // // Show indicator if using global brand |
| 161 | // if ($should_use_global) { |
| 162 | // echo ' <span class="embedpress-global-brand-indicator" title="Using global brand image from Brand Your Work">🌐 Global</span>'; |
| 163 | // } |
| 164 | ?> |
| 165 | </p> |
| 166 | <div class="form__control__wrap"> |
| 167 | <label class="input__switch switch__text <?php echo $pro_active ? '': 'isPro'; ?>"> |
| 168 | <input type="checkbox" name="<?php echo esc_attr( $px_branding ); ?>" data-default="<?php echo esc_attr( $branding ); ?>" data-value="<?php echo esc_attr( $branding ); ?>" value="yes" <?php checked( 'yes', $branding);?> <?php echo $pro_active ? '': ' disabled'; ?>> |
| 169 | <span></span> |
| 170 | <a href="#" class="logo__adjust__toggler"><?php esc_html_e( "Settings", "embedpress" ); ?><i class="ep-icon ep-caret-down"></i></a> |
| 171 | </label> |
| 172 | <div class="logo__adjust__wrap <?php echo $pro_active ? '': 'proOverlay'; ?>" style="<?php if ( ('yes' !== $branding) || !$pro_active ) { echo 'display:none;'; } ?>"> |
| 173 | <label class="logo__upload" id="yt_logo_upload_wrap" style="<?php if (!empty( $logo_url)) { echo 'display:none;'; } ?>"> |
| 174 | <input type="hidden" class="preview__logo__input" name="<?php echo esc_attr( $px_logo_url ); ?>" id="<?php echo esc_attr( $px_logo_url ); ?>" data-default="<?php echo esc_url( $logo_url ); ?>" value="<?php echo $logo_url; ?>"> |
| 175 | <input type="hidden" class="preview__logo__input_id" name="<?php echo esc_attr( $px_logo_id ); ?>" id="<?php echo esc_attr( $px_logo_id ); ?>" data-default="<?php echo esc_attr( $logo_id ); ?>" value="<?php echo $logo_id; ?>"> |
| 176 | <span class="icon"><i class="ep-icon ep-upload"></i></span> |
| 177 | <span class="text"><?php esc_html_e( "Click To Upload", "embedpress" ); ?></span> |
| 178 | </label> |
| 179 | <div class="logo__upload__preview" id="yt_logo__upload__preview" style="<?php if ( empty( $logo_url) ) { echo 'display:none'; } ?> "> |
| 180 | <div class="instant__preview"> |
| 181 | <a href="#" id="yt_preview__remove" class="preview__remove"><i class="ep-icon ep-cross"></i></a> |
| 182 | <img class="instant__preview__img" id="yt_logo_preview" src="<?php echo esc_url($logo_url); ?>" alt=""> |
| 183 | </div> |
| 184 | </div> |
| 185 | |
| 186 | <div class="logo__adjust"> |
| 187 | <div class="logo__adjust__controller"> |
| 188 | <div class="logo__adjust__controller__item"> |
| 189 | <span class="controller__label"><?php esc_html_e( "Logo Opacity (%)", "embedpress" ); ?></span> |
| 190 | <div class="logo__adjust__controller__inputs"> |
| 191 | <input type="range" max="100" data-default="<?php echo esc_attr( $logo_opacity ); ?>" value="<?php echo esc_attr( $logo_opacity ); ?>" class="opacity__range" name="<?php echo esc_attr( $px_logo_opacity )?>"> |
| 192 | <input readonly type="number" class="form__control range__value" data-default="<?php echo esc_attr( $logo_opacity ); ?>" value="<?php echo esc_attr( $logo_opacity ); ?>"> |
| 193 | </div> |
| 194 | </div> |
| 195 | <div class="logo__adjust__controller__item"> |
| 196 | <span class="controller__label"><?php esc_html_e( "Logo X Position (%)", "embedpress" ); ?></span> |
| 197 | <div class="logo__adjust__controller__inputs"> |
| 198 | <input type="range" max="100" data-default="<?php echo esc_attr( $logo_xpos ); ?>" value="<?php echo $logo_xpos; ?>" class="x__range" name="<?php echo esc_attr( $px_logo_xpos );?>"> |
| 199 | <input readonly type="number" class="form__control range__value" data-default="<?php echo esc_attr( $logo_xpos ); ?>" value="<?php echo $logo_xpos; ?>"> |
| 200 | </div> |
| 201 | </div> |
| 202 | <div class="logo__adjust__controller__item"> |
| 203 | <span class="controller__label"><?php esc_html_e( "Logo Y Position (%)", "embedpress" ); ?></span> |
| 204 | <div class="logo__adjust__controller__inputs"> |
| 205 | <input type="range" max="100" data-default="<?php echo esc_attr( $logo_ypos ); ?>" value="<?php echo esc_attr( $logo_ypos ); ?>" class="y__range" name="<?php echo esc_attr( $px_logo_ypos ); ?>" > |
| 206 | <input readonly type="number" class="form__control range__value" data-default="<?php echo esc_attr( $logo_ypos ); ?>" value="<?php echo esc_attr( $logo_ypos ); ?>"> |
| 207 | </div> |
| 208 | </div> |
| 209 | <div class="logo__adjust__controller__item"> |
| 210 | <label class="controller__label" for="yt_cta_url" ><?php esc_html_e( "Call to Action Link", "embedpress" );?> </label> |
| 211 | <div> |
| 212 | <input type="url" name="<?php echo esc_attr( $px_cta_url ); ?>" id="<?php echo esc_attr( $px_cta_url ); ?>" class="form__control" data-default="<?php echo esc_url( $cta_url ); ?>" value="<?php echo esc_url( $cta_url); ?>"> |
| 213 | |
| 214 | <p><?php esc_html_e( "You may link the logo to any CTA link.", "embedpress" ); ?></p> |
| 215 | </div> |
| 216 | </div> |
| 217 | </div> |
| 218 | <div class="logo__adjust__preview"> |
| 219 | <span class="title"><?php esc_html_e( "Live Preview", "embedpress" ); ?></span> |
| 220 | <div class="preview__box"> |
| 221 | <?php echo $preview_video ;?> |
| 222 | <img src="<?php echo esc_url($logo_url); ?>" class="preview__logo" style="bottom:<?php echo esc_attr( $logo_ypos); ?>%; right:<?php echo esc_attr( $logo_xpos); ?>%; opacity:<?php echo ($logo_opacity/100); ?>;" alt=""> |
| 223 | </div> |
| 224 | </div> |
| 225 | </div> |
| 226 | </div> |
| 227 | <?php if ( !$pro_active ) { include EMBEDPRESS_SETTINGS_PATH . 'templates/partials/alert-pro.php'; } ?> |
| 228 | |
| 229 | </div> |
| 230 | </div> |
| 231 | |
| 232 | <?php |
| 233 | } |
| 234 | ?> |