| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 4 |
if ( ! is_admin() ) die; |
| 5 |
|
| 6 |
/* Variablen für das Backend definieren */ |
| 7 |
define( 'WPAPPBOX_URL_PAYPAL', 'https://www.paypal.me/marcelismus' ); |
| 8 |
define( 'WPAPPBOX_URL_AMAZON', 'http://www.amazon.de/gp/registry/wishlist/1FC2DA2J8SZW7?tag=wp-appbox-21' ); |
| 9 |
|
| 10 |
|
| 11 |
/** |
| 12 |
* Registrierung der Einstellungen des Plugins |
| 13 |
* |
| 14 |
* @since 1.0.0 |
| 15 |
* @change 3.2.0 |
| 16 |
*/ |
| 17 |
|
| 18 |
function wpAppbox_pageInit() { |
| 19 |
$settings_page = add_options_page( WPAPPBOX_PLUGIN_NAME . ' ' . __('settings', 'wp-appbox') , WPAPPBOX_PLUGIN_NAME, 'manage_options', 'wp-appbox', 'wpAppbox_options_page' ); |
| 20 |
add_action( "load-{$settings_page}", 'wpAppbox_loadSettingsPage' ); |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
/** |
| 25 |
* Initalisierung der Adminseite [deprecated] |
| 26 |
* |
| 27 |
* @since 1.0.0 |
| 28 |
* @change 3.2.0 |
| 29 |
*/ |
| 30 |
|
| 31 |
function wpAppbox_adminInit() { |
| 32 |
} |
| 33 |
|
| 34 |
|
| 35 |
/** |
| 36 |
* Benachrichtigung im Admin-Panel anzeigen |
| 37 |
* |
| 38 |
* @since 4.0.0 |
| 39 |
* @change 4.4.0 |
| 40 |
*/ |
| 41 |
|
| 42 |
function wpAppbox_showAdminNotification() { |
| 43 |
if ( ( 'not' == 'show' ) && ( WPAPPBOX_PLUGIN_VERSION != get_option( 'wpAppbox_notifyLastV' ) ) ): |
| 44 |
?> |
| 45 |
<div class="notice notice-success is-dismissible"> |
| 46 |
<p> |
| 47 |
🎉🎊 <strong><?php printf( esc_html__( 'WP-Appbox %1$s is here!', 'wp-appbox' ), esc_html( WPAPPBOX_PLUGIN_VERSION ) ); ?> </strong> |
| 48 |
<?php printf( wp_kses( __( '<a href="%s" target="_blank">See here</a> what is new.', 'wp-appbox' ), array( 'a' => array( 'href' => array(), 'target' => array( '_blank') ) ) ), esc_url( ( get_locale() == 'de_DE' ) ? 'http://wordpress.org/plugins/wp-appbox/changelog/' : 'http://wordpress.org/plugins/wp-appbox/changelog/' ) ); ?> |
| 49 |
<?php printf( wp_kses( __( 'If you like this plugin and find it useful, please <a href="%s" target="_blank">consider to rate</a> this plugin.', 'wp-appbox' ), array( 'a' => array( 'href' => array(), 'target' => array( '_blank') ) ) ), esc_url( 'https://wordpress.org/support/plugin/wp-appbox/reviews/' ) ); ?> :-) |
| 50 |
</p> |
| 51 |
</div> |
| 52 |
<?php |
| 53 |
update_option( 'wpAppbox_notifyLastV', sanitize_text_field( WPAPPBOX_PLUGIN_VERSION ), 'no' ); |
| 54 |
endif; |
| 55 |
} |
| 56 |
add_action( 'admin_notices', 'wpAppbox_showAdminNotification' ); |
| 57 |
|
| 58 |
|
| 59 |
/** |
| 60 |
* Anzeige der Apps im Cache im Dashboard-Glance-Widget |
| 61 |
* |
| 62 |
* @since 3.4.0 |
| 63 |
* @change 4.4.0 |
| 64 |
*/ |
| 65 |
|
| 66 |
function wpAppbox_counterInDashboard( $items = array() ) { |
| 67 |
if ( ! current_user_can('manage_options') ) { |
| 68 |
return( $items ); |
| 69 |
} |
| 70 |
$countCachedApps = wpAppbox_countCachedApps(); |
| 71 |
if ( $countCachedApps > 0 ) { |
| 72 |
echo( '<style>#dashboard_right_now .wp-appbox a:before { content: "\f108" !important; }</style>' ); |
| 73 |
echo( '<li class="page-count wp-appbox"><a href="options-general.php?page=wp-appbox&tab=cache-list">' . esc_html( $countCachedApps ) . ' ' . _n( 'app in cache', 'apps in cache', $countCachedApps, 'wp-appbox' ) . '</a></li>' ); |
| 74 |
} |
| 75 |
//return( $items ); |
| 76 |
} |
| 77 |
add_filter( 'dashboard_glance_items', 'wpAppbox_counterInDashboard', 10, 1 ); |
| 78 |
|
| 79 |
|
| 80 |
/** |
| 81 |
* Tab-Navigation erzeugen und anzeigen |
| 82 |
* |
| 83 |
* @since 3.0.2 |
| 84 |
* @change 4.4.0 |
| 85 |
* |
| 86 |
* @param string $currentTab Aktuell ausgewählter Tab [optional] |
| 87 |
* |
| 88 |
* @output HTML-Ausgabe der Tableiste Tableiste |
| 89 |
*/ |
| 90 |
|
| 91 |
function wpAppbox_createTabs( $currentTab = 'info' ) { |
| 92 |
if ( isset($_GET['tab'] ) ) { |
| 93 |
$currentTab = sanitize_key( $_GET['tab'] ); |
| 94 |
} |
| 95 |
$tabs = array( |
| 96 |
'info' => array( 'name' => __( 'Info', 'wp-appbox' ), 'dashicon' => 'heart' ), |
| 97 |
//'compilations' => array( 'name' => __('Compilations', 'wp-appbox'), 'dashicon' => 'excerpt-view' ), |
| 98 |
'output' => array( 'name' => __( 'Output', 'wp-appbox' ), 'dashicon' => 'analytics' ), |
| 99 |
'cache' => array( 'name' => __( 'Cache', 'wp-appbox' ), 'dashicon' => 'dashboard' ), |
| 100 |
'buttons' => array( 'name' => __( 'Editor-Buttons', 'wp-appbox' ), 'dashicon' => 'editor-kitchensink' ), |
| 101 |
'storeurls' => array( 'name' => __( 'Store-URLs', 'wp-appbox' ), 'dashicon' => 'admin-links' ), |
| 102 |
'advanced' => array( 'name' => __( 'Advanced', 'wp-appbox' ), 'dashicon' => 'admin-tools' ), |
| 103 |
'help' => array( 'name' => __( 'Help', 'wp-appbox' ), 'dashicon' => 'editor-help' ) |
| 104 |
); |
| 105 |
echo( '<h2 class="nav-tab-wrapper">' ); |
| 106 |
foreach ( $tabs as $tab => $properties ) { |
| 107 |
if ( 'cache-list' == $currentTab ) $currentTab = 'cache'; |
| 108 |
$class = ( $tab == $currentTab ) ? ' nav-tab-active' : ''; |
| 109 |
$dashicon = $properties['dashicon']; |
| 110 |
$name = $properties['name']; |
| 111 |
echo( "<a class='nav-tab$class dashicons-before dashicons-$dashicon' href='?page=wp-appbox&tab=$tab'> $name</a>" ); |
| 112 |
} |
| 113 |
echo( "<a class='nav-tab paypal dashicons-before dashicons-superhero-alt' target='blank' href='" . esc_attr( WPAPPBOX_URL_PAYPAL ) . "' ); ?>" . __('PayPal-Donation', 'wp-appbox') . "</a>" ); |
| 114 |
echo( "<a class='nav-tab amazon dashicons-before dashicons-amazon' target='blank' href='" . esc_attr( WPAPPBOX_URL_AMAZON ) . "' ); ?>" . __('Amazon Wishlist', 'wp-appbox') . "</a>" ); |
| 115 |
echo( '</h2>' ); |
| 116 |
} |
| 117 |
|
| 118 |
|
| 119 |
/** |
| 120 |
* Optionsseiten laden |
| 121 |
* |
| 122 |
* @since 1.0.0 |
| 123 |
* @change 4.1.14 |
| 124 |
*/ |
| 125 |
|
| 126 |
function wpAppbox_loadSettingsPage() { |
| 127 |
if ( isset( $_GET['tab'] ) && 'cachelist' == $_GET['tab'] ) { |
| 128 |
$args = array( |
| 129 |
'label' => __('Apps', 'wp-appbox'), |
| 130 |
'default' => 50, |
| 131 |
'option' => 'apps_per_page' |
| 132 |
); |
| 133 |
add_screen_option( 'per_page', $args) ; |
| 134 |
} |
| 135 |
if ( isset( $_POST["wp-appbox-settings-submit"]) && 'Y' == $_POST["wp-appbox-settings-submit"] ) { |
| 136 |
check_admin_referer( "wp-appbox-setting-page" ); |
| 137 |
wpAppbox_saveSettings(); |
| 138 |
$url_parameters = isset( $_GET['tab'] ) ? 'updated=true&tab=' . sanitize_text_field( $_GET['tab'] ) : 'updated=true'; |
| 139 |
wp_redirect( admin_url( "options-general.php?page=wp-appbox&$url_parameters" ) ); |
| 140 |
exit; |
| 141 |
} |
| 142 |
} |
| 143 |
|
| 144 |
|
| 145 |
/** |
| 146 |
* Anzahl der Einträge pro Seite in der Cache-Tabelle |
| 147 |
* |
| 148 |
* @since 2.0.0 |
| 149 |
* @change 3.2.0 |
| 150 |
* |
| 151 |
* @param string $status Status [WordPress] |
| 152 |
* @param string $option Angefragte Optionskey |
| 153 |
* @param string $value Angefragter Optionswert |
| 154 |
* @return string $theURL Umgewandelter App-Link |
| 155 |
*/ |
| 156 |
|
| 157 |
function wpAppbox_setScreenOptions( $status, $option, $value ) { |
| 158 |
if ( 'apps_per_page' == $option ) { |
| 159 |
return( $value ); |
| 160 |
} |
| 161 |
} |
| 162 |
add_filter( 'set-screen-option', 'wpAppbox_setScreenOptions', 10, 3 ); |
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
/** |
| 167 |
* Status der Amazon API testen |
| 168 |
* |
| 169 |
* @since 4.5.0 |
| 170 |
* |
| 171 |
* @return boolean $amaStatus True or False |
| 172 |
*/ |
| 173 |
|
| 174 |
function wpAppbox_checkAmazonAPIstatus() { |
| 175 |
return( true ); |
| 176 |
} |
| 177 |
|
| 178 |
|
| 179 |
/** |
| 180 |
* Einstellungen in "wp_options" speichern |
| 181 |
* |
| 182 |
* @since 1.0.0 |
| 183 |
* @change 4.4.0 |
| 184 |
*/ |
| 185 |
|
| 186 |
function wpAppbox_saveSettings() { |
| 187 |
global $wpAppbox_storeNames, $wpAppbox_optionsDefault; |
| 188 |
$tab = 'info'; |
| 189 |
if ( isset( $_GET['tab'] ) ) { |
| 190 |
$tab = sanitize_text_field( $_GET['tab'] ); |
| 191 |
} |
| 192 |
switch ( $tab ) { |
| 193 |
case 'output': |
| 194 |
update_option( 'wpAppbox_downloadCaption', ( !empty( sanitize_text_field( $_POST['wpAppbox_downloadCaption'] ) ) ? sanitize_text_field( $_POST['wpAppbox_downloadCaption'] ) : sanitize_text_field( $wpAppbox_optionsDefault['downloadCaption'] ) ), 'no' ); |
| 195 |
update_option( 'wpAppbox_nofollow', ( isset( $_POST['wpAppbox_nofollow'] ) ? true : false ), 'no' ); |
| 196 |
update_option( 'wpAppbox_targetBlank', ( isset( $_POST['wpAppbox_targetBlank'] ) ? true : false ), 'no' ); |
| 197 |
update_option( 'wpAppbox_screenshotTabs', ( isset( $_POST['wpAppbox_screenshotTabs'] ) ? true : false ), 'no' ); |
| 198 |
update_option( 'wpAppbox_showRating', intval( $_POST['wpAppbox_showRating'] ), 'no' ); |
| 199 |
update_option( 'wpAppbox_colorfulIcons', ( isset( $_POST['wpAppbox_colorfulIcons'] ) ? true : false ), 'no' ); |
| 200 |
update_option( 'wpAppbox_dontGreyOut', ( isset( $_POST['wpAppbox_dontGreyOut'] ) ? true : false ), 'no' ); |
| 201 |
update_option( 'wpAppbox_defaultStyle', intval( $_POST['wpAppbox_defaultStyle'] ), 'no' ); |
| 202 |
update_option( 'wpAppbox_replaceAppIcons', ( isset( $_POST['wpAppbox_replaceAppIcons'] ) ? true : false ), 'no' ); |
| 203 |
break; |
| 204 |
case 'cache': |
| 205 |
if ( TRUE == get_option('wpAppbox_blockMissing') && FALSE == $_POST['wpAppbox_blockMissing'] ) wpAppbox_resetBlockedQueries(); |
| 206 |
update_option( 'wpAppbox_cacheTime', ( '' != intval( $_POST['wpAppbox_cacheTime'] ) ? intval( $_POST['wpAppbox_cacheTime'] ) : sanitize_text_field( $wpAppbox_optionsDefault['cacheTime'] ) ), 'no' ); |
| 207 |
update_option( 'wpAppbox_blockMissing', ( isset( $_POST['wpAppbox_blockMissing'] ) ? true : false ) ); |
| 208 |
update_option( 'wpAppbox_blockMissingTime', ( '' != intval( $_POST['wpAppbox_blockMissingTime'] ) ? intval( $_POST['wpAppbox_blockMissingTime'] ) : sanitize_text_field( $wpAppbox_optionsDefault['blockMissingTime'] ) ), 'no' ); |
| 209 |
update_option( 'wpAppbox_cacheMode', ( !empty( $_POST['wpAppbox_cacheMode'] ) != '' ? sanitize_text_field( $_POST['wpAppbox_cacheMode'] ) : sanitize_text_field( $wpAppbox_optionsDefault['cacheMode'] ) ), 'no' ); |
| 210 |
update_option( 'wpAppbox_cronIntervall', ( '' != intval( $_POST['wpAppbox_cronIntervall'] ) ? intval( $_POST['wpAppbox_cronIntervall'] ) : sanitize_text_field( $wpAppbox_optionsDefault['cronIntervall'] ) ), 'no' ); |
| 211 |
update_option( 'wpAppbox_cronCount', ( '' != intval( $_POST['wpAppbox_cronCount'] ) ? intval( $_POST['wpAppbox_cronCount'] ) : sanitize_text_field( $wpAppbox_optionsDefault['cronCount'] ) ), 'no' ); |
| 212 |
update_option( 'wpAppbox_cachePlugin', ( !empty( $_POST['wpAppbox_cachePlugin'] ) != '' ? sanitize_text_field( $_POST['wpAppbox_cachePlugin'] ) : 0 ), 'no' ); |
| 213 |
$imageCacheWAS = get_option( 'wpAppbox_imgCache' ); |
| 214 |
if ( isset( $_POST['wpAppbox_imgCache'] ) && $_POST['wpAppbox_imgCache'] ) { |
| 215 |
if ( wpAppbox_imageCache::checkImageCache() ) |
| 216 |
update_option( 'wpAppbox_imgCache', ( isset( $_POST['wpAppbox_imgCache'] ) ? true : false ), 'no' ); |
| 217 |
else |
| 218 |
set_transient( 'wpAppbox_imgCacheBlocked', true, 12 * HOUR_IN_SECONDS ); |
| 219 |
} else { |
| 220 |
update_option( 'wpAppbox_imgCache', false, 'no' ); |
| 221 |
} |
| 222 |
if ( $imageCacheWAS && !get_option( 'wpAppbox_imgCache' ) ) |
| 223 |
$delete = wpAppbox_imageCache::deleteImageCache( true ); |
| 224 |
if ( isset( $_POST['wpAppbox_imgCacheMode'] ) && is_array( $_POST['wpAppbox_imgCacheMode'] ) ) { |
| 225 |
update_option( 'wpAppbox_imgCacheMode', array_map( 'sanitize_text_field', $_POST['wpAppbox_imgCacheMode'] ), 'no'); |
| 226 |
} |
| 227 |
else { |
| 228 |
delete_option( 'wpAppbox_imgCacheMode' ); |
| 229 |
update_option( 'wpAppbox_imgCache', false, 'no' ); |
| 230 |
} |
| 231 |
update_option( 'wpAppbox_imgCacheDelay', ( isset( $_POST['wpAppbox_imgCacheDelay'] ) ? true : false ), 'no' ); |
| 232 |
update_option( 'wpAppbox_imgCacheDelayTime', ( '' != intval( $_POST['wpAppbox_imgCacheDelayTime'] ) ? intval( $_POST['wpAppbox_imgCacheDelayTime'] ) : sanitize_text_field( $wpAppbox_optionsDefault['imgCacheDelayTime'] ) ), 'no' ); |
| 233 |
wpAppbox_setupCronCache(); |
| 234 |
break; |
| 235 |
case 'advanced': |
| 236 |
update_option( 'wpAppbox_autoLinks', ( isset( $_POST['wpAppbox_autoLinks'] ) ? true : false ), 'no' ); |
| 237 |
update_option( 'wpAppbox_anonymizeLinks', ( isset( $_POST['wpAppbox_anonymizeLinks'] ) ? true : false ), 'no' ); |
| 238 |
if ( function_exists( 'register_block_type' ) ) { |
| 239 |
update_option( 'wpAppbox_renderGutenberg', ( isset( $_POST['wpAppbox_renderGutenberg'] ) ? true : false ), 'no' ); |
| 240 |
} else { |
| 241 |
delete_option( 'wpAppbox_renderGutenberg' ); |
| 242 |
} |
| 243 |
update_option( 'wpAppbox_disableDefer', ( isset( $_POST['wpAppbox_disableDefer'] ) ? true : false ), 'no' ); |
| 244 |
update_option( 'wpAppbox_includeCSS', ( !empty( $_POST['wpAppbox_includeCSS'] ) ? sanitize_text_field( trim( $_POST['wpAppbox_includeCSS'] ) ) : '0' ), 'no' ); |
| 245 |
update_option( 'wpAppbox_disableFonts', ( isset( $_POST['wpAppbox_disableFonts'] ) ? true : false ), 'no' ); |
| 246 |
update_option( 'wpAppbox_curlTimeout', ( '' != intval( $_POST['wpAppbox_curlTimeout'] ) ? intval( $_POST['wpAppbox_curlTimeout'] ) : sanitize_text_field( $wpAppbox_optionsDefault['curlTimeout'] ) ) ); |
| 247 |
update_option( 'wpAppbox_eOnlyAuthors', ( isset( $_POST['wpAppbox_eOnlyAuthors'] ) ? true : false ), 'no' ); |
| 248 |
update_option( 'wpAppbox_eOutput', ( !empty( $_POST['wpAppbox_eOutput'] ) ? sanitize_text_field( trim( $_POST['wpAppbox_eOutput'] ) ) : sanitize_text_field( $wpAppbox_optionsDefault['eOutput'] ) ), 'no' ); |
| 249 |
update_option( 'wpAppbox_forceSSL', ( isset ( $_POST['wpAppbox_forceSSL'] ) ? true : false ), 'no' ); |
| 250 |
update_option( 'wpAppbox_imgProxy', ( isset ( $_POST['wpAppbox_imgProxy'] ) ? true : false ), 'no' ); |
| 251 |
update_option( 'wpAppbox_amaAPIuse', ( isset( $_POST['wpAppbox_amaAPIuse'] ) ? true : false ), 'no' ); |
| 252 |
update_option( 'wpAppbox_amaAPIhost', ( isset( $_POST['wpAppbox_amaAPIhost'] ) ? sanitize_text_field( trim( $_POST['wpAppbox_amaAPIhost'] ) ) : '' ), 'no' ); |
| 253 |
update_option( 'wpAppbox_amaAPIpartnerTag', ( isset( $_POST['wpAppbox_amaAPIpartnerTag'] ) ? sanitize_text_field( trim( $_POST['wpAppbox_amaAPIpartnerTag'] ) ) : '' ), 'no' ); |
| 254 |
update_option( 'wpAppbox_amaAPIaccessKey', ( isset( $_POST['wpAppbox_amaAPIaccessKey'] ) ? sanitize_text_field( trim( $_POST['wpAppbox_amaAPIaccessKey'] ) ) : '' ), 'no' ); |
| 255 |
update_option( 'wpAppbox_amaAPIsecretKey', ( isset( $_POST['wpAppbox_amaAPIsecretKey'] ) ? sanitize_text_field( trim( $_POST['wpAppbox_amaAPIsecretKey'] ) ) : '' ), 'no' ); |
| 256 |
if ( ('' == get_option( 'wpAppbox_amaAPIhost' )) || '' == get_option( 'wpAppbox_amaAPIpartnerTag' ) || '' == get_option( 'wpAppbox_amaAPIaccessKey' ) || '' == get_option( 'wpAppbox_amaAPIsecretKey' )) |
| 257 |
update_option( 'wpAppbox_amaAPIuse', false, 'no' ); |
| 258 |
update_option( 'wpAppbox_amaAPIstatus', wpAppbox_checkAmazonAPIstatus(), 'no' ); |
| 259 |
break; |
| 260 |
case 'buttons': |
| 261 |
update_option( 'wpAppbox_defaultButton', intval( $_POST['wpAppbox_defaultButton'] ) ); |
| 262 |
foreach ( $wpAppbox_storeNames as $storeID => $storeName ): |
| 263 |
$key_buttonAppbox = "wpAppbox_buttonAppbox_$storeID"; |
| 264 |
update_option( $key_buttonAppbox, ( isset( $_POST[$key_buttonAppbox] ) ? true : false ), 'no' ); |
| 265 |
$key_buttonWYSIWYG = "wpAppbox_buttonWYSIWYG_$storeID"; |
| 266 |
update_option( $key_buttonWYSIWYG, ( isset( $_POST[$key_buttonWYSIWYG] ) ? true : false ), 'no' ); |
| 267 |
$key_buttonHTML = "wpAppbox_buttonHTML_$storeID"; |
| 268 |
update_option( $key_buttonHTML, ( isset( $_POST[$key_buttonHTML] ) ? true : false ), 'no' ); |
| 269 |
$key_buttonHidden = "wpAppbox_buttonHidden_$storeID"; |
| 270 |
update_option( $key_buttonHidden, ( isset( $_POST[$key_buttonHidden] ) ? true : false ), 'no' ); |
| 271 |
endforeach; |
| 272 |
if ( isset( $_POST['wpAppbox_advancedToolbar'] ) && '1' == $_POST['wpAppbox_advancedToolbar'] ) |
| 273 |
update_option( 'wpAppbox_advancedToolbar', true, 'no' ); |
| 274 |
else |
| 275 |
delete_option( 'wpAppbox_advancedToolbar' ); |
| 276 |
break; |
| 277 |
case 'storeurls': |
| 278 |
foreach ( $wpAppbox_storeNames as $storeID => $storeName ): |
| 279 |
$key_storeURL = "wpAppbox_storeURL_$storeID"; |
| 280 |
update_option( $key_storeURL, ( isset( $_POST[$key_storeURL] ) ? intval( $_POST[$key_storeURL] ) : '' ) ); |
| 281 |
if ( isset( $_POST[$key_storeURL] ) && '0' == $_POST[$key_storeURL] ): |
| 282 |
$key_storeURL_URL = "wpAppbox_storeURL_URL_$storeID"; |
| 283 |
update_option( $key_storeURL_URL, ( isset( $_POST[$key_storeURL_URL] ) ? sanitize_text_field( trim( $_POST[$key_storeURL_URL] ) ) : '' ), 'no' ); |
| 284 |
endif; |
| 285 |
endforeach; |
| 286 |
break; |
| 287 |
} |
| 288 |
update_option( 'wpAppbox_pluginVersion', sanitize_text_field( WPAPPBOX_PLUGIN_VERSION ) ); |
| 289 |
} |
| 290 |
|
| 291 |
|
| 292 |
/** |
| 293 |
* Erzeugung und Ausgabe der Optionsseiten |
| 294 |
* |
| 295 |
* @since 1.0.0 |
| 296 |
* @change 4.4.0 |
| 297 |
* |
| 298 |
* @output HTML-Ausgabe der Optionsseiten |
| 299 |
*/ |
| 300 |
|
| 301 |
function wpAppbox_options_page() { |
| 302 |
global $wpAppbox_storeNames, $wpAppbox_styleNames, $wpAppbox_storeStyles, $wpAppbox_storeURL_languages, $wpAppbox_storeURL, $wpAppbox_storeURL_noLanguages, $wpAppbox_amaAPIregions; |
| 303 |
if ( isset( $_GET['flushcache'] ) ) { |
| 304 |
$tab = 'cache'; |
| 305 |
} |
| 306 |
?> |
| 307 |
<div class="wrap"> |
| 308 |
<style> |
| 309 |
hr { |
| 310 |
margin-top: 10px !important; |
| 311 |
margin-bottom: 30px !important; |
| 312 |
} |
| 313 |
.wpa-error { |
| 314 |
} |
| 315 |
.wpa-infobox { |
| 316 |
display: block; |
| 317 |
background: #fff; |
| 318 |
border-left: 4px solid #fff; |
| 319 |
-webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1); |
| 320 |
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1); |
| 321 |
margin: 20px 0 25px 0; |
| 322 |
padding: 10px 16px |
| 323 |
} |
| 324 |
.wpa-infobox.wpa-notice { |
| 325 |
border-left: 4px solid #ffba00; |
| 326 |
} |
| 327 |
.wpa-infobox.wpa-error { |
| 328 |
color: #b94a48; |
| 329 |
border-left-color: #dc3232 |
| 330 |
} |
| 331 |
.wpa-infobox + h3 { |
| 332 |
padding-top: 8px; |
| 333 |
} |
| 334 |
.wpa-infobox + .form-table { |
| 335 |
margin-top: -10px !important; |
| 336 |
} |
| 337 |
.dashicons, .dashicons-before:before { |
| 338 |
line-height: 1.1 !important; |
| 339 |
} |
| 340 |
.nav-tab.paypal { |
| 341 |
background: #52aed8; |
| 342 |
border: 1px solid #169BD7; |
| 343 |
border-bottom: 0; |
| 344 |
color: #FFF; |
| 345 |
} |
| 346 |
.nav-tab.paypal:hover { |
| 347 |
background: #169BD7 !important; |
| 348 |
border: 1px solid #169BD7 !important; |
| 349 |
border-bottom: 0 !important; |
| 350 |
} |
| 351 |
.nav-tab.amazon { |
| 352 |
background: #fcba57; |
| 353 |
border: 1px solid #FF9900; |
| 354 |
border-bottom: 0; |
| 355 |
color: #FFF; |
| 356 |
} |
| 357 |
.nav-tab.amazon:hover { |
| 358 |
background: #FF9900 !important; |
| 359 |
border: 1px solid #FF9900 !important; |
| 360 |
border-bottom: 0 !important; |
| 361 |
} |
| 362 |
</style> |
| 363 |
<div id="icon-options-general" class="icon32"> |
| 364 |
<br> |
| 365 |
</div> |
| 366 |
<h2><?php esc_html_e( WPAPPBOX_PLUGIN_NAME ); ?> (Version <?php esc_html_e( WPAPPBOX_PLUGIN_VERSION ); ?>)</h2> |
| 367 |
|
| 368 |
<?php if ( isset($_GET['flushcache'] ) ) { |
| 369 |
if( wpAppbox_clearCache() ) echo( '<div id="setting-error-settings_updated" class="updated settings-error is-dismissible"><p><strong>'.__( 'The cache was flushed successfully.', 'wp-appbox' ).'</strong></p></div>' ); |
| 370 |
else echo( '<div id="setting-error-settings_updated" class="updated settings-error is-dismissible"><p><strong>'.__( 'The cache can not be emptied or there are no apps in the cache.', 'wp-appbox' ).'</strong></p></div>' ); |
| 371 |
} ?> |
| 372 |
|
| 373 |
<?php if ( isset($_GET['flushimgcache'] ) ) { |
| 374 |
if( wpAppbox_imageCache::deleteImageCache() ) echo( '<div id="setting-error-settings_updated" class="updated settings-error is-dismissible"><p><strong>'.__( 'The image cache was flushed successfully.', 'wp-appbox' ).'</strong></p></div>' ); |
| 375 |
else echo( '<div id="setting-error-settings_updated" class="updated settings-error is-dismissible"><p><strong>'.__( 'The image cache can not be emptied.', 'wp-appbox' ).'</strong></p></div>' ); |
| 376 |
} ?> |
| 377 |
|
| 378 |
<?php if ( isset($_GET['cleanupimagefolder'] ) ) { |
| 379 |
if( wpAppbox_imageCache::cleanUpCacheFolder() ) echo( '<div id="setting-error-settings_updated" class="updated settings-error is-dismissible"><p><strong>'.__( 'The image folder was successfully cleaned up.', 'wp-appbox' ).'</strong></p></div>' ); |
| 380 |
else echo( '<div id="setting-error-settings_updated" class="updated settings-error is-dismissible"><p><strong>'.__( 'The image folder can not be cleaned up.', 'wp-appbox' ).'</strong></p></div>' ); |
| 381 |
} ?> |
| 382 |
|
| 383 |
<?php if ( isset($_GET['resetdeprecated'] ) ) { |
| 384 |
if( wpAppbox_resetDeprecatedApps() ) echo( '<div id="setting-error-settings_updated" class="updated settings-error is-dismissible"><p><strong>'.__( 'Deprecated apps were successfully reset.', 'wp-appbox' ).'</strong></p></div>' ); |
| 385 |
else echo( '<div id="setting-error-settings_updated" class="updated settings-error is-dismissible"><p><strong>'.__( 'Deprecated apps can not be resetted.', 'wp-appbox' ).'</strong></p></div>' ); |
| 386 |
} ?> |
| 387 |
|
| 388 |
<?php if ( isset($_GET['resetblockedqueries'] ) ) { |
| 389 |
if( wpAppbox_resetBlockedQueries() ) echo( '<div id="setting-error-settings_updated" class="updated settings-error is-dismissible"><p><strong>'.__( 'Blocked queries were successfully reset.', 'wp-appbox' ).'</strong></p></div>' ); |
| 390 |
else echo( '<div id="setting-error-settings_updated" class="updated settings-error is-dismissible"><p><strong>'.__( 'Blocked queries can not be resetted.', 'wp-appbox' ).'</strong></p></div>' ); |
| 391 |
} ?> |
| 392 |
|
| 393 |
<?php if ( !wpAppbox_imageCache::checkImageCache() && ( get_option('wpAppbox_imgCache') || get_transient( 'wpAppbox_imgCacheBlocked' ) ) ): ?> |
| 394 |
<div class="notice notice-error is-dismissible"> |
| 395 |
<p><span style="font-weight:bold;"><?php _e('Image cache is not active'); ?>: </span><?php esc_html_e( wpAppbox_imageCache::checkImageCache( true ) ); ?></p> |
| 396 |
</div> |
| 397 |
<?php delete_transient( 'wpAppbox_imgCacheBlocked' ); ?> |
| 398 |
<?php endif; ?> |
| 399 |
|
| 400 |
<div class="widget" style="margin:15px 0;"><p style="margin:10px;"> |
| 401 |
<a href="https://twitter.com/Marcelismus" target="_blank"><?php esc_html_e('Follow me on Twitter', 'wp-appbox'); ?></a> | <a href="<?php echo( ( get_locale() == 'de_DE' ) ? 'https://tchgdns.de/wp-appbox-app-badge-fuer-google-play-mac-app-store-windows-store-windows-phone-store-co/' : 'https://translate.google.de/translate?hl=de&sl=de&tl=en&u=https%3A%2F%2Ftchgdns.de%2Fwp-appbox-app-badge-fuer-google-play-mac-app-store-windows-store-windows-phone-store-co%2F' ); ?>" target="_blank"><?php esc_html_e('Visit the Plugin plage', 'wp-appbox'); ?></a> | <a href="http://wordpress.org/extend/plugins/wp-appbox/" target="_blank"><?php esc_html_e('Plugin at WordPress Directory', 'wp-appbox'); ?></a> | <a href="http://wordpress.org/plugins/wp-appbox/changelog/" target="_blank"><?php esc_html_e('Changelog', 'wp-appbox'); ?></a> |
| 402 |
</p></div> |
| 403 |
<?php wpAppbox_createTabs(); ?> |
| 404 |
<form method="post" action="<?php admin_url( 'options-general.php?page=wp-appbox' ); ?>"> |
| 405 |
<?php wp_nonce_field( "wp-appbox-setting-page" ); ?> |
| 406 |
<?php |
| 407 |
$tab = 'info'; |
| 408 |
if ( isset( $_GET['tab'] ) ) { |
| 409 |
$tab = sanitize_key( $_GET['tab'] ); |
| 410 |
} |
| 411 |
if ( isset( $tab ) && file_exists( plugin_dir_path( __FILE__ ) . "settings-$tab.php" ) ) { |
| 412 |
include_once( "settings-$tab.php" ); |
| 413 |
} else { |
| 414 |
include_once( "settings-info.php" ); |
| 415 |
} |
| 416 |
?> |
| 417 |
|
| 418 |
<?php if ( ( 'help' != $tab ) && ( 'info' != $tab ) && ( 'cache-list' != $tab ) ) { ?> |
| 419 |
<p class="submit" style="clear: both;"> |
| 420 |
<input type="submit" name="Submit" class="button-primary" value="<?php esc_html_e('Save changes', 'wp-appbox'); ?>" /> |
| 421 |
<input type="hidden" name="wp-appbox-settings-submit" value="Y" /> |
| 422 |
<?php |
| 423 |
$countCachedApps = wpAppbox_countCachedApps(); |
| 424 |
if ( isset( $_GET['tab'] ) && $_GET['tab'] == 'cache' && $countCachedApps > 0 ): |
| 425 |
?> |
| 426 |
<a class="button-secondary" href="options-general.php?page=wp-appbox&tab=cache-list"><?php esc_html_e('Show all apps in cache', 'wp-appbox'); ?></a> |
| 427 |
<?php endif; |
| 428 |
?> |
| 429 |
</p> |
| 430 |
<?php } ?> |
| 431 |
|
| 432 |
</form> |
| 433 |
</div> |
| 434 |
<?php } ?> |