@@ -7,14 +7,14 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | // Define the basic options for HTTP calls to REDLINK. |
| 9 | 9 | define( 'WL_REDLINK_API_HTTP_OPTIONS', serialize( array( |
| 10 | - 'timeout' => 300, |
|
| 11 | - 'redirection' => 5, |
|
| 12 | - 'httpversion' => '1.1', |
|
| 13 | - 'blocking' => true, |
|
| 14 | - 'cookies' => array(), |
|
| 15 | - 'sslverify' => ( 'false' === getenv( 'WL_SSL_VERIFY_ENABLED' ) ) ? false : true, |
|
| 16 | - 'sslcertificates' => dirname( __FILE__ ) . '/ssl/ca-bundle.crt', |
|
| 17 | - 'decompress' => false, |
|
| 10 | + 'timeout' => 300, |
|
| 11 | + 'redirection' => 5, |
|
| 12 | + 'httpversion' => '1.1', |
|
| 13 | + 'blocking' => true, |
|
| 14 | + 'cookies' => array(), |
|
| 15 | + 'sslverify' => ( 'false' === getenv( 'WL_SSL_VERIFY_ENABLED' ) ) ? false : true, |
|
| 16 | + 'sslcertificates' => dirname( __FILE__ ) . '/ssl/ca-bundle.crt', |
|
| 17 | + 'decompress' => false, |
|
| 18 | 18 | ) ) ); |
| 19 | 19 | |
| 20 | 20 | // Create a unique ID for this request, useful to hook async HTTP requests. |
@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | function wl_is_sparql_update_queries_buffering_enabled() { |
| 29 | 29 | |
| 30 | - if ( isset( $_REQUEST['wl-async'] ) && 'false' === $_REQUEST['wl-async'] ) { |
|
| 31 | - return false; |
|
| 32 | - } |
|
| 30 | + if ( isset( $_REQUEST['wl-async'] ) && 'false' === $_REQUEST['wl-async'] ) { |
|
| 31 | + return false; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - return 'true' !== getenv( 'WL_DISABLE_SPARQL_UPDATE_QUERIES_BUFFERING' ); |
|
| 34 | + return 'true' !== getenv( 'WL_DISABLE_SPARQL_UPDATE_QUERIES_BUFFERING' ); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | // Define the meta name used to store the entity URL. |
@@ -64,14 +64,14 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | function wl_prefixes() { |
| 66 | 66 | |
| 67 | - $items = wl_prefixes_list(); |
|
| 68 | - $prefixes = array(); |
|
| 67 | + $items = wl_prefixes_list(); |
|
| 68 | + $prefixes = array(); |
|
| 69 | 69 | |
| 70 | - foreach ( $items as $item ) { |
|
| 71 | - $prefixes[ $item['prefix'] ] = $item['namespace']; |
|
| 72 | - } |
|
| 70 | + foreach ( $items as $item ) { |
|
| 71 | + $prefixes[ $item['prefix'] ] = $item['namespace']; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - return $prefixes; |
|
| 74 | + return $prefixes; |
|
| 75 | 75 | |
| 76 | 76 | } |
| 77 | 77 | |
@@ -87,14 +87,14 @@ discard block |
||
| 87 | 87 | * @return string The path to the temp directory for the specific site. |
| 88 | 88 | */ |
| 89 | 89 | function wl_temp_dir() { |
| 90 | - $tempdir = get_temp_dir(); |
|
| 91 | - $unique = md5( site_url() . get_current_blog_id() ); |
|
| 92 | - $unique_temp_dir = $tempdir . 'wl_' . $unique; // $tempdir should have a trailing slash. |
|
| 90 | + $tempdir = get_temp_dir(); |
|
| 91 | + $unique = md5( site_url() . get_current_blog_id() ); |
|
| 92 | + $unique_temp_dir = $tempdir . 'wl_' . $unique; // $tempdir should have a trailing slash. |
|
| 93 | 93 | |
| 94 | - // If directory do not exist, create it. |
|
| 95 | - if ( ! file_exists( $unique_temp_dir ) ) { |
|
| 96 | - mkdir( $unique_temp_dir ); |
|
| 97 | - } |
|
| 94 | + // If directory do not exist, create it. |
|
| 95 | + if ( ! file_exists( $unique_temp_dir ) ) { |
|
| 96 | + mkdir( $unique_temp_dir ); |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - return $unique_temp_dir . '/'; |
|
| 99 | + return $unique_temp_dir . '/'; |
|
| 100 | 100 | } |
@@ -6,39 +6,39 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | // Define the basic options for HTTP calls to REDLINK. |
| 9 | -define( 'WL_REDLINK_API_HTTP_OPTIONS', serialize( array( |
|
| 9 | +define('WL_REDLINK_API_HTTP_OPTIONS', serialize(array( |
|
| 10 | 10 | 'timeout' => 300, |
| 11 | 11 | 'redirection' => 5, |
| 12 | 12 | 'httpversion' => '1.1', |
| 13 | 13 | 'blocking' => true, |
| 14 | 14 | 'cookies' => array(), |
| 15 | - 'sslverify' => ( 'false' === getenv( 'WL_SSL_VERIFY_ENABLED' ) ) ? false : true, |
|
| 16 | - 'sslcertificates' => dirname( __FILE__ ) . '/ssl/ca-bundle.crt', |
|
| 15 | + 'sslverify' => ('false' === getenv('WL_SSL_VERIFY_ENABLED')) ? false : true, |
|
| 16 | + 'sslcertificates' => dirname(__FILE__).'/ssl/ca-bundle.crt', |
|
| 17 | 17 | 'decompress' => false, |
| 18 | -) ) ); |
|
| 18 | +))); |
|
| 19 | 19 | |
| 20 | 20 | // Create a unique ID for this request, useful to hook async HTTP requests. |
| 21 | -define( 'WL_REQUEST_ID', uniqid( true ) ); |
|
| 21 | +define('WL_REQUEST_ID', uniqid(true)); |
|
| 22 | 22 | |
| 23 | 23 | // Set the temporary files folder. |
| 24 | -defined( 'WL_TEMP_DIR' ) || define( 'WL_TEMP_DIR', wl_temp_dir() ); |
|
| 24 | +defined('WL_TEMP_DIR') || define('WL_TEMP_DIR', wl_temp_dir()); |
|
| 25 | 25 | |
| 26 | -define( 'WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING', wl_is_sparql_update_queries_buffering_enabled() ); |
|
| 26 | +define('WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING', wl_is_sparql_update_queries_buffering_enabled()); |
|
| 27 | 27 | |
| 28 | 28 | function wl_is_sparql_update_queries_buffering_enabled() { |
| 29 | 29 | |
| 30 | - if ( isset( $_REQUEST['wl-async'] ) && 'false' === $_REQUEST['wl-async'] ) { |
|
| 30 | + if (isset($_REQUEST['wl-async']) && 'false' === $_REQUEST['wl-async']) { |
|
| 31 | 31 | return false; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - return 'true' !== getenv( 'WL_DISABLE_SPARQL_UPDATE_QUERIES_BUFFERING' ); |
|
| 34 | + return 'true' !== getenv('WL_DISABLE_SPARQL_UPDATE_QUERIES_BUFFERING'); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | // Define the meta name used to store the entity URL. |
| 38 | -define( 'WL_ENTITY_URL_META_NAME', 'entity_url' ); |
|
| 38 | +define('WL_ENTITY_URL_META_NAME', 'entity_url'); |
|
| 39 | 39 | |
| 40 | 40 | // Max number of recursions when printing microdata. |
| 41 | -define( 'WL_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING', 3 ); |
|
| 41 | +define('WL_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING', 3); |
|
| 42 | 42 | |
| 43 | 43 | //// Use the WordLift API URL set on the command line. |
| 44 | 44 | //$env_wordlift_api_url = getenv( 'WORDLIFT_API_URL' ); |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | // 3.13.0, we use by default WLS 1.11 which provides us with the new, faster |
| 50 | 50 | // chunked analysis. |
| 51 | -define( 'WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE', defined( 'WORDLIFT_API_URL' ) ? WORDLIFT_API_URL . '/' : 'https://api.wordlift.it/' ); |
|
| 51 | +define('WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE', defined('WORDLIFT_API_URL') ? WORDLIFT_API_URL . '/' : 'https://api.wordlift.it/'); |
|
| 52 | 52 | |
| 53 | -define( 'WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL', 'https://developers.google.com/structured-data/testing-tool/?url=' ); |
|
| 53 | +define('WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL', 'https://developers.google.com/structured-data/testing-tool/?url='); |
|
| 54 | 54 | |
| 55 | 55 | // If is set to true, there will be additional button in 'Download Your Data' page |
| 56 | 56 | // that will allow users to download their data in JSON-LD format. |
| 57 | -defined( 'WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA' ) || define( 'WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA', false ); |
|
| 57 | +defined('WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA') || define('WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA', false); |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | $items = wl_prefixes_list(); |
| 68 | 68 | $prefixes = array(); |
| 69 | 69 | |
| 70 | - foreach ( $items as $item ) { |
|
| 71 | - $prefixes[ $item['prefix'] ] = $item['namespace']; |
|
| 70 | + foreach ($items as $item) { |
|
| 71 | + $prefixes[$item['prefix']] = $item['namespace']; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | return $prefixes; |
@@ -88,13 +88,13 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | function wl_temp_dir() { |
| 90 | 90 | $tempdir = get_temp_dir(); |
| 91 | - $unique = md5( site_url() . get_current_blog_id() ); |
|
| 92 | - $unique_temp_dir = $tempdir . 'wl_' . $unique; // $tempdir should have a trailing slash. |
|
| 91 | + $unique = md5(site_url().get_current_blog_id()); |
|
| 92 | + $unique_temp_dir = $tempdir.'wl_'.$unique; // $tempdir should have a trailing slash. |
|
| 93 | 93 | |
| 94 | 94 | // If directory do not exist, create it. |
| 95 | - if ( ! file_exists( $unique_temp_dir ) ) { |
|
| 96 | - mkdir( $unique_temp_dir ); |
|
| 95 | + if ( ! file_exists($unique_temp_dir)) { |
|
| 96 | + mkdir($unique_temp_dir); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - return $unique_temp_dir . '/'; |
|
| 99 | + return $unique_temp_dir.'/'; |
|
| 100 | 100 | } |