function refresh_token($refresh_token) { $response = Photonic::http($this->access_token_url(), 'POST', array('client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'refresh_token' => $refresh_token, 'grant_type' => 'refresh_token')); if (!is_wp_error($response)) { $secret = md5($this->client_secret, false); $body = $response['body']; $body = json_decode($body); if (isset($_COOKIE['photonic-' . $secret . '-oauth-token'])) { unset($_COOKIE['photonic-' . $secret . '-oauth-token']); } if (isset($_COOKIE['photonic-' . $secret . '-oauth-token-type'])) { unset($_COOKIE['photonic-' . $secret . '-oauth-token-type']); } if (isset($_COOKIE['photonic-' . $secret . '-oauth-token-created'])) { unset($_COOKIE['photonic-' . $secret . '-oauth-token-created']); } if (isset($_COOKIE['photonic-' . $secret . '-oauth-token-expires'])) { unset($_COOKIE['photonic-' . $secret . '-oauth-token-expires']); } $cookie_expiration = 365 * 24 * 60 * 60; setcookie('photonic-' . $secret . '-oauth-token', $body->access_token, time() + $cookie_expiration, COOKIEPATH); if (isset($body->refresh_token)) { setcookie('photonic-' . $secret . '-oauth-refresh-token', $body->refresh_token, time() + $cookie_expiration, COOKIEPATH); } setcookie('photonic-' . $secret . '-oauth-token-type', $body->token_type, time() + $cookie_expiration, COOKIEPATH); setcookie('photonic-' . $secret . '-oauth-token-created', time(), time() + $cookie_expiration, COOKIEPATH); setcookie('photonic-' . $secret . '-oauth-token-expires', $body->expires_in, time() + $cookie_expiration, COOKIEPATH); } }
function __construct() { parent::__construct(); global $photonic_picasa_client_id, $photonic_picasa_client_secret, $photonic_picasa_disable_title_link; $this->client_id = $photonic_picasa_client_id; $this->client_secret = $photonic_picasa_client_secret; $this->provider = 'picasa'; $this->oauth_version = '2.0'; $this->response_type = 'code'; $this->scope = 'https://picasaweb.google.com/data/'; $this->link_lightbox_title = empty($photonic_picasa_disable_title_link); $cookie = Photonic::parse_cookie(); global $photonic_picasa_allow_oauth; $this->oauth_done = false; if ($photonic_picasa_allow_oauth && isset($cookie['picasa']) && isset($cookie['picasa']['oauth_token']) && isset($cookie['picasa']['oauth_refresh_token'])) { // OAuth2, so no Access token secret if ($this->is_token_expired($cookie['picasa'])) { $this->refresh_token($cookie['picasa']['oauth_refresh_token']); $cookie = Photonic::parse_cookie(); // Refresh the cookie object based on the results of the refresh token if ($this->is_token_expired($cookie['picasa'])) { // Tried refreshing, but didn't work $this->oauth_done = false; } else { $this->oauth_done = true; } } else { $this->oauth_done = true; } } else { if (!isset($cookie['picasa']) || !isset($cookie['picasa']['oauth_token']) || !isset($cookie['picasa']['oauth_refresh_token'])) { $this->oauth_done = false; } } }
function generate_level_1_gallery($photos, $title_position, $row_constraints = array(), $columns = 'auto', $display = 'in-page', $sizes = array(), $show_lightbox = true, $type = 'photo', $pagination = array()) { $col_class = ''; if (Photonic::check_integer($columns)) { $col_class = 'photonic-gallery-' . $columns . 'c'; } if ($col_class == '' && $row_constraints['constraint-type'] == 'padding') { $col_class = 'photonic-pad-photos'; } else { if ($col_class == '') { $col_class = 'photonic-gallery-' . $row_constraints['count'] . 'c'; } } $link_attributes = $this->get_lightbox_attributes($display, $col_class, $show_lightbox); $ul_class = "class='title-display-{$title_position}'"; if ($display == 'popup') { $ul_class = "class='slideshow-grid-panel lib-{$this->library} title-display-{$title_position}'"; } $ret = "<ul {$ul_class}>"; global $photonic_external_links_in_new_tab; if (!empty($photonic_external_links_in_new_tab)) { $target = " target='_blank' "; } else { $target = ''; } $counter = 0; global $photonic_gallery_panel_items, $photonic_slideshow_library; foreach ($photos as $photo) { $counter++; $thumb = $photo['thumbnail']; $orig = $photo['main_image']; $url = $photo['main_page']; $title = esc_attr($photo['title']); $alt = esc_attr($photo['alt_title']); $orig = $this->library == 'none' || !$show_lightbox ? $url : $orig; $shown_title = ''; if ($title_position == 'below') { $shown_title = '<span class="photonic-photo-title">' . wp_specialchars_decode($alt, ENT_QUOTES) . '</span>'; } if ($display == 'in-page') { $ret .= "\n\t" . '<li class="photonic-' . $this->provider . '-image photonic-' . $this->provider . '-' . $type . ' ' . $col_class . '">'; } else { if ($counter % $photonic_gallery_panel_items == 1 && $display != 'in-page') { $ret .= "\n\t" . '<li class="photonic-' . $this->provider . '-image photonic-' . $this->provider . '-' . $type . '">'; } } $style = array(); if (!empty($sizes['thumb-width'])) { $style[] = 'width:' . $sizes['thumb-width'] . 'px'; } if (!empty($sizes['thumb-height'])) { $style[] = 'height:' . $sizes['thumb-height'] . 'px'; } if (!empty($style)) { $style = 'style="' . implode(';', $style) . '"'; } else { $style = ''; } $title_link_start = $this->link_lightbox_title && $photonic_slideshow_library != 'thickbox' ? esc_attr("<a href='{$url}' {$target}>") : ''; $title_link_end = $this->link_lightbox_title && $photonic_slideshow_library != 'thickbox' ? esc_attr("</a>") : ''; if ($display == 'in-page') { $ret .= '<a ' . $link_attributes . ' href="' . $orig . '" title="' . $title_link_start . $title . $title_link_end . '" ' . $target . '><img alt="' . $alt . '" src="' . $thumb . '" ' . $style . '/></a>' . $shown_title; } else { $ret .= '<a ' . $link_attributes . ' href="' . $orig . '" title="' . $title_link_start . $title . $title_link_end . '" ' . $target . '><img alt="' . $alt . '" src="' . $thumb . '" ' . $style . '/>' . $shown_title . '</a>'; } /* if (!empty($object['passworded'])) { $prompt_title = esc_attr(__('Enter Password', 'photonic')); $prompt_submit = esc_attr(__('Access', 'photonic')); $form_url = admin_url('admin-ajax.php'); $password_prompt = " <div class='photonic-password-prompter' id='photonic-zenfolio-prompter-{$object['id_1']}-$this->gallery_index' title='$prompt_title'> <form class='photonic-password-form photonic-zenfolio-form' action='$form_url'> <input type='password' name='photonic-zenfolio-password' /> <input type='hidden' name='photonic-zenfolio-realm' value='{$photoset->AccessDescriptor->RealmId}' /> <input type='hidden' name='action' value='photonic_verify_password' /> <input type='submit' name='photonic-zenfolio-submit' value='$prompt_submit' /> </form> </div>"; $ret .= $password_prompt; }*/ if ($display == 'in-page' || $counter % $photonic_gallery_panel_items == 0 && $display != 'in-page') { $ret .= "</li>"; } } if ($ret != "<ul {$ul_class}>") { if (substr($ret, -5) != "</li>") { $ret .= "</li>"; } $ret .= "\n</ul>\n"; if (!empty($pagination) && !empty($pagination['paginate'])) { // Show "Load more" button if (!empty($pagination['current_page']) && !empty($pagination['per_page'])) { if (!empty($pagination['left'])) { // } } } } else { $ret = ''; } if (is_archive()) { global $photonic_archive_thumbs; if (!empty($photonic_archive_thumbs) && $counter < $photonic_archive_thumbs) { $this->is_more_required = false; } } return $ret; }
protected function make_call($query_url, $display_what, $columns, $thumb_size = 75, $auth_required = false) { global $photonic_instagram_client_id; $ret = ''; $query = $query_url; if (substr($query, -1, 1) != '&' && !stripos($query, '?')) { $query .= '?'; } else { if (substr($query, -1, 1) != '&' && stripos($query, '?')) { $query .= '&'; } } if ($auth_required) { $cookie = Photonic::parse_cookie(); if (isset($cookie['instagram']) && !$this->is_token_expired($cookie['instagram'])) { $query .= 'access_token=' . $cookie['instagram']['oauth_token']; } else { return __("Please login to see this content.", 'photonic'); } } else { $query .= 'client_id=' . $photonic_instagram_client_id; } $response = wp_remote_request($query, array('sslverify' => false)); $url = ''; if ($display_what == 'single-media') { $base_url = $this->get_normalized_http_url($query); $parameters = $this->parse_parameters(substr($query, strlen($base_url) + 1)); if (isset($parameters['url'])) { $url = $parameters['url']; } } if (!is_wp_error($response)) { if (isset($response['response']) && isset($response['response']['code'])) { if ($response['response']['code'] == 200) { $body = json_decode($response['body']); if (isset($body->data) && $display_what != 'single-media') { $data = $body->data; $this->gallery_index++; switch ($display_what) { case 'users': $ret .= $this->process_users($data, $columns, $thumb_size); break; case 'media': default: $ret .= $this->process_media($data, $columns, $thumb_size); break; } } else { if ($display_what == 'single-media') { $ret .= $this->process_single_media($body, $url); } else { return __('No data returned. Unknown error', 'photonic'); } } } else { if (isset($response['body'])) { $body = json_decode($response['body']); if (isset($body->meta) && isset($body->meta->error_message)) { return $body->meta->error_message; } else { return __('Unknown error', 'photonic'); } } else { if (isset($response['response']['message'])) { return $response['response']['message']; } else { return __('Unknown error', 'photonic'); } } } } } else { return __('There was a problem connecting. Please try back after some time.', 'photonic'); } return $ret; }
/** * Checks if authentication has been enabled and the user has authenticated. If so, it signs the call, then adds the additional parameters to it. * This method also attaches the oauth_signature to the parameters. * * @param $api_method * @param $method * @param $parameters * @return mixed */ public function sign_call($api_method, $method, $parameters) { $allow_oauth = 'photonic_' . $this->provider . '_allow_oauth'; global ${$allow_oauth}; if (${$allow_oauth}) { $cookie = Photonic::parse_cookie(); if (isset($cookie[$this->provider]) && isset($cookie[$this->provider]['oauth_token']) && isset($cookie[$this->provider]['oauth_token_secret']) && isset($cookie[$this->provider]['oauth_token_type']) && $cookie[$this->provider]['oauth_token_type'] == 'access') { $token = array('oauth_token' => $cookie[$this->provider]['oauth_token'], 'oauth_token_secret' => $cookie[$this->provider]['oauth_token_secret']); $this->nonce = $this->nonce(); $this->oauth_timestamp = time(); $signature = $this->generate_signature($api_method, $parameters, $method, $token); if (isset($this->signature_parameters) && isset($this->signature_parameters['parameters'])) { $this->signature_parameters['parameters']['oauth_signature'] = $signature; return $this->signature_parameters['parameters']; } } } return $parameters; }
/** * Method to validate that the stored token is indeed authenticated. * * @param $request_token * @return array|WP_Error */ function check_access_token($request_token) { $signed_parameters = $this->sign_call('https://api.500px.com/v1/users', 'GET', array()); // $end_point = $this->end_point(); $end_point = 'https://api.500px.com/v1/users?' . Photonic_Processor::build_query($signed_parameters); $response = Photonic::http($end_point, 'GET', null); return $response; }
/** * Checks if a user has authenticated a particular provider's services. When this is invoked we don't know if the page has * a Flickr / 500px / SmugMug gallery, so we just invoke it and set some global variables. * * @return mixed */ function check_authentication() { if (is_admin()) { return; } global $photonic_flickr_allow_oauth, $photonic_500px_allow_oauth, $photonic_smug_allow_oauth, $photonic_picasa_allow_oauth; if (!$photonic_flickr_allow_oauth && !$photonic_500px_allow_oauth && !$photonic_smug_allow_oauth && !$photonic_picasa_allow_oauth) { return; } global $photonic_flickr_oauth_done, $photonic_500px_oauth_done, $photonic_smug_oauth_done; $photonic_flickr_oauth_done = $photonic_500px_oauth_done = $photonic_smug_oauth_done = false; $cookie = Photonic::parse_cookie(); if ($photonic_flickr_allow_oauth && isset($cookie['flickr']) && isset($cookie['flickr']['oauth_token']) && isset($cookie['flickr']['oauth_token_secret'])) { global $photonic_flickr_gallery; if (!isset($photonic_flickr_gallery)) { $photonic_flickr_gallery = new Photonic_Flickr_Processor(); } $current_token = array('oauth_token' => $cookie['flickr']['oauth_token'], 'oauth_token_secret' => $cookie['flickr']['oauth_token_secret']); if (isset($_REQUEST['oauth_verifier']) && isset($_REQUEST['oauth_token'])) { $current_token['oauth_token'] = $_REQUEST['oauth_token']; $current_token['oauth_verifier'] = $_REQUEST['oauth_verifier']; $new_token = $photonic_flickr_gallery->get_access_token($current_token); if (isset($new_token['oauth_token']) && isset($new_token['oauth_token_secret'])) { $photonic_flickr_oauth_done = true; $redirect = remove_query_arg(array('oauth_token', 'oauth_verifier')); wp_redirect($redirect); exit; } } else { if (isset($cookie['flickr']['oauth_token_type']) && $cookie['flickr']['oauth_token_type'] == 'access') { $access_token_response = $photonic_flickr_gallery->check_access_token($current_token); if (is_wp_error($access_token_response)) { $photonic_flickr_gallery->is_server_down = true; } $photonic_flickr_oauth_done = $photonic_flickr_gallery->is_access_token_valid($access_token_response); } } } if ($photonic_500px_allow_oauth && isset($cookie['500px']) && isset($cookie['500px']['oauth_token']) && isset($cookie['500px']['oauth_token_secret'])) { global $photonic_500px_gallery; if (!isset($photonic_500px_gallery)) { $photonic_500px_gallery = new Photonic_500px_Processor(); } $current_token = array('oauth_token' => $cookie['500px']['oauth_token'], 'oauth_token_secret' => $cookie['500px']['oauth_token_secret']); if (isset($_REQUEST['oauth_verifier']) && isset($_REQUEST['oauth_token'])) { $current_token['oauth_token'] = $_REQUEST['oauth_token']; $current_token['oauth_verifier'] = $_REQUEST['oauth_verifier']; $new_token = $photonic_500px_gallery->get_access_token($current_token); if (isset($new_token['oauth_token']) && isset($new_token['oauth_token_secret'])) { // Strip out the token and the verifier from the callback URL and send the user to the callback URL. $photonic_500px_oauth_done = true; $redirect = remove_query_arg(array('oauth_token', 'oauth_verifier')); wp_redirect($redirect); exit; } } else { if (isset($cookie['500px']['oauth_token_type']) && $cookie['500px']['oauth_token_type'] == 'access') { $access_token_response = $photonic_500px_gallery->check_access_token($current_token); if (is_wp_error($access_token_response)) { $photonic_500px_gallery->is_server_down = true; } $photonic_500px_oauth_done = $photonic_500px_gallery->is_access_token_valid($access_token_response); } } } if ($photonic_smug_allow_oauth && isset($cookie['smug']) && isset($cookie['smug']['oauth_token']) && isset($cookie['smug']['oauth_token_secret'])) { global $photonic_smugmug_gallery; if (!isset($photonic_smugmug_gallery)) { $photonic_smugmug_gallery = new Photonic_SmugMug_Processor(); } $current_token = array('oauth_token' => $cookie['smug']['oauth_token'], 'oauth_token_secret' => $cookie['smug']['oauth_token_secret']); if (!$photonic_smug_oauth_done && (isset($cookie['smug']['oauth_token_type']) && $cookie['smug']['oauth_token_type'] == 'request' || !isset($cookie['smug']['oauth_token_type']))) { $new_token = $photonic_smugmug_gallery->get_access_token($current_token); if (isset($new_token['oauth_token']) && isset($new_token['oauth_token_secret'])) { $access_token_response = $photonic_smugmug_gallery->check_access_token($new_token); if (is_wp_error($access_token_response)) { $photonic_smugmug_gallery->is_server_down = true; } $photonic_smug_oauth_done = $photonic_smugmug_gallery->is_access_token_valid($access_token_response); } } else { if (isset($cookie['smug']['oauth_token_type']) && $cookie['smug']['oauth_token_type'] == 'access') { $access_token_response = $photonic_smugmug_gallery->check_access_token($current_token); if (is_wp_error($access_token_response)) { $photonic_smugmug_gallery->is_server_down = true; } $photonic_smug_oauth_done = $photonic_smugmug_gallery->is_access_token_valid($access_token_response); } } } if (isset($photonic_picasa_allow_oauth)) { global $photonic_picasa_gallery; if (!isset($photonic_picasa_gallery)) { $photonic_picasa_gallery = new Photonic_Picasa_Processor(); } } if (isset($photonic_instagram_allow_oauth)) { global $photonic_instagram_gallery; if (!isset($photonic_instagram_gallery)) { $photonic_instagram_gallery = new Photonic_Instagram_Processor(); } } }
/** * Runs a sequence of web-service calls to get information. Most often a single web-service call with the "Extras" parameter suffices for SmugMug. * But there are some scenarios, e.g. clicking on an album to get a popup of all images in that album, where you need to chain the calls for the header. * * @param $chained_calls * @param $smug_args * @param $shortcode_attr * @return string */ function make_chained_calls($chained_calls, $smug_args, $shortcode_attr) { if (is_array($chained_calls) && count($chained_calls) > 0) { $this->gallery_index++; extract($shortcode_attr); $ret = ''; global $photonic_smug_oauth_done; $passworded = false; foreach ($chained_calls as $call) { $smug_args['method'] = $call; if ($photonic_smug_oauth_done) { $signed_args = $this->sign_call('https://secure.smugmug.com/services/api/json/1.3.0/', 'POST', $smug_args); $response = Photonic::http('https://secure.smugmug.com/services/api/json/1.3.0/', 'POST', $signed_args); } else { $response = Photonic::http('https://secure.smugmug.com/services/api/json/1.3.0/', 'POST', $smug_args); } if ($call == 'smugmug.albums.get') { $body = $response['body']; $body = json_decode($body); if ($body->stat == 'ok') { $albums = $body->Albums; if (is_array($albums) && count($albums) > 0) { $album_text = $this->process_albums($albums, $columns); if (!empty($album_text)) { $ret .= "<div class='photonic-smug-stream photonic-stream' id='photonic-smug-stream-{$this->gallery_index}'>"; $ret .= $album_text; $ret .= "</div>"; } } } } else { if ($call == 'smugmug.albums.getInfo') { $body = $response['body']; $body = json_decode($body); if ($body->stat == 'ok') { $album = $body->Album; if (isset($album->Passworded) && $album->Passworded && !isset($album->Password) && !isset($signed_args['Password'])) { $passworded = true; } $header_object = array(); $highlight = $album->Highlight; $rand = rand(1000, 9999); $header_object['thumb_url'] = "https://secure.smugmug.com/photos/random.mg?AlbumID={$album->id}&AlbumKey={$album->Key}&Size=75x75&rand={$rand}"; $header_object['title'] = $album->Title; $header_object['link_url'] = $album->URL; global $photonic_smug_disable_title_link, $photonic_smug_hide_album_thumbnail, $photonic_smug_hide_album_title, $photonic_smug_hide_album_photo_count; $hidden = array('thumbnail' => !empty($photonic_smug_hide_album_thumbnail), 'title' => !empty($photonic_smug_hide_album_title), 'counter' => !empty($photonic_smug_hide_album_photo_count)); $counters = array('photos' => $album->ImageCount); if (empty($display)) { $display = 'in-page'; } $insert = $this->process_object_header($header_object, 'album', $hidden, $counters, empty($photonic_smug_disable_title_link), $display); if (isset($shortcode_attr['display']) && $shortcode_attr['display'] == 'popup') { // Do nothing. We will insert this into the popup. } else { $ret .= $insert; } } else { if ($body->stat == 'fail' && $body->code == 31) { $passworded = false; } } } else { if ($call == 'smugmug.images.get') { if (!$passworded) { if (isset($insert)) { $ret .= $this->process_images($response, $columns, $shortcode_attr, $insert); } else { $ret .= $this->process_images($response, $columns, $shortcode_attr); } } } else { if ($call == 'smugmug.users.getTree') { $body = $response['body']; $body = json_decode($body); if ($body->stat == 'ok') { $categories = $body->Categories; if (is_array($categories) && count($categories) > 0) { $ret .= "<ul class='photonic-tree'>"; foreach ($categories as $category) { if (isset($category->Albums)) { $albums = $category->Albums; $album_text = $this->process_albums($albums, $columns); if (!empty($album_text)) { $ret .= "<li>"; $ret .= "<div class='photonic-smug-category'><span class='photonic-header-title photonic-category-title'>{$category->Name}</span></div>"; $ret .= $album_text; $ret .= "</li>"; } } if (isset($category->SubCategories)) { $sub_categories = $category->SubCategories; $ret .= "<li>"; if (is_array($sub_categories) && count($sub_categories) > 0) { $ret .= "<ul class='photonic-sub-tree'>"; foreach ($sub_categories as $sub_category) { $albums = $sub_category->Albums; $ret .= "<li>"; $ret .= "<div class='photonic-smug-sub-category'><span class='photonic-header-title photonic-sub-category-title'>{$sub_category->Name}</span></div>"; $ret .= $this->process_albums($albums, $columns); $ret .= "</li>"; } $ret .= "</ul>"; } $ret .= "</li>"; } } $ret .= "</ul>"; } } } } } } } return $ret; } return ''; }
/** * Method to validate that the stored token is indeed authenticated. * * @param $request_token * @return array|WP_Error */ function check_access_token($request_token) { $parameters = array('method' => $this->check_access_token_method(), 'format' => 'json', 'nojsoncallback' => 1); $signed_parameters = $this->sign_call($this->end_point(), 'GET', $parameters); $end_point = $this->end_point(); $end_point .= '?' . Photonic_Processor::build_query($signed_parameters); $parameters = null; $response = Photonic::http($end_point, 'GET', $parameters); return $response; }
echo $selected_tab; ?> ' "; len = newValues.length; for (var i=0; i<len; i++) { shortcode += newValues[i] + ' '; } shortcode += ']'; $j('#photonic-preview').text(shortcode); $j('#photonic-shortcode').val(shortcode); }); $j('#photonic-shortcode-form select').change(); }); </script> <?php $fields = array('default' => array('name' => __('WP Galleries', 'photonic'), 'fields' => array(array('id' => 'id', 'name' => __('Gallery ID', 'photonic'), 'type' => 'text', 'req' => true), array('id' => 'ids', 'name' => __('Image IDs', 'photonic'), 'type' => 'text', 'hint' => __('Comma-separated. You can specify this if there is no Gallery ID specified.', 'photonic')), array('id' => 'style', 'name' => __('Display Style', 'photonic'), 'type' => 'select', 'options' => array('strip-below' => __('Thumbnails below slideshow', 'photonic'), 'strip-above' => __('Thumbnails above slideshow', 'photonic'), 'no-strip' => __('No thumbnails - only slideshow', 'photonic'), 'launch' => __('Only thumbnails - click for slideshow', 'photonic'))), array('id' => 'fx', 'name' => __('Slideshow Effects', 'photonic'), 'type' => 'select', 'options' => array('fade' => __('Fade', 'photonic'), 'scrollUp' => __('Scroll Up', 'photonic'), 'scrollDown' => __('Scroll Down', 'photonic'), 'scrollLeft' => __('Scroll Left', 'photonic'), 'scrollRight' => __('Scroll Right', 'photonic'), 'scrollHorz' => __('Scroll Horizontal', 'photonic'), 'scrollVert' => __('Scroll Vertical', 'photonic'), 'slideX' => __('Slide X', 'photonic'), 'slideY' => __('Slide Y', 'photonic'), 'turnUp' => __('Turn Up', 'photonic'), 'turnDown' => __('Turn Down', 'photonic'), 'turnLeft' => __('Turn Left', 'photonic'), 'turnRight' => __('Turn Right', 'photonic'), 'zoom' => __('Zoom', 'photonic'), 'fadeZoom' => __('Fade Zoom', 'photonic'), 'blindX' => __('Blind X', 'photonic'), 'blindY' => __('Blind Y', 'photonic'), 'blindZ' => __('Blind Z', 'photonic'), 'growX' => __('Grow X', 'photonic'), 'growY' => __('Grow Y', 'photonic'), 'curtainX' => __('Curtain-X', 'photonic'), 'curtainY' => __('Curtain-Y', 'photonic'), 'cover' => __('Cover', 'photonic'), 'uncover' => __('Uncover', 'photonic'), 'wipe' => __('Wipe', 'photonic'))), array('id' => 'slideshow_height', 'name' => __('Slideshow Height', 'photonic'), 'type' => 'text', 'std' => 500, 'hint' => __('In pixels. This is applicable only if you are displaying the slideshow directly on the page.', 'photonic'), 'req' => true), array('id' => 'columns', 'name' => __('Number of columns', 'photonic'), 'type' => 'text', 'std' => 3), array('id' => 'thumb_width', 'name' => __('Thumbnail width', 'photonic'), 'type' => 'text', 'std' => 75, 'hint' => __('In pixels', 'photonic')), array('id' => 'thumb_height', 'name' => __('Thumbnail height', 'photonic'), 'type' => 'text', 'std' => 75, 'hint' => __('In pixels', 'photonic')), array('id' => 'thumbnail_size', 'name' => __('Thumbnail size', 'photonic'), 'type' => 'raw', 'std' => Photonic::get_image_sizes_selection('thumbnail_size', false), 'hint' => __('Sizes defined by your theme. Image picked here will be resized to the dimensions above.', 'photonic')), array('id' => 'slide_size', 'name' => __('Slides image size', 'photonic'), 'type' => 'raw', 'std' => Photonic::get_image_sizes_selection('slide_size', true), 'hint' => __('Sizes defined by your theme. Applies to slideshows only. Avoid loading large sizes to reduce page loads.', 'photonic')), array('id' => 'timeout', 'name' => __('Time between slides in ms', 'photonic'), 'type' => 'text', 'std' => 4000, 'hint' => __('Applies to slideshows only', 'photonic')), array('id' => 'speed', 'name' => __('Time for each transition in ms', 'photonic'), 'type' => 'text', 'std' => 1000, 'hint' => __('Applies to slideshows only', 'photonic')))), 'flickr' => array('name' => __('Flickr', 'photonic'), 'prelude' => __('You have to define your Flickr API Key under Photonic → Settings → Flickr → Flickr Settings', 'photonic'), 'fields' => array(array('id' => 'user_id', 'name' => __('User ID', 'photonic'), 'type' => 'text', 'req' => true, 'hint' => __('Find your user ID from Photonic → Helpers.', 'photonic')), array('id' => 'view', 'name' => __('Display', 'photonic'), 'type' => 'select', 'options' => array('photos' => __('Photos', 'photonic'), 'photosets' => __('Photosets', 'photonic'), 'galleries' => __('Galleries', 'photonic'), 'collections' => __('Collections', 'photonic'), 'photo' => __('Single Photo', 'photonic')), 'req' => true), array('id' => 'photoset_id', 'name' => __('Photoset ID', 'photonic'), 'type' => 'text', 'hint' => __('Will show a single photoset if "Display" is set to "Photosets"', 'photonic')), array('id' => 'gallery_id', 'name' => __('Gallery ID', 'photonic'), 'type' => 'text', 'hint' => __('Will show a single gallery if "Display" is set to "Galleries"', 'photonic')), array('id' => 'collection_id', 'name' => __('Collection ID', 'photonic'), 'type' => 'text', 'hint' => __('Will show contents of a single collection if "Display" is set to "Collections"', 'photonic')), array('id' => 'photo_id', 'name' => __('Photo ID', 'photonic'), 'type' => 'text', 'hint' => __('Will show a single photo if "Display" is set to "Single Photo"', 'photonic')), array('id' => 'columns', 'name' => __('Number of columns', 'photonic'), 'type' => 'text'), array('id' => 'tags', 'name' => __('Tags', 'photonic'), 'type' => 'text', 'hint' => __('Comma-separated list of tags', 'photonic')), array('id' => 'tag_mode', 'name' => __('Tag mode', 'photonic'), 'type' => 'select', 'options' => array('any' => __('Any tag', 'photonic'), 'all' => __('All tags', 'photonic'))), array('id' => 'text', 'name' => __('With text', 'photonic'), 'type' => 'text'), array('id' => 'sort', 'name' => __('Sort by', 'photonic'), 'type' => 'select', 'options' => array('date-posted-desc' => __('Date posted, descending', 'photonic'), 'date-posted-asc' => __('Date posted, ascending', 'photonic'), 'date-taken-asc' => __('Date taken, ascending', 'photonic'), 'date-taken-desc' => __('Date taken, descending', 'photonic'), 'interestingness-desc' => __('Interestingness, descending', 'photonic'), 'interestingness-asc' => __('Interestingness, ascending', 'photonic'), 'relevance' => __('Relevance', 'photonic'))), array('id' => 'group_id', 'name' => __('Group ID', 'photonic'), 'type' => 'text'), array('id' => 'per_page', 'name' => __('Number of photos to show', 'photonic'), 'type' => 'text'), array('id' => 'privacy_filter', 'name' => __('Privacy filter', 'photonic'), 'type' => 'select', 'options' => array('' => __('None', 'photonic'), '1' => __('Public photos', 'photonic'), '2' => __('Private photos visible to friends', 'photonic'), '3' => __('Private photos visible to family', 'photonic'), '4' => __('Private photos visible to friends & family', 'photonic'), '5' => __('Completely private photos', 'photonic')), 'hint' => __('Applicable only if Flickr private photos are turned on', 'photonic')))), 'picasa' => array('name' => __('Picasa', 'photonic'), 'fields' => array(array('id' => 'user_id', 'name' => __('User ID', 'photonic'), 'type' => 'text', 'req' => true), array('id' => 'kind', 'name' => __('Display', 'photonic'), 'type' => 'select', 'options' => array('album' => __('Albums', 'photonic'), 'photo' => __('Photos', 'photonic'))), array('id' => 'album', 'name' => __('Album', 'photonic'), 'type' => 'text'), array('id' => 'max_results', 'name' => __('Number of photos to show', 'photonic'), 'type' => 'text'), array('id' => 'thumbsize', 'name' => __('Thumbnail size', 'photonic'), 'type' => 'text', 'std' => 75, 'hint' => __('In pixels', 'photonic')))), 'smugmug' => array('name' => __('SmugMug', 'photonic'), 'prelude' => __('You have to define your SmugMug API Key under Photonic → Settings → SmugMug → SmugMug Settings', 'photonic'), 'fields' => array(array('id' => 'view', 'name' => __('Display', 'photonic'), 'type' => 'select', 'options' => array('tree' => __('Tree', 'photonic'), 'albums' => __('All albums', 'photonic'), 'album' => __('Single Album', 'photonic')), 'req' => true), array('id' => 'nick_name', 'name' => __('Nickname', 'photonic'), 'type' => 'text', 'hint' => __('If your SmugMug URL is http://joe-sixpack.smugmug.com, this is "joe-sixpack". Required if the "Display" is "Tree" or "All albums".', 'photonic')), array('id' => 'album', 'name' => __('Album', 'photonic'), 'type' => 'text', 'hint' => __('Required if you are showing "Single Album" above. If your gallery URL is http://nick-name.smugmug.com/gallery/<b>abcdefgh_123456</b>, this is <b>abcdefgh_123456</b>', 'photonic')), array('id' => 'columns', 'name' => __('Number of columns', 'photonic'), 'type' => 'text'))), '500px' => array('name' => __('500px', 'photonic'), 'prelude' => __('You have to define your Consumer API Key under Photonic → Settings → 500px → 500px Settings', 'photonic'), 'fields' => array(array('id' => 'view', 'name' => __('Display', 'photonic'), 'type' => 'select', 'options' => array('photos' => __('Photos', 'photonic'), 'collections' => __('Collections', 'photonic')), 'req' => true), array('id' => 'view_id', 'name' => __('Object ID', 'photonic'), 'type' => 'text', 'hint' => __('Required if you are displaying collections or a single photo', 'photonic')), array('id' => 'feature', 'name' => __('Feature', 'photonic'), 'type' => 'select', 'options' => array('popular' => __('Popular photos', 'photonic'), 'upcoming' => __('Upcoming photos', 'photonic'), 'editors' => __("Editor's choices", 'photonic'), 'fresh_today' => __('Fresh today', 'photonic'), 'fresh_yesterday' => __('Fresh today', 'photonic'), 'fresh_week' => __('Fresh today', 'photonic'), 'user' => __("Specified user's photos", 'photonic'), 'user_friends' => __("Photos of specified user's friends", 'photonic'), 'user_favorites' => __("Specified user's favourite photos", 'photonic')), 'req' => true, 'hint' => __('Required if you are displaying photos', 'photonic')), array('id' => 'user_id', 'name' => __('User ID', 'photonic'), 'type' => 'text', 'hint' => __('Either User ID or User Name is required if Feature is user-specific', 'photonic')), array('id' => 'username', 'name' => __('User Name', 'photonic'), 'type' => 'text', 'hint' => __('Either User ID or User Name is required if Feature is user-specific', 'photonic')), array('id' => 'only', 'name' => __('Include category', 'photonic'), 'type' => 'select', 'options' => array('' => __('All Categories', 'photonic'), 'Abstract' => __('Abstract', 'photonic'), 'Animals' => __('Animals', 'photonic'), 'Black and White' => __("Black and White", 'photonic'), 'Celebrities' => __('Celebrities', 'photonic'), 'City and Architecture' => __('Fresh today', 'photonic'), 'Commercial' => __('Commercial', 'photonic'), 'Concert' => __("Concert", 'photonic'), 'Family' => __("Family", 'photonic'), 'Fashion' => __("Fashion", 'photonic'), 'Film' => __("Film", 'photonic'), 'Fine Art' => __("Fine Art", 'photonic'), 'Food' => __("Food", 'photonic'), 'Journalism' => __("Journalism", 'photonic'), 'Landscapes' => __("Landscapes", 'photonic'), 'Macro' => __("Macro", 'photonic'), 'Nature' => __("Nature", 'photonic'), 'Nude' => __("Nude", 'photonic'), 'People' => __("People", 'photonic'), 'Performing Arts' => __("Performing Arts", 'photonic'), 'Sport' => __("Sport", 'photonic'), 'Still Life' => __("Still Life", 'photonic'), 'Street' => __("Street", 'photonic'), 'Transportation' => __("Transportation", 'photonic'), 'Travel' => __("Travel", 'photonic'), 'Underwater' => __("Underwater", 'photonic'), 'Urban Exploration' => __("Urban Exploration", 'photonic'), 'Wedding' => __("Wedding", 'photonic'))), array('id' => 'exclude', 'name' => __('Exclude category', 'photonic'), 'type' => 'select', 'options' => array('' => __('No Category', 'photonic'), 'Abstract' => __('Abstract', 'photonic'), 'Animals' => __('Animals', 'photonic'), 'Black and White' => __("Black and White", 'photonic'), 'Celebrities' => __('Celebrities', 'photonic'), 'City and Architecture' => __('Fresh today', 'photonic'), 'Commercial' => __('Commercial', 'photonic'), 'Concert' => __("Concert", 'photonic'), 'Family' => __("Family", 'photonic'), 'Fashion' => __("Fashion", 'photonic'), 'Film' => __("Film", 'photonic'), 'Fine Art' => __("Fine Art", 'photonic'), 'Food' => __("Food", 'photonic'), 'Journalism' => __("Journalism", 'photonic'), 'Landscapes' => __("Landscapes", 'photonic'), 'Macro' => __("Macro", 'photonic'), 'Nature' => __("Nature", 'photonic'), 'Nude' => __("Nude", 'photonic'), 'People' => __("People", 'photonic'), 'Performing Arts' => __("Performing Arts", 'photonic'), 'Sport' => __("Sport", 'photonic'), 'Still Life' => __("Still Life", 'photonic'), 'Street' => __("Street", 'photonic'), 'Transportation' => __("Transportation", 'photonic'), 'Travel' => __("Travel", 'photonic'), 'Underwater' => __("Underwater", 'photonic'), 'Urban Exploration' => __("Urban Exploration", 'photonic'), 'Wedding' => __("Wedding", 'photonic'))), array('id' => 'sort', 'name' => __('Sort by', 'photonic'), 'type' => 'select', 'options' => array('created_at' => __('Created at', 'photonic'), 'rating' => __('Rating', 'photonic'), 'times_viewed' => __('Times viewed', 'photonic'), 'votes_count' => __('Votes count', 'photonic'), 'favorites_count' => __('Favorites count', 'photonic'), 'comments_count' => __('Comments count', 'photonic'), 'taken_at' => __('Taken at', 'photonic'))), array('id' => 'tag', 'name' => __('Tags', 'photonic'), 'type' => 'text', 'hint' => __('Comma-separated list of tags (above criteria will not apply)', 'photonic')), array('id' => 'term', 'name' => __('Search terms', 'photonic'), 'type' => 'text', 'hint' => __('Comma-separated list of search terms (above criteria will not apply)', 'photonic')), array('id' => 'rpp', 'name' => __('Number of photos to show', 'photonic'), 'type' => 'text', 'std' => 20), array('id' => 'date_from', 'name' => __('From this date', 'photonic'), 'type' => 'text', 'hint' => __('Format: yyyy-mm-dd. Use this to filter from a certain date (this is the start date). Keep "Sort by" to "Created at"!', 'photonic')), array('id' => 'date_to', 'name' => __('To this date', 'photonic'), 'type' => 'text', 'hint' => __('Format: yyyy-mm-dd. Use this to filter to a certain date (this is the end date). Keep "Sort by" to "Created at"!', 'photonic')), array('id' => 'thumb_size', 'name' => __('Thumbnail size', 'photonic'), 'type' => 'select', 'options' => array('1' => __('75 × 75 px', 'photonic'), '2' => __('140 × 140 px', 'photonic'), '3' => __('280 × 280 px', 'photonic'), '100' => __('100 × 100 px', 'photonic'), '200' => __('200 × 200 px', 'photonic'), '440' => __('440 × 440 px', 'photonic'), '600' => __('600 × 600 px', 'photonic'))), array('id' => 'main_size', 'name' => __('Main image size', 'photonic'), 'type' => 'select', 'options' => array('3' => __('280 × 280 px', 'photonic'), '4' => __('900px on the longest edge', 'photonic'), '5' => __('1170px on the longest edge', 'photonic'), '1080' => __('1080px on the longest edge', 'photonic'), '1600' => __('1600px on the longest edge', 'photonic'), '2048' => __('2048px on the longest edge', 'photonic'))), array('id' => 'columns', 'name' => __('Number of columns', 'photonic'), 'type' => 'text'))), 'zenfolio' => array('name' => __('Zenfolio', 'photonic'), 'prelude' => '', 'fields' => array(array('id' => 'view', 'name' => __('Display', 'photonic'), 'type' => 'select', 'options' => array('photos' => __('Photos', 'photonic'), 'photosets' => __('Photosets', 'photonic'), 'hierarchy' => __('Group Hierarchy', 'photonic'), 'group' => __('Group', 'photonic')), 'req' => true), array('id' => 'object_id', 'name' => __('Object ID', 'photonic'), 'type' => 'text', 'hint' => __('Can be set if "Display" is <code>Photos</code>, <code>Photosets</code> or <code>Group</code>.', 'photonic')), array('id' => 'text', 'name' => __('Search by text', 'photonic'), 'type' => 'text', 'hint' => __('Can be set if "Display" is <code>Photos</code> or <code>Photosets</code>.', 'photonic')), array('id' => 'category_code', 'name' => __('Search by category code', 'photonic'), 'type' => 'text', 'hint' => __('Can be set if "Display" is <code>Photos</code> or <code>Photosets</code>.', 'photonic') . '<br/>' . __('See the list of categories from <em>Photonic → Helpers</em>.', 'photonic')), array('id' => 'sort_order', 'name' => __('Search results sort order', 'photonic'), 'type' => 'select', 'options' => array('' => '', 'Date' => __('Date', 'photonic'), 'Popularity' => __('Popularity', 'photonic'), 'Rank' => __('Rank (for searching by text only)', 'photonic')), 'hint' => __('Can be set if "Display" is <code>Photos</code> or <code>Photosets</code>.', 'photonic') . '<br/>' . __('For search results only.', 'photonic')), array('id' => 'photoset_type', 'name' => __('Photoset type', 'photonic'), 'type' => 'select', 'options' => array('' => '', 'Gallery' => __('Gallery', 'photonic'), 'Collection' => __('Collection', 'photonic')), 'hint' => __('Mandatory if Display = Photosets and no Object ID is specified.', 'photonic')), array('id' => 'kind', 'name' => __('Display classification', 'photonic'), 'type' => 'select', 'options' => array('' => '', 'popular' => __('Popular', 'photonic'), 'recent' => __('Recent', 'photonic')), 'hint' => __('Mandatory if "Display" is <code>Photos</code> or <code>Photosets</code>, and none of the other criteria above is specified.', 'photonic')), array('id' => 'login_name', 'name' => __('Login name', 'photonic'), 'type' => 'text', 'hint' => __('Mandatory if Display = Hierarchy', 'photonic')), array('id' => 'thumb_size', 'name' => __('Thumbnail size', 'photonic'), 'type' => 'select', 'std' => 1, "options" => array("1" => __("Square thumbnail, 60 x 60px, cropped square", 'photonic'), "0" => __("Small thumbnail, upto 80 x 80px", 'photonic'), "10" => __("Medium thumbnail, upto 120 x 120px", 'photonic'), "11" => __("Large thumbnail, upto 120 x 120px", 'photonic'), "2" => __("Small image, upto 400 x 400px", 'photonic'))), array('id' => 'columns', 'name' => __('Number of columns', 'photonic'), 'type' => 'text'), array('id' => 'limit', 'name' => __('Number of photos to show', 'photonic'), 'type' => 'text'))), 'instagram' => array('name' => __('Instagram', 'photonic'), 'prelude' => __('You have to define your Instagram Client ID under Photonic → Settings → Instagram → Instagram Settings', 'photonic'), 'fields' => array(array('id' => 'view', 'name' => __('Display', 'photonic'), 'type' => 'select', 'options' => array('media' => __('Photos', 'photonic'), 'user' => __('Users', 'photonic'), 'tag' => __('Tag', 'photonic'), 'location' => __('Location', 'photonic'), 'photo' => __('Single Photo', 'photonic')), 'req' => true), array('id' => 'kind', 'name' => __('Display classification', 'photonic'), 'type' => 'select', 'options' => array('popular' => __('Popular (If Display = Photos)', 'photonic'), 'search' => __('Search (If Display = Photos)', 'photonic'), 'recent' => __('Recent (If Display = Users)', 'photonic'), 'follows' => __('Follows (If Display = Users)', 'photonic'), 'followed-by' => __('Followed by (If Display = Users)', 'photonic')), 'req' => true), array('id' => 'user_id', 'name' => __('User ID', 'photonic'), 'type' => 'text', 'hint' => __('Find your user ID from Photonic → Helpers.', 'photonic') . '<br/>' . __('Required if "Display" is set to "Users"', 'photnic')), array('id' => 'media_id', 'name' => __('Media ID', 'photonic'), 'type' => 'text', 'hint' => __('Required if "Display" is set to "Single Photos".', 'photonic') . '<br/>' . __('If your photo is at <code>http://instagram.com/p/ABcde5678fg/</code>, your media id is <code>ABcde5678fg</code>.', 'photonic')), array('id' => 'tag_name', 'name' => __('Tag', 'photonic'), 'type' => 'text', 'hint' => __('Required if "Display" is set to "Tag"', 'photonic')), array('id' => 'lat', 'name' => __('Latitude', 'photonic'), 'type' => 'text', 'hint' => __('Latitude and Longitude are required if "Display" = "Photos" and "Display Classification" = "Search"', 'photonic')), array('id' => 'lng', 'name' => __('Longitude', 'photonic'), 'type' => 'text', 'hint' => __('Latitude and Longitude are required if "Display" = "Photos" and "Display Classification" = "Search"', 'photonic')), array('id' => 'location_id', 'name' => __('Location ID', 'photonic'), 'type' => 'text', 'hint' => __('Required if "Display" is set to "Location".', 'photonic')), array('id' => 'thumb_size', 'name' => __('Thumbnail size', 'photonic'), 'type' => 'text', 'std' => 75, 'hint' => __('In pixels', 'photonic')), array('id' => 'min_id', 'name' => __('Min Photo ID', 'photonic'), 'type' => 'text', 'hint' => __('Use the min and max ID to reduce your matches for "Search" and "Tag" displays', 'photonic')), array('id' => 'max_id', 'name' => __('Max Photo ID', 'photonic'), 'type' => 'text', 'hint' => __('Use the min and max ID to reduce your matches for "Search" and "Tag" displays', 'photonic')), array('id' => 'columns', 'name' => __('Number of columns', 'photonic'), 'type' => 'text'), array('id' => 'count', 'name' => __('Number of photos to show', 'photonic'), 'type' => 'text')))); $tab_list = ''; $tab_fields = ''; $field_list = array(); $prelude = ''; foreach ($fields as $tab => $field_group) { $tab_list .= "<li><a href='" . esc_url(add_query_arg(array('photonic-tab' => $tab))) . "' class='" . ($tab == $selected_tab ? 'current' : '') . "'>" . esc_attr($field_group['name']) . "</a> | </li>"; if ($tab == $selected_tab) { $field_list = $field_group['fields']; $prelude = isset($field_group['prelude']) ? $field_group['prelude'] : ''; } } echo "<form id='photonic-shortcode-form' method='post' action=''>"; echo "<ul class='subsubsub'>"; if (strlen($tab_list) > 8) { $tab_list = substr($tab_list, 0, -8);