@@ -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,15 +27,15 @@ 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 | - /** |
|
| 35 | - * Switching to disabled by default. |
|
| 36 | - */ |
|
| 37 | - // return 'true' !== getenv( 'WL_DISABLE_SPARQL_UPDATE_QUERIES_BUFFERING' ); |
|
| 38 | - return 'yes' === getenv( 'WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING' ); |
|
| 34 | + /** |
|
| 35 | + * Switching to disabled by default. |
|
| 36 | + */ |
|
| 37 | + // return 'true' !== getenv( 'WL_DISABLE_SPARQL_UPDATE_QUERIES_BUFFERING' ); |
|
| 38 | + return 'yes' === getenv( 'WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING' ); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // Define the meta name used to store the entity URL. |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | // Use the WordLift API URL set on the command line. |
| 48 | 48 | if ( ! defined( 'WORDLIFT_API_URL' ) && false !== getenv( 'WORDLIFT_API_URL' ) ) { |
| 49 | - define( 'WORDLIFT_API_URL', getenv( 'WORDLIFT_API_URL' ) ); |
|
| 49 | + define( 'WORDLIFT_API_URL', getenv( 'WORDLIFT_API_URL' ) ); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // 3.13.0, we use by default WLS 1.11 which provides us with the new, faster |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | function wl_prefixes() { |
| 82 | 82 | |
| 83 | - $items = wl_prefixes_list(); |
|
| 84 | - $prefixes = array(); |
|
| 83 | + $items = wl_prefixes_list(); |
|
| 84 | + $prefixes = array(); |
|
| 85 | 85 | |
| 86 | - foreach ( $items as $item ) { |
|
| 87 | - $prefixes[ $item['prefix'] ] = $item['namespace']; |
|
| 88 | - } |
|
| 86 | + foreach ( $items as $item ) { |
|
| 87 | + $prefixes[ $item['prefix'] ] = $item['namespace']; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - return $prefixes; |
|
| 90 | + return $prefixes; |
|
| 91 | 91 | |
| 92 | 92 | } |
| 93 | 93 | |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | * @return string The path to the temp directory for the specific site. |
| 104 | 104 | */ |
| 105 | 105 | function wl_temp_dir() { |
| 106 | - $tempdir = get_temp_dir(); |
|
| 107 | - $unique = md5( site_url() . get_current_blog_id() ); |
|
| 108 | - $unique_temp_dir = $tempdir . 'wl_' . $unique; // $tempdir should have a trailing slash. |
|
| 106 | + $tempdir = get_temp_dir(); |
|
| 107 | + $unique = md5( site_url() . get_current_blog_id() ); |
|
| 108 | + $unique_temp_dir = $tempdir . 'wl_' . $unique; // $tempdir should have a trailing slash. |
|
| 109 | 109 | |
| 110 | - // If directory do not exist, create it. |
|
| 111 | - if ( ! file_exists( $unique_temp_dir ) ) { |
|
| 112 | - @mkdir( $unique_temp_dir ); |
|
| 113 | - } |
|
| 110 | + // If directory do not exist, create it. |
|
| 111 | + if ( ! file_exists( $unique_temp_dir ) ) { |
|
| 112 | + @mkdir( $unique_temp_dir ); |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - return $unique_temp_dir . '/'; |
|
| 115 | + return $unique_temp_dir . '/'; |
|
| 116 | 116 | } |
@@ -6,28 +6,28 @@ 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 | |
@@ -35,43 +35,43 @@ discard block |
||
| 35 | 35 | * Switching to disabled by default. |
| 36 | 36 | */ |
| 37 | 37 | // return 'true' !== getenv( 'WL_DISABLE_SPARQL_UPDATE_QUERIES_BUFFERING' ); |
| 38 | - return 'yes' === getenv( 'WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING' ); |
|
| 38 | + return 'yes' === getenv('WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING'); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // Define the meta name used to store the entity URL. |
| 42 | -define( 'WL_ENTITY_URL_META_NAME', 'entity_url' ); |
|
| 42 | +define('WL_ENTITY_URL_META_NAME', 'entity_url'); |
|
| 43 | 43 | |
| 44 | 44 | // Max number of recursions when printing microdata. |
| 45 | -define( 'WL_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING', 3 ); |
|
| 45 | +define('WL_RECURSION_DEPTH_ON_ENTITY_METADATA_PRINTING', 3); |
|
| 46 | 46 | |
| 47 | 47 | // Use the WordLift API URL set on the command line. |
| 48 | -if ( ! defined( 'WORDLIFT_API_URL' ) && false !== getenv( 'WORDLIFT_API_URL' ) ) { |
|
| 49 | - define( 'WORDLIFT_API_URL', getenv( 'WORDLIFT_API_URL' ) ); |
|
| 48 | +if ( ! defined('WORDLIFT_API_URL') && false !== getenv('WORDLIFT_API_URL')) { |
|
| 49 | + define('WORDLIFT_API_URL', getenv('WORDLIFT_API_URL')); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // 3.13.0, we use by default WLS 1.11 which provides us with the new, faster |
| 53 | 53 | // chunked analysis. |
| 54 | -define( 'WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE', defined( 'WORDLIFT_API_URL' ) ? WORDLIFT_API_URL . '/' : 'https://api.wordlift.it/' ); |
|
| 54 | +define('WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE', defined('WORDLIFT_API_URL') ? WORDLIFT_API_URL . '/' : 'https://api.wordlift.it/'); |
|
| 55 | 55 | |
| 56 | -define( 'WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL', 'https://developers.google.com/structured-data/testing-tool/?url=' ); |
|
| 56 | +define('WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL', 'https://developers.google.com/structured-data/testing-tool/?url='); |
|
| 57 | 57 | |
| 58 | 58 | // If is set to true, there will be additional button in 'Download Your Data' page |
| 59 | 59 | // that will allow users to download their data in JSON-LD format. |
| 60 | -defined( 'WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA' ) || define( 'WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA', false ); |
|
| 60 | +defined('WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA') || define('WL_CONFIG_DOWNLOAD_GA_CONTENT_DATA', false); |
|
| 61 | 61 | |
| 62 | 62 | /* |
| 63 | 63 | * Define the default scope for autocomplete requests. |
| 64 | 64 | * |
| 65 | 65 | * @see https://github.com/insideout10/wordlift-plugin/issues/839 |
| 66 | 66 | */ |
| 67 | -defined( 'WL_AUTOCOMPLETE_SCOPE' ) || define( 'WL_AUTOCOMPLETE_SCOPE', 'cloud' ); |
|
| 67 | +defined('WL_AUTOCOMPLETE_SCOPE') || define('WL_AUTOCOMPLETE_SCOPE', 'cloud'); |
|
| 68 | 68 | |
| 69 | 69 | /* |
| 70 | 70 | * Enable/disable the `all entity types` feature. Initially we keep the feature disabled to enture proper Q/A. |
| 71 | 71 | * |
| 72 | 72 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 73 | 73 | */ |
| 74 | -defined( 'WL_ALL_ENTITY_TYPES' ) || define( 'WL_ALL_ENTITY_TYPES', false ); |
|
| 74 | +defined('WL_ALL_ENTITY_TYPES') || define('WL_ALL_ENTITY_TYPES', false); |
|
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * Get an array with commonly supported prefixes. |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | $items = wl_prefixes_list(); |
| 84 | 84 | $prefixes = array(); |
| 85 | 85 | |
| 86 | - foreach ( $items as $item ) { |
|
| 87 | - $prefixes[ $item['prefix'] ] = $item['namespace']; |
|
| 86 | + foreach ($items as $item) { |
|
| 87 | + $prefixes[$item['prefix']] = $item['namespace']; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | return $prefixes; |
@@ -104,13 +104,13 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | function wl_temp_dir() { |
| 106 | 106 | $tempdir = get_temp_dir(); |
| 107 | - $unique = md5( site_url() . get_current_blog_id() ); |
|
| 108 | - $unique_temp_dir = $tempdir . 'wl_' . $unique; // $tempdir should have a trailing slash. |
|
| 107 | + $unique = md5(site_url().get_current_blog_id()); |
|
| 108 | + $unique_temp_dir = $tempdir.'wl_'.$unique; // $tempdir should have a trailing slash. |
|
| 109 | 109 | |
| 110 | 110 | // If directory do not exist, create it. |
| 111 | - if ( ! file_exists( $unique_temp_dir ) ) { |
|
| 112 | - @mkdir( $unique_temp_dir ); |
|
| 111 | + if ( ! file_exists($unique_temp_dir)) { |
|
| 112 | + @mkdir($unique_temp_dir); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - return $unique_temp_dir . '/'; |
|
| 115 | + return $unique_temp_dir.'/'; |
|
| 116 | 116 | } |