Changeset 808889
- Timestamp:
- 11/22/2013 02:37:42 PM (12 years ago)
- Location:
- wp-quadratum/trunk
- Files:
-
- 126 added
- 1 deleted
- 10 edited
-
assets (deleted)
-
css/wp-quadratum-admin.css (modified) (1 diff)
-
css/wp-quadratum-admin.min.css (modified) (1 diff)
-
includes/class-wp-quadratum-admin.php (modified) (16 diffs)
-
includes/class-wp-quadratum-frontend.php (modified) (7 diffs)
-
includes/class-wp-quadratum.php (modified) (5 diffs)
-
includes/factual-php-driver (added)
-
includes/factual-php-driver/CHANGELOG.md (added)
-
includes/factual-php-driver/DiffsQuery.php (added)
-
includes/factual-php-driver/DiffsResponse.php (added)
-
includes/factual-php-driver/FacetQuery.php (added)
-
includes/factual-php-driver/Factual.php (added)
-
includes/factual-php-driver/FactualApiException.php (added)
-
includes/factual-php-driver/FactualCircle.php (added)
-
includes/factual-php-driver/FactualClearor.php (added)
-
includes/factual-php-driver/FactualColumnSchema.php (added)
-
includes/factual-php-driver/FactualFilter.php (added)
-
includes/factual-php-driver/FactualFlagger.php (added)
-
includes/factual-php-driver/FactualPlace.php (added)
-
includes/factual-php-driver/FactualPoint.php (added)
-
includes/factual-php-driver/FactualPost.php (added)
-
includes/factual-php-driver/FactualQuery.php (added)
-
includes/factual-php-driver/FactualResponse.php (added)
-
includes/factual-php-driver/FactualSubmittor.php (added)
-
includes/factual-php-driver/FactualTest.php (added)
-
includes/factual-php-driver/FieldFilter.php (added)
-
includes/factual-php-driver/FilterGroup.php (added)
-
includes/factual-php-driver/FlagResponse.php (added)
-
includes/factual-php-driver/GeocoderWrapper.php (added)
-
includes/factual-php-driver/LICENSE.txt (added)
-
includes/factual-php-driver/MatchQuery.php (added)
-
includes/factual-php-driver/MatchResponse.php (added)
-
includes/factual-php-driver/MultiResponse.php (added)
-
includes/factual-php-driver/QueryBuilder.php (added)
-
includes/factual-php-driver/README.md (added)
-
includes/factual-php-driver/ReadResponse.php (added)
-
includes/factual-php-driver/ResolveQuery.php (added)
-
includes/factual-php-driver/ResolveResponse.php (added)
-
includes/factual-php-driver/SchemaResponse.php (added)
-
includes/factual-php-driver/SubmitResponse.php (added)
-
includes/factual-php-driver/composer.json (added)
-
includes/factual-php-driver/config.ini (added)
-
includes/factual-php-driver/oauth-php (added)
-
includes/factual-php-driver/oauth-php/LICENSE (added)
-
includes/factual-php-driver/oauth-php/README (added)
-
includes/factual-php-driver/oauth-php/library (added)
-
includes/factual-php-driver/oauth-php/library/OAuthDiscovery.php (added)
-
includes/factual-php-driver/oauth-php/library/OAuthException2.php (added)
-
includes/factual-php-driver/oauth-php/library/OAuthRequest.php (added)
-
includes/factual-php-driver/oauth-php/library/OAuthRequestLogger.php (added)
-
includes/factual-php-driver/oauth-php/library/OAuthRequestSigner.php (added)
-
includes/factual-php-driver/oauth-php/library/OAuthRequestVerifier.php (added)
-
includes/factual-php-driver/oauth-php/library/OAuthRequester.php (added)
-
includes/factual-php-driver/oauth-php/library/OAuthServer.php (added)
-
includes/factual-php-driver/oauth-php/library/OAuthSession.php (added)
-
includes/factual-php-driver/oauth-php/library/OAuthStore.php (added)
-
includes/factual-php-driver/oauth-php/library/body (added)
-
includes/factual-php-driver/oauth-php/library/body/OAuthBodyContentDisposition.php (added)
-
includes/factual-php-driver/oauth-php/library/body/OAuthBodyMultipartFormdata.php (added)
-
includes/factual-php-driver/oauth-php/library/discovery (added)
-
includes/factual-php-driver/oauth-php/library/discovery/xrds_parse.php (added)
-
includes/factual-php-driver/oauth-php/library/discovery/xrds_parse.txt (added)
-
includes/factual-php-driver/oauth-php/library/session (added)
-
includes/factual-php-driver/oauth-php/library/session/OAuthSessionAbstract.class.php (added)
-
includes/factual-php-driver/oauth-php/library/session/OAuthSessionSESSION.php (added)
-
includes/factual-php-driver/oauth-php/library/signature_method (added)
-
includes/factual-php-driver/oauth-php/library/signature_method/OAuthSignatureMethod.class.php (added)
-
includes/factual-php-driver/oauth-php/library/signature_method/OAuthSignatureMethod_HMAC_SHA1.php (added)
-
includes/factual-php-driver/oauth-php/library/signature_method/OAuthSignatureMethod_MD5.php (added)
-
includes/factual-php-driver/oauth-php/library/signature_method/OAuthSignatureMethod_PLAINTEXT.php (added)
-
includes/factual-php-driver/oauth-php/library/signature_method/OAuthSignatureMethod_RSA_SHA1.php (added)
-
includes/factual-php-driver/oauth-php/library/store (added)
-
includes/factual-php-driver/oauth-php/library/store/OAuthStore2Leg.php (added)
-
includes/factual-php-driver/oauth-php/library/store/OAuthStoreAbstract.class.php (added)
-
includes/factual-php-driver/oauth-php/library/store/OAuthStoreAnyMeta.php (added)
-
includes/factual-php-driver/oauth-php/library/store/OAuthStoreMySQL.php (added)
-
includes/factual-php-driver/oauth-php/library/store/OAuthStoreMySQLi.php (added)
-
includes/factual-php-driver/oauth-php/library/store/OAuthStoreOracle.php (added)
-
includes/factual-php-driver/oauth-php/library/store/OAuthStorePDO.php (added)
-
includes/factual-php-driver/oauth-php/library/store/OAuthStorePostgreSQL.php (added)
-
includes/factual-php-driver/oauth-php/library/store/OAuthStoreSQL.php (added)
-
includes/factual-php-driver/oauth-php/library/store/OAuthStoreSession.php (added)
-
includes/factual-php-driver/oauth-php/library/store/mysql (added)
-
includes/factual-php-driver/oauth-php/library/store/mysql/install.php (added)
-
includes/factual-php-driver/oauth-php/library/store/mysql/mysql.sql (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/1_Tables (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/1_Tables/TABLES.sql (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/2_Sequences (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/2_Sequences/SEQUENCES.sql (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_ADD_CONSUMER_REQUEST_TOKEN.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_ADD_LOG.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_ADD_SERVER_TOKEN.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_AUTH_CONSUMER_REQ_TOKEN.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_CHECK_SERVER_NONCE.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_CONSUMER_STATIC_SAVE.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_COUNT_CONSUMER_ACCESS_TOKEN.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_COUNT_SERVICE_TOKENS.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_DELETE_CONSUMER.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_DELETE_SERVER.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_DELETE_SERVER_TOKEN.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_DEL_CONSUMER_ACCESS_TOKEN.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_DEL_CONSUMER_REQUEST_TOKEN.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_EXCH_CONS_REQ_FOR_ACC_TOKEN.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_CONSUMER.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_CONSUMER_ACCESS_TOKEN.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_CONSUMER_REQUEST_TOKEN.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_CONSUMER_STATIC_SELECT.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_SECRETS_FOR_SIGNATURE.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_SECRETS_FOR_VERIFY.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_SERVER.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_SERVER_FOR_URI.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_SERVER_TOKEN.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_SERVER_TOKEN_SECRETS.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_LIST_CONSUMERS.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_LIST_CONSUMER_TOKENS.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_LIST_LOG.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_LIST_SERVERS.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_LIST_SERVER_TOKENS.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_SET_CONSUMER_ACC_TOKEN_TTL.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_SET_SERVER_TOKEN_TTL.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_UPDATE_CONSUMER.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_UPDATE_SERVER.prc (added)
-
includes/factual-php-driver/oauth-php/library/store/oracle/install.php (added)
-
includes/factual-php-driver/oauth-php/library/store/postgresql (added)
-
includes/factual-php-driver/oauth-php/library/store/postgresql/pgsql.sql (added)
-
includes/factual-php-driver/test.php (added)
-
js/wp-quadratum-admin.js (modified) (1 diff)
-
js/wp-quadratum-admin.min.js (modified) (1 diff)
-
license.txt (added)
-
readme.txt (modified) (11 diffs)
-
tools (added)
-
tools/git2svn.sh (added)
-
uninstall.php (modified) (1 diff)
-
wp-quadratum.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-quadratum/trunk/css/wp-quadratum-admin.css
r531408 r808889 51 51 background: #FCB2B5 url(../images/error.png) no-repeat 5px center; 52 52 } 53 54 #wp-quadratum-client-id, #wp-quadratum-client-secret, 55 #wp-quadratum-factual-oauth-key, #wp-quadratum-factual-oauth-secret { 56 width: 450px; 57 } -
wp-quadratum/trunk/css/wp-quadratum-admin.min.css
r580206 r808889 1 @charset "utf-8";.wp-quadratum-postbox-settings{width:60%;padding:0 0 0 0}.wp-quadratum-postbox-sidebar{width:30%;padding:0 0 0 10px}.wp-quadratum-postbox-sidebar ul{list-style:square;padding:0 0 0 1em}.wp-quadratum-success{border:1px solid #8ACEFF;padding:3px 15px 4px 27px;display:block;margin-bottom:5px;font-size:11px;line-height:15px;-moz-border-radius:3px;-webkit-border-radius:3px;background:#E2F5FE url(../images/success.png) no-repeat 5px center}.wp-quadratum-warning{border:1px solid #F8C44F;padding:3px 15px 4px 27px;display:block;margin-bottom:5px;font-size:11px;line-height:15px;-moz-border-radius:3px;-webkit-border-radius:3px;background:#FEE8B9 url(../images/warning.png) no-repeat 5px center}.wp-quadratum-error{border:1px solid #F96764;padding:3px 15px 4px 27px;display:block;margin-bottom:5px;font-size:11px;line-height:15px;-moz-border-radius:3px;-webkit-border-radius:3px;background:#FCB2B5 url(../images/error.png) no-repeat 5px center} 1 @charset "utf-8";.wp-quadratum-postbox-settings{width:60%;padding:0 0 0 0}.wp-quadratum-postbox-sidebar{width:30%;padding:0 0 0 10px}.wp-quadratum-postbox-sidebar ul{list-style:square;padding:0 0 0 1em}.wp-quadratum-success{border:1px solid #8ACEFF;padding:3px 15px 4px 27px;display:block;margin-bottom:5px;font-size:11px;line-height:15px;-moz-border-radius:3px;-webkit-border-radius:3px;background:#E2F5FE url(../images/success.png) no-repeat 5px center}.wp-quadratum-warning{border:1px solid #F8C44F;padding:3px 15px 4px 27px;display:block;margin-bottom:5px;font-size:11px;line-height:15px;-moz-border-radius:3px;-webkit-border-radius:3px;background:#FEE8B9 url(../images/warning.png) no-repeat 5px center}.wp-quadratum-error{border:1px solid #F96764;padding:3px 15px 4px 27px;display:block;margin-bottom:5px;font-size:11px;line-height:15px;-moz-border-radius:3px;-webkit-border-radius:3px;background:#FCB2B5 url(../images/error.png) no-repeat 5px center}#wp-quadratum-client-id,#wp-quadratum-client-secret,#wp-quadratum-factual-oauth-key,#wp-quadratum-factual-oauth-secret{width:450px} -
wp-quadratum/trunk/includes/class-wp-quadratum-admin.php
r761076 r808889 22 22 'foursquare' => "Foursquare", 23 23 'maps' => "Maps", 24 'shortcodes' => __('Shortcodes'), 24 25 'defaults' => "Defaults", 25 26 'colophon' => "Colophon" … … 161 162 $upgrade_settings = false; 162 163 $current_plugin_version = NULL; 163 164 164 $options = WP_Quadratum::get_option (); 165 165 166 if (is_array ($options) && 166 167 !empty ($options['version']) && … … 277 278 $this->admin_upgrade_option($options, 'openmq_key', ''); 278 279 $this->admin_upgrade_option($options, 'microsoft7_key', ''); 279 280 281 case '131': 282 $this->admin_upgrade_option($options, 'enable_map_sc', 'on'); 283 $this->admin_upgrade_option($options, 'enable_locality_sc', ''); 284 $this->admin_upgrade_option($options, 'factual_oauth_key', ''); 285 $this->admin_upgrade_option($options, 'factual_oauth_secret', ''); 286 287 $cache = array(); 288 $cache['timestamp'] = time(); 289 $cache['checkin'] = null; 290 $cache['locality'] = null; 291 update_option(WP_Quadratum::CACHE, $cache); 292 280 293 $options['version'] = WP_Quadratum::VERSION; 281 294 $upgrade_settings = true; … … 307 320 $foursquare_settings = array (); 308 321 $foursquare_title = __('Foursquare OAuth Settings'); 322 $factual_title = __('Factual OAuth Settings'); 309 323 $nokia_settings = array (); 310 324 $nokia_title = __('Nokia Location API Settings'); … … 317 331 $openmq_settings = array (); 318 332 $bingv7_settings = array(); 319 333 334 $shortcodes_settings = array(); 335 320 336 $tab = $this->admin_validate_tab (); 321 337 //$providers = $this->mxn->get_supported_providers (); … … 391 407 break; 392 408 409 case 'shortcodes': 410 /**************************************************************************** 411 * Shortcodes tab content 412 */ 413 414 $shortcodes_settings[] = '<p><em>' . __('This tab allows you to control whether the plugin\'s shortcodes are acted on in post or page content.', 'wp-quadratum') . '</em></p>'; 415 $shortcodes_settings[] = '<p><strong>' . __('Enable Map Shortcode Usage', 'wp-quadratum') . '</strong><br/> 416 <input type="checkbox" name="wp_quadratum_enable_map_sc" id="wp-quadratum-enable-map-sc" ' 417 .checked ($options['enable_map_sc'], 'on', false) 418 . '/> 419 <small>' . __('Enable use of the <code>[wp_quadratum]</code> and <code>[wpq_map]</code> shortcodes</em>', 'wp-quadratum') . '</small></p>'; 420 $shortcodes_settings[] = '<p><strong>' . __('Enable Locality Shortcode Usage', 'wp-quadratum') . '</strong><br/> 421 <input type="checkbox" name="wp_quadratum_enable_locality_sc" id="wp-quadratum-enable-locality-sc" ' 422 .checked ($options['enable_locality_sc'], 'on', false) 423 . '/> 424 <small>' . __('Enable use of the <code>[wp_quadratum_locality]</code> and <code>[wpq_locality]</code> shortcodes</em>', 'wp-quadratum') . '</small></p>'; 425 426 if (!empty($options['factual_oauth_key']) && !empty($options['factual_oauth_secret'])) { 427 $factual_title .= ' (' . __('Successfully Authenticated', 'wp-quadratum') . ')'; 428 } 429 else { 430 $factual_title .= ' (' . __('Not Authenticated', 'wp-quadratum') . ')'; 431 } 432 433 $have_factual_key = !empty($options['factual_oauth_key']); 434 $have_factual_secret = !empty($options['factual_oauth_secret']); 435 436 $factual_settings[] = '<p><em>' . __('You\'ve enabled support for the Locality Shortcode. This allows you to embed the postal code, address, region, locality or geographic coordinates of your last Foursquare checkin in a page or post. Unfortunately not all Foursquare Venues contain this information. WP Quadratum can obtain this missing information for you by using a service called a <a href="http://en.wikipedia.org/wiki/Reverse_geocoding" target="_blank">reverse geocoder</a> from Factual. To do this, you\'ll need to sign up for a <a href="https://www.factual.com/api-keys/request" target="_blank">Factual API Key</a> and enter the OAuth key and secret below.', 'wp-quadratum') . '</em></p>'; 437 438 $factual_settings[] = '<p><strong>' . __('Factual OAuth Key') . '</strong><br /> 439 <input type="text" name="wp_quadratum_factual_oauth_key" id="wp-quadratum-factual-oauth-key" value="' . $options['factual_oauth_key'] . '" /><br /> 440 <small>Your Factual API OAuth key</small></p>'; 441 442 $factual_settings[] = '<p><strong>' . __('Factual OAuth Secret') . '</strong><br /> 443 <input type="text" name="wp_quadratum_factual_oauth_secret" id="wp-quadratum-factual-oauth-secret" value="' . $options['factual_oauth_secret'] . '" /><br /> 444 <small>Your Factual API OAuth secret</small></p>'; 445 446 if ($have_factual_key && $have_factual_secret) { 447 $factual_settings[] = '<div class="wp-quadratum-success">' 448 . __('You are currently successfully authenticated with the Factual API.') 449 . '</div>'; 450 } 451 452 else { 453 $factual_settings[] = '<div class="wp-quadratum-warning">' 454 . __('You are not currently authenticated with the Factual API; the Locality Shortcode will be disabled.') 455 . '</div>'; 456 } 457 458 break; 459 393 460 case 'defaults': 394 461 /**************************************************************************** … … 429 496 */ 430 497 431 if (empty ($options['oauth_token'])) { 498 499 $have_oauth_token = (isset($options['oauth_token']) && !empty($options['oauth_token'])); 500 $have_client_id = (isset($options['client_id']) && !empty($options['client_id'])); 501 $have_client_secret = (isset($options['client_secret']) && !empty($options['client_secret'])); 502 503 if ($have_oauth_token) { 504 $foursquare_title .= __(' (Successfully Authenticated)'); 505 } 506 507 else { 432 508 $foursquare_title .= __(' (Not Authenticated)'); 433 509 } 434 510 435 else {436 $foursquare_title .= __(' (Successfully Authenticated)');437 }438 439 511 $foursquare_settings[] = '<p><em>' . __('This tab allows you to authenticate with Foursquare to allow WP Quadratum to display your checkins.', 'wp-quadratum') . '</em></p>'; 440 441 if (empty ($options['oauth_token'])) { 512 $foursquare_settings[] = '<div>'; 513 514 $disabled = ''; 515 if (!$have_client_id && !$have_client_secret) { 442 516 $foursquare_settings[] = '<div class="wp-quadratum-error">' 443 517 . __('You are not currently authenticated with the Foursquare API.') 444 518 . '</div>'; 445 519 446 $foursquare_settings[] = '< div><p>'520 $foursquare_settings[] = '<p>' 447 521 . __('To display your Foursquare checkins, WP Quadratum needs to be authorised to access your Foursquare account information; this is a simple, safe and secure 3 step process. WP Quadratum never sees your account login information and cannot store any personally identifiable information.') 448 522 . '</p>' … … 466 540 . __('Step 2. Copy and paste the supplied Client id and Client secret below and click on the "Save Foursquare Settings" button') 467 541 . '</strong></p>'; 468 469 $foursquare_settings[] = '<p><strong>' . __('Foursquare Client ID') . '</strong><br />470 <input type="text" name="wp_quadratum_client_id" id="wp-quadratum-client-id" value="' . $options['client_id'] . '" /><br />471 <small>Your Foursquare API Client ID</small></p>';472 473 $foursquare_settings[] = '<p><strong>' . __('Foursquare Client Secret') . '</strong><br />474 <input type="text" name="wp_quadratum_client_secret" id="wp-quadratum-client-secret" value="' . $options['client_secret'] . '" /><br />475 <small>Your Foursquare API Client Secret</small></p>';476 477 if (!empty ($options['client_id'])) {478 $foursquare_settings[] = '<p><strong>'479 . __('Step 3. You should now be authorised and ready to go; click on the <em>Connect to Foursquare</em> button below.')480 . '</strong></p>';481 482 $client_id = $options['client_id'];483 $client_secret = $options['client_secret'];484 $redirect_url = WP_Quadratum::make_redirect_url ();485 $fh = new FoursquareHelper_v1_0 ($client_id, $client_secret, $redirect_url);486 $foursquare_settings[] = '<p class="submit">'487 . '<a href="' . $fh->authentication_link () . '" class="button-primary">'488 . __('Connect to Foursquare') . '</a>'489 . '</p>';490 }491 492 $foursquare_settings[] = '</div>';493 542 } 494 543 495 544 else { 545 $disabled = ' disabled="disabled"'; 546 } 547 548 549 $foursquare_settings[] = '<p><strong>' . __('Foursquare Client ID') . '</strong><br /> 550 <input type="text" name="wp_quadratum_client_id" id="wp-quadratum-client-id" value="' . $options['client_id'] . '"' . $disabled . ' /><br /> 551 <small>Your Foursquare API Client ID</small></p>'; 552 553 $foursquare_settings[] = '<p><strong>' . __('Foursquare Client Secret') . '</strong><br /> 554 <input type="text" name="wp_quadratum_client_secret" id="wp-quadratum-client-secret" value="' . $options['client_secret'] . '"' . $disabled . ' /><br /> 555 <small>Your Foursquare API Client Secret</small></p>'; 556 557 if ($have_client_id && $have_client_secret && !$have_oauth_token) { 558 $foursquare_settings[] = '<p><strong>' 559 . __('Step 3. You should now be authorised and ready to go; click on the <em>Connect to Foursquare</em> button below.') 560 . '</strong></p>'; 561 562 $client_id = $options['client_id']; 563 $client_secret = $options['client_secret']; 564 $redirect_url = WP_Quadratum::make_redirect_url (); 565 $fh = new FoursquareHelper_v1_0 ($client_id, $client_secret, $redirect_url); 566 $foursquare_settings[] = '<p class="submit">' 567 . '<a href="' . $fh->authentication_link () . '" class="button-primary">' 568 . __('Connect to Foursquare') . '</a>' 569 . '</p>'; 570 } 571 572 else if ($have_oauth_token) { 496 573 $foursquare_settings[] = '<div class="wp-quadratum-success">' 497 574 . __('You are currently successfully authenticated with the Foursquare API.') 498 575 . '</div>'; 499 576 } 577 578 $foursquare_settings[] = '</div>'; 500 579 break; 501 580 … … 528 607 $wrapped_content[] = $this->admin_postbox ($id, $title, implode ('', $$block), $hidden); 529 608 } // end-foreach 609 break; 610 611 case 'shortcodes': 612 $wrapped_content[] = $this->admin_postbox('wp-quadratum-shortcodes-settings', 613 'Shortcodes', implode('', $shortcodes_settings)); 614 615 $hidden = ($options['enable_locality_sc'] !== 'on'); 616 $wrapped_content[] = $this->admin_postbox('wp-quadratum-factual-settings', 617 $factual_title, implode('', $factual_settings), $hidden); 618 break; 530 619 break; 531 620 … … 594 683 break; 595 684 685 case 'shortcodes': 686 $options['enable_map_sc'] = $this->admin_option('wp_quadratum_enable_map_sc'); 687 $options['enable_locality_sc'] = $this->admin_option('wp_quadratum_enable_locality_sc'); 688 $options['factual_oauth_key'] = html_entity_decode($this->admin_option('wp_quadratum_factual_oauth_key')); 689 $options['factual_oauth_secret'] = html_entity_decode($this->admin_option('wp_quadratum_factual_oauth_secret')); 690 break; 691 596 692 case 'defaults': 597 693 $update_options = false; … … 601 697 $this->admin_reset_plugin (); 602 698 $update_msg = __('All', 'wp-quadratum'); 603 $ update_action= __('Reset To Default Values', 'wp-quadratum');699 $action_msg = __('Reset To Default Values', 'wp-quadratum'); 604 700 } 605 701 break; … … 689 785 <?php 690 786 echo $this->admin_help_and_support (); 787 echo $this->acknowledgements(); 691 788 ?> 692 789 </div> … … 711 808 case 'foursquare': 712 809 case 'maps': 810 case 'shortcodes': 713 811 case 'defaults': 714 812 $content[] = '<p class="submit">'; … … 752 850 . '</p>' 753 851 . '<p>' 754 . __('But ...help and support is a two way street; here\'s what you might want to do:')852 . __('But help and support is a two way street; here\'s what you might want to do:') 755 853 . '<ul>' 756 854 . '<li>' … … 761 859 . '</li>' 762 860 . '<li>' 763 . __('WP Quadratum is both free as in speech and free as in beer; <a href="http://www.vicchi.org/codeage/donate/">here\'s why</a>.')861 . __('WP Quadratum is free; no premium or light version, no ads. If you\'d like to support this plugin <a href="http://www.vicchi.org/codeage/donate/">here\'s how</a>.', 'wp-quadratum') 764 862 . '</li>' 765 863 . '</ul>' … … 767 865 768 866 return $this->admin_postbox ('wp-quadratum-support', __('Help & Support'), $content); 867 } 868 869 function acknowledgements() { 870 $content = array(); 871 872 $content[] = '<p>'; 873 $content[] = sprintf(__('Checkin data powered by <a href="%s" target="_blank">Foursquare</a>. Reverse geocoding courtesy of <a href="%s" target="_blank">Factual</a>.', 'wp-quadratum'), 874 'https://foursquare.com/', 875 'http://www.factual.com/' 876 ); 877 $content[] = '</p>'; 878 879 return $this->admin_postbox('wp-quadratum-legal', __('Acknowledgements', 'wp-quadratum'), implode(PHP_EOL, $content)); 769 880 } 770 881 -
wp-quadratum/trunk/includes/class-wp-quadratum-frontend.php
r761076 r808889 16 16 private $widgets = null; 17 17 private $checkin = null; 18 private $cache = null; 18 19 private $icon_url = null; 19 20 … … 23 24 24 25 private function __construct () { 25 add_shortcode ('wp_quadratum', array ($this, 'shortcode')); 26 26 add_shortcode('wp_quadratum', array($this, 'map_shortcode')); 27 add_shortcode('wp_quadratum_map', array($this, 'map_shortcode')); 28 add_shortcode('wpq_map', array($this, 'map_shortcode')); 29 30 add_shortcode('wp_quadratum_locality', array($this, 'locality_shortcode')); 31 add_shortcode('wpq_locality', array($this, 'locality_shortcode')); 32 27 33 $this->hook('wp_loaded'); 28 34 $this->hook('wp_enqueue_scripts'); … … 80 86 ); 81 87 82 $strapline = '<h5>Last seen at <a href="' . $venue_url . ' " target="_blank">' . $venue->name . '</a> on ' . date ("d M Y G:i T", $this->checkin->createdAt) . '</h5>';88 $strapline = '<h5>Last seen at <a href="' . $venue_url . '?ref=' . WP_Quadratum::get_option('client_id') . '" target="_blank">' . $venue->name . '</a> on ' . date ("d M Y G:i T", $this->checkin->createdAt) . '</h5>'; 83 89 84 90 apply_filters('wp_quadratum_checkin', $this->checkin); … … 96 102 } 97 103 104 else { 105 $content[] = '<h5>Something went wrong; the Foursquare API might be down?</h5>'; 106 } 107 98 108 return $content; 99 109 } 100 110 101 111 /** 102 * Shortcode handler for the [wp_quadratum] shortcode; expands the shortcode tothe103 * checkin map according to the current set of plugin settings/options.112 * Shortcode handler for the [wp_quadratum] and [wpq_map] shortcodes; expands the 113 * shortcode to the checkin map according to the current set of plugin settings/options. 104 114 * 105 115 * @param array atts Array containing the optional shortcode attributes specified by … … 112 122 */ 113 123 114 function shortcode ($atts, $content=null) { 115 116 // TODO: handle self-closing and enclosing shortcode forms properly 117 // TODO: this function is fugly; need to break out the checkin acquisition 118 // and map generation code into a function/functions that can be called by 119 // both the shortcode, the widget and the the_content filter (when I write it) 120 // TODO: check and handle error responses from the 4sq API 121 // TODO: handle 4sq API response caching 122 123 static $instance = 0; 124 125 $container_id = 'wp-quadratum-shortcode-container-' . $instance; 126 $map_id = 'wp-quadratum-shortcode-map-' . $instance; 127 $form_id = 'wp-quadratum-shortcode-form-' . $instance; 128 $zoom_id = 'wp-quadratum-shortcode-zoom-' . $instance; 129 $content = array (); 130 131 extract (shortcode_atts (array ( 132 'width' => 300, 133 'width_units' => 'px', 134 'height' => 300, 135 'height_units' => 'px', 136 'zoom' => 16 137 ), $atts)); 138 139 if (strpos($width_units, 'px') === false && strpos($width_units, '%') === false) { 140 $width_units = 'px'; 141 } 142 if (strpos($height_units, 'px') === false && strpos($height_units, '%') === false) { 143 $height_units = 'px'; 144 } 145 146 $args = array (); 147 $args['width'] = $width; 148 $args['width_units'] = $width_units; 149 $args['height'] = $height; 150 $args['height_units'] = $height_units; 151 $args['zoom'] = $zoom; 152 $args['container-class'] = 'wp-quadratum-shortcode-container'; 153 $args['container-id'] = $container_id; 154 $args['map-class'] = 'wp-quadratum-shortcode-map'; 155 $args['map-id'] = $map_id; 156 $args['venue-class'] = 'wp-quadratum-shortcode-venue'; 157 $args['form-id'] = $form_id; 158 $args['zoom-id'] = $zoom_id; 159 $args['instance'] = $instance; 160 $content = WP_QuadratumFrontEnd::render_checkin_map ($args, true); 161 $instance++; 162 163 return implode (PHP_EOL, $content); 124 function map_shortcode ($atts, $content=null) { 125 if ($options['enable_map_sc'] === 'on') { 126 // TODO: handle self-closing and enclosing shortcode forms properly 127 // TODO: this function is fugly; need to break out the checkin acquisition 128 // and map generation code into a function/functions that can be called by 129 // both the shortcode, the widget and the the_content filter (when I write it) 130 // TODO: check and handle error responses from the 4sq API 131 // TODO: handle 4sq API response caching 132 133 static $instance = 0; 134 135 $container_id = 'wp-quadratum-shortcode-container-' . $instance; 136 $map_id = 'wp-quadratum-shortcode-map-' . $instance; 137 $form_id = 'wp-quadratum-shortcode-form-' . $instance; 138 $zoom_id = 'wp-quadratum-shortcode-zoom-' . $instance; 139 $content = array (); 140 141 extract (shortcode_atts (array ( 142 'width' => 300, 143 'width_units' => 'px', 144 'height' => 300, 145 'height_units' => 'px', 146 'zoom' => 16 147 ), $atts)); 148 149 if (strpos($width_units, 'px') === false && strpos($width_units, '%') === false) { 150 $width_units = 'px'; 151 } 152 if (strpos($height_units, 'px') === false && strpos($height_units, '%') === false) { 153 $height_units = 'px'; 154 } 155 156 $args = array (); 157 $args['width'] = $width; 158 $args['width_units'] = $width_units; 159 $args['height'] = $height; 160 $args['height_units'] = $height_units; 161 $args['zoom'] = $zoom; 162 $args['container-class'] = 'wp-quadratum-shortcode-container'; 163 $args['container-id'] = $container_id; 164 $args['map-class'] = 'wp-quadratum-shortcode-map'; 165 $args['map-id'] = $map_id; 166 $args['venue-class'] = 'wp-quadratum-shortcode-venue'; 167 $args['form-id'] = $form_id; 168 $args['zoom-id'] = $zoom_id; 169 $args['instance'] = $instance; 170 $content = WP_QuadratumFrontEnd::render_checkin_map ($args, true); 171 $instance++; 172 173 $content = implode (PHP_EOL, $content); 174 } 175 176 return $content; 177 } 178 179 function locality_shortcode($atts, $content=null) { 180 $options = WP_Quadratum::get_option(); 181 if ($options['enable_locality_sc'] === 'on' && 182 !empty($options['factual_oauth_key']) && 183 !empty($options['factual_oauth_secret'])) { 184 extract (shortcode_atts (array ( 185 'type' => 'locality' 186 ), $atts)); 187 188 $type = strtolower($type); 189 190 if ($this->checkin) { 191 $value = __('No information currently available', 'wp-quadratum'); 192 $location = null; 193 if (isset($this->checkin) && isset($this->checkin->venue) && isset($this->checkin->venue->location)) { 194 $location = $this->checkin->venue->location; 195 } 196 197 switch ($type) { 198 case 'venue': 199 if (isset($this->checkin) && isset($this->checkin->venue) && isset($this->checkin->venue->name)) { 200 $value = $this->checkin->venue->name; 201 } 202 break; 203 204 case 'address': 205 if (isset($location) && isset($location->address)) { 206 $value = $location->address; 207 } 208 else if (isset($location) && isset($location->lat) && isset($location->lng)) { 209 $cache = $this->get_reverse_geocode($location); 210 if (isset($cache['address'])) { 211 $value = $cache['address']; 212 } 213 } 214 break; 215 216 case 'region': 217 if (isset($location) && isset($location->lat) && isset($location->lng)) { 218 $cache = $this->get_reverse_geocode($location); 219 if (isset($cache['region'])) { 220 $value = $cache['region']; 221 } 222 } 223 break; 224 225 case 'postcode': 226 if (isset($location) && isset($location->lat) && isset($location->lng)) { 227 $cache = $this->get_reverse_geocode($location); 228 if (isset($cache['postcode'])) { 229 $value = $cache['postcode']; 230 } 231 } 232 break; 233 234 case 'coordinates': 235 if (isset($location) && isset($location->lat) && isset($location->lng)) { 236 $value = $location->lat . ',' . $location->lng; 237 } 238 break; 239 240 case 'timezone': 241 if (isset($this->checkin) && isset($this->checkin->timeZone)) { 242 $value = $this->checkin->timeZone; 243 } 244 break; 245 246 case 'tzoffset': 247 if (isset($this->checkin) && isset($this->checkin->timeZoneOffset)) { 248 $tzo = $this->checkin->timeZoneOffset; 249 $minus = strpos($tzo, '-'); 250 if ($minus === 0) { 251 $tzo = substr($tzo, $minus, 1); 252 $minus = '-'; 253 } 254 else { 255 $minus = '+'; 256 } 257 $tzo = $tzo / 60; 258 $value = 'GMT' . $minus . $tzo; 259 } 260 break; 261 262 case 'locality': 263 default: 264 $type = 'locality'; 265 if (isset($location) && isset($location->city)) { 266 $value = $location->city; 267 } 268 else if (isset($location) && isset($location->lat) && isset($location->lng)) { 269 $cache = $this->get_reverse_geocode($location); 270 $value = $cache['locality']; 271 } 272 break; 273 } 274 275 $content = '<span class="wp-quadratum-' 276 . $type . '">' 277 . apply_filters('wp_quadratum_locality', $value, $type) 278 . '</span>'; 279 280 } 281 } 282 283 return $content; 284 } 285 286 private function get_reverse_geocode($location) { 287 if ($this->cache === null) { 288 require_once(FACTUAL_DRIVER_SRC); 289 290 $options = WP_Quadratum::get_option(); 291 $factual = new Factual($options['factual_oauth_key'], $options['factual_oauth_secret']); 292 $point = new FactualPoint($location->lat, $location->lng); 293 try { 294 //$start = microtime(true); 295 $response = $factual->factualReverseGeocode($point); 296 $this->cache = $response[0]; 297 WP_Quadratum::set_cache(WP_Quadratum::LOCALITY_CACHE, $this->cache); 298 } 299 300 catch (FactualApiException $e) { 301 $this->cache = WP_Quadratum::get_cache(WP_Quadratum::LOCALITY_CACHE); 302 } 303 //$end = (microtime(true) - $start); 304 //error_log('Cache refreshed in ' . $end . ' secs'); 305 } 306 307 return $this->cache; 164 308 } 165 309 … … 183 327 184 328 //if (count($this->widgets) !== 0) { 185 $json = WP_Quadratum::get_foursquare_checkins (); 329 $have_checkin = false; 330 $cached_checkin = false; 331 332 $json = WP_Quadratum::get_foursquare_checkins (); 333 if (!$this->validate_checkin($json)) { 334 $json = WP_Quadratum::get_cache(WP_Quadratum::CHECKIN_CACHE); 335 if ($this->validate_checkin($json)) { 336 $have_checkin = true; 337 $cached_checkin = true; 338 } 339 } 340 else { 341 $have_checkin = true; 342 } 343 344 if ($have_checkin) { 186 345 $checkins = $json->response->checkins->items; 187 346 188 347 $provider = WP_Quadratum::get_option ('provider'); 189 348 … … 208 367 $this->checkin = $checkins[0]; 209 368 $this->icon_url = $icon_url; 210 369 211 370 wp_localize_script($handle, 'WPQuadratum', $args); 371 372 if (!$cached_checkin) { 373 WP_Quadratum::set_cache(WP_Quadratum::CHECKIN_CACHE, $json); 374 } 375 } 212 376 //} 213 377 } 214 378 379 private function validate_checkin($json) { 380 if ($json === false || $json === null) { 381 return false; 382 } 383 384 if (!isset($json->response) || !isset($json->response->checkins) || !isset($json->response->checkins->items)) { 385 return false; 386 } 387 388 return true; 389 } 390 215 391 private function get_widgets() { 216 392 $this->widgets = array(); -
wp-quadratum/trunk/includes/class-wp-quadratum.php
r761076 r808889 6 6 7 7 const OPTIONS = 'wp_quadratum_settings'; 8 const VERSION = '130'; 9 const DISPLAY_VERSION = 'v1.3.0'; 8 const CACHE = 'wp_quadratum_cache'; 9 const LOCALITY_CACHE = 'locality'; 10 const CHECKIN_CACHE = 'checkin'; 11 const VERSION = '131'; 12 const DISPLAY_VERSION = 'v1.3.1'; 10 13 11 14 /** … … 166 169 //"cloudmade_key" => "", 167 170 'openmq_key' => '', 168 'bingv7_key' => '' 171 'bingv7_key' => '', 172 'enable_map_sc' => 'on', 173 'enable_locality_sc' => '', 174 'factual_oauth_key' => '', 175 'factual_oauth_secret' => '' 169 176 ) 170 177 ); 171 178 172 179 update_option (self::OPTIONS, $settings); 180 } 181 182 $cache = WP_Quadratum::get_cache(); 183 if (!is_array($cache)) { 184 $cache = array( 185 'timestamp' => time(), 186 'checkin' => null, 187 'locality' => null 188 ); 189 update_option(self::CACHE, $cache); 173 190 } 174 191 } … … 203 220 } 204 221 } 222 223 static function get_cache($key=NULL) { 224 $cache = get_option(self::CACHE); 225 226 if (isset($key) && !empty($key)) { 227 return json_decode($cache[$key]); 228 } 229 230 else { 231 return $cache; 232 } 233 } 205 234 206 235 /** … … 211 240 */ 212 241 213 static function set_option ($key, $value) {214 $options = get_option s(self::OPTIONS);242 static function set_option($key, $value) { 243 $options = get_option(self::OPTIONS); 215 244 $options[$key] = $value; 216 update_option (self::OPTIONS, $options); 217 } 218 245 update_option(self::OPTIONS, $options); 246 } 247 248 static function set_cache($key, $value) { 249 $cache = get_option(self::CACHE); 250 $cache['timestamp'] = time(); 251 $cache[$key] = json_encode($value); 252 update_option(self::CACHE, $cache); 253 } 219 254 220 255 /** … … 269 304 $fsq->set_access_token ($oauth_token); 270 305 $rsp = $fsq->get_private ($endpoint, $params); 271 $json = json_decode ($rsp); 272 return $json; 306 307 if ($rsp !== false) { 308 $json = json_decode($rsp); 309 return $json; 310 } 311 312 return $rsp; 273 313 } 274 314 -
wp-quadratum/trunk/js/wp-quadratum-admin.js
r580206 r808889 1 1 (function($) { 2 2 $().ready(function() { 3 $('#wp-quadratum-map-provider').focus (function() {4 $(this).data ('prev-provider', $(this).val());3 $('#wp-quadratum-map-provider').focus(function() { 4 $(this).data('prev-provider', $(this).val()); 5 5 }); 6 $('#wp-quadratum-map-provider').change (function() { 7 var prev_id = $('#wp-quadratum-' + $(this).data ('prev-provider') + '-settings'); 8 var curr_id = $('#wp-quadratum-' + $(this).val () + '-settings'); 9 prev_id.toggle (); 10 curr_id.toggle (); 11 $(this).data ('prev-provider', $(this).val ()); 6 7 $('#wp-quadratum-map-provider').change(function() { 8 var prev_id = $('#wp-quadratum-' + $(this).data('prev-provider') + '-settings'); 9 var curr_id = $('#wp-quadratum-' + $(this).val() + '-settings'); 10 prev_id.toggle(); 11 curr_id.toggle(); 12 $(this).data('prev-provider', $(this).val()); 13 }); 14 15 $('#wp-quadratum-enable-locality-sc').click(function() { 16 $('#wp-quadratum-factual-settings').toggle('slow'); 12 17 }); 13 18 }); -
wp-quadratum/trunk/js/wp-quadratum-admin.min.js
r580206 r808889 1 (function(a){a().ready(function(){a("#wp-quadratum-map-provider").focus(function(){a(this).data("prev-provider",a(this).val())});a("#wp-quadratum-map-provider").change(function(){var b=a("#wp-quadratum-"+a(this).data("prev-provider")+"-settings"),c=a("#wp-quadratum-"+a(this).val()+"-settings");b.toggle();c.toggle();a(this).data("prev-provider",a(this).val())}) })})(jQuery);1 (function(a){a().ready(function(){a("#wp-quadratum-map-provider").focus(function(){a(this).data("prev-provider",a(this).val())});a("#wp-quadratum-map-provider").change(function(){var b=a("#wp-quadratum-"+a(this).data("prev-provider")+"-settings"),c=a("#wp-quadratum-"+a(this).val()+"-settings");b.toggle();c.toggle();a(this).data("prev-provider",a(this).val())});a("#wp-quadratum-enable-locality-sc").click(function(){a("#wp-quadratum-factual-settings").toggle("slow")})})})(jQuery); -
wp-quadratum/trunk/readme.txt
r761076 r808889 3 3 Donate Link: http://www.vicchi.org/codeage/donate/ 4 4 Tags: wp-quadratum, maps, map, foursquare, checkins, checkin, widget 5 Requires at least: 3. 6.06 Tested up to: 3. 6.07 Stable tag: 1.3. 05 Requires at least: 3.7.0 6 Tested up to: 3.7.1 7 Stable tag: 1.3.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 40 40 1. Configure your Foursquare credentials; from the Dashboard, navigate to the *Settings / WP Quadratum* page or click on the *"Settings"* link from the Plugins page on the Dashboard. 41 41 1. To display your Foursquare checkins, WP Quadratum needs to be authorised to access your Foursquare account information; this is a simple, safe and secure 3 step process. WP Quadratum never sees your account login information and cannot store any personally identifiable information. 42 1. Register your WordPress site as a Foursquare application on the [Foursquare App Registration](https://foursquare.com/developers/register) page. If you're not currently logged into your Foursquare account, you'll need to login with the Foursquare account whose checkins you want WP Quadratum to display. The *Your app name* field is a label you want to use to identify this connection to your Foursquare account. The *Download / welcome page url* is the URL of your Wordpress site. The *Redirect URI* will be provided for you and will be along the lines of http://www.yoursite.com/wp-content/plugins/wp-quadratum/includes/wp-quadratum-callback.php(this is just an example, *don't use this URL*). *Push API Notifications* should be set to *Disable pushes to this app*. All other fields can be left at their default values. Once you have successfully registered your site, you'll be provided with two keys, the *Client ID* and the *Client Secret*.42 1. Register your WordPress site as a Foursquare application on the [Foursquare App Registration](https://foursquare.com/developers/register) page. If you're not currently logged into your Foursquare account, you'll need to login with the Foursquare account whose checkins you want WP Quadratum to display. The *Your app name* field is a label you want to use to identify this connection to your Foursquare account. The *Download / welcome page url* is the URL of your Wordpress site. The *Redirect URI* will be provided for you and will be along the lines of `http://www.yoursite.com/wp-content/plugins/wp-quadratum/includes/wp-quadratum-callback.php` (this is just an example, *don't use this URL*). *Push API Notifications* should be set to *Disable pushes to this app*. All other fields can be left at their default values. Once you have successfully registered your site, you'll be provided with two keys, the *Client ID* and the *Client Secret*. 43 43 1. Copy and paste the supplied *Client ID* and *Client Secret* into the respective WP Quadratum setting fields. Click on the *"Save Changes"* button to preserve them. 44 44 1. You should now be authorised and ready to go; click on the *Connect to Foursquare* button. … … 75 75 == Screenshots == 76 76 77 1. Settings and Options: Foursquare Tab; Client ID and Client Secret entered 77 1. Installed Plugins: Authentication prompt shown after activating plugin for the first time 78 1. Settings and Options: Foursquare Tab; No Client ID or Client Secret entered or saved 78 79 1. Settings and Options: Foursquare Tab; Client ID and Client Secret saved 79 1. Foursquare Authentication; not logged in 80 1. Foursquare Authentication; logged in 80 1. Foursquare Authentication: Allow or deny plugin access to your Foursquare account 81 81 1. Settings and Options: Foursquare Tab; Successfully authenticated with Foursquare 82 82 1. Settings and Options: Maps Tab; HERE Maps configuration … … 86 86 1. Settings and Options: Maps Tab; OpenLayers Maps configuration 87 87 1. Settings and Options: Maps Tab; MapQuest Open Maps configuration 88 1. Settings and Options: Shortcode Tab; [wp_quadratum] shortcode enabled 89 1. Settings and Options: Shortcode Tab; [wp_quadratum_locality] shortcode enabled, no Factual OAuth Key or Secret entered or saved 90 1. Settings and Options: Shortcode Tab; [wp_quadratum_locality] shortcode enabled, no Factual OAuth Key or Secret saved 88 91 1. Settings and Options: Defaults Tab 89 92 1. Settings and Options: Colophon Tab … … 94 97 == Changelog == 95 98 96 The current version is 1.3.0 (2013.08.22) 99 The current version is 1.3.1 (2013.10.23) 100 101 = 1.3.1 = 102 * Released: 2013.10.23 103 * Added: Caching of last good response from the Foursquare API, allowing the plugin to operate if the API is temporarily down. 104 * Added: New locality shortcodes, `[wp_quadratum_locality]` (and `[wpq_locality]` as an alias) to allow the last checkin's venue name, address, region, postal code, coordinates, timezone and/or timezone offset to be embedded in posts or pages. 105 * Added: New checkin map shortcodes, `[wp_quadratum_map]` and `[wpq_map]` as aliases for the plugin's `[wp_quadratum]` shortcode. 106 * Added: Ability for the plugin's shortcodes to be made configurable, on and off. 107 * Added: Ability to backfill the response of the Foursquare API, via Factual's reverse geocoder, to cope with cases when a Foursquare venue doesn't have a complete set of metadata attributes to be used in conjunction with the locality shortcodes. 108 * Added: New filter, `wp_quadratum_locality`, to filter and amend the output of the `[wp_quadratum_locality]` shortcode. 109 * Fixed: Detect and trap an invalid or empty response from the Foursquare API, preventing numerous PHP warnings from polluting a post or page. 110 * Other: Fully compatible with WordPress v3.7 "Basie". 97 111 98 112 = 1.3.0 = … … 111 125 * Other: Transitioned to `WP_Mapstraction` from `WP_MXNHelper`. 112 126 113 = 1.2 =127 = 1.2.0 = 114 128 * Released: 2012.11.06 115 129 * Added: Support for the `wp_quadratum_strapline` filter. … … 118 132 * Other: Moved all submodule classes/libraries from the plugin's root directory to /includes. 119 133 120 = 1.1 =134 = 1.1.0 = 121 135 * Released: 2012.07.01 122 136 * Added: Support for Nokia, CloudMade, Google and OpenLayers maps via Mapstraction … … 133 147 Fixed: An issue with an old version of WP_PluginBase, the PHP class which WP Quadratum extends. 134 148 135 = 1.0 =149 = 1.0.0 = 136 150 * First version of WP Quadratum released 137 151 138 152 == Upgrade Notice == 153 = 1.3.1 = 154 Cache last good Foursquare checkin response for when the Foursquare API is down. Add new locality shortcode. This release is fully compatible with WordPress 3.7 "Basie". 155 139 156 = 1.3.0 = 140 157 Fix issue where the map did not load due to new GitHub content serving policy. Add support for Leaflet, Bing and MapQuest Open maps. Add new `wp_quadratum_checkin` filter. … … 157 174 == Shortcode Support And Usage == 158 175 159 WP Quadratum supports a single shortcode, `[wp_quadratum]`. Adding this shortcode to the content of a post or page or into a theme template as content, expands the shortcode and replaces it with a checkin map. 176 WP Quadratum supports two shortcodes and three shortcode aliases; `[wp_quadratum_map]` to expand the shortcode in a post or page and replace it with the checkin map and `[wp_quadratum_locality]` to allow you to embed aspects of your last checkin in a post or page. 177 178 = [wp_quadratum_map] = 179 180 Adding this shortcode to the content of a post or page as content, expands the shortcode and replaces it with a checkin map. 160 181 161 182 The shortcode also supports multiple *attributes* which allow you to customise the way in which the shortcode is expanded into the checkin map: … … 167 188 * the `zoom` attribute 168 189 169 = The "width" Attribute = 190 ** The "width" Attribute ** 170 191 171 192 The `width` attribute, in conjunction with the `height` attribute specifies the width of the map to be inserted into a post or page. If omitted, the map width defaults to a value of `300`. 172 193 173 = The "width_units" Attribute = 194 ** The "width_units" Attribute ** 174 195 175 196 The `width_units` attribute, specifies how the value specified in the `width` attribute should be interpreted. Valid values for this attribute as `px` and `%`, denoting that the `width` attribute should be interpreted in pixels or as a percentage respectively. If omitted, this attribute defaults to a value of `px`. 176 197 177 = The "height" Attribute = 198 ** The "height" Attribute ** 178 199 179 200 The `height` attribute, in conjunction with the `width` attribute specifies the height of the map to be inserted into a post or page. If omitted, the map height defaults to a value of `300`. 180 201 181 = The "height_units" Attribute = 202 ** The "height_units" Attribute ** 182 203 183 204 The `height_units` attribute, specifies how the value specified in the `height` attribute should be interpreted. Valid values for this attribute as `px` and `%`, denoting that the `height` attribute should be interpreted in pixels or as a percentage respectively. If omitted, this attribute defaults to a value of `px`. 184 205 185 = The "zoom" Attribute = 206 ** The "zoom" Attribute ** 186 207 187 208 The `zoom` attribute specifies the zoom level to be used when displaying the checkin map. If omitted, the zoom level defaults to a value of `16` which is roughly analogous to a neighbourhood zoom. 188 209 210 = [wp_quadratum] = 211 212 The `[wp_quadratum]` shortcode is an alias for the `[wp_quadratum_map]` shortcode and has the same functionality. 213 214 = [wpq_map] = 215 216 The `[wpq_map]` shortcode is an alias for the `[wp_quadratum_map]` shortcode and has the same functionality. 217 218 = [wp_quadratum_locality] = 219 220 Adding this shortcode to the content of a post or page, expands the shortcode and replaces it with information about your last Foursquare checkin. The information to be displayed is selected by the shortcode's `type` attribute, which allows you to select the venue name, address, region, postal code, coordinates, timezone or timezone offset. 221 222 By default, the `[wp_quadratum_locality]` shortcode and the `[wpq_locality]` alias are disabled. This is because not all Foursquare venues contain the full scope of locality elements that the shortcode supports (the minimum requirements for a Foursquare venue are name, category and coordinates). To backfill any missing venue elements, WP Quadratum uses a *reverse geocoding* service from [Factual](http://www.factual.com/) to supply the missing information. 223 224 To enable the `[wp_quadratum_locality]` shortcode, from the Dashboard navigate to *Settings / WP Quadratum* and click on the *Shortcodes* tab. Select the *Enable Locality Shortcode Usage* checkbox and the *Factual OAuth Settings* meta-box will appear. You'll then need to sign up for a [Factual API key](https://www.factual.com/api-keys/request) after which you'll be given an *OAuth Key* and *OAuth Secret*. Copy and paste these into the *Factual OAuth* text fields and click on *Save Shortcode Settings*. You'll now be able to use the `[wp_quadratum_locality]` shortcode or its alias. 225 226 227 **The "type" Attribute** 228 229 The `type` attribute specifies the element of your last Foursquare checkin that is to be displayed in a post or page and can take one of the following values: 230 231 * `venue` - the name of the last Foursquare venue you checked into. 232 * `address` - the street address of the venue; not including the region, locality or postal code. 233 * `region` - the region of the venue; the geographic context of the region will vary from country to country but is roughly analogous to the venue's city. 234 * `postcode` - the postal code of the venue, if the country or region supports postal codes. 235 * `coordinates` - the geographic coordinates of the venue, in the form latitude,longitude. 236 * `timezone` - the timezone name of the time of the checkin, such as `Europe/London`. 237 * `tzoffset` - the offset from GMT of the time of the checkin, in the form GMT[-+]hours, such as GMT-1 or GMT+2. 238 * `locality` - the locality of the venue; the geographic context of the locality will vary according to country, but is roughly analogous to the town or neighbourhood. 239 240 If the `type` attribute is not supplied, or if the value of this attribute is not one of the above values, `type="locality"` will be assumed. The shortcode's replacement value can be modified via the plugin's `wp_quadratum_locality` filter; see the *Filter Support and Usage* section for more information. 241 242 = [wpq_locality] = 243 244 The `[wpq_locality]` shortcode is an alias for the `[wp_quadratum_locality]` shortcode and has the same functionality. 245 189 246 == Filter Support And Usage == 190 247 191 WP Quadratum supports t wofilters, which are described in more detail below. The plugin's filters allow you to:248 WP Quadratum supports three filters, which are described in more detail below. The plugin's filters allow you to: 192 249 193 250 * change the descriptive text that appears immediately below the map when displayed via the plugin's widget or shortcode. 194 251 * gain access to the checkin metadata that is returned from the Foursquare API 252 * change the output of the [wp_quadratum_locality]` shortcode 195 253 196 254 = wp_quadratum_checkin = … … 225 283 return $strapline; 226 284 }` 285 286 = wp_quadratum_locality = 287 288 Applied to the replacement content of the `[wp_quadratum_locality]` shortcode immediately before the shortcode is replaced. The filter's hook function is passed two arguments; the shortcode's value and corresponding `type` attribute. 289 290 *Example:* Wrap each invocation of the `[wp_quadratum_locality]` shortcode in a `div` whose class includes the attribute type. 291 292 `add_filter('wp_quadratum_locality', 'format_locality', 10, 2); 293 function format_locality($value, $type) { 294 $class = 'wp-quadratum-locality-' . $type; 295 return '<div class="' . $class . '">' . $value . '</div>'; 296 }` -
wp-quadratum/trunk/uninstall.php
r761076 r808889 4 4 delete_option('wp_quadratum_settings'); 5 5 delete_option('widget_wp_quadratumwidget'); 6 delete_option('wp_quadratum_cache'); 6 7 } 7 8 -
wp-quadratum/trunk/wp-quadratum.php
r761076 r808889 4 4 Plugin URI: http://www.vicchi.org/codeage/wp-quadratum/ 5 5 Description: A WordPress plugin to display your last Foursquare checkin as a map widget, fully authenticated via OAuth 2.0. 6 Version: 1.3. 06 Version: 1.3.1 7 7 Author: Gary Gale 8 8 Author URI: http://www.garygale.com/ … … 41 41 42 42 define('FOURSQUARE_HELPER_SRC', WPQUADRATUM_PATH . 'includes/foursquare-helper/foursquare-helper.php'); 43 define('FACTUAL_DRIVER_SRC', WPQUADRATUM_PATH . 'includes/factual-php-driver/Factual.php'); 43 44 44 45 include_once(ABSPATH . 'wp-admin/includes/plugin.php');
Note: See TracChangeset
for help on using the changeset viewer.