function handleOptions() { $options = $this->getOptions(); if (isset($_POST['instagram-update-auth-settings'])) { $options = array(); $options['app_user_username'] = trim($_POST['instagram-app-user-username']); $options['app_user_password'] = trim($_POST['instagram-app-user-password']); update_option($this->dbOptionKey, $options); $instagram = ColabsInstagram::getAPIInstance(); } else { if (isset($_POST['instagram-reset-settings'])) { delete_option($this->dbOptionKey); } } if (isset($_POST['instagram-update-settings'])) { $cacheTime = intval($_POST['instagram-cache-time']); if ($cacheTime > 0) { $options['app_cache_time'] = $cacheTime; } $options['app_disable_effects'] = isset($_POST['instagram-disable-fancybox']); $options['app_disable_image_attributes'] = isset($_POST['instagram-disable-image-attr']); update_option($this->dbOptionKey, $options); } $authorizeUrl = $this->getOAuthRedirectUrl(); include 'theme-instagram-options.php'; }
function handleOptions() { $options = $this->getOptions(); if (isset($_POST['instagram-update-auth-settings'])) { $options = array(); $options['app_user_username'] = trim($_POST['instagram-app-user-username']); $options['app_user_password'] = trim($_POST['instagram-app-user-password']); update_option($this->dbOptionKey, $options); $instagram = ColabsInstagram::getAPIInstance(); if (!$options['app_access_token']) { $errorMessage = ""; $token = $instagram->getAccessToken($errorMessage); if ($token) { $options['app_access_token'] = $token; update_option($this->dbOptionKey, $options); echo '<div class="updated"><p>' . __('Settings saved.', 'colabsthemes') . '</p></div>'; } else { if ($errorMessage) { echo '<div class="error"><p>' . __('Instagram API reported the following error', 'colabsthemes') . ': <b>'; echo $errorMessage; echo '</b></p></div>'; } } } } else { if (isset($_POST['instagram-reset-settings'])) { delete_option($this->dbOptionKey); } } if (isset($_POST['instagram-update-settings'])) { $cacheTime = intval($_POST['instagram-cache-time']); if ($cacheTime > 0) { $options['app_cache_time'] = $cacheTime; } $options['app_disable_effects'] = isset($_POST['instagram-disable-fancybox']); $options['app_disable_image_attributes'] = isset($_POST['instagram-disable-image-attr']); update_option($this->dbOptionKey, $options); } $authorizeUrl = $this->getOAuthRedirectUrl(); include 'theme-instagram-options.php'; }
.form-wrap > div { float: left; width: 100%; } </style> <div id="colabs_options" class="wrap <?php if (is_rtl()) { echo 'rtl'; } ?> colabs_instagram"> <?php if (!$options['app_access_token']) { $errorMessage = ""; $instagram = ColabsInstagram::getAPIInstance(); $token = $instagram->getAccessToken($errorMessage); if ($token) { $options['app_access_token'] = $token; update_option($this->dbOptionKey, $options); echo '<div class="updated"><p>' . __('Settings saved.', 'colabsthemes') . '</p></div>'; } else { if ($errorMessage) { echo '<div class="error"><p>' . __('Instagram API reported the following error', 'colabsthemes') . ': <b>'; echo $errorMessage; echo '</b></p></div>'; } } } ?>