platform-row.php
5 years ago
template.php
6 years ago
tpl--counter.php
6 years ago
tpl--social-services.php
6 years ago
platform-row.php
244 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Platform row. |
| 4 | * |
| 5 | * @package Hustle |
| 6 | * @since 4.0.0 |
| 7 | */ |
| 8 | |
| 9 | $global_placeholders = Opt_In_Utils::get_global_placeholders(); |
| 10 | ?> |
| 11 | <script id="hustle-platform-row-tpl" type="text/template"> |
| 12 | |
| 13 | <div class="sui-builder-field sui-accordion-item sui-can-move ui-sortable-handle" id="hustle-platform-{{platform}}" data-platform="{{platform}}"> |
| 14 | |
| 15 | <div class="sui-accordion-item-header"> |
| 16 | |
| 17 | <span class="sui-icon-drag" aria-hidden="true"></span> |
| 18 | |
| 19 | <div class="sui-builder-field-label"> |
| 20 | |
| 21 | <span class="sui-icon-social" aria-hidden="true"> |
| 22 | |
| 23 | <span class="hui-icon-social-{{platform_style}} hui-icon-circle"></span> |
| 24 | |
| 25 | </span> |
| 26 | |
| 27 | <span>{{label}}</span> |
| 28 | |
| 29 | </div> |
| 30 | |
| 31 | <button class="sui-button-icon sui-button-red hustle-remove-social-service" data-platform="{{platform}}"> |
| 32 | <span class="sui-icon-trash" aria-hidden="true"></span> |
| 33 | <span class="sui-screen-reader-text"><?php esc_html_e( 'Remove platform', 'hustle' ); ?></span> |
| 34 | </button> |
| 35 | |
| 36 | <div class="sui-builder-field-border" aria-hidden="true"></div> |
| 37 | |
| 38 | <button class="sui-button-icon sui-accordion-open-indicator"> |
| 39 | <span class="sui-icon-chevron-down" aria-hidden="true"></span> |
| 40 | <span class="sui-screen-reader-text"><?php esc_html_e( 'Open platform settings', 'hustle' ); ?></span> |
| 41 | </button> |
| 42 | |
| 43 | </div> |
| 44 | |
| 45 | <div class="sui-accordion-item-body"> |
| 46 | |
| 47 | <div class="sui-form-field" data-toggle-content="counter-enabled"> |
| 48 | |
| 49 | <label class="sui-label"><?php esc_html_e( 'Counter type', 'hustle' ); ?></label> |
| 50 | |
| 51 | <# if ( hasCounter ) { #> |
| 52 | |
| 53 | <div class="sui-side-tabs"> |
| 54 | |
| 55 | <div class="sui-tabs-menu"> |
| 56 | |
| 57 | <label for="hustle-{{platform}}-counter--click" class="sui-tab-item"> |
| 58 | <input |
| 59 | type="radio" |
| 60 | value="click" |
| 61 | name="{{platform}}_type" |
| 62 | data-attribute="{{platform}}_type" |
| 63 | data-tab-menu="{{platform}}-type-click" |
| 64 | id="hustle-{{platform}}-counter--click" |
| 65 | {{ _.checked( ( 'click' === type ), true) }} |
| 66 | /> |
| 67 | <?php esc_html_e( 'Click', 'hustle' ); ?> |
| 68 | </label> |
| 69 | |
| 70 | <label for="hustle-{{platform}}-counter--native" class="sui-tab-item"> |
| 71 | <input |
| 72 | type="radio" |
| 73 | value="native" |
| 74 | name="{{platform}}_type" |
| 75 | data-attribute="{{platform}}_type" |
| 76 | data-tab-menu="{{platform}}-type-native" |
| 77 | id="hustle-{{platform}}-counter--native" |
| 78 | {{ _.checked( ( 'native' === type ), true) }} |
| 79 | /> |
| 80 | <?php esc_html_e( 'Native', 'hustle' ); ?> |
| 81 | </label> |
| 82 | |
| 83 | </div> |
| 84 | |
| 85 | <# if ( 'twitter' === platform ) { #> |
| 86 | <div class="sui-tabs-content"> |
| 87 | <div class="sui-tab-content" data-tab-content="{{platform}}-type-native"> |
| 88 | <span class="sui-description"> |
| 89 | <?php |
| 90 | printf( |
| 91 | /* translators: 1. opening 'a' tag, 2. closing 'a' tag */ |
| 92 | esc_html__( 'Twitter deprecated its native counter functionality. Sign-up to %1$sthis service%2$s in order to retrieve your Twitter stats. Keep in mind that this only tracks new shares after you register your site.', 'hustle' ), |
| 93 | '<a href="http://www.twitcount.com/" target="_blank">', |
| 94 | '</a>' |
| 95 | ); |
| 96 | ?> |
| 97 | </span> |
| 98 | </div> |
| 99 | </div> |
| 100 | <# } #> |
| 101 | |
| 102 | </div> |
| 103 | |
| 104 | <# } else { #> |
| 105 | |
| 106 | <div class="sui-notice" style="margin-top: 10px;"> |
| 107 | |
| 108 | <div class="sui-notice-content"> |
| 109 | |
| 110 | <div class="sui-notice-message"> |
| 111 | |
| 112 | <span class="sui-notice-icon sui-icon-info sui-md" aria-hidden="true"></span> |
| 113 | <p style="margin: 0;"><?php esc_html_e( 'This social service only supports Click counter as there is no API support for Native counter.', 'hustle' ); ?></p> |
| 114 | |
| 115 | </div> |
| 116 | </div> |
| 117 | </div> |
| 118 | |
| 119 | <# } #> |
| 120 | |
| 121 | </div> |
| 122 | |
| 123 | <div class="sui-form-field" data-toggle-content="counter-enabled"> |
| 124 | |
| 125 | <label class="sui-label"><?php esc_html_e( 'Default counter', 'hustle' ); ?></label> |
| 126 | |
| 127 | <input |
| 128 | type="number" |
| 129 | name="{{platform}}_counter" |
| 130 | data-attribute="{{platform}}_counter" |
| 131 | value="{{counter}}" |
| 132 | placeholder="<?php esc_html_e( 'E.g. 0', 'hustle' ); ?>" |
| 133 | class="sui-form-control" |
| 134 | /> |
| 135 | |
| 136 | </div> |
| 137 | |
| 138 | <# if ( 'email' !== platform ) { #> |
| 139 | |
| 140 | <div class="sui-form-field hustle-social-url-field"> |
| 141 | |
| 142 | <# if ( hasEndpoint ) { #> |
| 143 | |
| 144 | <label class="sui-label"><?php esc_html_e( 'Custom URL (optional)', 'hustle' ); ?></label> |
| 145 | |
| 146 | <# } else { #> |
| 147 | |
| 148 | <label class="sui-label"><?php esc_html_e( 'Custom URL', 'hustle' ); ?></label> |
| 149 | |
| 150 | <# } #> |
| 151 | |
| 152 | <input |
| 153 | type="url" |
| 154 | name="{{platform}}_link" |
| 155 | data-attribute="{{platform}}_link" |
| 156 | value="{{link}}" |
| 157 | placeholder="<?php esc_html_e( 'Type the custom URL here', 'hustle' ); ?>" |
| 158 | class="sui-form-control" |
| 159 | /> |
| 160 | |
| 161 | <# if ( hasEndpoint ) { #> |
| 162 | |
| 163 | <span class="sui-description"><?php esc_html_e( 'Redirect visitors to this URL when they click the icon. Leaving this blank will share the page link instead.', 'hustle' ); ?></span> |
| 164 | |
| 165 | <# } else { #> |
| 166 | <p class="sui-error-message" style="width:100%; display:none; text-align:right;"><?php esc_html_e( 'A custom URL is required to redirect your users.', 'hustle' ); ?></p> |
| 167 | |
| 168 | <span class="sui-description"><?php esc_html_e( 'Redirect visitors to this URL when they click the icon. Note that a valid redirect URL is required to show this icon to your visitors.', 'hustle' ); ?></span> |
| 169 | |
| 170 | <# } #> |
| 171 | |
| 172 | </div> |
| 173 | |
| 174 | <# } else { #> |
| 175 | |
| 176 | <div class="sui-form-field"> |
| 177 | |
| 178 | <label for="hustle-sshare-email--subject" id="hustle-sshare-email--subject-label" class="sui-label"><?php esc_html_e( 'Email subject', 'hustle' ); ?></label> |
| 179 | |
| 180 | <div class="sui-insert-variables"> |
| 181 | |
| 182 | <input |
| 183 | type="text" |
| 184 | name="{{platform}}_title" |
| 185 | data-attribute="{{platform}}_title" |
| 186 | value="{{title}}" |
| 187 | id="hustle-sshare-email--subject" |
| 188 | class="sui-form-control" |
| 189 | aria-labelledby="hustle-sshare-email--subject-label" |
| 190 | /> |
| 191 | |
| 192 | <select class="hustle-select-field-variables" data-field="{{platform}}_title"> |
| 193 | |
| 194 | <?php foreach ( $global_placeholders as $placeholder => $display_name ) : ?> |
| 195 | <option value="{<?php echo esc_attr( $placeholder ); ?>}"><?php echo esc_html( $display_name ); ?></option> |
| 196 | <?php endforeach; ?> |
| 197 | |
| 198 | </select> |
| 199 | |
| 200 | </div> |
| 201 | |
| 202 | </div> |
| 203 | |
| 204 | <div class="sui-form-field"> |
| 205 | |
| 206 | <label |
| 207 | for="hustle-sshare-email--body" |
| 208 | id="hustle-sshare-email--body-label" |
| 209 | class="sui-label" |
| 210 | > |
| 211 | <?php esc_html_e( 'Email body', 'hustle' ); ?> |
| 212 | <span class="sui-label-note"><?php esc_html_e( 'Use the “+” icon to add variable(s)', 'hustle' ); ?></span> |
| 213 | </label> |
| 214 | |
| 215 | <div class="sui-insert-variables"> |
| 216 | |
| 217 | <textarea |
| 218 | name="{{platform}}_message" |
| 219 | data-attribute="{{platform}}_message" |
| 220 | id="hustle-sshare-email--body" |
| 221 | class="sui-form-control" |
| 222 | aria-labelledby="hustle-sshare-email--body-label" |
| 223 | >{{message}}</textarea> |
| 224 | |
| 225 | <select class="hustle-select-field-variables" data-field="{{platform}}_message"> |
| 226 | |
| 227 | <?php foreach ( $global_placeholders as $placeholder => $display_name ) : ?> |
| 228 | <option value="{<?php echo esc_attr( $placeholder ); ?>}" data-content="{<?php echo esc_attr( $placeholder ); ?>}" role="option"><?php echo esc_html( $display_name ); ?></option> |
| 229 | <?php endforeach; ?> |
| 230 | |
| 231 | </select> |
| 232 | |
| 233 | </div> |
| 234 | |
| 235 | </div> |
| 236 | |
| 237 | <# } #> |
| 238 | |
| 239 | </div> |
| 240 | |
| 241 | </div> |
| 242 | |
| 243 | </script> |
| 244 |