@@ -124,6 +124,9 @@ discard block |
||
| 124 | 124 | ) ); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | + /** |
|
| 128 | + * @param string $path |
|
| 129 | + */ |
|
| 127 | 130 | private function reduce( $accumulator, $path ) { |
| 128 | 131 | |
| 129 | 132 | // Open the dir handle. |
@@ -145,7 +148,7 @@ discard block |
||
| 145 | 148 | /** |
| 146 | 149 | * @param $accumulator |
| 147 | 150 | * @param $path |
| 148 | - * @param $handle |
|
| 151 | + * @param resource $handle |
|
| 149 | 152 | * |
| 150 | 153 | * @return array |
| 151 | 154 | */ |
@@ -21,162 +21,162 @@ |
||
| 21 | 21 | |
| 22 | 22 | class Ttl_Cache_Cleaner { |
| 23 | 23 | |
| 24 | - const PATH = 0; |
|
| 25 | - const MTIME = 1; |
|
| 26 | - const SIZE = 2; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * The max TTL in seconds. |
|
| 30 | - * |
|
| 31 | - * @access private |
|
| 32 | - * @var int $ttl The max TTL in seconds. |
|
| 33 | - */ |
|
| 34 | - private $ttl; |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * The max size in bytes. |
|
| 38 | - * |
|
| 39 | - * @access private |
|
| 40 | - * @var int $ttl The max size in bytes. |
|
| 41 | - */ |
|
| 42 | - private $max_size; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Ttl_Cache_Cleaner constructor. |
|
| 46 | - * |
|
| 47 | - * @param int $ttl The max TTL in seconds. |
|
| 48 | - * @param int $max_size The max size in bytes. |
|
| 49 | - */ |
|
| 50 | - public function __construct( $ttl = WORDLIFT_CACHE_DEFAULT_TTL, $max_size = WORDLIFT_CACHE_DEFAULT_MAX_SIZE ) { |
|
| 51 | - |
|
| 52 | - $this->ttl = $ttl; |
|
| 53 | - $this->max_size = $max_size; |
|
| 54 | - |
|
| 55 | - add_action( 'wp_ajax_wl_ttl_cache_cleaner__cleanup', array( $this, 'cleanup' ) ); |
|
| 56 | - add_action( 'wl_ttl_cache_cleaner__cleanup', array( $this, 'cleanup' ) ); |
|
| 57 | - |
|
| 58 | - // Do not bother to configure scheduled tasks while running on the front-end. |
|
| 59 | - if ( is_admin() && ! wp_next_scheduled( 'wl_ttl_cache_cleaner__cleanup' ) ) { |
|
| 60 | - wp_schedule_event( time(), 'hourly', 'wl_ttl_cache_cleaner__cleanup' ); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - public static function deactivate() { |
|
| 66 | - |
|
| 67 | - $timestamp = wp_next_scheduled( 'wl_ttl_cache_cleaner__cleanup' ); |
|
| 68 | - wp_unschedule_event( $timestamp, 'wl_ttl_cache_cleaner__cleanup' ); |
|
| 69 | - |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - public function cleanup() { |
|
| 73 | - |
|
| 74 | - // Get all the files, recursive. |
|
| 75 | - $files = $this->reduce( array(), Ttl_Cache::get_cache_folder() ); |
|
| 76 | - |
|
| 77 | - |
|
| 78 | - // Get the max mtime. |
|
| 79 | - $max_mtime = time() - WORDLIFT_CACHE_DEFAULT_TTL; |
|
| 80 | - |
|
| 81 | - // Keep the original count for statistics that we're going to send the client. |
|
| 82 | - $original_count = count( $files ); |
|
| 83 | - |
|
| 84 | - // Sort by size ascending. |
|
| 85 | - usort( $files, function ( $f1, $f2 ) { |
|
| 86 | - if ( $f1[ Ttl_Cache_Cleaner::MTIME ] === $f2[ Ttl_Cache_Cleaner::MTIME ] ) { |
|
| 87 | - return 0; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - return ( $f1[ Ttl_Cache_Cleaner::MTIME ] < $f2[ Ttl_Cache_Cleaner::MTIME ] ) ? - 1 : 1; |
|
| 91 | - } ); |
|
| 92 | - |
|
| 93 | - // Start removing stale files. |
|
| 94 | - for ( $i = 0; $i < count( $files ); $i ++ ) { |
|
| 95 | - $file = $files[ $i ]; |
|
| 96 | - // Break if the mtime is within the range. |
|
| 97 | - if ( $file[ Ttl_Cache_Cleaner::MTIME ] > $max_mtime ) { |
|
| 98 | - break; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - unset( $files[ $i ] ); |
|
| 102 | - @unlink( $file[ Ttl_Cache_Cleaner::PATH ] ); |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - // Calculate the size. |
|
| 106 | - $total_size = array_reduce( $files, function ( $carry, $item ) { |
|
| 107 | - |
|
| 108 | - return $carry + $item[ Ttl_Cache_Cleaner::SIZE ]; |
|
| 109 | - }, 0 ); |
|
| 110 | - |
|
| 111 | - |
|
| 112 | - // Remove files until we're within the max size. |
|
| 113 | - while ( $total_size > $this->max_size ) { |
|
| 114 | - $file = array_shift( $files ); |
|
| 115 | - $total_size -= $file[ Ttl_Cache_Cleaner::SIZE ]; |
|
| 116 | - @unlink( $file[ Ttl_Cache_Cleaner::PATH ] ); |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - // Send back some stats. |
|
| 120 | - wp_send_json_success( array( |
|
| 121 | - 'initial_count' => $original_count, |
|
| 122 | - 'current_count' => count( $files ), |
|
| 123 | - 'current_size' => $total_size, |
|
| 124 | - ) ); |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - private function reduce( $accumulator, $path ) { |
|
| 128 | - |
|
| 129 | - // Open the dir handle. |
|
| 130 | - $handle = opendir( $path ); |
|
| 131 | - |
|
| 132 | - // Catch exceptions to be sure to close the dir handle. |
|
| 133 | - try { |
|
| 134 | - $accumulator = @$this->_reduce( $accumulator, $path, $handle ); |
|
| 135 | - } catch ( Exception $e ) { |
|
| 136 | - // Do nothing. |
|
| 137 | - } |
|
| 24 | + const PATH = 0; |
|
| 25 | + const MTIME = 1; |
|
| 26 | + const SIZE = 2; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * The max TTL in seconds. |
|
| 30 | + * |
|
| 31 | + * @access private |
|
| 32 | + * @var int $ttl The max TTL in seconds. |
|
| 33 | + */ |
|
| 34 | + private $ttl; |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * The max size in bytes. |
|
| 38 | + * |
|
| 39 | + * @access private |
|
| 40 | + * @var int $ttl The max size in bytes. |
|
| 41 | + */ |
|
| 42 | + private $max_size; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Ttl_Cache_Cleaner constructor. |
|
| 46 | + * |
|
| 47 | + * @param int $ttl The max TTL in seconds. |
|
| 48 | + * @param int $max_size The max size in bytes. |
|
| 49 | + */ |
|
| 50 | + public function __construct( $ttl = WORDLIFT_CACHE_DEFAULT_TTL, $max_size = WORDLIFT_CACHE_DEFAULT_MAX_SIZE ) { |
|
| 51 | + |
|
| 52 | + $this->ttl = $ttl; |
|
| 53 | + $this->max_size = $max_size; |
|
| 54 | + |
|
| 55 | + add_action( 'wp_ajax_wl_ttl_cache_cleaner__cleanup', array( $this, 'cleanup' ) ); |
|
| 56 | + add_action( 'wl_ttl_cache_cleaner__cleanup', array( $this, 'cleanup' ) ); |
|
| 57 | + |
|
| 58 | + // Do not bother to configure scheduled tasks while running on the front-end. |
|
| 59 | + if ( is_admin() && ! wp_next_scheduled( 'wl_ttl_cache_cleaner__cleanup' ) ) { |
|
| 60 | + wp_schedule_event( time(), 'hourly', 'wl_ttl_cache_cleaner__cleanup' ); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + public static function deactivate() { |
|
| 66 | + |
|
| 67 | + $timestamp = wp_next_scheduled( 'wl_ttl_cache_cleaner__cleanup' ); |
|
| 68 | + wp_unschedule_event( $timestamp, 'wl_ttl_cache_cleaner__cleanup' ); |
|
| 69 | + |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + public function cleanup() { |
|
| 73 | + |
|
| 74 | + // Get all the files, recursive. |
|
| 75 | + $files = $this->reduce( array(), Ttl_Cache::get_cache_folder() ); |
|
| 76 | + |
|
| 77 | + |
|
| 78 | + // Get the max mtime. |
|
| 79 | + $max_mtime = time() - WORDLIFT_CACHE_DEFAULT_TTL; |
|
| 80 | + |
|
| 81 | + // Keep the original count for statistics that we're going to send the client. |
|
| 82 | + $original_count = count( $files ); |
|
| 83 | + |
|
| 84 | + // Sort by size ascending. |
|
| 85 | + usort( $files, function ( $f1, $f2 ) { |
|
| 86 | + if ( $f1[ Ttl_Cache_Cleaner::MTIME ] === $f2[ Ttl_Cache_Cleaner::MTIME ] ) { |
|
| 87 | + return 0; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + return ( $f1[ Ttl_Cache_Cleaner::MTIME ] < $f2[ Ttl_Cache_Cleaner::MTIME ] ) ? - 1 : 1; |
|
| 91 | + } ); |
|
| 92 | + |
|
| 93 | + // Start removing stale files. |
|
| 94 | + for ( $i = 0; $i < count( $files ); $i ++ ) { |
|
| 95 | + $file = $files[ $i ]; |
|
| 96 | + // Break if the mtime is within the range. |
|
| 97 | + if ( $file[ Ttl_Cache_Cleaner::MTIME ] > $max_mtime ) { |
|
| 98 | + break; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + unset( $files[ $i ] ); |
|
| 102 | + @unlink( $file[ Ttl_Cache_Cleaner::PATH ] ); |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + // Calculate the size. |
|
| 106 | + $total_size = array_reduce( $files, function ( $carry, $item ) { |
|
| 107 | + |
|
| 108 | + return $carry + $item[ Ttl_Cache_Cleaner::SIZE ]; |
|
| 109 | + }, 0 ); |
|
| 110 | + |
|
| 111 | + |
|
| 112 | + // Remove files until we're within the max size. |
|
| 113 | + while ( $total_size > $this->max_size ) { |
|
| 114 | + $file = array_shift( $files ); |
|
| 115 | + $total_size -= $file[ Ttl_Cache_Cleaner::SIZE ]; |
|
| 116 | + @unlink( $file[ Ttl_Cache_Cleaner::PATH ] ); |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + // Send back some stats. |
|
| 120 | + wp_send_json_success( array( |
|
| 121 | + 'initial_count' => $original_count, |
|
| 122 | + 'current_count' => count( $files ), |
|
| 123 | + 'current_size' => $total_size, |
|
| 124 | + ) ); |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + private function reduce( $accumulator, $path ) { |
|
| 128 | + |
|
| 129 | + // Open the dir handle. |
|
| 130 | + $handle = opendir( $path ); |
|
| 131 | + |
|
| 132 | + // Catch exceptions to be sure to close the dir handle. |
|
| 133 | + try { |
|
| 134 | + $accumulator = @$this->_reduce( $accumulator, $path, $handle ); |
|
| 135 | + } catch ( Exception $e ) { |
|
| 136 | + // Do nothing. |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - // Finally close the directory handle. |
|
| 140 | - closedir( $handle ); |
|
| 139 | + // Finally close the directory handle. |
|
| 140 | + closedir( $handle ); |
|
| 141 | 141 | |
| 142 | - return $accumulator; |
|
| 143 | - } |
|
| 142 | + return $accumulator; |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | - /** |
|
| 146 | - * @param $accumulator |
|
| 147 | - * @param $path |
|
| 148 | - * @param $handle |
|
| 149 | - * |
|
| 150 | - * @return array |
|
| 151 | - */ |
|
| 152 | - private function _reduce( $accumulator, $path, $handle ) { |
|
| 145 | + /** |
|
| 146 | + * @param $accumulator |
|
| 147 | + * @param $path |
|
| 148 | + * @param $handle |
|
| 149 | + * |
|
| 150 | + * @return array |
|
| 151 | + */ |
|
| 152 | + private function _reduce( $accumulator, $path, $handle ) { |
|
| 153 | 153 | |
| 154 | - while ( false !== ( $entry = readdir( $handle ) ) ) { |
|
| 154 | + while ( false !== ( $entry = readdir( $handle ) ) ) { |
|
| 155 | 155 | |
| 156 | - // Skip to the next one. |
|
| 157 | - if ( 0 === strpos( $entry, '.' ) ) { |
|
| 158 | - continue; |
|
| 159 | - } |
|
| 156 | + // Skip to the next one. |
|
| 157 | + if ( 0 === strpos( $entry, '.' ) ) { |
|
| 158 | + continue; |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | - // Set the full path to the entry. |
|
| 162 | - $entry_path = $path . DIRECTORY_SEPARATOR . $entry; |
|
| 161 | + // Set the full path to the entry. |
|
| 162 | + $entry_path = $path . DIRECTORY_SEPARATOR . $entry; |
|
| 163 | 163 | |
| 164 | - // Handle directories. |
|
| 165 | - if ( is_dir( $entry_path ) ) { |
|
| 166 | - $accumulator = $this->reduce( $accumulator, $entry_path ); |
|
| 164 | + // Handle directories. |
|
| 165 | + if ( is_dir( $entry_path ) ) { |
|
| 166 | + $accumulator = $this->reduce( $accumulator, $entry_path ); |
|
| 167 | 167 | |
| 168 | - continue; |
|
| 169 | - } |
|
| 168 | + continue; |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - // Store the file data. |
|
| 172 | - $accumulator[] = array( |
|
| 173 | - $entry_path, |
|
| 174 | - filemtime( $entry_path ), |
|
| 175 | - filesize( $entry_path ), |
|
| 176 | - ); |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - return $accumulator; |
|
| 180 | - } |
|
| 171 | + // Store the file data. |
|
| 172 | + $accumulator[] = array( |
|
| 173 | + $entry_path, |
|
| 174 | + filemtime( $entry_path ), |
|
| 175 | + filesize( $entry_path ), |
|
| 176 | + ); |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + return $accumulator; |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | 182 | } |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | use Exception; |
| 18 | 18 | |
| 19 | -defined( 'WORDLIFT_CACHE_DEFAULT_TTL' ) || define( 'WORDLIFT_CACHE_DEFAULT_TTL', 86400 ); // 24 hours |
|
| 20 | -defined( 'WORDLIFT_CACHE_DEFAULT_MAX_SIZE' ) || define( 'WORDLIFT_CACHE_DEFAULT_MAX_SIZE', 104857600 ); // 100 M |
|
| 19 | +defined('WORDLIFT_CACHE_DEFAULT_TTL') || define('WORDLIFT_CACHE_DEFAULT_TTL', 86400); // 24 hours |
|
| 20 | +defined('WORDLIFT_CACHE_DEFAULT_MAX_SIZE') || define('WORDLIFT_CACHE_DEFAULT_MAX_SIZE', 104857600); // 100 M |
|
| 21 | 21 | |
| 22 | 22 | class Ttl_Cache_Cleaner { |
| 23 | 23 | |
@@ -47,97 +47,97 @@ discard block |
||
| 47 | 47 | * @param int $ttl The max TTL in seconds. |
| 48 | 48 | * @param int $max_size The max size in bytes. |
| 49 | 49 | */ |
| 50 | - public function __construct( $ttl = WORDLIFT_CACHE_DEFAULT_TTL, $max_size = WORDLIFT_CACHE_DEFAULT_MAX_SIZE ) { |
|
| 50 | + public function __construct($ttl = WORDLIFT_CACHE_DEFAULT_TTL, $max_size = WORDLIFT_CACHE_DEFAULT_MAX_SIZE) { |
|
| 51 | 51 | |
| 52 | 52 | $this->ttl = $ttl; |
| 53 | 53 | $this->max_size = $max_size; |
| 54 | 54 | |
| 55 | - add_action( 'wp_ajax_wl_ttl_cache_cleaner__cleanup', array( $this, 'cleanup' ) ); |
|
| 56 | - add_action( 'wl_ttl_cache_cleaner__cleanup', array( $this, 'cleanup' ) ); |
|
| 55 | + add_action('wp_ajax_wl_ttl_cache_cleaner__cleanup', array($this, 'cleanup')); |
|
| 56 | + add_action('wl_ttl_cache_cleaner__cleanup', array($this, 'cleanup')); |
|
| 57 | 57 | |
| 58 | 58 | // Do not bother to configure scheduled tasks while running on the front-end. |
| 59 | - if ( is_admin() && ! wp_next_scheduled( 'wl_ttl_cache_cleaner__cleanup' ) ) { |
|
| 60 | - wp_schedule_event( time(), 'hourly', 'wl_ttl_cache_cleaner__cleanup' ); |
|
| 59 | + if (is_admin() && ! wp_next_scheduled('wl_ttl_cache_cleaner__cleanup')) { |
|
| 60 | + wp_schedule_event(time(), 'hourly', 'wl_ttl_cache_cleaner__cleanup'); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public static function deactivate() { |
| 66 | 66 | |
| 67 | - $timestamp = wp_next_scheduled( 'wl_ttl_cache_cleaner__cleanup' ); |
|
| 68 | - wp_unschedule_event( $timestamp, 'wl_ttl_cache_cleaner__cleanup' ); |
|
| 67 | + $timestamp = wp_next_scheduled('wl_ttl_cache_cleaner__cleanup'); |
|
| 68 | + wp_unschedule_event($timestamp, 'wl_ttl_cache_cleaner__cleanup'); |
|
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | public function cleanup() { |
| 73 | 73 | |
| 74 | 74 | // Get all the files, recursive. |
| 75 | - $files = $this->reduce( array(), Ttl_Cache::get_cache_folder() ); |
|
| 75 | + $files = $this->reduce(array(), Ttl_Cache::get_cache_folder()); |
|
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | // Get the max mtime. |
| 79 | 79 | $max_mtime = time() - WORDLIFT_CACHE_DEFAULT_TTL; |
| 80 | 80 | |
| 81 | 81 | // Keep the original count for statistics that we're going to send the client. |
| 82 | - $original_count = count( $files ); |
|
| 82 | + $original_count = count($files); |
|
| 83 | 83 | |
| 84 | 84 | // Sort by size ascending. |
| 85 | - usort( $files, function ( $f1, $f2 ) { |
|
| 86 | - if ( $f1[ Ttl_Cache_Cleaner::MTIME ] === $f2[ Ttl_Cache_Cleaner::MTIME ] ) { |
|
| 85 | + usort($files, function($f1, $f2) { |
|
| 86 | + if ($f1[Ttl_Cache_Cleaner::MTIME] === $f2[Ttl_Cache_Cleaner::MTIME]) { |
|
| 87 | 87 | return 0; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - return ( $f1[ Ttl_Cache_Cleaner::MTIME ] < $f2[ Ttl_Cache_Cleaner::MTIME ] ) ? - 1 : 1; |
|
| 90 | + return ($f1[Ttl_Cache_Cleaner::MTIME] < $f2[Ttl_Cache_Cleaner::MTIME]) ? -1 : 1; |
|
| 91 | 91 | } ); |
| 92 | 92 | |
| 93 | 93 | // Start removing stale files. |
| 94 | - for ( $i = 0; $i < count( $files ); $i ++ ) { |
|
| 95 | - $file = $files[ $i ]; |
|
| 94 | + for ($i = 0; $i < count($files); $i++) { |
|
| 95 | + $file = $files[$i]; |
|
| 96 | 96 | // Break if the mtime is within the range. |
| 97 | - if ( $file[ Ttl_Cache_Cleaner::MTIME ] > $max_mtime ) { |
|
| 97 | + if ($file[Ttl_Cache_Cleaner::MTIME] > $max_mtime) { |
|
| 98 | 98 | break; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - unset( $files[ $i ] ); |
|
| 102 | - @unlink( $file[ Ttl_Cache_Cleaner::PATH ] ); |
|
| 101 | + unset($files[$i]); |
|
| 102 | + @unlink($file[Ttl_Cache_Cleaner::PATH]); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // Calculate the size. |
| 106 | - $total_size = array_reduce( $files, function ( $carry, $item ) { |
|
| 106 | + $total_size = array_reduce($files, function($carry, $item) { |
|
| 107 | 107 | |
| 108 | - return $carry + $item[ Ttl_Cache_Cleaner::SIZE ]; |
|
| 109 | - }, 0 ); |
|
| 108 | + return $carry + $item[Ttl_Cache_Cleaner::SIZE]; |
|
| 109 | + }, 0); |
|
| 110 | 110 | |
| 111 | 111 | |
| 112 | 112 | // Remove files until we're within the max size. |
| 113 | - while ( $total_size > $this->max_size ) { |
|
| 114 | - $file = array_shift( $files ); |
|
| 115 | - $total_size -= $file[ Ttl_Cache_Cleaner::SIZE ]; |
|
| 116 | - @unlink( $file[ Ttl_Cache_Cleaner::PATH ] ); |
|
| 113 | + while ($total_size > $this->max_size) { |
|
| 114 | + $file = array_shift($files); |
|
| 115 | + $total_size -= $file[Ttl_Cache_Cleaner::SIZE]; |
|
| 116 | + @unlink($file[Ttl_Cache_Cleaner::PATH]); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | // Send back some stats. |
| 120 | - wp_send_json_success( array( |
|
| 120 | + wp_send_json_success(array( |
|
| 121 | 121 | 'initial_count' => $original_count, |
| 122 | - 'current_count' => count( $files ), |
|
| 122 | + 'current_count' => count($files), |
|
| 123 | 123 | 'current_size' => $total_size, |
| 124 | - ) ); |
|
| 124 | + )); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - private function reduce( $accumulator, $path ) { |
|
| 127 | + private function reduce($accumulator, $path) { |
|
| 128 | 128 | |
| 129 | 129 | // Open the dir handle. |
| 130 | - $handle = opendir( $path ); |
|
| 130 | + $handle = opendir($path); |
|
| 131 | 131 | |
| 132 | 132 | // Catch exceptions to be sure to close the dir handle. |
| 133 | 133 | try { |
| 134 | - $accumulator = @$this->_reduce( $accumulator, $path, $handle ); |
|
| 135 | - } catch ( Exception $e ) { |
|
| 134 | + $accumulator = @$this->_reduce($accumulator, $path, $handle); |
|
| 135 | + } catch (Exception $e) { |
|
| 136 | 136 | // Do nothing. |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | // Finally close the directory handle. |
| 140 | - closedir( $handle ); |
|
| 140 | + closedir($handle); |
|
| 141 | 141 | |
| 142 | 142 | return $accumulator; |
| 143 | 143 | } |
@@ -149,21 +149,21 @@ discard block |
||
| 149 | 149 | * |
| 150 | 150 | * @return array |
| 151 | 151 | */ |
| 152 | - private function _reduce( $accumulator, $path, $handle ) { |
|
| 152 | + private function _reduce($accumulator, $path, $handle) { |
|
| 153 | 153 | |
| 154 | - while ( false !== ( $entry = readdir( $handle ) ) ) { |
|
| 154 | + while (false !== ($entry = readdir($handle))) { |
|
| 155 | 155 | |
| 156 | 156 | // Skip to the next one. |
| 157 | - if ( 0 === strpos( $entry, '.' ) ) { |
|
| 157 | + if (0 === strpos($entry, '.')) { |
|
| 158 | 158 | continue; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | // Set the full path to the entry. |
| 162 | - $entry_path = $path . DIRECTORY_SEPARATOR . $entry; |
|
| 162 | + $entry_path = $path.DIRECTORY_SEPARATOR.$entry; |
|
| 163 | 163 | |
| 164 | 164 | // Handle directories. |
| 165 | - if ( is_dir( $entry_path ) ) { |
|
| 166 | - $accumulator = $this->reduce( $accumulator, $entry_path ); |
|
| 165 | + if (is_dir($entry_path)) { |
|
| 166 | + $accumulator = $this->reduce($accumulator, $entry_path); |
|
| 167 | 167 | |
| 168 | 168 | continue; |
| 169 | 169 | } |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | // Store the file data. |
| 172 | 172 | $accumulator[] = array( |
| 173 | 173 | $entry_path, |
| 174 | - filemtime( $entry_path ), |
|
| 175 | - filesize( $entry_path ), |
|
| 174 | + filemtime($entry_path), |
|
| 175 | + filesize($entry_path), |
|
| 176 | 176 | ); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -17,169 +17,169 @@ |
||
| 17 | 17 | // @@todo: add a hook to clear the cached files now and then. |
| 18 | 18 | class Ttl_Cache { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * The cache name. |
|
| 22 | - * |
|
| 23 | - * @var string $name The cache name. |
|
| 24 | - * @access private |
|
| 25 | - * @since 3.21.2 |
|
| 26 | - */ |
|
| 27 | - private $name; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * The TTL of cached responses in seconds. |
|
| 31 | - * |
|
| 32 | - * @var int $ttl The TTL in seconds. |
|
| 33 | - * @access private |
|
| 34 | - * @since 3.21.2 |
|
| 35 | - */ |
|
| 36 | - private $ttl; |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * The cache dir where the cached data is written. |
|
| 40 | - * |
|
| 41 | - * @since 3.21.2 |
|
| 42 | - * @access private |
|
| 43 | - * @var string $cache_dir The cache dir where the cached responses are written. |
|
| 44 | - */ |
|
| 45 | - private $cache_dir; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * A {@link Wordlift_Log_Service} instance. |
|
| 49 | - * |
|
| 50 | - * @var Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 51 | - * @access private |
|
| 52 | - * @since 3.21.2 |
|
| 53 | - */ |
|
| 54 | - private $log; |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * @var array |
|
| 58 | - */ |
|
| 59 | - private static $caches = array(); |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Create a {@link Ttl_Cache} with the specified TTL, default 900 secs. |
|
| 63 | - * |
|
| 64 | - * @param string $name The cache name. |
|
| 65 | - * @param int $ttl The cache TTL, default 900 secs. |
|
| 66 | - * |
|
| 67 | - * @since 3.21.2 |
|
| 68 | - */ |
|
| 69 | - public function __construct( $name, $ttl = 900 ) { |
|
| 70 | - |
|
| 71 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 72 | - |
|
| 73 | - $this->name = $name; |
|
| 74 | - $this->ttl = $ttl; |
|
| 75 | - |
|
| 76 | - // Get the temp dir and add the directory separator if missing. |
|
| 77 | - $temp_dir = get_temp_dir(); |
|
| 78 | - if ( DIRECTORY_SEPARATOR !== substr( $temp_dir, - strlen( DIRECTORY_SEPARATOR ) ) ) { |
|
| 79 | - $temp_dir .= DIRECTORY_SEPARATOR; |
|
| 80 | - } |
|
| 81 | - $this->cache_dir = self::get_cache_folder() . DIRECTORY_SEPARATOR . md5( $name ); |
|
| 82 | - |
|
| 83 | - $this->log->trace( "Creating the cache folder {$this->cache_dir}..." ); |
|
| 84 | - wp_mkdir_p( $this->cache_dir ); |
|
| 85 | - |
|
| 86 | - self::$caches[ $name ] = $this; |
|
| 87 | - |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * Get the root cache folder. |
|
| 92 | - * |
|
| 93 | - * This is useful to introduce a cache cleaning procedure which will scan and delete older stale cache files. |
|
| 94 | - * |
|
| 95 | - * @return string The root cache folder. |
|
| 96 | - * @since 3.22.5 |
|
| 97 | - */ |
|
| 98 | - public static function get_cache_folder() { |
|
| 99 | - |
|
| 100 | - // Get the temp dir and add the directory separator if missing. |
|
| 101 | - $temp_dir = get_temp_dir(); |
|
| 102 | - if ( DIRECTORY_SEPARATOR !== substr( $temp_dir, - strlen( DIRECTORY_SEPARATOR ) ) ) { |
|
| 103 | - $temp_dir .= DIRECTORY_SEPARATOR; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - return $temp_dir . 'wl.cache'; |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * Get the cached data for the specified key. |
|
| 111 | - * |
|
| 112 | - * @param mixed $key A serializable key. |
|
| 113 | - * |
|
| 114 | - * @return mixed|null |
|
| 115 | - * @since 3.21.2 |
|
| 116 | - */ |
|
| 117 | - public function get( $key ) { |
|
| 118 | - |
|
| 119 | - $filename = $this->get_filename( $key ); |
|
| 120 | - |
|
| 121 | - // If the cache file exists and it's not too old, then return it. |
|
| 122 | - if ( file_exists( $filename ) && $this->ttl >= time() - filemtime( $filename ) ) { |
|
| 123 | - $this->log->trace( "Cache HIT.\n" ); |
|
| 124 | - |
|
| 125 | - return json_decode( file_get_contents( $filename ), true ); |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - $this->log->trace( "Cache MISS, filename $filename.\n" ); |
|
| 129 | - |
|
| 130 | - return null; |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - public function put( $key, $data ) { |
|
| 134 | - |
|
| 135 | - $filename = $this->get_filename( $key ); |
|
| 136 | - |
|
| 137 | - // Cache. |
|
| 138 | - @unlink( $filename ); |
|
| 139 | - @file_put_contents( $filename, wp_json_encode( $data ) ); |
|
| 140 | - |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - public function flush() { |
|
| 144 | - |
|
| 145 | - $files = glob( $this->cache_dir . DIRECTORY_SEPARATOR . '*' ); |
|
| 146 | - foreach ( $files as $file ) { // iterate files |
|
| 147 | - if ( is_file( $file ) ) { |
|
| 148 | - @unlink( $file ); |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - } |
|
| 20 | + /** |
|
| 21 | + * The cache name. |
|
| 22 | + * |
|
| 23 | + * @var string $name The cache name. |
|
| 24 | + * @access private |
|
| 25 | + * @since 3.21.2 |
|
| 26 | + */ |
|
| 27 | + private $name; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * The TTL of cached responses in seconds. |
|
| 31 | + * |
|
| 32 | + * @var int $ttl The TTL in seconds. |
|
| 33 | + * @access private |
|
| 34 | + * @since 3.21.2 |
|
| 35 | + */ |
|
| 36 | + private $ttl; |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * The cache dir where the cached data is written. |
|
| 40 | + * |
|
| 41 | + * @since 3.21.2 |
|
| 42 | + * @access private |
|
| 43 | + * @var string $cache_dir The cache dir where the cached responses are written. |
|
| 44 | + */ |
|
| 45 | + private $cache_dir; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * A {@link Wordlift_Log_Service} instance. |
|
| 49 | + * |
|
| 50 | + * @var Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 51 | + * @access private |
|
| 52 | + * @since 3.21.2 |
|
| 53 | + */ |
|
| 54 | + private $log; |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * @var array |
|
| 58 | + */ |
|
| 59 | + private static $caches = array(); |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Create a {@link Ttl_Cache} with the specified TTL, default 900 secs. |
|
| 63 | + * |
|
| 64 | + * @param string $name The cache name. |
|
| 65 | + * @param int $ttl The cache TTL, default 900 secs. |
|
| 66 | + * |
|
| 67 | + * @since 3.21.2 |
|
| 68 | + */ |
|
| 69 | + public function __construct( $name, $ttl = 900 ) { |
|
| 70 | + |
|
| 71 | + $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 72 | + |
|
| 73 | + $this->name = $name; |
|
| 74 | + $this->ttl = $ttl; |
|
| 75 | + |
|
| 76 | + // Get the temp dir and add the directory separator if missing. |
|
| 77 | + $temp_dir = get_temp_dir(); |
|
| 78 | + if ( DIRECTORY_SEPARATOR !== substr( $temp_dir, - strlen( DIRECTORY_SEPARATOR ) ) ) { |
|
| 79 | + $temp_dir .= DIRECTORY_SEPARATOR; |
|
| 80 | + } |
|
| 81 | + $this->cache_dir = self::get_cache_folder() . DIRECTORY_SEPARATOR . md5( $name ); |
|
| 82 | + |
|
| 83 | + $this->log->trace( "Creating the cache folder {$this->cache_dir}..." ); |
|
| 84 | + wp_mkdir_p( $this->cache_dir ); |
|
| 85 | + |
|
| 86 | + self::$caches[ $name ] = $this; |
|
| 87 | + |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * Get the root cache folder. |
|
| 92 | + * |
|
| 93 | + * This is useful to introduce a cache cleaning procedure which will scan and delete older stale cache files. |
|
| 94 | + * |
|
| 95 | + * @return string The root cache folder. |
|
| 96 | + * @since 3.22.5 |
|
| 97 | + */ |
|
| 98 | + public static function get_cache_folder() { |
|
| 99 | + |
|
| 100 | + // Get the temp dir and add the directory separator if missing. |
|
| 101 | + $temp_dir = get_temp_dir(); |
|
| 102 | + if ( DIRECTORY_SEPARATOR !== substr( $temp_dir, - strlen( DIRECTORY_SEPARATOR ) ) ) { |
|
| 103 | + $temp_dir .= DIRECTORY_SEPARATOR; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + return $temp_dir . 'wl.cache'; |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * Get the cached data for the specified key. |
|
| 111 | + * |
|
| 112 | + * @param mixed $key A serializable key. |
|
| 113 | + * |
|
| 114 | + * @return mixed|null |
|
| 115 | + * @since 3.21.2 |
|
| 116 | + */ |
|
| 117 | + public function get( $key ) { |
|
| 118 | + |
|
| 119 | + $filename = $this->get_filename( $key ); |
|
| 120 | + |
|
| 121 | + // If the cache file exists and it's not too old, then return it. |
|
| 122 | + if ( file_exists( $filename ) && $this->ttl >= time() - filemtime( $filename ) ) { |
|
| 123 | + $this->log->trace( "Cache HIT.\n" ); |
|
| 124 | + |
|
| 125 | + return json_decode( file_get_contents( $filename ), true ); |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + $this->log->trace( "Cache MISS, filename $filename.\n" ); |
|
| 129 | + |
|
| 130 | + return null; |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + public function put( $key, $data ) { |
|
| 134 | + |
|
| 135 | + $filename = $this->get_filename( $key ); |
|
| 136 | + |
|
| 137 | + // Cache. |
|
| 138 | + @unlink( $filename ); |
|
| 139 | + @file_put_contents( $filename, wp_json_encode( $data ) ); |
|
| 140 | + |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + public function flush() { |
|
| 144 | + |
|
| 145 | + $files = glob( $this->cache_dir . DIRECTORY_SEPARATOR . '*' ); |
|
| 146 | + foreach ( $files as $file ) { // iterate files |
|
| 147 | + if ( is_file( $file ) ) { |
|
| 148 | + @unlink( $file ); |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - public static function flush_all() { |
|
| 154 | + public static function flush_all() { |
|
| 155 | 155 | |
| 156 | - /** @var Ttl_Cache $cache */ |
|
| 157 | - foreach ( self::$caches as $cache ) { |
|
| 158 | - $cache->flush(); |
|
| 159 | - } |
|
| 156 | + /** @var Ttl_Cache $cache */ |
|
| 157 | + foreach ( self::$caches as $cache ) { |
|
| 158 | + $cache->flush(); |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | - } |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | - /** |
|
| 164 | - * Get the full path for the given `$hash`. The file is not checked for its existence. |
|
| 165 | - * |
|
| 166 | - * @param string $hash A file hash. |
|
| 167 | - * |
|
| 168 | - * @return string The full path to the file. |
|
| 169 | - * @since 3.21.2 |
|
| 170 | - */ |
|
| 171 | - private function get_path( $hash ) { |
|
| 163 | + /** |
|
| 164 | + * Get the full path for the given `$hash`. The file is not checked for its existence. |
|
| 165 | + * |
|
| 166 | + * @param string $hash A file hash. |
|
| 167 | + * |
|
| 168 | + * @return string The full path to the file. |
|
| 169 | + * @since 3.21.2 |
|
| 170 | + */ |
|
| 171 | + private function get_path( $hash ) { |
|
| 172 | 172 | |
| 173 | - return $this->cache_dir . DIRECTORY_SEPARATOR . $hash; |
|
| 174 | - } |
|
| 173 | + return $this->cache_dir . DIRECTORY_SEPARATOR . $hash; |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | - private function get_filename( $key ) { |
|
| 176 | + private function get_filename( $key ) { |
|
| 177 | 177 | |
| 178 | - // Create a hash and a path to the cache file. |
|
| 179 | - $hash = md5( json_encode( $key ) ); |
|
| 180 | - $filename = $this->get_path( $hash ); |
|
| 178 | + // Create a hash and a path to the cache file. |
|
| 179 | + $hash = md5( json_encode( $key ) ); |
|
| 180 | + $filename = $this->get_path( $hash ); |
|
| 181 | 181 | |
| 182 | - return $filename; |
|
| 183 | - } |
|
| 182 | + return $filename; |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | 185 | } |
@@ -66,24 +66,24 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @since 3.21.2 |
| 68 | 68 | */ |
| 69 | - public function __construct( $name, $ttl = 900 ) { |
|
| 69 | + public function __construct($name, $ttl = 900) { |
|
| 70 | 70 | |
| 71 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 71 | + $this->log = Wordlift_Log_Service::get_logger(get_class()); |
|
| 72 | 72 | |
| 73 | 73 | $this->name = $name; |
| 74 | 74 | $this->ttl = $ttl; |
| 75 | 75 | |
| 76 | 76 | // Get the temp dir and add the directory separator if missing. |
| 77 | 77 | $temp_dir = get_temp_dir(); |
| 78 | - if ( DIRECTORY_SEPARATOR !== substr( $temp_dir, - strlen( DIRECTORY_SEPARATOR ) ) ) { |
|
| 78 | + if (DIRECTORY_SEPARATOR !== substr($temp_dir, - strlen(DIRECTORY_SEPARATOR))) { |
|
| 79 | 79 | $temp_dir .= DIRECTORY_SEPARATOR; |
| 80 | 80 | } |
| 81 | - $this->cache_dir = self::get_cache_folder() . DIRECTORY_SEPARATOR . md5( $name ); |
|
| 81 | + $this->cache_dir = self::get_cache_folder().DIRECTORY_SEPARATOR.md5($name); |
|
| 82 | 82 | |
| 83 | - $this->log->trace( "Creating the cache folder {$this->cache_dir}..." ); |
|
| 84 | - wp_mkdir_p( $this->cache_dir ); |
|
| 83 | + $this->log->trace("Creating the cache folder {$this->cache_dir}..."); |
|
| 84 | + wp_mkdir_p($this->cache_dir); |
|
| 85 | 85 | |
| 86 | - self::$caches[ $name ] = $this; |
|
| 86 | + self::$caches[$name] = $this; |
|
| 87 | 87 | |
| 88 | 88 | } |
| 89 | 89 | |
@@ -99,11 +99,11 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | // Get the temp dir and add the directory separator if missing. |
| 101 | 101 | $temp_dir = get_temp_dir(); |
| 102 | - if ( DIRECTORY_SEPARATOR !== substr( $temp_dir, - strlen( DIRECTORY_SEPARATOR ) ) ) { |
|
| 102 | + if (DIRECTORY_SEPARATOR !== substr($temp_dir, - strlen(DIRECTORY_SEPARATOR))) { |
|
| 103 | 103 | $temp_dir .= DIRECTORY_SEPARATOR; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - return $temp_dir . 'wl.cache'; |
|
| 106 | + return $temp_dir.'wl.cache'; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -114,38 +114,38 @@ discard block |
||
| 114 | 114 | * @return mixed|null |
| 115 | 115 | * @since 3.21.2 |
| 116 | 116 | */ |
| 117 | - public function get( $key ) { |
|
| 117 | + public function get($key) { |
|
| 118 | 118 | |
| 119 | - $filename = $this->get_filename( $key ); |
|
| 119 | + $filename = $this->get_filename($key); |
|
| 120 | 120 | |
| 121 | 121 | // If the cache file exists and it's not too old, then return it. |
| 122 | - if ( file_exists( $filename ) && $this->ttl >= time() - filemtime( $filename ) ) { |
|
| 123 | - $this->log->trace( "Cache HIT.\n" ); |
|
| 122 | + if (file_exists($filename) && $this->ttl >= time() - filemtime($filename)) { |
|
| 123 | + $this->log->trace("Cache HIT.\n"); |
|
| 124 | 124 | |
| 125 | - return json_decode( file_get_contents( $filename ), true ); |
|
| 125 | + return json_decode(file_get_contents($filename), true); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $this->log->trace( "Cache MISS, filename $filename.\n" ); |
|
| 128 | + $this->log->trace("Cache MISS, filename $filename.\n"); |
|
| 129 | 129 | |
| 130 | 130 | return null; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - public function put( $key, $data ) { |
|
| 133 | + public function put($key, $data) { |
|
| 134 | 134 | |
| 135 | - $filename = $this->get_filename( $key ); |
|
| 135 | + $filename = $this->get_filename($key); |
|
| 136 | 136 | |
| 137 | 137 | // Cache. |
| 138 | - @unlink( $filename ); |
|
| 139 | - @file_put_contents( $filename, wp_json_encode( $data ) ); |
|
| 138 | + @unlink($filename); |
|
| 139 | + @file_put_contents($filename, wp_json_encode($data)); |
|
| 140 | 140 | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | public function flush() { |
| 144 | 144 | |
| 145 | - $files = glob( $this->cache_dir . DIRECTORY_SEPARATOR . '*' ); |
|
| 146 | - foreach ( $files as $file ) { // iterate files |
|
| 147 | - if ( is_file( $file ) ) { |
|
| 148 | - @unlink( $file ); |
|
| 145 | + $files = glob($this->cache_dir.DIRECTORY_SEPARATOR.'*'); |
|
| 146 | + foreach ($files as $file) { // iterate files |
|
| 147 | + if (is_file($file)) { |
|
| 148 | + @unlink($file); |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | public static function flush_all() { |
| 155 | 155 | |
| 156 | 156 | /** @var Ttl_Cache $cache */ |
| 157 | - foreach ( self::$caches as $cache ) { |
|
| 157 | + foreach (self::$caches as $cache) { |
|
| 158 | 158 | $cache->flush(); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -168,16 +168,16 @@ discard block |
||
| 168 | 168 | * @return string The full path to the file. |
| 169 | 169 | * @since 3.21.2 |
| 170 | 170 | */ |
| 171 | - private function get_path( $hash ) { |
|
| 171 | + private function get_path($hash) { |
|
| 172 | 172 | |
| 173 | - return $this->cache_dir . DIRECTORY_SEPARATOR . $hash; |
|
| 173 | + return $this->cache_dir.DIRECTORY_SEPARATOR.$hash; |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - private function get_filename( $key ) { |
|
| 176 | + private function get_filename($key) { |
|
| 177 | 177 | |
| 178 | 178 | // Create a hash and a path to the cache file. |
| 179 | - $hash = md5( json_encode( $key ) ); |
|
| 180 | - $filename = $this->get_path( $hash ); |
|
| 179 | + $hash = md5(json_encode($key)); |
|
| 180 | + $filename = $this->get_path($hash); |
|
| 181 | 181 | |
| 182 | 182 | return $filename; |
| 183 | 183 | } |
@@ -17,138 +17,138 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | class Wordlift_Navigator_Shortcode extends Wordlift_Shortcode { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * {@inheritdoc} |
|
| 22 | - */ |
|
| 23 | - const SHORTCODE = 'wl_navigator'; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * {@inheritdoc} |
|
| 27 | - */ |
|
| 28 | - public function render( $atts ) { |
|
| 29 | - |
|
| 30 | - return Wordlift_AMP_Service::is_amp_endpoint() ? $this->amp_shortcode( $atts ) |
|
| 31 | - : $this->web_shortcode( $atts ); |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * Shared function used by web_shortcode and amp_shortcode |
|
| 36 | - * Bootstrap logic for attributes extraction and boolean filtering |
|
| 37 | - * |
|
| 38 | - * @param array $atts Shortcode attributes. |
|
| 39 | - * |
|
| 40 | - * @return array $shortcode_atts |
|
| 41 | - * @since 3.20.0 |
|
| 42 | - * |
|
| 43 | - */ |
|
| 44 | - private function make_shortcode_atts( $atts ) { |
|
| 45 | - |
|
| 46 | - // Extract attributes and set default values. |
|
| 47 | - $shortcode_atts = shortcode_atts( array( |
|
| 48 | - 'title' => __( 'Related articles', 'wordlift' ), |
|
| 49 | - 'limit' => 4, |
|
| 50 | - 'offset' => 0, |
|
| 51 | - 'template_id' => '', |
|
| 52 | - 'post_id' => '', |
|
| 53 | - 'uniqid' => uniqid( 'wl-navigator-widget-' ), |
|
| 54 | - ), $atts ); |
|
| 55 | - |
|
| 56 | - return $shortcode_atts; |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * Function in charge of diplaying the [wl-navigator] in web mode. |
|
| 61 | - * |
|
| 62 | - * @param array $atts Shortcode attributes. |
|
| 63 | - * |
|
| 64 | - * @return string Shortcode HTML for web |
|
| 65 | - * @since 3.20.0 |
|
| 66 | - * |
|
| 67 | - */ |
|
| 68 | - private function web_shortcode( $atts ) { |
|
| 69 | - |
|
| 70 | - // attributes extraction and boolean filtering |
|
| 71 | - $shortcode_atts = $this->make_shortcode_atts( $atts ); |
|
| 72 | - |
|
| 73 | - // avoid building the widget when no post_id is specified and there is a list of posts. |
|
| 74 | - if ( empty( $shortcode_atts['post_id'] ) && ! is_singular() ) { |
|
| 75 | - return; |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - $post = ! empty( $shortcode_atts['post_id'] ) ? get_post( intval( $shortcode_atts['post_id'] ) ) : get_post(); |
|
| 79 | - $navigator_id = $shortcode_atts['uniqid']; |
|
| 80 | - $rest_url = $post ? admin_url( sprintf( 'admin-ajax.php?action=wl_navigator&uniqid=%s&post_id=%s&limit=%s&offset=%s', $navigator_id, $post->ID, $shortcode_atts['limit'], $shortcode_atts['offset'] ) ) : false; |
|
| 81 | - |
|
| 82 | - // avoid building the widget when no valid $rest_url |
|
| 83 | - if ( ! $rest_url ) { |
|
| 84 | - return; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - wp_enqueue_script( 'wordlift-cloud' ); |
|
| 88 | - $json_navigator_id = json_encode( $navigator_id ); |
|
| 89 | - wp_add_inline_script( 'wordlift-cloud', "window.wlNavigators = window.wlNavigators || []; wlNavigators.push( $json_navigator_id );" ); |
|
| 90 | - |
|
| 91 | - return sprintf( |
|
| 92 | - '<div id="%s" class="%s" data-rest-url="%s" data-title="%s" data-template-id="%s" data-limit="%s"></div>', |
|
| 93 | - $navigator_id, |
|
| 94 | - 'wl-navigator', |
|
| 95 | - $rest_url, |
|
| 96 | - $shortcode_atts['title'], |
|
| 97 | - $shortcode_atts['template_id'], |
|
| 98 | - $shortcode_atts['limit'] |
|
| 99 | - ); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * Function in charge of diplaying the [wl-faceted-search] in amp mode. |
|
| 104 | - * |
|
| 105 | - * @param array $atts Shortcode attributes. |
|
| 106 | - * |
|
| 107 | - * @return string Shortcode HTML for amp |
|
| 108 | - * @since 3.20.0 |
|
| 109 | - * |
|
| 110 | - */ |
|
| 111 | - private function amp_shortcode( $atts ) { |
|
| 112 | - |
|
| 113 | - // attributes extraction and boolean filtering |
|
| 114 | - $shortcode_atts = $this->make_shortcode_atts( $atts ); |
|
| 115 | - |
|
| 116 | - // avoid building the widget when there is a list of posts. |
|
| 117 | - if ( ! is_singular() ) { |
|
| 118 | - return ''; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - $current_post = get_post(); |
|
| 122 | - |
|
| 123 | - // Enqueue amp specific styles |
|
| 124 | - wp_enqueue_style( 'wordlift-amp-custom', plugin_dir_url( dirname( __FILE__ ) ) . '/css/wordlift-amp-custom.min.css' ); |
|
| 125 | - |
|
| 126 | - $post = ! empty( $shortcode_atts['post_id'] ) ? get_post( intval( $shortcode_atts['post_id'] ) ) : get_post(); |
|
| 127 | - $navigator_id = $shortcode_atts['uniqid']; |
|
| 128 | - |
|
| 129 | - $wp_json_base = get_rest_url() . WL_REST_ROUTE_DEFAULT_NAMESPACE; |
|
| 130 | - |
|
| 131 | - $navigator_query = array( |
|
| 132 | - 'uniqid' => $navigator_id, |
|
| 133 | - 'post_id' => $post->ID, |
|
| 134 | - 'limit' => $shortcode_atts['limit'], |
|
| 135 | - 'offset' => $shortcode_atts['offset'], |
|
| 136 | - ); |
|
| 137 | - |
|
| 138 | - if ( strpos( $wp_json_base, 'wp-json/' . WL_REST_ROUTE_DEFAULT_NAMESPACE ) ) { |
|
| 139 | - $delimiter = '?'; |
|
| 140 | - } else { |
|
| 141 | - $delimiter = '&'; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - // Use a protocol-relative URL as amp-list spec says that URL's protocol must be HTTPS. |
|
| 145 | - // This is a hackish way, but this works for http and https URLs |
|
| 146 | - $wp_json_url_posts = str_replace( array( |
|
| 147 | - 'http:', |
|
| 148 | - 'https:', |
|
| 149 | - ), '', $wp_json_base ) . '/navigator' . $delimiter . http_build_query( $navigator_query ); |
|
| 150 | - |
|
| 151 | - return <<<HTML |
|
| 20 | + /** |
|
| 21 | + * {@inheritdoc} |
|
| 22 | + */ |
|
| 23 | + const SHORTCODE = 'wl_navigator'; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * {@inheritdoc} |
|
| 27 | + */ |
|
| 28 | + public function render( $atts ) { |
|
| 29 | + |
|
| 30 | + return Wordlift_AMP_Service::is_amp_endpoint() ? $this->amp_shortcode( $atts ) |
|
| 31 | + : $this->web_shortcode( $atts ); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * Shared function used by web_shortcode and amp_shortcode |
|
| 36 | + * Bootstrap logic for attributes extraction and boolean filtering |
|
| 37 | + * |
|
| 38 | + * @param array $atts Shortcode attributes. |
|
| 39 | + * |
|
| 40 | + * @return array $shortcode_atts |
|
| 41 | + * @since 3.20.0 |
|
| 42 | + * |
|
| 43 | + */ |
|
| 44 | + private function make_shortcode_atts( $atts ) { |
|
| 45 | + |
|
| 46 | + // Extract attributes and set default values. |
|
| 47 | + $shortcode_atts = shortcode_atts( array( |
|
| 48 | + 'title' => __( 'Related articles', 'wordlift' ), |
|
| 49 | + 'limit' => 4, |
|
| 50 | + 'offset' => 0, |
|
| 51 | + 'template_id' => '', |
|
| 52 | + 'post_id' => '', |
|
| 53 | + 'uniqid' => uniqid( 'wl-navigator-widget-' ), |
|
| 54 | + ), $atts ); |
|
| 55 | + |
|
| 56 | + return $shortcode_atts; |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * Function in charge of diplaying the [wl-navigator] in web mode. |
|
| 61 | + * |
|
| 62 | + * @param array $atts Shortcode attributes. |
|
| 63 | + * |
|
| 64 | + * @return string Shortcode HTML for web |
|
| 65 | + * @since 3.20.0 |
|
| 66 | + * |
|
| 67 | + */ |
|
| 68 | + private function web_shortcode( $atts ) { |
|
| 69 | + |
|
| 70 | + // attributes extraction and boolean filtering |
|
| 71 | + $shortcode_atts = $this->make_shortcode_atts( $atts ); |
|
| 72 | + |
|
| 73 | + // avoid building the widget when no post_id is specified and there is a list of posts. |
|
| 74 | + if ( empty( $shortcode_atts['post_id'] ) && ! is_singular() ) { |
|
| 75 | + return; |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + $post = ! empty( $shortcode_atts['post_id'] ) ? get_post( intval( $shortcode_atts['post_id'] ) ) : get_post(); |
|
| 79 | + $navigator_id = $shortcode_atts['uniqid']; |
|
| 80 | + $rest_url = $post ? admin_url( sprintf( 'admin-ajax.php?action=wl_navigator&uniqid=%s&post_id=%s&limit=%s&offset=%s', $navigator_id, $post->ID, $shortcode_atts['limit'], $shortcode_atts['offset'] ) ) : false; |
|
| 81 | + |
|
| 82 | + // avoid building the widget when no valid $rest_url |
|
| 83 | + if ( ! $rest_url ) { |
|
| 84 | + return; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + wp_enqueue_script( 'wordlift-cloud' ); |
|
| 88 | + $json_navigator_id = json_encode( $navigator_id ); |
|
| 89 | + wp_add_inline_script( 'wordlift-cloud', "window.wlNavigators = window.wlNavigators || []; wlNavigators.push( $json_navigator_id );" ); |
|
| 90 | + |
|
| 91 | + return sprintf( |
|
| 92 | + '<div id="%s" class="%s" data-rest-url="%s" data-title="%s" data-template-id="%s" data-limit="%s"></div>', |
|
| 93 | + $navigator_id, |
|
| 94 | + 'wl-navigator', |
|
| 95 | + $rest_url, |
|
| 96 | + $shortcode_atts['title'], |
|
| 97 | + $shortcode_atts['template_id'], |
|
| 98 | + $shortcode_atts['limit'] |
|
| 99 | + ); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * Function in charge of diplaying the [wl-faceted-search] in amp mode. |
|
| 104 | + * |
|
| 105 | + * @param array $atts Shortcode attributes. |
|
| 106 | + * |
|
| 107 | + * @return string Shortcode HTML for amp |
|
| 108 | + * @since 3.20.0 |
|
| 109 | + * |
|
| 110 | + */ |
|
| 111 | + private function amp_shortcode( $atts ) { |
|
| 112 | + |
|
| 113 | + // attributes extraction and boolean filtering |
|
| 114 | + $shortcode_atts = $this->make_shortcode_atts( $atts ); |
|
| 115 | + |
|
| 116 | + // avoid building the widget when there is a list of posts. |
|
| 117 | + if ( ! is_singular() ) { |
|
| 118 | + return ''; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + $current_post = get_post(); |
|
| 122 | + |
|
| 123 | + // Enqueue amp specific styles |
|
| 124 | + wp_enqueue_style( 'wordlift-amp-custom', plugin_dir_url( dirname( __FILE__ ) ) . '/css/wordlift-amp-custom.min.css' ); |
|
| 125 | + |
|
| 126 | + $post = ! empty( $shortcode_atts['post_id'] ) ? get_post( intval( $shortcode_atts['post_id'] ) ) : get_post(); |
|
| 127 | + $navigator_id = $shortcode_atts['uniqid']; |
|
| 128 | + |
|
| 129 | + $wp_json_base = get_rest_url() . WL_REST_ROUTE_DEFAULT_NAMESPACE; |
|
| 130 | + |
|
| 131 | + $navigator_query = array( |
|
| 132 | + 'uniqid' => $navigator_id, |
|
| 133 | + 'post_id' => $post->ID, |
|
| 134 | + 'limit' => $shortcode_atts['limit'], |
|
| 135 | + 'offset' => $shortcode_atts['offset'], |
|
| 136 | + ); |
|
| 137 | + |
|
| 138 | + if ( strpos( $wp_json_base, 'wp-json/' . WL_REST_ROUTE_DEFAULT_NAMESPACE ) ) { |
|
| 139 | + $delimiter = '?'; |
|
| 140 | + } else { |
|
| 141 | + $delimiter = '&'; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + // Use a protocol-relative URL as amp-list spec says that URL's protocol must be HTTPS. |
|
| 145 | + // This is a hackish way, but this works for http and https URLs |
|
| 146 | + $wp_json_url_posts = str_replace( array( |
|
| 147 | + 'http:', |
|
| 148 | + 'https:', |
|
| 149 | + ), '', $wp_json_base ) . '/navigator' . $delimiter . http_build_query( $navigator_query ); |
|
| 150 | + |
|
| 151 | + return <<<HTML |
|
| 152 | 152 | <div id="{$navigator_id}" class="wl-navigator-widget" style="width: 100%"> |
| 153 | 153 | <h3 class="wl-headline">{$shortcode_atts['title']}</h3> |
| 154 | 154 | <amp-list |
@@ -205,6 +205,6 @@ discard block |
||
| 205 | 205 | </amp-list> |
| 206 | 206 | </div> |
| 207 | 207 | HTML; |
| 208 | - } |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | 210 | } |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | /** |
| 26 | 26 | * {@inheritdoc} |
| 27 | 27 | */ |
| 28 | - public function render( $atts ) { |
|
| 28 | + public function render($atts) { |
|
| 29 | 29 | |
| 30 | - return Wordlift_AMP_Service::is_amp_endpoint() ? $this->amp_shortcode( $atts ) |
|
| 31 | - : $this->web_shortcode( $atts ); |
|
| 30 | + return Wordlift_AMP_Service::is_amp_endpoint() ? $this->amp_shortcode($atts) |
|
| 31 | + : $this->web_shortcode($atts); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -41,17 +41,17 @@ discard block |
||
| 41 | 41 | * @since 3.20.0 |
| 42 | 42 | * |
| 43 | 43 | */ |
| 44 | - private function make_shortcode_atts( $atts ) { |
|
| 44 | + private function make_shortcode_atts($atts) { |
|
| 45 | 45 | |
| 46 | 46 | // Extract attributes and set default values. |
| 47 | - $shortcode_atts = shortcode_atts( array( |
|
| 48 | - 'title' => __( 'Related articles', 'wordlift' ), |
|
| 47 | + $shortcode_atts = shortcode_atts(array( |
|
| 48 | + 'title' => __('Related articles', 'wordlift'), |
|
| 49 | 49 | 'limit' => 4, |
| 50 | 50 | 'offset' => 0, |
| 51 | 51 | 'template_id' => '', |
| 52 | 52 | 'post_id' => '', |
| 53 | - 'uniqid' => uniqid( 'wl-navigator-widget-' ), |
|
| 54 | - ), $atts ); |
|
| 53 | + 'uniqid' => uniqid('wl-navigator-widget-'), |
|
| 54 | + ), $atts); |
|
| 55 | 55 | |
| 56 | 56 | return $shortcode_atts; |
| 57 | 57 | } |
@@ -65,28 +65,28 @@ discard block |
||
| 65 | 65 | * @since 3.20.0 |
| 66 | 66 | * |
| 67 | 67 | */ |
| 68 | - private function web_shortcode( $atts ) { |
|
| 68 | + private function web_shortcode($atts) { |
|
| 69 | 69 | |
| 70 | 70 | // attributes extraction and boolean filtering |
| 71 | - $shortcode_atts = $this->make_shortcode_atts( $atts ); |
|
| 71 | + $shortcode_atts = $this->make_shortcode_atts($atts); |
|
| 72 | 72 | |
| 73 | 73 | // avoid building the widget when no post_id is specified and there is a list of posts. |
| 74 | - if ( empty( $shortcode_atts['post_id'] ) && ! is_singular() ) { |
|
| 74 | + if (empty($shortcode_atts['post_id']) && ! is_singular()) { |
|
| 75 | 75 | return; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $post = ! empty( $shortcode_atts['post_id'] ) ? get_post( intval( $shortcode_atts['post_id'] ) ) : get_post(); |
|
| 78 | + $post = ! empty($shortcode_atts['post_id']) ? get_post(intval($shortcode_atts['post_id'])) : get_post(); |
|
| 79 | 79 | $navigator_id = $shortcode_atts['uniqid']; |
| 80 | - $rest_url = $post ? admin_url( sprintf( 'admin-ajax.php?action=wl_navigator&uniqid=%s&post_id=%s&limit=%s&offset=%s', $navigator_id, $post->ID, $shortcode_atts['limit'], $shortcode_atts['offset'] ) ) : false; |
|
| 80 | + $rest_url = $post ? admin_url(sprintf('admin-ajax.php?action=wl_navigator&uniqid=%s&post_id=%s&limit=%s&offset=%s', $navigator_id, $post->ID, $shortcode_atts['limit'], $shortcode_atts['offset'])) : false; |
|
| 81 | 81 | |
| 82 | 82 | // avoid building the widget when no valid $rest_url |
| 83 | - if ( ! $rest_url ) { |
|
| 83 | + if ( ! $rest_url) { |
|
| 84 | 84 | return; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - wp_enqueue_script( 'wordlift-cloud' ); |
|
| 88 | - $json_navigator_id = json_encode( $navigator_id ); |
|
| 89 | - wp_add_inline_script( 'wordlift-cloud', "window.wlNavigators = window.wlNavigators || []; wlNavigators.push( $json_navigator_id );" ); |
|
| 87 | + wp_enqueue_script('wordlift-cloud'); |
|
| 88 | + $json_navigator_id = json_encode($navigator_id); |
|
| 89 | + wp_add_inline_script('wordlift-cloud', "window.wlNavigators = window.wlNavigators || []; wlNavigators.push( $json_navigator_id );"); |
|
| 90 | 90 | |
| 91 | 91 | return sprintf( |
| 92 | 92 | '<div id="%s" class="%s" data-rest-url="%s" data-title="%s" data-template-id="%s" data-limit="%s"></div>', |
@@ -108,25 +108,25 @@ discard block |
||
| 108 | 108 | * @since 3.20.0 |
| 109 | 109 | * |
| 110 | 110 | */ |
| 111 | - private function amp_shortcode( $atts ) { |
|
| 111 | + private function amp_shortcode($atts) { |
|
| 112 | 112 | |
| 113 | 113 | // attributes extraction and boolean filtering |
| 114 | - $shortcode_atts = $this->make_shortcode_atts( $atts ); |
|
| 114 | + $shortcode_atts = $this->make_shortcode_atts($atts); |
|
| 115 | 115 | |
| 116 | 116 | // avoid building the widget when there is a list of posts. |
| 117 | - if ( ! is_singular() ) { |
|
| 117 | + if ( ! is_singular()) { |
|
| 118 | 118 | return ''; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | $current_post = get_post(); |
| 122 | 122 | |
| 123 | 123 | // Enqueue amp specific styles |
| 124 | - wp_enqueue_style( 'wordlift-amp-custom', plugin_dir_url( dirname( __FILE__ ) ) . '/css/wordlift-amp-custom.min.css' ); |
|
| 124 | + wp_enqueue_style('wordlift-amp-custom', plugin_dir_url(dirname(__FILE__)).'/css/wordlift-amp-custom.min.css'); |
|
| 125 | 125 | |
| 126 | - $post = ! empty( $shortcode_atts['post_id'] ) ? get_post( intval( $shortcode_atts['post_id'] ) ) : get_post(); |
|
| 126 | + $post = ! empty($shortcode_atts['post_id']) ? get_post(intval($shortcode_atts['post_id'])) : get_post(); |
|
| 127 | 127 | $navigator_id = $shortcode_atts['uniqid']; |
| 128 | 128 | |
| 129 | - $wp_json_base = get_rest_url() . WL_REST_ROUTE_DEFAULT_NAMESPACE; |
|
| 129 | + $wp_json_base = get_rest_url().WL_REST_ROUTE_DEFAULT_NAMESPACE; |
|
| 130 | 130 | |
| 131 | 131 | $navigator_query = array( |
| 132 | 132 | 'uniqid' => $navigator_id, |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | 'offset' => $shortcode_atts['offset'], |
| 136 | 136 | ); |
| 137 | 137 | |
| 138 | - if ( strpos( $wp_json_base, 'wp-json/' . WL_REST_ROUTE_DEFAULT_NAMESPACE ) ) { |
|
| 138 | + if (strpos($wp_json_base, 'wp-json/'.WL_REST_ROUTE_DEFAULT_NAMESPACE)) { |
|
| 139 | 139 | $delimiter = '?'; |
| 140 | 140 | } else { |
| 141 | 141 | $delimiter = '&'; |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | // Use a protocol-relative URL as amp-list spec says that URL's protocol must be HTTPS. |
| 145 | 145 | // This is a hackish way, but this works for http and https URLs |
| 146 | - $wp_json_url_posts = str_replace( array( |
|
| 146 | + $wp_json_url_posts = str_replace(array( |
|
| 147 | 147 | 'http:', |
| 148 | 148 | 'https:', |
| 149 | - ), '', $wp_json_base ) . '/navigator' . $delimiter . http_build_query( $navigator_query ); |
|
| 149 | + ), '', $wp_json_base).'/navigator'.$delimiter.http_build_query($navigator_query); |
|
| 150 | 150 | |
| 151 | 151 | return <<<HTML |
| 152 | 152 | <div id="{$navigator_id}" class="wl-navigator-widget" style="width: 100%"> |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | use Wordlift\Cache\Ttl_Cache_Cleaner; |
| 29 | 29 | |
| 30 | 30 | if ( ! defined( 'WPINC' ) ) { |
| 31 | - die; |
|
| 31 | + die; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // Include WordLift constants. |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | function wl_write_log( $log ) { |
| 50 | 50 | |
| 51 | - Wordlift_Log_Service::get_instance()->debug( $log ); |
|
| 51 | + Wordlift_Log_Service::get_instance()->debug( $log ); |
|
| 52 | 52 | |
| 53 | 53 | } |
| 54 | 54 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | function wl_write_log_hide_key( $text ) { |
| 67 | 67 | |
| 68 | - return str_ireplace( wl_configuration_get_key(), '<hidden>', $text ); |
|
| 68 | + return str_ireplace( wl_configuration_get_key(), '<hidden>', $text ); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -73,21 +73,21 @@ discard block |
||
| 73 | 73 | * see http://vip.wordpress.com/documentation/register-additional-html-attributes-for-tinymce-and-wp-kses/ |
| 74 | 74 | */ |
| 75 | 75 | function wordlift_allowed_post_tags() { |
| 76 | - global $allowedposttags; |
|
| 77 | - |
|
| 78 | - $tags = array( 'span' ); |
|
| 79 | - $new_attributes = array( |
|
| 80 | - 'itemscope' => array(), |
|
| 81 | - 'itemtype' => array(), |
|
| 82 | - 'itemprop' => array(), |
|
| 83 | - 'itemid' => array(), |
|
| 84 | - ); |
|
| 85 | - |
|
| 86 | - foreach ( $tags as $tag ) { |
|
| 87 | - if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) { |
|
| 88 | - $allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes ); |
|
| 89 | - } |
|
| 90 | - } |
|
| 76 | + global $allowedposttags; |
|
| 77 | + |
|
| 78 | + $tags = array( 'span' ); |
|
| 79 | + $new_attributes = array( |
|
| 80 | + 'itemscope' => array(), |
|
| 81 | + 'itemtype' => array(), |
|
| 82 | + 'itemprop' => array(), |
|
| 83 | + 'itemid' => array(), |
|
| 84 | + ); |
|
| 85 | + |
|
| 86 | + foreach ( $tags as $tag ) { |
|
| 87 | + if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) { |
|
| 88 | + $allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes ); |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | // add allowed post tags. |
@@ -98,15 +98,15 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | function wordlift_admin_enqueue_scripts() { |
| 100 | 100 | |
| 101 | - // Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/) |
|
| 102 | - wp_enqueue_script( 'wpdialogs' ); |
|
| 103 | - wp_enqueue_style( 'wp-jquery-ui-dialog' ); |
|
| 101 | + // Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/) |
|
| 102 | + wp_enqueue_script( 'wpdialogs' ); |
|
| 103 | + wp_enqueue_style( 'wp-jquery-ui-dialog' ); |
|
| 104 | 104 | |
| 105 | - wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' ); |
|
| 105 | + wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' ); |
|
| 106 | 106 | |
| 107 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
| 107 | + wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
| 108 | 108 | |
| 109 | - /* |
|
| 109 | + /* |
|
| 110 | 110 | * Angular isn't loaded anymore separately, it is embedded in wordlift-reloaded.js. |
| 111 | 111 | * |
| 112 | 112 | * See https://github.com/insideout10/wordlift-plugin/issues/865. |
@@ -127,10 +127,10 @@ discard block |
||
| 127 | 127 | // |
| 128 | 128 | // $log->debug( 'Registering angular scripts was ' . ( $result ? 'successful.' : 'unsuccessful.' ) ); |
| 129 | 129 | |
| 130 | - // Disable auto-save for custom entity posts only |
|
| 131 | - if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) { |
|
| 132 | - wp_dequeue_script( 'autosave' ); |
|
| 133 | - } |
|
| 130 | + // Disable auto-save for custom entity posts only |
|
| 131 | + if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) { |
|
| 132 | + wp_dequeue_script( 'autosave' ); |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | 135 | } |
| 136 | 136 | |
@@ -155,18 +155,18 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | function wordlift_allowed_html( $allowedtags, $context ) { |
| 157 | 157 | |
| 158 | - if ( 'post' !== $context ) { |
|
| 159 | - return $allowedtags; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - return array_merge_recursive( $allowedtags, array( |
|
| 163 | - 'span' => array( |
|
| 164 | - 'itemscope' => true, |
|
| 165 | - 'itemtype' => true, |
|
| 166 | - 'itemid' => true, |
|
| 167 | - 'itemprop' => true, |
|
| 168 | - ), |
|
| 169 | - ) ); |
|
| 158 | + if ( 'post' !== $context ) { |
|
| 159 | + return $allowedtags; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + return array_merge_recursive( $allowedtags, array( |
|
| 163 | + 'span' => array( |
|
| 164 | + 'itemscope' => true, |
|
| 165 | + 'itemtype' => true, |
|
| 166 | + 'itemid' => true, |
|
| 167 | + 'itemprop' => true, |
|
| 168 | + ), |
|
| 169 | + ) ); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | add_filter( 'wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2 ); |
@@ -180,16 +180,16 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | function wl_get_coordinates( $post_id ) { |
| 182 | 182 | |
| 183 | - $latitude = wl_schema_get_value( $post_id, 'latitude' ); |
|
| 184 | - $longitude = wl_schema_get_value( $post_id, 'longitude' ); |
|
| 183 | + $latitude = wl_schema_get_value( $post_id, 'latitude' ); |
|
| 184 | + $longitude = wl_schema_get_value( $post_id, 'longitude' ); |
|
| 185 | 185 | |
| 186 | - // DO NOT set latitude/longitude to 0/0 as default values. It's a specific |
|
| 187 | - // place on the globe:"The zero/zero point of this system is located in the |
|
| 188 | - // Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana." |
|
| 189 | - return array( |
|
| 190 | - 'latitude' => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '', |
|
| 191 | - 'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : '', |
|
| 192 | - ); |
|
| 186 | + // DO NOT set latitude/longitude to 0/0 as default values. It's a specific |
|
| 187 | + // place on the globe:"The zero/zero point of this system is located in the |
|
| 188 | + // Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana." |
|
| 189 | + return array( |
|
| 190 | + 'latitude' => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '', |
|
| 191 | + 'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : '', |
|
| 192 | + ); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
@@ -203,9 +203,9 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | function wl_get_image_urls( $post_id ) { |
| 205 | 205 | |
| 206 | - return Wordlift_Storage_Factory::get_instance() |
|
| 207 | - ->post_images() |
|
| 208 | - ->get( $post_id ); |
|
| 206 | + return Wordlift_Storage_Factory::get_instance() |
|
| 207 | + ->post_images() |
|
| 208 | + ->get( $post_id ); |
|
| 209 | 209 | |
| 210 | 210 | // // If there is a featured image it has the priority. |
| 211 | 211 | // $featured_image_id = get_post_thumbnail_id( $post_id ); |
@@ -253,24 +253,24 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | function wl_get_attachment_for_source_url( $parent_post_id, $source_url ) { |
| 255 | 255 | |
| 256 | - // wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" ); |
|
| 256 | + // wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" ); |
|
| 257 | 257 | |
| 258 | - $posts = get_posts( array( |
|
| 259 | - 'post_type' => 'attachment', |
|
| 260 | - 'posts_per_page' => 1, |
|
| 261 | - 'post_status' => 'any', |
|
| 262 | - 'post_parent' => $parent_post_id, |
|
| 263 | - 'meta_key' => 'wl_source_url', |
|
| 264 | - 'meta_value' => $source_url, |
|
| 265 | - ) ); |
|
| 258 | + $posts = get_posts( array( |
|
| 259 | + 'post_type' => 'attachment', |
|
| 260 | + 'posts_per_page' => 1, |
|
| 261 | + 'post_status' => 'any', |
|
| 262 | + 'post_parent' => $parent_post_id, |
|
| 263 | + 'meta_key' => 'wl_source_url', |
|
| 264 | + 'meta_value' => $source_url, |
|
| 265 | + ) ); |
|
| 266 | 266 | |
| 267 | - // Return the found post. |
|
| 268 | - if ( 1 === count( $posts ) ) { |
|
| 269 | - return $posts[0]; |
|
| 270 | - } |
|
| 267 | + // Return the found post. |
|
| 268 | + if ( 1 === count( $posts ) ) { |
|
| 269 | + return $posts[0]; |
|
| 270 | + } |
|
| 271 | 271 | |
| 272 | - // Return null. |
|
| 273 | - return null; |
|
| 272 | + // Return null. |
|
| 273 | + return null; |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /** |
@@ -281,8 +281,8 @@ discard block |
||
| 281 | 281 | */ |
| 282 | 282 | function wl_set_source_url( $post_id, $source_url ) { |
| 283 | 283 | |
| 284 | - delete_post_meta( $post_id, 'wl_source_url' ); |
|
| 285 | - add_post_meta( $post_id, 'wl_source_url', $source_url ); |
|
| 284 | + delete_post_meta( $post_id, 'wl_source_url' ); |
|
| 285 | + add_post_meta( $post_id, 'wl_source_url', $source_url ); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | /** |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | */ |
| 299 | 299 | function wl_sanitize_uri_path( $path, $char = '_' ) { |
| 300 | 300 | |
| 301 | - return Wordlift_Uri_Service::get_instance()->sanitize_path( $path, $char ); |
|
| 301 | + return Wordlift_Uri_Service::get_instance()->sanitize_path( $path, $char ); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | ///** |
@@ -339,47 +339,47 @@ discard block |
||
| 339 | 339 | */ |
| 340 | 340 | function wl_replace_item_id_with_uri( $content ) { |
| 341 | 341 | |
| 342 | - $log = Wordlift_Log_Service::get_logger( 'wl_replace_item_id_with_uri' ); |
|
| 343 | - $log->trace( 'Replacing item IDs with URIs...' ); |
|
| 342 | + $log = Wordlift_Log_Service::get_logger( 'wl_replace_item_id_with_uri' ); |
|
| 343 | + $log->trace( 'Replacing item IDs with URIs...' ); |
|
| 344 | 344 | |
| 345 | - // Strip slashes, see https://core.trac.wordpress.org/ticket/21767 |
|
| 346 | - $content = stripslashes( $content ); |
|
| 345 | + // Strip slashes, see https://core.trac.wordpress.org/ticket/21767 |
|
| 346 | + $content = stripslashes( $content ); |
|
| 347 | 347 | |
| 348 | - // If any match are found. |
|
| 349 | - $matches = array(); |
|
| 350 | - if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) { |
|
| 348 | + // If any match are found. |
|
| 349 | + $matches = array(); |
|
| 350 | + if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) { |
|
| 351 | 351 | |
| 352 | - foreach ( $matches as $match ) { |
|
| 352 | + foreach ( $matches as $match ) { |
|
| 353 | 353 | |
| 354 | - // Get the item ID. |
|
| 355 | - $item_id = $match[1]; |
|
| 354 | + // Get the item ID. |
|
| 355 | + $item_id = $match[1]; |
|
| 356 | 356 | |
| 357 | - // Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' . |
|
| 358 | - $post = Wordlift_Entity_Service::get_instance() |
|
| 359 | - ->get_entity_post_by_uri( $item_id ); |
|
| 357 | + // Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' . |
|
| 358 | + $post = Wordlift_Entity_Service::get_instance() |
|
| 359 | + ->get_entity_post_by_uri( $item_id ); |
|
| 360 | 360 | |
| 361 | - // If no entity is found, continue to the next one. |
|
| 362 | - if ( null === $post ) { |
|
| 363 | - continue; |
|
| 364 | - } |
|
| 361 | + // If no entity is found, continue to the next one. |
|
| 362 | + if ( null === $post ) { |
|
| 363 | + continue; |
|
| 364 | + } |
|
| 365 | 365 | |
| 366 | - // Get the URI for that post. |
|
| 367 | - $uri = wl_get_entity_uri( $post->ID ); |
|
| 366 | + // Get the URI for that post. |
|
| 367 | + $uri = wl_get_entity_uri( $post->ID ); |
|
| 368 | 368 | |
| 369 | - // wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" ); |
|
| 369 | + // wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" ); |
|
| 370 | 370 | |
| 371 | - // If the item ID and the URI differ, replace the item ID with the URI saved in WordPress. |
|
| 372 | - if ( $item_id !== $uri ) { |
|
| 373 | - $uri_e = esc_html( $uri ); |
|
| 374 | - $content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content ); |
|
| 375 | - } |
|
| 376 | - } |
|
| 377 | - } |
|
| 371 | + // If the item ID and the URI differ, replace the item ID with the URI saved in WordPress. |
|
| 372 | + if ( $item_id !== $uri ) { |
|
| 373 | + $uri_e = esc_html( $uri ); |
|
| 374 | + $content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content ); |
|
| 375 | + } |
|
| 376 | + } |
|
| 377 | + } |
|
| 378 | 378 | |
| 379 | - // Reapply slashes. |
|
| 380 | - $content = addslashes( $content ); |
|
| 379 | + // Reapply slashes. |
|
| 380 | + $content = addslashes( $content ); |
|
| 381 | 381 | |
| 382 | - return $content; |
|
| 382 | + return $content; |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | add_filter( 'content_save_pre', 'wl_replace_item_id_with_uri', 1, 1 ); |
@@ -440,24 +440,24 @@ discard block |
||
| 440 | 440 | */ |
| 441 | 441 | function activate_wordlift() { |
| 442 | 442 | |
| 443 | - $log = Wordlift_Log_Service::get_logger( 'activate_wordlift' ); |
|
| 443 | + $log = Wordlift_Log_Service::get_logger( 'activate_wordlift' ); |
|
| 444 | 444 | |
| 445 | - $log->info( 'Activating WordLift...' ); |
|
| 445 | + $log->info( 'Activating WordLift...' ); |
|
| 446 | 446 | |
| 447 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php'; |
|
| 448 | - Wordlift_Activator::activate(); |
|
| 447 | + require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php'; |
|
| 448 | + Wordlift_Activator::activate(); |
|
| 449 | 449 | |
| 450 | - /** |
|
| 451 | - * Tell the {@link Wordlift_Http_Api} class that we're activating, to let it run activation tasks. |
|
| 452 | - * |
|
| 453 | - * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue. |
|
| 454 | - * @since 3.19.2 |
|
| 455 | - */ |
|
| 456 | - Wordlift_Http_Api::activate(); |
|
| 450 | + /** |
|
| 451 | + * Tell the {@link Wordlift_Http_Api} class that we're activating, to let it run activation tasks. |
|
| 452 | + * |
|
| 453 | + * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue. |
|
| 454 | + * @since 3.19.2 |
|
| 455 | + */ |
|
| 456 | + Wordlift_Http_Api::activate(); |
|
| 457 | 457 | |
| 458 | - // Ensure the post type is registered before flushing the rewrite rules. |
|
| 459 | - Wordlift_Entity_Post_Type_Service::get_instance()->register(); |
|
| 460 | - flush_rewrite_rules(); |
|
| 458 | + // Ensure the post type is registered before flushing the rewrite rules. |
|
| 459 | + Wordlift_Entity_Post_Type_Service::get_instance()->register(); |
|
| 460 | + flush_rewrite_rules(); |
|
| 461 | 461 | |
| 462 | 462 | } |
| 463 | 463 | |
@@ -467,11 +467,11 @@ discard block |
||
| 467 | 467 | */ |
| 468 | 468 | function deactivate_wordlift() { |
| 469 | 469 | |
| 470 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
| 471 | - Wordlift_Deactivator::deactivate(); |
|
| 472 | - Wordlift_Http_Api::deactivate(); |
|
| 473 | - Ttl_Cache_Cleaner::deactivate(); |
|
| 474 | - flush_rewrite_rules(); |
|
| 470 | + require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
| 471 | + Wordlift_Deactivator::deactivate(); |
|
| 472 | + Wordlift_Http_Api::deactivate(); |
|
| 473 | + Ttl_Cache_Cleaner::deactivate(); |
|
| 474 | + flush_rewrite_rules(); |
|
| 475 | 475 | |
| 476 | 476 | } |
| 477 | 477 | |
@@ -495,18 +495,18 @@ discard block |
||
| 495 | 495 | */ |
| 496 | 496 | function run_wordlift() { |
| 497 | 497 | |
| 498 | - /* |
|
| 498 | + /* |
|
| 499 | 499 | * We introduce the WordLift autoloader, since we start using classes in namespaces, i.e. Wordlift\Http. |
| 500 | 500 | * |
| 501 | 501 | * @since 3.21.2 |
| 502 | 502 | */ |
| 503 | - wordlift_plugin_autoload_register(); |
|
| 503 | + wordlift_plugin_autoload_register(); |
|
| 504 | 504 | |
| 505 | - $plugin = new Wordlift(); |
|
| 506 | - $plugin->run(); |
|
| 505 | + $plugin = new Wordlift(); |
|
| 506 | + $plugin->run(); |
|
| 507 | 507 | |
| 508 | - // Initialize the TTL Cache Cleaner. |
|
| 509 | - new Ttl_Cache_Cleaner(); |
|
| 508 | + // Initialize the TTL Cache Cleaner. |
|
| 509 | + new Ttl_Cache_Cleaner(); |
|
| 510 | 510 | |
| 511 | 511 | } |
| 512 | 512 | |
@@ -520,31 +520,31 @@ discard block |
||
| 520 | 520 | */ |
| 521 | 521 | function wordlift_plugin_autoload_register() { |
| 522 | 522 | |
| 523 | - spl_autoload_register( function ( $class_name ) { |
|
| 523 | + spl_autoload_register( function ( $class_name ) { |
|
| 524 | 524 | |
| 525 | - // Bail out if these are not our classes. |
|
| 526 | - if ( 0 !== strpos( $class_name, 'Wordlift\\Cache\\' ) ) { |
|
| 527 | - return false; |
|
| 528 | - } |
|
| 525 | + // Bail out if these are not our classes. |
|
| 526 | + if ( 0 !== strpos( $class_name, 'Wordlift\\Cache\\' ) ) { |
|
| 527 | + return false; |
|
| 528 | + } |
|
| 529 | 529 | |
| 530 | - $class_name_lc = strtolower( str_replace( '_', '-', $class_name ) ); |
|
| 530 | + $class_name_lc = strtolower( str_replace( '_', '-', $class_name ) ); |
|
| 531 | 531 | |
| 532 | - preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches ); |
|
| 532 | + preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches ); |
|
| 533 | 533 | |
| 534 | - $path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] ); |
|
| 535 | - $file = 'class-' . $matches[2] . '.php'; |
|
| 534 | + $path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] ); |
|
| 535 | + $file = 'class-' . $matches[2] . '.php'; |
|
| 536 | 536 | |
| 537 | - $full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file; |
|
| 537 | + $full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file; |
|
| 538 | 538 | |
| 539 | - if ( ! file_exists( $full_path ) ) { |
|
| 540 | - echo( "Class $class_name not found at $full_path." ); |
|
| 539 | + if ( ! file_exists( $full_path ) ) { |
|
| 540 | + echo( "Class $class_name not found at $full_path." ); |
|
| 541 | 541 | |
| 542 | - return false; |
|
| 543 | - } |
|
| 542 | + return false; |
|
| 543 | + } |
|
| 544 | 544 | |
| 545 | - require_once $full_path; |
|
| 545 | + require_once $full_path; |
|
| 546 | 546 | |
| 547 | - return true; |
|
| 548 | - } ); |
|
| 547 | + return true; |
|
| 548 | + } ); |
|
| 549 | 549 | |
| 550 | 550 | } |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | // If this file is called directly, abort. |
| 28 | 28 | use Wordlift\Cache\Ttl_Cache_Cleaner; |
| 29 | 29 | |
| 30 | -if ( ! defined( 'WPINC' ) ) { |
|
| 30 | +if ( ! defined('WPINC')) { |
|
| 31 | 31 | die; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // Include WordLift constants. |
| 35 | -require_once( 'wordlift_constants.php' ); |
|
| 35 | +require_once('wordlift_constants.php'); |
|
| 36 | 36 | |
| 37 | 37 | // Load modules. |
| 38 | -require_once( 'modules/core/wordlift_core.php' ); |
|
| 38 | +require_once('modules/core/wordlift_core.php'); |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Log to the debug.log file. |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @param string|mixed $log The log data. |
| 48 | 48 | */ |
| 49 | -function wl_write_log( $log ) { |
|
| 49 | +function wl_write_log($log) { |
|
| 50 | 50 | |
| 51 | - Wordlift_Log_Service::get_instance()->debug( $log ); |
|
| 51 | + Wordlift_Log_Service::get_instance()->debug($log); |
|
| 52 | 52 | |
| 53 | 53 | } |
| 54 | 54 | |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @return string A text with the key hidden. |
| 65 | 65 | */ |
| 66 | -function wl_write_log_hide_key( $text ) { |
|
| 66 | +function wl_write_log_hide_key($text) { |
|
| 67 | 67 | |
| 68 | - return str_ireplace( wl_configuration_get_key(), '<hidden>', $text ); |
|
| 68 | + return str_ireplace(wl_configuration_get_key(), '<hidden>', $text); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | function wordlift_allowed_post_tags() { |
| 76 | 76 | global $allowedposttags; |
| 77 | 77 | |
| 78 | - $tags = array( 'span' ); |
|
| 78 | + $tags = array('span'); |
|
| 79 | 79 | $new_attributes = array( |
| 80 | 80 | 'itemscope' => array(), |
| 81 | 81 | 'itemtype' => array(), |
@@ -83,15 +83,15 @@ discard block |
||
| 83 | 83 | 'itemid' => array(), |
| 84 | 84 | ); |
| 85 | 85 | |
| 86 | - foreach ( $tags as $tag ) { |
|
| 87 | - if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) { |
|
| 88 | - $allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes ); |
|
| 86 | + foreach ($tags as $tag) { |
|
| 87 | + if (isset($allowedposttags[$tag]) && is_array($allowedposttags[$tag])) { |
|
| 88 | + $allowedposttags[$tag] = array_merge($allowedposttags[$tag], $new_attributes); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | // add allowed post tags. |
| 94 | -add_action( 'init', 'wordlift_allowed_post_tags' ); |
|
| 94 | +add_action('init', 'wordlift_allowed_post_tags'); |
|
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * Register additional scripts for the admin UI. |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | function wordlift_admin_enqueue_scripts() { |
| 100 | 100 | |
| 101 | 101 | // Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/) |
| 102 | - wp_enqueue_script( 'wpdialogs' ); |
|
| 103 | - wp_enqueue_style( 'wp-jquery-ui-dialog' ); |
|
| 102 | + wp_enqueue_script('wpdialogs'); |
|
| 103 | + wp_enqueue_style('wp-jquery-ui-dialog'); |
|
| 104 | 104 | |
| 105 | - wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' ); |
|
| 105 | + wp_enqueue_style('wordlift-reloaded', plugin_dir_url(__FILE__).'css/wordlift-reloaded.min.css'); |
|
| 106 | 106 | |
| 107 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
| 107 | + wp_enqueue_script('jquery-ui-autocomplete'); |
|
| 108 | 108 | |
| 109 | 109 | /* |
| 110 | 110 | * Angular isn't loaded anymore separately, it is embedded in wordlift-reloaded.js. |
@@ -128,13 +128,13 @@ discard block |
||
| 128 | 128 | // $log->debug( 'Registering angular scripts was ' . ( $result ? 'successful.' : 'unsuccessful.' ) ); |
| 129 | 129 | |
| 130 | 130 | // Disable auto-save for custom entity posts only |
| 131 | - if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) { |
|
| 132 | - wp_dequeue_script( 'autosave' ); |
|
| 131 | + if (Wordlift_Entity_Service::TYPE_NAME === get_post_type()) { |
|
| 132 | + wp_dequeue_script('autosave'); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | -add_action( 'admin_enqueue_scripts', 'wordlift_admin_enqueue_scripts' ); |
|
| 137 | +add_action('admin_enqueue_scripts', 'wordlift_admin_enqueue_scripts'); |
|
| 138 | 138 | |
| 139 | 139 | // We shouldn't load the wordlift-ui.min.css stylesheet when not needed. |
| 140 | 140 | // |
@@ -153,23 +153,23 @@ discard block |
||
| 153 | 153 | * |
| 154 | 154 | * @return array An array which contains allowed microdata attributes. |
| 155 | 155 | */ |
| 156 | -function wordlift_allowed_html( $allowedtags, $context ) { |
|
| 156 | +function wordlift_allowed_html($allowedtags, $context) { |
|
| 157 | 157 | |
| 158 | - if ( 'post' !== $context ) { |
|
| 158 | + if ('post' !== $context) { |
|
| 159 | 159 | return $allowedtags; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - return array_merge_recursive( $allowedtags, array( |
|
| 162 | + return array_merge_recursive($allowedtags, array( |
|
| 163 | 163 | 'span' => array( |
| 164 | 164 | 'itemscope' => true, |
| 165 | 165 | 'itemtype' => true, |
| 166 | 166 | 'itemid' => true, |
| 167 | 167 | 'itemprop' => true, |
| 168 | 168 | ), |
| 169 | - ) ); |
|
| 169 | + )); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | -add_filter( 'wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2 ); |
|
| 172 | +add_filter('wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2); |
|
| 173 | 173 | |
| 174 | 174 | /** |
| 175 | 175 | * Get the coordinates for the specified post ID. |
@@ -178,17 +178,17 @@ discard block |
||
| 178 | 178 | * |
| 179 | 179 | * @return array|null An array of coordinates or null. |
| 180 | 180 | */ |
| 181 | -function wl_get_coordinates( $post_id ) { |
|
| 181 | +function wl_get_coordinates($post_id) { |
|
| 182 | 182 | |
| 183 | - $latitude = wl_schema_get_value( $post_id, 'latitude' ); |
|
| 184 | - $longitude = wl_schema_get_value( $post_id, 'longitude' ); |
|
| 183 | + $latitude = wl_schema_get_value($post_id, 'latitude'); |
|
| 184 | + $longitude = wl_schema_get_value($post_id, 'longitude'); |
|
| 185 | 185 | |
| 186 | 186 | // DO NOT set latitude/longitude to 0/0 as default values. It's a specific |
| 187 | 187 | // place on the globe:"The zero/zero point of this system is located in the |
| 188 | 188 | // Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana." |
| 189 | 189 | return array( |
| 190 | - 'latitude' => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '', |
|
| 191 | - 'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : '', |
|
| 190 | + 'latitude' => isset($latitude[0]) && is_numeric($latitude[0]) ? $latitude[0] : '', |
|
| 191 | + 'longitude' => isset($longitude[0]) && is_numeric($longitude[0]) ? $longitude[0] : '', |
|
| 192 | 192 | ); |
| 193 | 193 | } |
| 194 | 194 | |
@@ -201,11 +201,11 @@ discard block |
||
| 201 | 201 | * |
| 202 | 202 | * @return array An array of image URLs. |
| 203 | 203 | */ |
| 204 | -function wl_get_image_urls( $post_id ) { |
|
| 204 | +function wl_get_image_urls($post_id) { |
|
| 205 | 205 | |
| 206 | 206 | return Wordlift_Storage_Factory::get_instance() |
| 207 | 207 | ->post_images() |
| 208 | - ->get( $post_id ); |
|
| 208 | + ->get($post_id); |
|
| 209 | 209 | |
| 210 | 210 | // // If there is a featured image it has the priority. |
| 211 | 211 | // $featured_image_id = get_post_thumbnail_id( $post_id ); |
@@ -251,21 +251,21 @@ discard block |
||
| 251 | 251 | * |
| 252 | 252 | * @return WP_Post|null A post instance or null if not found. |
| 253 | 253 | */ |
| 254 | -function wl_get_attachment_for_source_url( $parent_post_id, $source_url ) { |
|
| 254 | +function wl_get_attachment_for_source_url($parent_post_id, $source_url) { |
|
| 255 | 255 | |
| 256 | 256 | // wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" ); |
| 257 | 257 | |
| 258 | - $posts = get_posts( array( |
|
| 258 | + $posts = get_posts(array( |
|
| 259 | 259 | 'post_type' => 'attachment', |
| 260 | 260 | 'posts_per_page' => 1, |
| 261 | 261 | 'post_status' => 'any', |
| 262 | 262 | 'post_parent' => $parent_post_id, |
| 263 | 263 | 'meta_key' => 'wl_source_url', |
| 264 | 264 | 'meta_value' => $source_url, |
| 265 | - ) ); |
|
| 265 | + )); |
|
| 266 | 266 | |
| 267 | 267 | // Return the found post. |
| 268 | - if ( 1 === count( $posts ) ) { |
|
| 268 | + if (1 === count($posts)) { |
|
| 269 | 269 | return $posts[0]; |
| 270 | 270 | } |
| 271 | 271 | |
@@ -279,10 +279,10 @@ discard block |
||
| 279 | 279 | * @param int $post_id The post ID. |
| 280 | 280 | * @param string $source_url The source URL. |
| 281 | 281 | */ |
| 282 | -function wl_set_source_url( $post_id, $source_url ) { |
|
| 282 | +function wl_set_source_url($post_id, $source_url) { |
|
| 283 | 283 | |
| 284 | - delete_post_meta( $post_id, 'wl_source_url' ); |
|
| 285 | - add_post_meta( $post_id, 'wl_source_url', $source_url ); |
|
| 284 | + delete_post_meta($post_id, 'wl_source_url'); |
|
| 285 | + add_post_meta($post_id, 'wl_source_url', $source_url); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | /** |
@@ -296,9 +296,9 @@ discard block |
||
| 296 | 296 | * |
| 297 | 297 | * @return string The sanitized path. |
| 298 | 298 | */ |
| 299 | -function wl_sanitize_uri_path( $path, $char = '_' ) { |
|
| 299 | +function wl_sanitize_uri_path($path, $char = '_') { |
|
| 300 | 300 | |
| 301 | - return Wordlift_Uri_Service::get_instance()->sanitize_path( $path, $char ); |
|
| 301 | + return Wordlift_Uri_Service::get_instance()->sanitize_path($path, $char); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | ///** |
@@ -337,102 +337,102 @@ discard block |
||
| 337 | 337 | * |
| 338 | 338 | * @return string The updated post content. |
| 339 | 339 | */ |
| 340 | -function wl_replace_item_id_with_uri( $content ) { |
|
| 340 | +function wl_replace_item_id_with_uri($content) { |
|
| 341 | 341 | |
| 342 | - $log = Wordlift_Log_Service::get_logger( 'wl_replace_item_id_with_uri' ); |
|
| 343 | - $log->trace( 'Replacing item IDs with URIs...' ); |
|
| 342 | + $log = Wordlift_Log_Service::get_logger('wl_replace_item_id_with_uri'); |
|
| 343 | + $log->trace('Replacing item IDs with URIs...'); |
|
| 344 | 344 | |
| 345 | 345 | // Strip slashes, see https://core.trac.wordpress.org/ticket/21767 |
| 346 | - $content = stripslashes( $content ); |
|
| 346 | + $content = stripslashes($content); |
|
| 347 | 347 | |
| 348 | 348 | // If any match are found. |
| 349 | 349 | $matches = array(); |
| 350 | - if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) { |
|
| 350 | + if (0 < preg_match_all('/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER)) { |
|
| 351 | 351 | |
| 352 | - foreach ( $matches as $match ) { |
|
| 352 | + foreach ($matches as $match) { |
|
| 353 | 353 | |
| 354 | 354 | // Get the item ID. |
| 355 | 355 | $item_id = $match[1]; |
| 356 | 356 | |
| 357 | 357 | // Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' . |
| 358 | 358 | $post = Wordlift_Entity_Service::get_instance() |
| 359 | - ->get_entity_post_by_uri( $item_id ); |
|
| 359 | + ->get_entity_post_by_uri($item_id); |
|
| 360 | 360 | |
| 361 | 361 | // If no entity is found, continue to the next one. |
| 362 | - if ( null === $post ) { |
|
| 362 | + if (null === $post) { |
|
| 363 | 363 | continue; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | // Get the URI for that post. |
| 367 | - $uri = wl_get_entity_uri( $post->ID ); |
|
| 367 | + $uri = wl_get_entity_uri($post->ID); |
|
| 368 | 368 | |
| 369 | 369 | // wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" ); |
| 370 | 370 | |
| 371 | 371 | // If the item ID and the URI differ, replace the item ID with the URI saved in WordPress. |
| 372 | - if ( $item_id !== $uri ) { |
|
| 373 | - $uri_e = esc_html( $uri ); |
|
| 374 | - $content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content ); |
|
| 372 | + if ($item_id !== $uri) { |
|
| 373 | + $uri_e = esc_html($uri); |
|
| 374 | + $content = str_replace(" itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content); |
|
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | // Reapply slashes. |
| 380 | - $content = addslashes( $content ); |
|
| 380 | + $content = addslashes($content); |
|
| 381 | 381 | |
| 382 | 382 | return $content; |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | -add_filter( 'content_save_pre', 'wl_replace_item_id_with_uri', 1, 1 ); |
|
| 385 | +add_filter('content_save_pre', 'wl_replace_item_id_with_uri', 1, 1); |
|
| 386 | 386 | |
| 387 | -require_once( 'wordlift_entity_functions.php' ); |
|
| 387 | +require_once('wordlift_entity_functions.php'); |
|
| 388 | 388 | |
| 389 | 389 | // add editor related methods. |
| 390 | -require_once( 'wordlift_editor.php' ); |
|
| 390 | +require_once('wordlift_editor.php'); |
|
| 391 | 391 | |
| 392 | 392 | // add the WordLift entity custom type. |
| 393 | -require_once( 'wordlift_entity_type.php' ); |
|
| 393 | +require_once('wordlift_entity_type.php'); |
|
| 394 | 394 | |
| 395 | 395 | // add callbacks on post save to notify data changes from wp to redlink triple store |
| 396 | -require_once( 'wordlift_to_redlink_data_push_callbacks.php' ); |
|
| 396 | +require_once('wordlift_to_redlink_data_push_callbacks.php'); |
|
| 397 | 397 | |
| 398 | -require_once( 'modules/configuration/wordlift_configuration_settings.php' ); |
|
| 398 | +require_once('modules/configuration/wordlift_configuration_settings.php'); |
|
| 399 | 399 | |
| 400 | 400 | // Load modules |
| 401 | -require_once( 'modules/analyzer/wordlift_analyzer.php' ); |
|
| 402 | -require_once( 'modules/linked_data/wordlift_linked_data.php' ); |
|
| 403 | -require_once( 'modules/prefixes/wordlift_prefixes.php' ); |
|
| 401 | +require_once('modules/analyzer/wordlift_analyzer.php'); |
|
| 402 | +require_once('modules/linked_data/wordlift_linked_data.php'); |
|
| 403 | +require_once('modules/prefixes/wordlift_prefixes.php'); |
|
| 404 | 404 | |
| 405 | 405 | // Shortcodes |
| 406 | 406 | |
| 407 | -require_once( 'modules/geo_widget/wordlift_geo_widget.php' ); |
|
| 408 | -require_once( 'shortcodes/wordlift_shortcode_chord.php' ); |
|
| 409 | -require_once( 'shortcodes/wordlift_shortcode_geomap.php' ); |
|
| 410 | -require_once( 'shortcodes/wordlift_shortcode_field.php' ); |
|
| 411 | -require_once( 'shortcodes/wordlift_shortcode_faceted_search.php' ); |
|
| 412 | -require_once( 'shortcodes/wordlift_shortcode_navigator.php' ); |
|
| 407 | +require_once('modules/geo_widget/wordlift_geo_widget.php'); |
|
| 408 | +require_once('shortcodes/wordlift_shortcode_chord.php'); |
|
| 409 | +require_once('shortcodes/wordlift_shortcode_geomap.php'); |
|
| 410 | +require_once('shortcodes/wordlift_shortcode_field.php'); |
|
| 411 | +require_once('shortcodes/wordlift_shortcode_faceted_search.php'); |
|
| 412 | +require_once('shortcodes/wordlift_shortcode_navigator.php'); |
|
| 413 | 413 | |
| 414 | -require_once( 'widgets/wordlift_widget_geo.php' ); |
|
| 415 | -require_once( 'widgets/class-wordlift-chord-widget.php' ); |
|
| 416 | -require_once( 'widgets/wordlift_widget_timeline.php' ); |
|
| 414 | +require_once('widgets/wordlift_widget_geo.php'); |
|
| 415 | +require_once('widgets/class-wordlift-chord-widget.php'); |
|
| 416 | +require_once('widgets/wordlift_widget_timeline.php'); |
|
| 417 | 417 | |
| 418 | -require_once( 'wordlift_redlink.php' ); |
|
| 418 | +require_once('wordlift_redlink.php'); |
|
| 419 | 419 | |
| 420 | 420 | // Add admin functions. |
| 421 | 421 | // TODO: find a way to make 'admin' UI tests work. |
| 422 | 422 | //if ( is_admin() ) { |
| 423 | 423 | |
| 424 | -require_once( 'admin/wordlift_admin.php' ); |
|
| 425 | -require_once( 'admin/wordlift_admin_edit_post.php' ); |
|
| 426 | -require_once( 'admin/wordlift_admin_save_post.php' ); |
|
| 424 | +require_once('admin/wordlift_admin.php'); |
|
| 425 | +require_once('admin/wordlift_admin_edit_post.php'); |
|
| 426 | +require_once('admin/wordlift_admin_save_post.php'); |
|
| 427 | 427 | |
| 428 | 428 | // add the entities meta box. |
| 429 | -require_once( 'admin/wordlift_admin_meta_box_entities.php' ); |
|
| 429 | +require_once('admin/wordlift_admin_meta_box_entities.php'); |
|
| 430 | 430 | |
| 431 | 431 | // add the entity creation AJAX. |
| 432 | -require_once( 'admin/wordlift_admin_ajax_related_posts.php' ); |
|
| 432 | +require_once('admin/wordlift_admin_ajax_related_posts.php'); |
|
| 433 | 433 | |
| 434 | 434 | // Load the wl_chord TinyMCE button and configuration dialog. |
| 435 | -require_once( 'admin/wordlift_admin_shortcodes.php' ); |
|
| 435 | +require_once('admin/wordlift_admin_shortcodes.php'); |
|
| 436 | 436 | |
| 437 | 437 | /** |
| 438 | 438 | * The code that runs during plugin activation. |
@@ -440,11 +440,11 @@ discard block |
||
| 440 | 440 | */ |
| 441 | 441 | function activate_wordlift() { |
| 442 | 442 | |
| 443 | - $log = Wordlift_Log_Service::get_logger( 'activate_wordlift' ); |
|
| 443 | + $log = Wordlift_Log_Service::get_logger('activate_wordlift'); |
|
| 444 | 444 | |
| 445 | - $log->info( 'Activating WordLift...' ); |
|
| 445 | + $log->info('Activating WordLift...'); |
|
| 446 | 446 | |
| 447 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php'; |
|
| 447 | + require_once plugin_dir_path(__FILE__).'includes/class-wordlift-activator.php'; |
|
| 448 | 448 | Wordlift_Activator::activate(); |
| 449 | 449 | |
| 450 | 450 | /** |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | */ |
| 468 | 468 | function deactivate_wordlift() { |
| 469 | 469 | |
| 470 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
| 470 | + require_once plugin_dir_path(__FILE__).'includes/class-wordlift-deactivator.php'; |
|
| 471 | 471 | Wordlift_Deactivator::deactivate(); |
| 472 | 472 | Wordlift_Http_Api::deactivate(); |
| 473 | 473 | Ttl_Cache_Cleaner::deactivate(); |
@@ -475,14 +475,14 @@ discard block |
||
| 475 | 475 | |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | -register_activation_hook( __FILE__, 'activate_wordlift' ); |
|
| 479 | -register_deactivation_hook( __FILE__, 'deactivate_wordlift' ); |
|
| 478 | +register_activation_hook(__FILE__, 'activate_wordlift'); |
|
| 479 | +register_deactivation_hook(__FILE__, 'deactivate_wordlift'); |
|
| 480 | 480 | |
| 481 | 481 | /** |
| 482 | 482 | * The core plugin class that is used to define internationalization, |
| 483 | 483 | * admin-specific hooks, and public-facing site hooks. |
| 484 | 484 | */ |
| 485 | -require plugin_dir_path( __FILE__ ) . 'includes/class-wordlift.php'; |
|
| 485 | +require plugin_dir_path(__FILE__).'includes/class-wordlift.php'; |
|
| 486 | 486 | |
| 487 | 487 | /** |
| 488 | 488 | * Begins execution of the plugin. |
@@ -520,24 +520,24 @@ discard block |
||
| 520 | 520 | */ |
| 521 | 521 | function wordlift_plugin_autoload_register() { |
| 522 | 522 | |
| 523 | - spl_autoload_register( function ( $class_name ) { |
|
| 523 | + spl_autoload_register(function($class_name) { |
|
| 524 | 524 | |
| 525 | 525 | // Bail out if these are not our classes. |
| 526 | - if ( 0 !== strpos( $class_name, 'Wordlift\\Cache\\' ) ) { |
|
| 526 | + if (0 !== strpos($class_name, 'Wordlift\\Cache\\')) { |
|
| 527 | 527 | return false; |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | - $class_name_lc = strtolower( str_replace( '_', '-', $class_name ) ); |
|
| 530 | + $class_name_lc = strtolower(str_replace('_', '-', $class_name)); |
|
| 531 | 531 | |
| 532 | - preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches ); |
|
| 532 | + preg_match('|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches); |
|
| 533 | 533 | |
| 534 | - $path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] ); |
|
| 535 | - $file = 'class-' . $matches[2] . '.php'; |
|
| 534 | + $path = str_replace('\\', DIRECTORY_SEPARATOR, $matches[1]); |
|
| 535 | + $file = 'class-'.$matches[2].'.php'; |
|
| 536 | 536 | |
| 537 | - $full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file; |
|
| 537 | + $full_path = plugin_dir_path(__FILE__).$path.DIRECTORY_SEPARATOR.$file; |
|
| 538 | 538 | |
| 539 | - if ( ! file_exists( $full_path ) ) { |
|
| 540 | - echo( "Class $class_name not found at $full_path." ); |
|
| 539 | + if ( ! file_exists($full_path)) { |
|
| 540 | + echo("Class $class_name not found at $full_path."); |
|
| 541 | 541 | |
| 542 | 542 | return false; |
| 543 | 543 | } |
@@ -49,6 +49,11 @@ |
||
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | + /** |
|
| 53 | + * @param string $url |
|
| 54 | + * |
|
| 55 | + * @return integer|null |
|
| 56 | + */ |
|
| 52 | 57 | private function url_to_postid( $url ) { |
| 53 | 58 | // Try with url_to_postid |
| 54 | 59 | $post_id = url_to_postid( $url ); |
@@ -9,58 +9,58 @@ |
||
| 9 | 9 | |
| 10 | 10 | class Wordlift_Context_Cards_Service { |
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * @var string |
|
| 14 | - */ |
|
| 15 | - private $endpoint; |
|
| 12 | + /** |
|
| 13 | + * @var string |
|
| 14 | + */ |
|
| 15 | + private $endpoint; |
|
| 16 | 16 | |
| 17 | - function __construct() { |
|
| 17 | + function __construct() { |
|
| 18 | 18 | |
| 19 | - $this->endpoint = '/jsonld'; |
|
| 19 | + $this->endpoint = '/jsonld'; |
|
| 20 | 20 | |
| 21 | - // PHP 5.3 compatibility as `$this` cannot be used in closures. |
|
| 22 | - $that = $this; |
|
| 21 | + // PHP 5.3 compatibility as `$this` cannot be used in closures. |
|
| 22 | + $that = $this; |
|
| 23 | 23 | |
| 24 | - add_action( 'rest_api_init', function () use ( $that ) { |
|
| 25 | - register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, $that->endpoint, array( |
|
| 26 | - 'methods' => 'GET', |
|
| 27 | - 'callback' => array( $that, 'context_data' ), |
|
| 28 | - ) ); |
|
| 29 | - } ); |
|
| 24 | + add_action( 'rest_api_init', function () use ( $that ) { |
|
| 25 | + register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, $that->endpoint, array( |
|
| 26 | + 'methods' => 'GET', |
|
| 27 | + 'callback' => array( $that, 'context_data' ), |
|
| 28 | + ) ); |
|
| 29 | + } ); |
|
| 30 | 30 | |
| 31 | - } |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - public function context_data( $request ) { |
|
| 33 | + public function context_data( $request ) { |
|
| 34 | 34 | |
| 35 | - $entity_uri = urldecode( $request->get_param( 'entity_url' ) ); |
|
| 36 | - $entity_id = $this->url_to_postid( $entity_uri ); |
|
| 37 | - $jsonld = Wordlift_Jsonld_Service::get_instance()->get_jsonld( false, $entity_id ); |
|
| 35 | + $entity_uri = urldecode( $request->get_param( 'entity_url' ) ); |
|
| 36 | + $entity_id = $this->url_to_postid( $entity_uri ); |
|
| 37 | + $jsonld = Wordlift_Jsonld_Service::get_instance()->get_jsonld( false, $entity_id ); |
|
| 38 | 38 | |
| 39 | - return $jsonld; |
|
| 39 | + return $jsonld; |
|
| 40 | 40 | |
| 41 | - } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - public function enqueue_scripts() { |
|
| 44 | - $show_context_cards = true; |
|
| 45 | - $show_context_cards = apply_filters( 'wl_show_context_cards', $show_context_cards ); |
|
| 46 | - if ( $show_context_cards ) { |
|
| 47 | - wp_enqueue_script( 'wordlift-cloud' ); |
|
| 48 | - wp_add_inline_script( 'wordlift-cloud', "window.addEventListener( 'load', function() { wordliftCloud.contextCards('a.wl-entity-page-link', '" . get_rest_url() . WL_REST_ROUTE_DEFAULT_NAMESPACE . $this->endpoint . "'); } );" ); |
|
| 49 | - } |
|
| 50 | - } |
|
| 43 | + public function enqueue_scripts() { |
|
| 44 | + $show_context_cards = true; |
|
| 45 | + $show_context_cards = apply_filters( 'wl_show_context_cards', $show_context_cards ); |
|
| 46 | + if ( $show_context_cards ) { |
|
| 47 | + wp_enqueue_script( 'wordlift-cloud' ); |
|
| 48 | + wp_add_inline_script( 'wordlift-cloud', "window.addEventListener( 'load', function() { wordliftCloud.contextCards('a.wl-entity-page-link', '" . get_rest_url() . WL_REST_ROUTE_DEFAULT_NAMESPACE . $this->endpoint . "'); } );" ); |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - private function url_to_postid( $url ) { |
|
| 53 | - // Try with url_to_postid |
|
| 54 | - $post_id = url_to_postid( $url ); |
|
| 55 | - if ( $post_id == 0 ) { |
|
| 56 | - // Try with get_page_by_path |
|
| 57 | - $post = get_page_by_path( basename( untrailingslashit( $url ) ), OBJECT, 'entity' ); |
|
| 58 | - if ( $post ) { |
|
| 59 | - $post_id = $post->ID; |
|
| 60 | - } |
|
| 61 | - } |
|
| 52 | + private function url_to_postid( $url ) { |
|
| 53 | + // Try with url_to_postid |
|
| 54 | + $post_id = url_to_postid( $url ); |
|
| 55 | + if ( $post_id == 0 ) { |
|
| 56 | + // Try with get_page_by_path |
|
| 57 | + $post = get_page_by_path( basename( untrailingslashit( $url ) ), OBJECT, 'entity' ); |
|
| 58 | + if ( $post ) { |
|
| 59 | + $post_id = $post->ID; |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - return $post_id; |
|
| 64 | - } |
|
| 63 | + return $post_id; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | 66 | } |
@@ -21,20 +21,20 @@ discard block |
||
| 21 | 21 | // PHP 5.3 compatibility as `$this` cannot be used in closures. |
| 22 | 22 | $that = $this; |
| 23 | 23 | |
| 24 | - add_action( 'rest_api_init', function () use ( $that ) { |
|
| 25 | - register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, $that->endpoint, array( |
|
| 24 | + add_action('rest_api_init', function() use ($that) { |
|
| 25 | + register_rest_route(WL_REST_ROUTE_DEFAULT_NAMESPACE, $that->endpoint, array( |
|
| 26 | 26 | 'methods' => 'GET', |
| 27 | - 'callback' => array( $that, 'context_data' ), |
|
| 28 | - ) ); |
|
| 27 | + 'callback' => array($that, 'context_data'), |
|
| 28 | + )); |
|
| 29 | 29 | } ); |
| 30 | 30 | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function context_data( $request ) { |
|
| 33 | + public function context_data($request) { |
|
| 34 | 34 | |
| 35 | - $entity_uri = urldecode( $request->get_param( 'entity_url' ) ); |
|
| 36 | - $entity_id = $this->url_to_postid( $entity_uri ); |
|
| 37 | - $jsonld = Wordlift_Jsonld_Service::get_instance()->get_jsonld( false, $entity_id ); |
|
| 35 | + $entity_uri = urldecode($request->get_param('entity_url')); |
|
| 36 | + $entity_id = $this->url_to_postid($entity_uri); |
|
| 37 | + $jsonld = Wordlift_Jsonld_Service::get_instance()->get_jsonld(false, $entity_id); |
|
| 38 | 38 | |
| 39 | 39 | return $jsonld; |
| 40 | 40 | |
@@ -42,20 +42,20 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function enqueue_scripts() { |
| 44 | 44 | $show_context_cards = true; |
| 45 | - $show_context_cards = apply_filters( 'wl_show_context_cards', $show_context_cards ); |
|
| 46 | - if ( $show_context_cards ) { |
|
| 47 | - wp_enqueue_script( 'wordlift-cloud' ); |
|
| 48 | - wp_add_inline_script( 'wordlift-cloud', "window.addEventListener( 'load', function() { wordliftCloud.contextCards('a.wl-entity-page-link', '" . get_rest_url() . WL_REST_ROUTE_DEFAULT_NAMESPACE . $this->endpoint . "'); } );" ); |
|
| 45 | + $show_context_cards = apply_filters('wl_show_context_cards', $show_context_cards); |
|
| 46 | + if ($show_context_cards) { |
|
| 47 | + wp_enqueue_script('wordlift-cloud'); |
|
| 48 | + wp_add_inline_script('wordlift-cloud', "window.addEventListener( 'load', function() { wordliftCloud.contextCards('a.wl-entity-page-link', '".get_rest_url().WL_REST_ROUTE_DEFAULT_NAMESPACE.$this->endpoint."'); } );"); |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - private function url_to_postid( $url ) { |
|
| 52 | + private function url_to_postid($url) { |
|
| 53 | 53 | // Try with url_to_postid |
| 54 | - $post_id = url_to_postid( $url ); |
|
| 55 | - if ( $post_id == 0 ) { |
|
| 54 | + $post_id = url_to_postid($url); |
|
| 55 | + if ($post_id == 0) { |
|
| 56 | 56 | // Try with get_page_by_path |
| 57 | - $post = get_page_by_path( basename( untrailingslashit( $url ) ), OBJECT, 'entity' ); |
|
| 58 | - if ( $post ) { |
|
| 57 | + $post = get_page_by_path(basename(untrailingslashit($url)), OBJECT, 'entity'); |
|
| 58 | + if ($post) { |
|
| 59 | 59 | $post_id = $post->ID; |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -16,129 +16,129 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | function wl_shortcode_navigator_data() { |
| 18 | 18 | |
| 19 | - // Create the cache key. |
|
| 20 | - $cache_key_params = $_REQUEST; |
|
| 21 | - unset( $cache_key_params['uniqid'] ); |
|
| 22 | - $cache_key = array( 'request_params' => $cache_key_params ); |
|
| 19 | + // Create the cache key. |
|
| 20 | + $cache_key_params = $_REQUEST; |
|
| 21 | + unset( $cache_key_params['uniqid'] ); |
|
| 22 | + $cache_key = array( 'request_params' => $cache_key_params ); |
|
| 23 | 23 | |
| 24 | - // Create the TTL cache and try to get the results. |
|
| 25 | - $cache = new Ttl_Cache( "navigator", 24 * 60 * 60 ); // 24 hours. |
|
| 26 | - $cache_results = $cache->get( $cache_key ); |
|
| 24 | + // Create the TTL cache and try to get the results. |
|
| 25 | + $cache = new Ttl_Cache( "navigator", 24 * 60 * 60 ); // 24 hours. |
|
| 26 | + $cache_results = $cache->get( $cache_key ); |
|
| 27 | 27 | |
| 28 | - if ( isset( $cache_results ) ) { |
|
| 29 | - header( 'X-WordLift-Cache: HIT' ); |
|
| 28 | + if ( isset( $cache_results ) ) { |
|
| 29 | + header( 'X-WordLift-Cache: HIT' ); |
|
| 30 | 30 | |
| 31 | - return $cache_results; |
|
| 32 | - } |
|
| 31 | + return $cache_results; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - header( 'X-WordLift-Cache: MISS' ); |
|
| 34 | + header( 'X-WordLift-Cache: MISS' ); |
|
| 35 | 35 | |
| 36 | - $results = _wl_navigator_get_data(); |
|
| 36 | + $results = _wl_navigator_get_data(); |
|
| 37 | 37 | |
| 38 | - // Put the result before sending the json to the client, since sending the json will terminate us. |
|
| 39 | - $cache->put( $cache_key, $results ); |
|
| 38 | + // Put the result before sending the json to the client, since sending the json will terminate us. |
|
| 39 | + $cache->put( $cache_key, $results ); |
|
| 40 | 40 | |
| 41 | - return $results; |
|
| 41 | + return $results; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | function _wl_navigator_get_data() { |
| 45 | 45 | |
| 46 | - // Post ID must be defined |
|
| 47 | - if ( ! isset( $_GET['post_id'] ) ) { |
|
| 48 | - wp_send_json_error( 'No post_id given' ); |
|
| 46 | + // Post ID must be defined |
|
| 47 | + if ( ! isset( $_GET['post_id'] ) ) { |
|
| 48 | + wp_send_json_error( 'No post_id given' ); |
|
| 49 | 49 | |
| 50 | - return array(); |
|
| 51 | - } |
|
| 50 | + return array(); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - // Limit the results (defaults to 4) |
|
| 54 | - $navigator_length = isset( $_GET['limit'] ) ? intval( $_GET['limit'] ) : 4; |
|
| 55 | - $navigator_offset = isset( $_GET['offset'] ) ? intval( $_GET['offset'] ) : 0; |
|
| 53 | + // Limit the results (defaults to 4) |
|
| 54 | + $navigator_length = isset( $_GET['limit'] ) ? intval( $_GET['limit'] ) : 4; |
|
| 55 | + $navigator_offset = isset( $_GET['offset'] ) ? intval( $_GET['offset'] ) : 0; |
|
| 56 | 56 | |
| 57 | - $current_post_id = $_GET['post_id']; |
|
| 58 | - $current_post = get_post( $current_post_id ); |
|
| 57 | + $current_post_id = $_GET['post_id']; |
|
| 58 | + $current_post = get_post( $current_post_id ); |
|
| 59 | 59 | |
| 60 | - $navigator_id = $_GET['uniqid']; |
|
| 60 | + $navigator_id = $_GET['uniqid']; |
|
| 61 | 61 | |
| 62 | - // Post ID has to match an existing item |
|
| 63 | - if ( null === $current_post ) { |
|
| 64 | - wp_die( 'No valid post_id given' ); |
|
| 62 | + // Post ID has to match an existing item |
|
| 63 | + if ( null === $current_post ) { |
|
| 64 | + wp_die( 'No valid post_id given' ); |
|
| 65 | 65 | |
| 66 | - return array(); |
|
| 67 | - } |
|
| 66 | + return array(); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - $referencing_posts = _wl_navigator_get_results( $current_post_id, array( |
|
| 70 | - 'ID', |
|
| 71 | - 'post_title', |
|
| 72 | - ), 'ID DESC', $navigator_length, $navigator_offset ); |
|
| 69 | + $referencing_posts = _wl_navigator_get_results( $current_post_id, array( |
|
| 70 | + 'ID', |
|
| 71 | + 'post_title', |
|
| 72 | + ), 'ID DESC', $navigator_length, $navigator_offset ); |
|
| 73 | 73 | |
| 74 | - // loop over them and take the first one which is not already in the $related_posts |
|
| 75 | - $results = array(); |
|
| 76 | - foreach ( $referencing_posts as $referencing_post ) { |
|
| 77 | - $serialized_entity = wl_serialize_entity( $referencing_post->entity_id ); |
|
| 74 | + // loop over them and take the first one which is not already in the $related_posts |
|
| 75 | + $results = array(); |
|
| 76 | + foreach ( $referencing_posts as $referencing_post ) { |
|
| 77 | + $serialized_entity = wl_serialize_entity( $referencing_post->entity_id ); |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * Use the thumbnail. |
|
| 81 | - * |
|
| 82 | - * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue. |
|
| 83 | - * @see https://github.com/insideout10/wordlift-plugin/issues/837 |
|
| 84 | - * |
|
| 85 | - * @since 3.19.3 We're using the medium size image. |
|
| 86 | - */ |
|
| 87 | - $thumbnail = get_the_post_thumbnail_url( $referencing_post, 'medium' ); |
|
| 79 | + /** |
|
| 80 | + * Use the thumbnail. |
|
| 81 | + * |
|
| 82 | + * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue. |
|
| 83 | + * @see https://github.com/insideout10/wordlift-plugin/issues/837 |
|
| 84 | + * |
|
| 85 | + * @since 3.19.3 We're using the medium size image. |
|
| 86 | + */ |
|
| 87 | + $thumbnail = get_the_post_thumbnail_url( $referencing_post, 'medium' ); |
|
| 88 | 88 | |
| 89 | 89 | // if ( $thumbnail ) { |
| 90 | 90 | |
| 91 | - $result = array( |
|
| 92 | - 'post' => array( |
|
| 93 | - 'permalink' => get_permalink( $referencing_post->ID ), |
|
| 94 | - 'title' => $referencing_post->post_title, |
|
| 95 | - 'thumbnail' => $thumbnail, |
|
| 96 | - ), |
|
| 97 | - 'entity' => array( |
|
| 98 | - 'label' => $serialized_entity['label'], |
|
| 99 | - 'mainType' => $serialized_entity['mainType'], |
|
| 100 | - 'permalink' => get_permalink( $referencing_post->entity_id ), |
|
| 101 | - ), |
|
| 102 | - ); |
|
| 103 | - |
|
| 104 | - $result['post'] = apply_filters( 'wl_navigator_data_post', $result['post'], intval( $referencing_post->ID ), $navigator_id ); |
|
| 105 | - $result['entity'] = apply_filters( 'wl_navigator_data_entity', $result['entity'], intval( $referencing_post->entity_id ), $navigator_id ); |
|
| 106 | - |
|
| 107 | - $results[] = $result; |
|
| 108 | - |
|
| 109 | - // Be sure no more than 1 post for entity is returned |
|
| 91 | + $result = array( |
|
| 92 | + 'post' => array( |
|
| 93 | + 'permalink' => get_permalink( $referencing_post->ID ), |
|
| 94 | + 'title' => $referencing_post->post_title, |
|
| 95 | + 'thumbnail' => $thumbnail, |
|
| 96 | + ), |
|
| 97 | + 'entity' => array( |
|
| 98 | + 'label' => $serialized_entity['label'], |
|
| 99 | + 'mainType' => $serialized_entity['mainType'], |
|
| 100 | + 'permalink' => get_permalink( $referencing_post->entity_id ), |
|
| 101 | + ), |
|
| 102 | + ); |
|
| 103 | + |
|
| 104 | + $result['post'] = apply_filters( 'wl_navigator_data_post', $result['post'], intval( $referencing_post->ID ), $navigator_id ); |
|
| 105 | + $result['entity'] = apply_filters( 'wl_navigator_data_entity', $result['entity'], intval( $referencing_post->entity_id ), $navigator_id ); |
|
| 106 | + |
|
| 107 | + $results[] = $result; |
|
| 108 | + |
|
| 109 | + // Be sure no more than 1 post for entity is returned |
|
| 110 | 110 | // break; |
| 111 | 111 | // } |
| 112 | - } |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - if ( count( $results ) < $navigator_length ) { |
|
| 115 | - $results = apply_filters( 'wl_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length ); |
|
| 116 | - } |
|
| 114 | + if ( count( $results ) < $navigator_length ) { |
|
| 115 | + $results = apply_filters( 'wl_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length ); |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - // Return first 4 results in json accordingly to 4 columns layout |
|
| 119 | - return $results; |
|
| 118 | + // Return first 4 results in json accordingly to 4 columns layout |
|
| 119 | + return $results; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | function _wl_navigator_get_results( |
| 124 | - $post_id, $fields = array( |
|
| 125 | - 'ID', |
|
| 126 | - 'post_title', |
|
| 124 | + $post_id, $fields = array( |
|
| 125 | + 'ID', |
|
| 126 | + 'post_title', |
|
| 127 | 127 | ), $order_by = 'ID DESC', $limit = 10, $offset = 0 |
| 128 | 128 | ) { |
| 129 | - global $wpdb; |
|
| 129 | + global $wpdb; |
|
| 130 | 130 | |
| 131 | - $select = implode( ', ', array_map( function ( $item ) { |
|
| 132 | - return "p.$item AS $item"; |
|
| 133 | - }, (array) $fields ) ); |
|
| 131 | + $select = implode( ', ', array_map( function ( $item ) { |
|
| 132 | + return "p.$item AS $item"; |
|
| 133 | + }, (array) $fields ) ); |
|
| 134 | 134 | |
| 135 | - $order_by = implode( ', ', array_map( function ( $item ) { |
|
| 136 | - return "p.$item"; |
|
| 137 | - }, (array) $order_by ) ); |
|
| 135 | + $order_by = implode( ', ', array_map( function ( $item ) { |
|
| 136 | + return "p.$item"; |
|
| 137 | + }, (array) $order_by ) ); |
|
| 138 | 138 | |
| 139 | - /** @noinspection SqlNoDataSourceInspection */ |
|
| 140 | - return $wpdb->get_results( |
|
| 141 | - $wpdb->prepare( <<<EOF |
|
| 139 | + /** @noinspection SqlNoDataSourceInspection */ |
|
| 140 | + return $wpdb->get_results( |
|
| 141 | + $wpdb->prepare( <<<EOF |
|
| 142 | 142 | SELECT %4\$s, p2.ID as entity_id |
| 143 | 143 | FROM {$wpdb->prefix}wl_relation_instances r1 |
| 144 | 144 | INNER JOIN {$wpdb->prefix}wl_relation_instances r2 |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | LIMIT %2\$d |
| 171 | 171 | OFFSET %3\$d |
| 172 | 172 | EOF |
| 173 | - , $post_id, $limit, $offset, $select, $order_by ) |
|
| 174 | - ); |
|
| 173 | + , $post_id, $limit, $offset, $select, $order_by ) |
|
| 174 | + ); |
|
| 175 | 175 | |
| 176 | 176 | } |
| 177 | 177 | |
@@ -182,9 +182,9 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | function wl_shortcode_navigator_ajax() { |
| 184 | 184 | |
| 185 | - // Temporary blocking the Navigator. |
|
| 186 | - $results = wl_shortcode_navigator_data(); |
|
| 187 | - wl_core_send_json( $results ); |
|
| 185 | + // Temporary blocking the Navigator. |
|
| 186 | + $results = wl_shortcode_navigator_data(); |
|
| 187 | + wl_core_send_json( $results ); |
|
| 188 | 188 | |
| 189 | 189 | } |
| 190 | 190 | |
@@ -196,16 +196,16 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | function wl_shortcode_navigator_wp_json() { |
| 198 | 198 | |
| 199 | - $results = wl_shortcode_navigator_data(); |
|
| 200 | - if ( ob_get_contents() ) { |
|
| 201 | - ob_clean(); |
|
| 202 | - } |
|
| 199 | + $results = wl_shortcode_navigator_data(); |
|
| 200 | + if ( ob_get_contents() ) { |
|
| 201 | + ob_clean(); |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - return array( |
|
| 205 | - 'items' => array( |
|
| 206 | - array( 'values' => $results ), |
|
| 207 | - ), |
|
| 208 | - ); |
|
| 204 | + return array( |
|
| 205 | + 'items' => array( |
|
| 206 | + array( 'values' => $results ), |
|
| 207 | + ), |
|
| 208 | + ); |
|
| 209 | 209 | |
| 210 | 210 | } |
| 211 | 211 | |
@@ -213,56 +213,56 @@ discard block |
||
| 213 | 213 | * Adding `rest_api_init` action for amp backend of navigator |
| 214 | 214 | */ |
| 215 | 215 | add_action( 'rest_api_init', function () { |
| 216 | - register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/navigator', array( |
|
| 217 | - 'methods' => 'GET', |
|
| 218 | - 'callback' => 'wl_shortcode_navigator_wp_json', |
|
| 219 | - ) ); |
|
| 216 | + register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/navigator', array( |
|
| 217 | + 'methods' => 'GET', |
|
| 218 | + 'callback' => 'wl_shortcode_navigator_wp_json', |
|
| 219 | + ) ); |
|
| 220 | 220 | } ); |
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | 223 | * register_block_type for Gutenberg blocks |
| 224 | 224 | */ |
| 225 | 225 | add_action( 'init', function () { |
| 226 | - // Bail out if the `register_block_type` function isn't available. |
|
| 227 | - if ( ! function_exists( 'register_block_type' ) ) { |
|
| 228 | - return; |
|
| 229 | - } |
|
| 230 | - |
|
| 231 | - register_block_type( 'wordlift/navigator', array( |
|
| 232 | - 'editor_script' => 'wordlift-admin-edit-gutenberg', |
|
| 233 | - 'render_callback' => function ( $attributes ) { |
|
| 234 | - $attr_code = ''; |
|
| 235 | - foreach ( $attributes as $key => $value ) { |
|
| 236 | - $attr_code .= $key . '="' . $value . '" '; |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - return '[wl_navigator ' . $attr_code . ']'; |
|
| 240 | - }, |
|
| 241 | - 'attributes' => array( |
|
| 242 | - 'title' => array( |
|
| 243 | - 'type' => 'string', |
|
| 244 | - 'default' => __( 'Related articles', 'wordlift' ), |
|
| 245 | - ), |
|
| 246 | - 'limit' => array( |
|
| 247 | - 'type' => 'number', |
|
| 248 | - 'default' => 4, |
|
| 249 | - ), |
|
| 250 | - 'template_id' => array( |
|
| 251 | - 'type' => 'string', |
|
| 252 | - ), |
|
| 253 | - 'post_id' => array( |
|
| 254 | - 'type' => 'number', |
|
| 255 | - ), |
|
| 256 | - 'offset' => array( |
|
| 257 | - 'type' => 'number', |
|
| 258 | - 'default' => 0, |
|
| 259 | - ), |
|
| 260 | - 'uniqid' => array( |
|
| 261 | - 'type' => 'string', |
|
| 262 | - 'default' => uniqid( 'wl-navigator-widget-' ), |
|
| 263 | - ), |
|
| 264 | - ), |
|
| 265 | - ) ); |
|
| 226 | + // Bail out if the `register_block_type` function isn't available. |
|
| 227 | + if ( ! function_exists( 'register_block_type' ) ) { |
|
| 228 | + return; |
|
| 229 | + } |
|
| 230 | + |
|
| 231 | + register_block_type( 'wordlift/navigator', array( |
|
| 232 | + 'editor_script' => 'wordlift-admin-edit-gutenberg', |
|
| 233 | + 'render_callback' => function ( $attributes ) { |
|
| 234 | + $attr_code = ''; |
|
| 235 | + foreach ( $attributes as $key => $value ) { |
|
| 236 | + $attr_code .= $key . '="' . $value . '" '; |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + return '[wl_navigator ' . $attr_code . ']'; |
|
| 240 | + }, |
|
| 241 | + 'attributes' => array( |
|
| 242 | + 'title' => array( |
|
| 243 | + 'type' => 'string', |
|
| 244 | + 'default' => __( 'Related articles', 'wordlift' ), |
|
| 245 | + ), |
|
| 246 | + 'limit' => array( |
|
| 247 | + 'type' => 'number', |
|
| 248 | + 'default' => 4, |
|
| 249 | + ), |
|
| 250 | + 'template_id' => array( |
|
| 251 | + 'type' => 'string', |
|
| 252 | + ), |
|
| 253 | + 'post_id' => array( |
|
| 254 | + 'type' => 'number', |
|
| 255 | + ), |
|
| 256 | + 'offset' => array( |
|
| 257 | + 'type' => 'number', |
|
| 258 | + 'default' => 0, |
|
| 259 | + ), |
|
| 260 | + 'uniqid' => array( |
|
| 261 | + 'type' => 'string', |
|
| 262 | + 'default' => uniqid( 'wl-navigator-widget-' ), |
|
| 263 | + ), |
|
| 264 | + ), |
|
| 265 | + ) ); |
|
| 266 | 266 | } ); |
| 267 | 267 | |
| 268 | 268 | /** |
@@ -272,22 +272,22 @@ discard block |
||
| 272 | 272 | */ |
| 273 | 273 | add_action( 'plugins_loaded', function () { |
| 274 | 274 | |
| 275 | - if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $_REQUEST['action'] ) { |
|
| 276 | - return; |
|
| 277 | - } |
|
| 275 | + if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $_REQUEST['action'] ) { |
|
| 276 | + return; |
|
| 277 | + } |
|
| 278 | 278 | |
| 279 | - remove_action( 'plugins_loaded', 'rocket_init' ); |
|
| 280 | - remove_action( 'plugins_loaded', 'wpseo_premium_init', 14 ); |
|
| 281 | - remove_action( 'plugins_loaded', 'wpseo_init', 14 ); |
|
| 279 | + remove_action( 'plugins_loaded', 'rocket_init' ); |
|
| 280 | + remove_action( 'plugins_loaded', 'wpseo_premium_init', 14 ); |
|
| 281 | + remove_action( 'plugins_loaded', 'wpseo_init', 14 ); |
|
| 282 | 282 | }, 0 ); |
| 283 | 283 | |
| 284 | 284 | add_action( 'init', function () { |
| 285 | 285 | |
| 286 | - if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $_REQUEST['action'] ) { |
|
| 287 | - return; |
|
| 288 | - } |
|
| 286 | + if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $_REQUEST['action'] ) { |
|
| 287 | + return; |
|
| 288 | + } |
|
| 289 | 289 | |
| 290 | - remove_action( 'init', 'wp_widgets_init', 1 ); |
|
| 291 | - remove_action( 'init', 'gglcptch_init' ); |
|
| 290 | + remove_action( 'init', 'wp_widgets_init', 1 ); |
|
| 291 | + remove_action( 'init', 'gglcptch_init' ); |
|
| 292 | 292 | }, 0 ); |
| 293 | 293 | |
@@ -18,25 +18,25 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | // Create the cache key. |
| 20 | 20 | $cache_key_params = $_REQUEST; |
| 21 | - unset( $cache_key_params['uniqid'] ); |
|
| 22 | - $cache_key = array( 'request_params' => $cache_key_params ); |
|
| 21 | + unset($cache_key_params['uniqid']); |
|
| 22 | + $cache_key = array('request_params' => $cache_key_params); |
|
| 23 | 23 | |
| 24 | 24 | // Create the TTL cache and try to get the results. |
| 25 | - $cache = new Ttl_Cache( "navigator", 24 * 60 * 60 ); // 24 hours. |
|
| 26 | - $cache_results = $cache->get( $cache_key ); |
|
| 25 | + $cache = new Ttl_Cache("navigator", 24 * 60 * 60); // 24 hours. |
|
| 26 | + $cache_results = $cache->get($cache_key); |
|
| 27 | 27 | |
| 28 | - if ( isset( $cache_results ) ) { |
|
| 29 | - header( 'X-WordLift-Cache: HIT' ); |
|
| 28 | + if (isset($cache_results)) { |
|
| 29 | + header('X-WordLift-Cache: HIT'); |
|
| 30 | 30 | |
| 31 | 31 | return $cache_results; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - header( 'X-WordLift-Cache: MISS' ); |
|
| 34 | + header('X-WordLift-Cache: MISS'); |
|
| 35 | 35 | |
| 36 | 36 | $results = _wl_navigator_get_data(); |
| 37 | 37 | |
| 38 | 38 | // Put the result before sending the json to the client, since sending the json will terminate us. |
| 39 | - $cache->put( $cache_key, $results ); |
|
| 39 | + $cache->put($cache_key, $results); |
|
| 40 | 40 | |
| 41 | 41 | return $results; |
| 42 | 42 | } |
@@ -44,37 +44,37 @@ discard block |
||
| 44 | 44 | function _wl_navigator_get_data() { |
| 45 | 45 | |
| 46 | 46 | // Post ID must be defined |
| 47 | - if ( ! isset( $_GET['post_id'] ) ) { |
|
| 48 | - wp_send_json_error( 'No post_id given' ); |
|
| 47 | + if ( ! isset($_GET['post_id'])) { |
|
| 48 | + wp_send_json_error('No post_id given'); |
|
| 49 | 49 | |
| 50 | 50 | return array(); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // Limit the results (defaults to 4) |
| 54 | - $navigator_length = isset( $_GET['limit'] ) ? intval( $_GET['limit'] ) : 4; |
|
| 55 | - $navigator_offset = isset( $_GET['offset'] ) ? intval( $_GET['offset'] ) : 0; |
|
| 54 | + $navigator_length = isset($_GET['limit']) ? intval($_GET['limit']) : 4; |
|
| 55 | + $navigator_offset = isset($_GET['offset']) ? intval($_GET['offset']) : 0; |
|
| 56 | 56 | |
| 57 | 57 | $current_post_id = $_GET['post_id']; |
| 58 | - $current_post = get_post( $current_post_id ); |
|
| 58 | + $current_post = get_post($current_post_id); |
|
| 59 | 59 | |
| 60 | 60 | $navigator_id = $_GET['uniqid']; |
| 61 | 61 | |
| 62 | 62 | // Post ID has to match an existing item |
| 63 | - if ( null === $current_post ) { |
|
| 64 | - wp_die( 'No valid post_id given' ); |
|
| 63 | + if (null === $current_post) { |
|
| 64 | + wp_die('No valid post_id given'); |
|
| 65 | 65 | |
| 66 | 66 | return array(); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - $referencing_posts = _wl_navigator_get_results( $current_post_id, array( |
|
| 69 | + $referencing_posts = _wl_navigator_get_results($current_post_id, array( |
|
| 70 | 70 | 'ID', |
| 71 | 71 | 'post_title', |
| 72 | - ), 'ID DESC', $navigator_length, $navigator_offset ); |
|
| 72 | + ), 'ID DESC', $navigator_length, $navigator_offset); |
|
| 73 | 73 | |
| 74 | 74 | // loop over them and take the first one which is not already in the $related_posts |
| 75 | 75 | $results = array(); |
| 76 | - foreach ( $referencing_posts as $referencing_post ) { |
|
| 77 | - $serialized_entity = wl_serialize_entity( $referencing_post->entity_id ); |
|
| 76 | + foreach ($referencing_posts as $referencing_post) { |
|
| 77 | + $serialized_entity = wl_serialize_entity($referencing_post->entity_id); |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * Use the thumbnail. |
@@ -84,25 +84,25 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @since 3.19.3 We're using the medium size image. |
| 86 | 86 | */ |
| 87 | - $thumbnail = get_the_post_thumbnail_url( $referencing_post, 'medium' ); |
|
| 87 | + $thumbnail = get_the_post_thumbnail_url($referencing_post, 'medium'); |
|
| 88 | 88 | |
| 89 | 89 | // if ( $thumbnail ) { |
| 90 | 90 | |
| 91 | 91 | $result = array( |
| 92 | 92 | 'post' => array( |
| 93 | - 'permalink' => get_permalink( $referencing_post->ID ), |
|
| 93 | + 'permalink' => get_permalink($referencing_post->ID), |
|
| 94 | 94 | 'title' => $referencing_post->post_title, |
| 95 | 95 | 'thumbnail' => $thumbnail, |
| 96 | 96 | ), |
| 97 | 97 | 'entity' => array( |
| 98 | 98 | 'label' => $serialized_entity['label'], |
| 99 | 99 | 'mainType' => $serialized_entity['mainType'], |
| 100 | - 'permalink' => get_permalink( $referencing_post->entity_id ), |
|
| 100 | + 'permalink' => get_permalink($referencing_post->entity_id), |
|
| 101 | 101 | ), |
| 102 | 102 | ); |
| 103 | 103 | |
| 104 | - $result['post'] = apply_filters( 'wl_navigator_data_post', $result['post'], intval( $referencing_post->ID ), $navigator_id ); |
|
| 105 | - $result['entity'] = apply_filters( 'wl_navigator_data_entity', $result['entity'], intval( $referencing_post->entity_id ), $navigator_id ); |
|
| 104 | + $result['post'] = apply_filters('wl_navigator_data_post', $result['post'], intval($referencing_post->ID), $navigator_id); |
|
| 105 | + $result['entity'] = apply_filters('wl_navigator_data_entity', $result['entity'], intval($referencing_post->entity_id), $navigator_id); |
|
| 106 | 106 | |
| 107 | 107 | $results[] = $result; |
| 108 | 108 | |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | // } |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if ( count( $results ) < $navigator_length ) { |
|
| 115 | - $results = apply_filters( 'wl_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length ); |
|
| 114 | + if (count($results) < $navigator_length) { |
|
| 115 | + $results = apply_filters('wl_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | // Return first 4 results in json accordingly to 4 columns layout |
@@ -128,17 +128,17 @@ discard block |
||
| 128 | 128 | ) { |
| 129 | 129 | global $wpdb; |
| 130 | 130 | |
| 131 | - $select = implode( ', ', array_map( function ( $item ) { |
|
| 131 | + $select = implode(', ', array_map(function($item) { |
|
| 132 | 132 | return "p.$item AS $item"; |
| 133 | - }, (array) $fields ) ); |
|
| 133 | + }, (array) $fields)); |
|
| 134 | 134 | |
| 135 | - $order_by = implode( ', ', array_map( function ( $item ) { |
|
| 135 | + $order_by = implode(', ', array_map(function($item) { |
|
| 136 | 136 | return "p.$item"; |
| 137 | - }, (array) $order_by ) ); |
|
| 137 | + }, (array) $order_by)); |
|
| 138 | 138 | |
| 139 | 139 | /** @noinspection SqlNoDataSourceInspection */ |
| 140 | 140 | return $wpdb->get_results( |
| 141 | - $wpdb->prepare( <<<EOF |
|
| 141 | + $wpdb->prepare(<<<EOF |
|
| 142 | 142 | SELECT %4\$s, p2.ID as entity_id |
| 143 | 143 | FROM {$wpdb->prefix}wl_relation_instances r1 |
| 144 | 144 | INNER JOIN {$wpdb->prefix}wl_relation_instances r2 |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | LIMIT %2\$d |
| 171 | 171 | OFFSET %3\$d |
| 172 | 172 | EOF |
| 173 | - , $post_id, $limit, $offset, $select, $order_by ) |
|
| 173 | + , $post_id, $limit, $offset, $select, $order_by) |
|
| 174 | 174 | ); |
| 175 | 175 | |
| 176 | 176 | } |
@@ -184,12 +184,12 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | // Temporary blocking the Navigator. |
| 186 | 186 | $results = wl_shortcode_navigator_data(); |
| 187 | - wl_core_send_json( $results ); |
|
| 187 | + wl_core_send_json($results); |
|
| 188 | 188 | |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | -add_action( 'wp_ajax_wl_navigator', 'wl_shortcode_navigator_ajax' ); |
|
| 192 | -add_action( 'wp_ajax_nopriv_wl_navigator', 'wl_shortcode_navigator_ajax' ); |
|
| 191 | +add_action('wp_ajax_wl_navigator', 'wl_shortcode_navigator_ajax'); |
|
| 192 | +add_action('wp_ajax_nopriv_wl_navigator', 'wl_shortcode_navigator_ajax'); |
|
| 193 | 193 | |
| 194 | 194 | /** |
| 195 | 195 | * wp-json call for the navigator widget |
@@ -197,13 +197,13 @@ discard block |
||
| 197 | 197 | function wl_shortcode_navigator_wp_json() { |
| 198 | 198 | |
| 199 | 199 | $results = wl_shortcode_navigator_data(); |
| 200 | - if ( ob_get_contents() ) { |
|
| 200 | + if (ob_get_contents()) { |
|
| 201 | 201 | ob_clean(); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | return array( |
| 205 | 205 | 'items' => array( |
| 206 | - array( 'values' => $results ), |
|
| 206 | + array('values' => $results), |
|
| 207 | 207 | ), |
| 208 | 208 | ); |
| 209 | 209 | |
@@ -212,36 +212,36 @@ discard block |
||
| 212 | 212 | /** |
| 213 | 213 | * Adding `rest_api_init` action for amp backend of navigator |
| 214 | 214 | */ |
| 215 | -add_action( 'rest_api_init', function () { |
|
| 216 | - register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/navigator', array( |
|
| 215 | +add_action('rest_api_init', function() { |
|
| 216 | + register_rest_route(WL_REST_ROUTE_DEFAULT_NAMESPACE, '/navigator', array( |
|
| 217 | 217 | 'methods' => 'GET', |
| 218 | 218 | 'callback' => 'wl_shortcode_navigator_wp_json', |
| 219 | - ) ); |
|
| 219 | + )); |
|
| 220 | 220 | } ); |
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | 223 | * register_block_type for Gutenberg blocks |
| 224 | 224 | */ |
| 225 | -add_action( 'init', function () { |
|
| 225 | +add_action('init', function() { |
|
| 226 | 226 | // Bail out if the `register_block_type` function isn't available. |
| 227 | - if ( ! function_exists( 'register_block_type' ) ) { |
|
| 227 | + if ( ! function_exists('register_block_type')) { |
|
| 228 | 228 | return; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - register_block_type( 'wordlift/navigator', array( |
|
| 231 | + register_block_type('wordlift/navigator', array( |
|
| 232 | 232 | 'editor_script' => 'wordlift-admin-edit-gutenberg', |
| 233 | - 'render_callback' => function ( $attributes ) { |
|
| 233 | + 'render_callback' => function($attributes) { |
|
| 234 | 234 | $attr_code = ''; |
| 235 | - foreach ( $attributes as $key => $value ) { |
|
| 236 | - $attr_code .= $key . '="' . $value . '" '; |
|
| 235 | + foreach ($attributes as $key => $value) { |
|
| 236 | + $attr_code .= $key.'="'.$value.'" '; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - return '[wl_navigator ' . $attr_code . ']'; |
|
| 239 | + return '[wl_navigator '.$attr_code.']'; |
|
| 240 | 240 | }, |
| 241 | 241 | 'attributes' => array( |
| 242 | 242 | 'title' => array( |
| 243 | 243 | 'type' => 'string', |
| 244 | - 'default' => __( 'Related articles', 'wordlift' ), |
|
| 244 | + 'default' => __('Related articles', 'wordlift'), |
|
| 245 | 245 | ), |
| 246 | 246 | 'limit' => array( |
| 247 | 247 | 'type' => 'number', |
@@ -259,10 +259,10 @@ discard block |
||
| 259 | 259 | ), |
| 260 | 260 | 'uniqid' => array( |
| 261 | 261 | 'type' => 'string', |
| 262 | - 'default' => uniqid( 'wl-navigator-widget-' ), |
|
| 262 | + 'default' => uniqid('wl-navigator-widget-'), |
|
| 263 | 263 | ), |
| 264 | 264 | ), |
| 265 | - ) ); |
|
| 265 | + )); |
|
| 266 | 266 | } ); |
| 267 | 267 | |
| 268 | 268 | /** |
@@ -270,24 +270,24 @@ discard block |
||
| 270 | 270 | * |
| 271 | 271 | * @since 2.2.0 |
| 272 | 272 | */ |
| 273 | -add_action( 'plugins_loaded', function () { |
|
| 273 | +add_action('plugins_loaded', function() { |
|
| 274 | 274 | |
| 275 | - if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $_REQUEST['action'] ) { |
|
| 275 | + if ( ! defined('DOING_AJAX') || ! DOING_AJAX || 'wl_navigator' !== $_REQUEST['action']) { |
|
| 276 | 276 | return; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - remove_action( 'plugins_loaded', 'rocket_init' ); |
|
| 280 | - remove_action( 'plugins_loaded', 'wpseo_premium_init', 14 ); |
|
| 281 | - remove_action( 'plugins_loaded', 'wpseo_init', 14 ); |
|
| 282 | -}, 0 ); |
|
| 279 | + remove_action('plugins_loaded', 'rocket_init'); |
|
| 280 | + remove_action('plugins_loaded', 'wpseo_premium_init', 14); |
|
| 281 | + remove_action('plugins_loaded', 'wpseo_init', 14); |
|
| 282 | +}, 0); |
|
| 283 | 283 | |
| 284 | -add_action( 'init', function () { |
|
| 284 | +add_action('init', function() { |
|
| 285 | 285 | |
| 286 | - if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $_REQUEST['action'] ) { |
|
| 286 | + if ( ! defined('DOING_AJAX') || ! DOING_AJAX || 'wl_navigator' !== $_REQUEST['action']) { |
|
| 287 | 287 | return; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - remove_action( 'init', 'wp_widgets_init', 1 ); |
|
| 291 | - remove_action( 'init', 'gglcptch_init' ); |
|
| 292 | -}, 0 ); |
|
| 290 | + remove_action('init', 'wp_widgets_init', 1); |
|
| 291 | + remove_action('init', 'gglcptch_init'); |
|
| 292 | +}, 0); |
|
| 293 | 293 | |
@@ -28,1494 +28,1494 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | class Wordlift { |
| 30 | 30 | |
| 31 | - //<editor-fold desc="## FIELDS"> |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 35 | - * the plugin. |
|
| 36 | - * |
|
| 37 | - * @since 1.0.0 |
|
| 38 | - * @access protected |
|
| 39 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 40 | - */ |
|
| 41 | - protected $loader; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * The unique identifier of this plugin. |
|
| 45 | - * |
|
| 46 | - * @since 1.0.0 |
|
| 47 | - * @access protected |
|
| 48 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 49 | - */ |
|
| 50 | - protected $plugin_name; |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * The current version of the plugin. |
|
| 54 | - * |
|
| 55 | - * @since 1.0.0 |
|
| 56 | - * @access protected |
|
| 57 | - * @var string $version The current version of the plugin. |
|
| 58 | - */ |
|
| 59 | - protected $version; |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 63 | - * |
|
| 64 | - * @since 3.12.0 |
|
| 65 | - * @access protected |
|
| 66 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 67 | - */ |
|
| 68 | - protected $tinymce_adapter; |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * The Thumbnail service. |
|
| 72 | - * |
|
| 73 | - * @since 3.1.5 |
|
| 74 | - * @access private |
|
| 75 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 76 | - */ |
|
| 77 | - private $thumbnail_service; |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * The UI service. |
|
| 81 | - * |
|
| 82 | - * @since 3.2.0 |
|
| 83 | - * @access private |
|
| 84 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 85 | - */ |
|
| 86 | - private $ui_service; |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * The Schema service. |
|
| 90 | - * |
|
| 91 | - * @since 3.3.0 |
|
| 92 | - * @access protected |
|
| 93 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 94 | - */ |
|
| 95 | - protected $schema_service; |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * The Entity service. |
|
| 99 | - * |
|
| 100 | - * @since 3.1.0 |
|
| 101 | - * @access protected |
|
| 102 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 103 | - */ |
|
| 104 | - protected $entity_service; |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * The Topic Taxonomy service. |
|
| 108 | - * |
|
| 109 | - * @since 3.5.0 |
|
| 110 | - * @access private |
|
| 111 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 112 | - */ |
|
| 113 | - private $topic_taxonomy_service; |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * The Entity Types Taxonomy service. |
|
| 117 | - * |
|
| 118 | - * @since 3.18.0 |
|
| 119 | - * @access private |
|
| 120 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 121 | - */ |
|
| 122 | - private $entity_types_taxonomy_service; |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * The User service. |
|
| 126 | - * |
|
| 127 | - * @since 3.1.7 |
|
| 128 | - * @access protected |
|
| 129 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 130 | - */ |
|
| 131 | - protected $user_service; |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * The Timeline service. |
|
| 135 | - * |
|
| 136 | - * @since 3.1.0 |
|
| 137 | - * @access private |
|
| 138 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 139 | - */ |
|
| 140 | - private $timeline_service; |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * The Redirect service. |
|
| 144 | - * |
|
| 145 | - * @since 3.2.0 |
|
| 146 | - * @access private |
|
| 147 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 148 | - */ |
|
| 149 | - private $redirect_service; |
|
| 150 | - |
|
| 151 | - /** |
|
| 152 | - * The Notice service. |
|
| 153 | - * |
|
| 154 | - * @since 3.3.0 |
|
| 155 | - * @access private |
|
| 156 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 157 | - */ |
|
| 158 | - private $notice_service; |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * The Entity list customization. |
|
| 162 | - * |
|
| 163 | - * @since 3.3.0 |
|
| 164 | - * @access protected |
|
| 165 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 166 | - */ |
|
| 167 | - protected $entity_list_service; |
|
| 168 | - |
|
| 169 | - /** |
|
| 170 | - * The Entity Types Taxonomy Walker. |
|
| 171 | - * |
|
| 172 | - * @since 3.1.0 |
|
| 173 | - * @access private |
|
| 174 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 175 | - */ |
|
| 176 | - private $entity_types_taxonomy_walker; |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * The ShareThis service. |
|
| 180 | - * |
|
| 181 | - * @since 3.2.0 |
|
| 182 | - * @access private |
|
| 183 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 184 | - */ |
|
| 185 | - private $sharethis_service; |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * The PrimaShop adapter. |
|
| 189 | - * |
|
| 190 | - * @since 3.2.3 |
|
| 191 | - * @access private |
|
| 192 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 193 | - */ |
|
| 194 | - private $primashop_adapter; |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * The WordLift Dashboard adapter. |
|
| 198 | - * |
|
| 199 | - * @since 3.4.0 |
|
| 200 | - * @access private |
|
| 201 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 202 | - */ |
|
| 203 | - private $dashboard_service; |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * The entity type service. |
|
| 207 | - * |
|
| 208 | - * @since 3.6.0 |
|
| 209 | - * @access private |
|
| 210 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 211 | - */ |
|
| 212 | - private $entity_post_type_service; |
|
| 213 | - |
|
| 214 | - /** |
|
| 215 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 216 | - * |
|
| 217 | - * @since 3.6.0 |
|
| 218 | - * @access private |
|
| 219 | - * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 220 | - */ |
|
| 221 | - private $entity_link_service; |
|
| 222 | - |
|
| 223 | - /** |
|
| 224 | - * A {@link Wordlift_Sparql_Service} instance. |
|
| 225 | - * |
|
| 226 | - * @since 3.6.0 |
|
| 227 | - * @access protected |
|
| 228 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 229 | - */ |
|
| 230 | - protected $sparql_service; |
|
| 231 | - |
|
| 232 | - /** |
|
| 233 | - * A {@link Wordlift_Import_Service} instance. |
|
| 234 | - * |
|
| 235 | - * @since 3.6.0 |
|
| 236 | - * @access private |
|
| 237 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 238 | - */ |
|
| 239 | - private $import_service; |
|
| 240 | - |
|
| 241 | - /** |
|
| 242 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
| 243 | - * |
|
| 244 | - * @since 3.6.0 |
|
| 245 | - * @access private |
|
| 246 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 247 | - */ |
|
| 248 | - private $rebuild_service; |
|
| 249 | - |
|
| 250 | - /** |
|
| 251 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 252 | - * |
|
| 253 | - * @since 3.7.0 |
|
| 254 | - * @access protected |
|
| 255 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 256 | - */ |
|
| 257 | - protected $jsonld_service; |
|
| 258 | - |
|
| 259 | - /** |
|
| 260 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 261 | - * |
|
| 262 | - * @since 3.14.0 |
|
| 263 | - * @access protected |
|
| 264 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 265 | - */ |
|
| 266 | - protected $jsonld_website_converter; |
|
| 267 | - |
|
| 268 | - /** |
|
| 269 | - * A {@link Wordlift_Property_Factory} instance. |
|
| 270 | - * |
|
| 271 | - * @since 3.7.0 |
|
| 272 | - * @access private |
|
| 273 | - * @var \Wordlift_Property_Factory $property_factory |
|
| 274 | - */ |
|
| 275 | - private $property_factory; |
|
| 276 | - |
|
| 277 | - /** |
|
| 278 | - * The 'Download Your Data' page. |
|
| 279 | - * |
|
| 280 | - * @since 3.6.0 |
|
| 281 | - * @access private |
|
| 282 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 283 | - */ |
|
| 284 | - private $download_your_data_page; |
|
| 285 | - |
|
| 286 | - /** |
|
| 287 | - * The 'WordLift Settings' page. |
|
| 288 | - * |
|
| 289 | - * @since 3.11.0 |
|
| 290 | - * @access protected |
|
| 291 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 292 | - */ |
|
| 293 | - protected $settings_page; |
|
| 294 | - |
|
| 295 | - /** |
|
| 296 | - * The 'WordLift Batch analysis' page. |
|
| 297 | - * |
|
| 298 | - * @since 3.14.0 |
|
| 299 | - * @access protected |
|
| 300 | - * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page. |
|
| 301 | - */ |
|
| 302 | - protected $batch_analysis_page; |
|
| 303 | - |
|
| 304 | - /** |
|
| 305 | - * The install wizard page. |
|
| 306 | - * |
|
| 307 | - * @since 3.9.0 |
|
| 308 | - * @access private |
|
| 309 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 310 | - */ |
|
| 311 | - private $admin_setup; |
|
| 312 | - |
|
| 313 | - /** |
|
| 314 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 315 | - * linking of entities to their pages. |
|
| 316 | - * |
|
| 317 | - * @since 3.8.0 |
|
| 318 | - * @access private |
|
| 319 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 320 | - */ |
|
| 321 | - private $content_filter_service; |
|
| 322 | - |
|
| 323 | - /** |
|
| 324 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 325 | - * |
|
| 326 | - * @since 3.9.0 |
|
| 327 | - * @access private |
|
| 328 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 329 | - */ |
|
| 330 | - private $key_validation_service; |
|
| 331 | - |
|
| 332 | - /** |
|
| 333 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 334 | - * |
|
| 335 | - * @since 3.10.0 |
|
| 336 | - * @access private |
|
| 337 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 338 | - */ |
|
| 339 | - private $rating_service; |
|
| 340 | - |
|
| 341 | - /** |
|
| 342 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 343 | - * |
|
| 344 | - * @since 3.10.0 |
|
| 345 | - * @access protected |
|
| 346 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 347 | - */ |
|
| 348 | - protected $post_to_jsonld_converter; |
|
| 349 | - |
|
| 350 | - /** |
|
| 351 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 352 | - * |
|
| 353 | - * @since 3.10.0 |
|
| 354 | - * @access protected |
|
| 355 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 356 | - */ |
|
| 357 | - protected $configuration_service; |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * A {@link Wordlift_Install_Service} instance. |
|
| 361 | - * |
|
| 362 | - * @since 3.18.0 |
|
| 363 | - * @access protected |
|
| 364 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 365 | - */ |
|
| 366 | - protected $install_service; |
|
| 367 | - |
|
| 368 | - /** |
|
| 369 | - * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 370 | - * |
|
| 371 | - * @since 3.10.0 |
|
| 372 | - * @access protected |
|
| 373 | - * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 374 | - */ |
|
| 375 | - protected $entity_type_service; |
|
| 376 | - |
|
| 377 | - /** |
|
| 378 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 379 | - * |
|
| 380 | - * @since 3.10.0 |
|
| 381 | - * @access protected |
|
| 382 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 383 | - */ |
|
| 384 | - protected $entity_post_to_jsonld_converter; |
|
| 385 | - |
|
| 386 | - /** |
|
| 387 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 388 | - * |
|
| 389 | - * @since 3.10.0 |
|
| 390 | - * @access protected |
|
| 391 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 392 | - */ |
|
| 393 | - protected $postid_to_jsonld_converter; |
|
| 394 | - |
|
| 395 | - /** |
|
| 396 | - * The {@link Wordlift_Admin_Status_Page} class. |
|
| 397 | - * |
|
| 398 | - * @since 3.9.8 |
|
| 399 | - * @access private |
|
| 400 | - * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 401 | - */ |
|
| 402 | - private $status_page; |
|
| 403 | - |
|
| 404 | - /** |
|
| 405 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 406 | - * |
|
| 407 | - * @since 3.11.0 |
|
| 408 | - * @access protected |
|
| 409 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 410 | - */ |
|
| 411 | - protected $category_taxonomy_service; |
|
| 412 | - |
|
| 413 | - /** |
|
| 414 | - * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 415 | - * |
|
| 416 | - * @since 3.11.0 |
|
| 417 | - * @access protected |
|
| 418 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 419 | - */ |
|
| 420 | - protected $entity_page_service; |
|
| 421 | - |
|
| 422 | - /** |
|
| 423 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 424 | - * |
|
| 425 | - * @since 3.11.0 |
|
| 426 | - * @access protected |
|
| 427 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 428 | - */ |
|
| 429 | - protected $settings_page_action_link; |
|
| 430 | - |
|
| 431 | - /** |
|
| 432 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 433 | - * |
|
| 434 | - * @since 3.11.0 |
|
| 435 | - * @access protected |
|
| 436 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 437 | - */ |
|
| 438 | - protected $analytics_settings_page_action_link; |
|
| 439 | - |
|
| 440 | - /** |
|
| 441 | - * The {@link Wordlift_Analytics_Connect} class. |
|
| 442 | - * |
|
| 443 | - * @since 3.11.0 |
|
| 444 | - * @access protected |
|
| 445 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 446 | - */ |
|
| 447 | - protected $analytics_connect; |
|
| 448 | - |
|
| 449 | - /** |
|
| 450 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 451 | - * |
|
| 452 | - * @since 3.11.0 |
|
| 453 | - * @access protected |
|
| 454 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 455 | - */ |
|
| 456 | - protected $publisher_ajax_adapter; |
|
| 457 | - |
|
| 458 | - /** |
|
| 459 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 460 | - * |
|
| 461 | - * @since 3.11.0 |
|
| 462 | - * @access protected |
|
| 463 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 464 | - */ |
|
| 465 | - protected $input_element; |
|
| 466 | - |
|
| 467 | - /** |
|
| 468 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 469 | - * |
|
| 470 | - * @since 3.13.0 |
|
| 471 | - * @access protected |
|
| 472 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 473 | - */ |
|
| 474 | - protected $radio_input_element; |
|
| 475 | - |
|
| 476 | - /** |
|
| 477 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 478 | - * |
|
| 479 | - * @since 3.11.0 |
|
| 480 | - * @access protected |
|
| 481 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 482 | - */ |
|
| 483 | - protected $language_select_element; |
|
| 484 | - |
|
| 485 | - /** |
|
| 486 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 487 | - * |
|
| 488 | - * @since 3.18.0 |
|
| 489 | - * @access protected |
|
| 490 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 491 | - */ |
|
| 492 | - protected $country_select_element; |
|
| 493 | - |
|
| 494 | - /** |
|
| 495 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 496 | - * |
|
| 497 | - * @since 3.11.0 |
|
| 498 | - * @access protected |
|
| 499 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 500 | - */ |
|
| 501 | - protected $publisher_element; |
|
| 502 | - |
|
| 503 | - /** |
|
| 504 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 505 | - * |
|
| 506 | - * @since 3.11.0 |
|
| 507 | - * @access protected |
|
| 508 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 509 | - */ |
|
| 510 | - protected $select2_element; |
|
| 511 | - |
|
| 512 | - /** |
|
| 513 | - * The controller for the entity type list admin page |
|
| 514 | - * |
|
| 515 | - * @since 3.11.0 |
|
| 516 | - * @access private |
|
| 517 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 518 | - */ |
|
| 519 | - private $entity_type_admin_page; |
|
| 520 | - |
|
| 521 | - /** |
|
| 522 | - * The controller for the entity type settings admin page |
|
| 523 | - * |
|
| 524 | - * @since 3.11.0 |
|
| 525 | - * @access private |
|
| 526 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 527 | - */ |
|
| 528 | - private $entity_type_settings_admin_page; |
|
| 529 | - |
|
| 530 | - /** |
|
| 531 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 532 | - * |
|
| 533 | - * @since 3.11.0 |
|
| 534 | - * @access protected |
|
| 535 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 536 | - */ |
|
| 537 | - protected $related_entities_cloud_widget; |
|
| 538 | - |
|
| 539 | - /** |
|
| 540 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 541 | - * |
|
| 542 | - * @since 3.14.0 |
|
| 543 | - * @access protected |
|
| 544 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 545 | - */ |
|
| 546 | - protected $author_element; |
|
| 547 | - |
|
| 548 | - /** |
|
| 549 | - * The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 550 | - * |
|
| 551 | - * @since 3.14.0 |
|
| 552 | - * @access protected |
|
| 553 | - * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 554 | - */ |
|
| 555 | - protected $batch_analysis_service; |
|
| 556 | - |
|
| 557 | - /** |
|
| 558 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 559 | - * |
|
| 560 | - * @since 3.12.0 |
|
| 561 | - * @access protected |
|
| 562 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 563 | - */ |
|
| 564 | - protected $sample_data_service; |
|
| 565 | - |
|
| 566 | - /** |
|
| 567 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 568 | - * |
|
| 569 | - * @since 3.12.0 |
|
| 570 | - * @access protected |
|
| 571 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 572 | - */ |
|
| 573 | - protected $sample_data_ajax_adapter; |
|
| 574 | - |
|
| 575 | - /** |
|
| 576 | - * The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 577 | - * |
|
| 578 | - * @since 3.14.2 |
|
| 579 | - * @access protected |
|
| 580 | - * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 581 | - */ |
|
| 582 | - private $batch_analysis_adapter; |
|
| 583 | - |
|
| 584 | - /** |
|
| 585 | - * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 586 | - * |
|
| 587 | - * @since 3.14.3 |
|
| 588 | - * @access private |
|
| 589 | - * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 590 | - */ |
|
| 591 | - private $relation_rebuild_service; |
|
| 592 | - |
|
| 593 | - /** |
|
| 594 | - * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 595 | - * |
|
| 596 | - * @since 3.14.3 |
|
| 597 | - * @access private |
|
| 598 | - * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 599 | - */ |
|
| 600 | - private $relation_rebuild_adapter; |
|
| 601 | - |
|
| 602 | - /** |
|
| 603 | - * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 604 | - * |
|
| 605 | - * @since 3.18.0 |
|
| 606 | - * @access private |
|
| 607 | - * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 608 | - */ |
|
| 609 | - private $reference_rebuild_service; |
|
| 610 | - |
|
| 611 | - /** |
|
| 612 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 613 | - * |
|
| 614 | - * @since 3.16.0 |
|
| 615 | - * @access protected |
|
| 616 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 617 | - */ |
|
| 618 | - protected $google_analytics_export_service; |
|
| 619 | - |
|
| 620 | - /** |
|
| 621 | - * {@link Wordlift}'s singleton instance. |
|
| 622 | - * |
|
| 623 | - * @since 3.15.0 |
|
| 624 | - * @access protected |
|
| 625 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 626 | - */ |
|
| 627 | - protected $entity_type_adapter; |
|
| 628 | - |
|
| 629 | - /** |
|
| 630 | - * The {@link Wordlift_Linked_Data_Service} instance. |
|
| 631 | - * |
|
| 632 | - * @since 3.15.0 |
|
| 633 | - * @access protected |
|
| 634 | - * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance. |
|
| 635 | - */ |
|
| 636 | - protected $linked_data_service; |
|
| 637 | - |
|
| 638 | - /** |
|
| 639 | - * The {@link Wordlift_Storage_Factory} instance. |
|
| 640 | - * |
|
| 641 | - * @since 3.15.0 |
|
| 642 | - * @access protected |
|
| 643 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 644 | - */ |
|
| 645 | - protected $storage_factory; |
|
| 646 | - |
|
| 647 | - /** |
|
| 648 | - * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 649 | - * |
|
| 650 | - * @since 3.15.0 |
|
| 651 | - * @access protected |
|
| 652 | - * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 653 | - */ |
|
| 654 | - protected $rendition_factory; |
|
| 655 | - |
|
| 656 | - /** |
|
| 657 | - * The {@link Wordlift_Autocomplete_Service} instance. |
|
| 658 | - * |
|
| 659 | - * @since 3.15.0 |
|
| 660 | - * @access private |
|
| 661 | - * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance. |
|
| 662 | - */ |
|
| 663 | - private $autocomplete_service; |
|
| 664 | - |
|
| 665 | - /** |
|
| 666 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 667 | - * |
|
| 668 | - * @since 3.15.0 |
|
| 669 | - * @access private |
|
| 670 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 671 | - */ |
|
| 672 | - private $autocomplete_adapter; |
|
| 673 | - |
|
| 674 | - /** |
|
| 675 | - * The {@link Wordlift_Relation_Service} instance. |
|
| 676 | - * |
|
| 677 | - * @since 3.15.0 |
|
| 678 | - * @access protected |
|
| 679 | - * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 680 | - */ |
|
| 681 | - protected $relation_service; |
|
| 682 | - |
|
| 683 | - /** |
|
| 684 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 685 | - * |
|
| 686 | - * @since 3.16.0 |
|
| 687 | - * @access protected |
|
| 688 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 689 | - * |
|
| 690 | - */ |
|
| 691 | - protected $cached_postid_to_jsonld_converter; |
|
| 692 | - |
|
| 693 | - /** |
|
| 694 | - * The {@link Wordlift_File_Cache_Service} instance. |
|
| 695 | - * |
|
| 696 | - * @since 3.16.0 |
|
| 697 | - * @access protected |
|
| 698 | - * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance. |
|
| 699 | - */ |
|
| 700 | - protected $file_cache_service; |
|
| 701 | - |
|
| 702 | - /** |
|
| 703 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 704 | - * |
|
| 705 | - * @since 3.16.3 |
|
| 706 | - * @access protected |
|
| 707 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 708 | - */ |
|
| 709 | - protected $entity_uri_service; |
|
| 710 | - |
|
| 711 | - /** |
|
| 712 | - * The {@link Wordlift_Publisher_Service} instance. |
|
| 713 | - * |
|
| 714 | - * @since 3.19.0 |
|
| 715 | - * @access protected |
|
| 716 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 717 | - */ |
|
| 718 | - protected $publisher_service; |
|
| 719 | - |
|
| 720 | - /** |
|
| 721 | - * {@link Wordlift}'s singleton instance. |
|
| 722 | - * |
|
| 723 | - * @since 3.11.2 |
|
| 724 | - * @access private |
|
| 725 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 726 | - */ |
|
| 727 | - private static $instance; |
|
| 728 | - |
|
| 729 | - //</editor-fold> |
|
| 730 | - |
|
| 731 | - /** |
|
| 732 | - * Define the core functionality of the plugin. |
|
| 733 | - * |
|
| 734 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 735 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 736 | - * the public-facing side of the site. |
|
| 737 | - * |
|
| 738 | - * @since 1.0.0 |
|
| 739 | - */ |
|
| 740 | - public function __construct() { |
|
| 741 | - |
|
| 742 | - self::$instance = $this; |
|
| 743 | - |
|
| 744 | - $this->plugin_name = 'wordlift'; |
|
| 745 | - $this->version = '3.22.5'; |
|
| 746 | - $this->load_dependencies(); |
|
| 747 | - $this->set_locale(); |
|
| 748 | - $this->define_admin_hooks(); |
|
| 749 | - $this->define_public_hooks(); |
|
| 750 | - |
|
| 751 | - // If we're in `WP_CLI` load the related files. |
|
| 752 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 753 | - $this->load_cli_dependencies(); |
|
| 754 | - } |
|
| 755 | - |
|
| 756 | - } |
|
| 757 | - |
|
| 758 | - /** |
|
| 759 | - * Get the singleton instance. |
|
| 760 | - * |
|
| 761 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 762 | - * @since 3.11.2 |
|
| 763 | - * |
|
| 764 | - */ |
|
| 765 | - public static function get_instance() { |
|
| 766 | - |
|
| 767 | - return self::$instance; |
|
| 768 | - } |
|
| 769 | - |
|
| 770 | - /** |
|
| 771 | - * Load the required dependencies for this plugin. |
|
| 772 | - * |
|
| 773 | - * Include the following files that make up the plugin: |
|
| 774 | - * |
|
| 775 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 776 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 777 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 778 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 779 | - * |
|
| 780 | - * Create an instance of the loader which will be used to register the hooks |
|
| 781 | - * with WordPress. |
|
| 782 | - * |
|
| 783 | - * @since 1.0.0 |
|
| 784 | - * @access private |
|
| 785 | - */ |
|
| 786 | - private function load_dependencies() { |
|
| 787 | - |
|
| 788 | - /** |
|
| 789 | - * The class responsible for orchestrating the actions and filters of the |
|
| 790 | - * core plugin. |
|
| 791 | - */ |
|
| 792 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 793 | - |
|
| 794 | - // The class responsible for plugin uninstall. |
|
| 795 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 796 | - |
|
| 797 | - /** |
|
| 798 | - * The class responsible for defining internationalization functionality |
|
| 799 | - * of the plugin. |
|
| 800 | - */ |
|
| 801 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 802 | - |
|
| 803 | - /** |
|
| 804 | - * WordLift's supported languages. |
|
| 805 | - */ |
|
| 806 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 807 | - |
|
| 808 | - /** |
|
| 809 | - * WordLift's supported countries. |
|
| 810 | - */ |
|
| 811 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 812 | - |
|
| 813 | - /** |
|
| 814 | - * Provide support functions to sanitize data. |
|
| 815 | - */ |
|
| 816 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 817 | - |
|
| 818 | - /** Services. */ |
|
| 819 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 820 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 821 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 823 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 824 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 825 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 826 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 829 | - |
|
| 830 | - /** |
|
| 831 | - * The Query builder. |
|
| 832 | - */ |
|
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 834 | - |
|
| 835 | - /** |
|
| 836 | - * The Schema service. |
|
| 837 | - */ |
|
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 839 | - |
|
| 840 | - /** |
|
| 841 | - * The schema:url property service. |
|
| 842 | - */ |
|
| 843 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 844 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 845 | - |
|
| 846 | - /** |
|
| 847 | - * The UI service. |
|
| 848 | - */ |
|
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 850 | - |
|
| 851 | - /** |
|
| 852 | - * The Thumbnail service. |
|
| 853 | - */ |
|
| 854 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 855 | - |
|
| 856 | - /** |
|
| 857 | - * The Entity Types Taxonomy service. |
|
| 858 | - */ |
|
| 859 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 860 | - |
|
| 861 | - /** |
|
| 862 | - * The Entity service. |
|
| 863 | - */ |
|
| 864 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 866 | - |
|
| 867 | - // Add the entity rating service. |
|
| 868 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 869 | - |
|
| 870 | - /** |
|
| 871 | - * The User service. |
|
| 872 | - */ |
|
| 873 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 874 | - |
|
| 875 | - /** |
|
| 876 | - * The Timeline service. |
|
| 877 | - */ |
|
| 878 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 879 | - |
|
| 880 | - /** |
|
| 881 | - * The Topic Taxonomy service. |
|
| 882 | - */ |
|
| 883 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 884 | - |
|
| 885 | - /** |
|
| 886 | - * The SPARQL service. |
|
| 887 | - */ |
|
| 888 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 889 | - |
|
| 890 | - /** |
|
| 891 | - * The WordLift import service. |
|
| 892 | - */ |
|
| 893 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 894 | - |
|
| 895 | - /** |
|
| 896 | - * The WordLift URI service. |
|
| 897 | - */ |
|
| 898 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 901 | - |
|
| 902 | - /** |
|
| 903 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 904 | - */ |
|
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 906 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 907 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 908 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 909 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 910 | - |
|
| 911 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 912 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 913 | - |
|
| 914 | - /** |
|
| 915 | - * Load the converters. |
|
| 916 | - */ |
|
| 917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 918 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 919 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 921 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 922 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 923 | - |
|
| 924 | - /** |
|
| 925 | - * Load cache-related files. |
|
| 926 | - */ |
|
| 927 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 928 | - |
|
| 929 | - /** |
|
| 930 | - * Load the content filter. |
|
| 931 | - */ |
|
| 932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 933 | - |
|
| 934 | - /* |
|
| 31 | + //<editor-fold desc="## FIELDS"> |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 35 | + * the plugin. |
|
| 36 | + * |
|
| 37 | + * @since 1.0.0 |
|
| 38 | + * @access protected |
|
| 39 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 40 | + */ |
|
| 41 | + protected $loader; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * The unique identifier of this plugin. |
|
| 45 | + * |
|
| 46 | + * @since 1.0.0 |
|
| 47 | + * @access protected |
|
| 48 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 49 | + */ |
|
| 50 | + protected $plugin_name; |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * The current version of the plugin. |
|
| 54 | + * |
|
| 55 | + * @since 1.0.0 |
|
| 56 | + * @access protected |
|
| 57 | + * @var string $version The current version of the plugin. |
|
| 58 | + */ |
|
| 59 | + protected $version; |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 63 | + * |
|
| 64 | + * @since 3.12.0 |
|
| 65 | + * @access protected |
|
| 66 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 67 | + */ |
|
| 68 | + protected $tinymce_adapter; |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * The Thumbnail service. |
|
| 72 | + * |
|
| 73 | + * @since 3.1.5 |
|
| 74 | + * @access private |
|
| 75 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 76 | + */ |
|
| 77 | + private $thumbnail_service; |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * The UI service. |
|
| 81 | + * |
|
| 82 | + * @since 3.2.0 |
|
| 83 | + * @access private |
|
| 84 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 85 | + */ |
|
| 86 | + private $ui_service; |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * The Schema service. |
|
| 90 | + * |
|
| 91 | + * @since 3.3.0 |
|
| 92 | + * @access protected |
|
| 93 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 94 | + */ |
|
| 95 | + protected $schema_service; |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * The Entity service. |
|
| 99 | + * |
|
| 100 | + * @since 3.1.0 |
|
| 101 | + * @access protected |
|
| 102 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 103 | + */ |
|
| 104 | + protected $entity_service; |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * The Topic Taxonomy service. |
|
| 108 | + * |
|
| 109 | + * @since 3.5.0 |
|
| 110 | + * @access private |
|
| 111 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 112 | + */ |
|
| 113 | + private $topic_taxonomy_service; |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * The Entity Types Taxonomy service. |
|
| 117 | + * |
|
| 118 | + * @since 3.18.0 |
|
| 119 | + * @access private |
|
| 120 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 121 | + */ |
|
| 122 | + private $entity_types_taxonomy_service; |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * The User service. |
|
| 126 | + * |
|
| 127 | + * @since 3.1.7 |
|
| 128 | + * @access protected |
|
| 129 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 130 | + */ |
|
| 131 | + protected $user_service; |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * The Timeline service. |
|
| 135 | + * |
|
| 136 | + * @since 3.1.0 |
|
| 137 | + * @access private |
|
| 138 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 139 | + */ |
|
| 140 | + private $timeline_service; |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * The Redirect service. |
|
| 144 | + * |
|
| 145 | + * @since 3.2.0 |
|
| 146 | + * @access private |
|
| 147 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 148 | + */ |
|
| 149 | + private $redirect_service; |
|
| 150 | + |
|
| 151 | + /** |
|
| 152 | + * The Notice service. |
|
| 153 | + * |
|
| 154 | + * @since 3.3.0 |
|
| 155 | + * @access private |
|
| 156 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 157 | + */ |
|
| 158 | + private $notice_service; |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * The Entity list customization. |
|
| 162 | + * |
|
| 163 | + * @since 3.3.0 |
|
| 164 | + * @access protected |
|
| 165 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 166 | + */ |
|
| 167 | + protected $entity_list_service; |
|
| 168 | + |
|
| 169 | + /** |
|
| 170 | + * The Entity Types Taxonomy Walker. |
|
| 171 | + * |
|
| 172 | + * @since 3.1.0 |
|
| 173 | + * @access private |
|
| 174 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 175 | + */ |
|
| 176 | + private $entity_types_taxonomy_walker; |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * The ShareThis service. |
|
| 180 | + * |
|
| 181 | + * @since 3.2.0 |
|
| 182 | + * @access private |
|
| 183 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 184 | + */ |
|
| 185 | + private $sharethis_service; |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * The PrimaShop adapter. |
|
| 189 | + * |
|
| 190 | + * @since 3.2.3 |
|
| 191 | + * @access private |
|
| 192 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 193 | + */ |
|
| 194 | + private $primashop_adapter; |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * The WordLift Dashboard adapter. |
|
| 198 | + * |
|
| 199 | + * @since 3.4.0 |
|
| 200 | + * @access private |
|
| 201 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 202 | + */ |
|
| 203 | + private $dashboard_service; |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * The entity type service. |
|
| 207 | + * |
|
| 208 | + * @since 3.6.0 |
|
| 209 | + * @access private |
|
| 210 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 211 | + */ |
|
| 212 | + private $entity_post_type_service; |
|
| 213 | + |
|
| 214 | + /** |
|
| 215 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 216 | + * |
|
| 217 | + * @since 3.6.0 |
|
| 218 | + * @access private |
|
| 219 | + * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 220 | + */ |
|
| 221 | + private $entity_link_service; |
|
| 222 | + |
|
| 223 | + /** |
|
| 224 | + * A {@link Wordlift_Sparql_Service} instance. |
|
| 225 | + * |
|
| 226 | + * @since 3.6.0 |
|
| 227 | + * @access protected |
|
| 228 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 229 | + */ |
|
| 230 | + protected $sparql_service; |
|
| 231 | + |
|
| 232 | + /** |
|
| 233 | + * A {@link Wordlift_Import_Service} instance. |
|
| 234 | + * |
|
| 235 | + * @since 3.6.0 |
|
| 236 | + * @access private |
|
| 237 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 238 | + */ |
|
| 239 | + private $import_service; |
|
| 240 | + |
|
| 241 | + /** |
|
| 242 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
| 243 | + * |
|
| 244 | + * @since 3.6.0 |
|
| 245 | + * @access private |
|
| 246 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 247 | + */ |
|
| 248 | + private $rebuild_service; |
|
| 249 | + |
|
| 250 | + /** |
|
| 251 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 252 | + * |
|
| 253 | + * @since 3.7.0 |
|
| 254 | + * @access protected |
|
| 255 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 256 | + */ |
|
| 257 | + protected $jsonld_service; |
|
| 258 | + |
|
| 259 | + /** |
|
| 260 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 261 | + * |
|
| 262 | + * @since 3.14.0 |
|
| 263 | + * @access protected |
|
| 264 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 265 | + */ |
|
| 266 | + protected $jsonld_website_converter; |
|
| 267 | + |
|
| 268 | + /** |
|
| 269 | + * A {@link Wordlift_Property_Factory} instance. |
|
| 270 | + * |
|
| 271 | + * @since 3.7.0 |
|
| 272 | + * @access private |
|
| 273 | + * @var \Wordlift_Property_Factory $property_factory |
|
| 274 | + */ |
|
| 275 | + private $property_factory; |
|
| 276 | + |
|
| 277 | + /** |
|
| 278 | + * The 'Download Your Data' page. |
|
| 279 | + * |
|
| 280 | + * @since 3.6.0 |
|
| 281 | + * @access private |
|
| 282 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 283 | + */ |
|
| 284 | + private $download_your_data_page; |
|
| 285 | + |
|
| 286 | + /** |
|
| 287 | + * The 'WordLift Settings' page. |
|
| 288 | + * |
|
| 289 | + * @since 3.11.0 |
|
| 290 | + * @access protected |
|
| 291 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 292 | + */ |
|
| 293 | + protected $settings_page; |
|
| 294 | + |
|
| 295 | + /** |
|
| 296 | + * The 'WordLift Batch analysis' page. |
|
| 297 | + * |
|
| 298 | + * @since 3.14.0 |
|
| 299 | + * @access protected |
|
| 300 | + * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page. |
|
| 301 | + */ |
|
| 302 | + protected $batch_analysis_page; |
|
| 303 | + |
|
| 304 | + /** |
|
| 305 | + * The install wizard page. |
|
| 306 | + * |
|
| 307 | + * @since 3.9.0 |
|
| 308 | + * @access private |
|
| 309 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 310 | + */ |
|
| 311 | + private $admin_setup; |
|
| 312 | + |
|
| 313 | + /** |
|
| 314 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 315 | + * linking of entities to their pages. |
|
| 316 | + * |
|
| 317 | + * @since 3.8.0 |
|
| 318 | + * @access private |
|
| 319 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 320 | + */ |
|
| 321 | + private $content_filter_service; |
|
| 322 | + |
|
| 323 | + /** |
|
| 324 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 325 | + * |
|
| 326 | + * @since 3.9.0 |
|
| 327 | + * @access private |
|
| 328 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 329 | + */ |
|
| 330 | + private $key_validation_service; |
|
| 331 | + |
|
| 332 | + /** |
|
| 333 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 334 | + * |
|
| 335 | + * @since 3.10.0 |
|
| 336 | + * @access private |
|
| 337 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 338 | + */ |
|
| 339 | + private $rating_service; |
|
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 343 | + * |
|
| 344 | + * @since 3.10.0 |
|
| 345 | + * @access protected |
|
| 346 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 347 | + */ |
|
| 348 | + protected $post_to_jsonld_converter; |
|
| 349 | + |
|
| 350 | + /** |
|
| 351 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 352 | + * |
|
| 353 | + * @since 3.10.0 |
|
| 354 | + * @access protected |
|
| 355 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 356 | + */ |
|
| 357 | + protected $configuration_service; |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * A {@link Wordlift_Install_Service} instance. |
|
| 361 | + * |
|
| 362 | + * @since 3.18.0 |
|
| 363 | + * @access protected |
|
| 364 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 365 | + */ |
|
| 366 | + protected $install_service; |
|
| 367 | + |
|
| 368 | + /** |
|
| 369 | + * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 370 | + * |
|
| 371 | + * @since 3.10.0 |
|
| 372 | + * @access protected |
|
| 373 | + * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 374 | + */ |
|
| 375 | + protected $entity_type_service; |
|
| 376 | + |
|
| 377 | + /** |
|
| 378 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 379 | + * |
|
| 380 | + * @since 3.10.0 |
|
| 381 | + * @access protected |
|
| 382 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 383 | + */ |
|
| 384 | + protected $entity_post_to_jsonld_converter; |
|
| 385 | + |
|
| 386 | + /** |
|
| 387 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 388 | + * |
|
| 389 | + * @since 3.10.0 |
|
| 390 | + * @access protected |
|
| 391 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 392 | + */ |
|
| 393 | + protected $postid_to_jsonld_converter; |
|
| 394 | + |
|
| 395 | + /** |
|
| 396 | + * The {@link Wordlift_Admin_Status_Page} class. |
|
| 397 | + * |
|
| 398 | + * @since 3.9.8 |
|
| 399 | + * @access private |
|
| 400 | + * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 401 | + */ |
|
| 402 | + private $status_page; |
|
| 403 | + |
|
| 404 | + /** |
|
| 405 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 406 | + * |
|
| 407 | + * @since 3.11.0 |
|
| 408 | + * @access protected |
|
| 409 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 410 | + */ |
|
| 411 | + protected $category_taxonomy_service; |
|
| 412 | + |
|
| 413 | + /** |
|
| 414 | + * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 415 | + * |
|
| 416 | + * @since 3.11.0 |
|
| 417 | + * @access protected |
|
| 418 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 419 | + */ |
|
| 420 | + protected $entity_page_service; |
|
| 421 | + |
|
| 422 | + /** |
|
| 423 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 424 | + * |
|
| 425 | + * @since 3.11.0 |
|
| 426 | + * @access protected |
|
| 427 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 428 | + */ |
|
| 429 | + protected $settings_page_action_link; |
|
| 430 | + |
|
| 431 | + /** |
|
| 432 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 433 | + * |
|
| 434 | + * @since 3.11.0 |
|
| 435 | + * @access protected |
|
| 436 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 437 | + */ |
|
| 438 | + protected $analytics_settings_page_action_link; |
|
| 439 | + |
|
| 440 | + /** |
|
| 441 | + * The {@link Wordlift_Analytics_Connect} class. |
|
| 442 | + * |
|
| 443 | + * @since 3.11.0 |
|
| 444 | + * @access protected |
|
| 445 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 446 | + */ |
|
| 447 | + protected $analytics_connect; |
|
| 448 | + |
|
| 449 | + /** |
|
| 450 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 451 | + * |
|
| 452 | + * @since 3.11.0 |
|
| 453 | + * @access protected |
|
| 454 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 455 | + */ |
|
| 456 | + protected $publisher_ajax_adapter; |
|
| 457 | + |
|
| 458 | + /** |
|
| 459 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 460 | + * |
|
| 461 | + * @since 3.11.0 |
|
| 462 | + * @access protected |
|
| 463 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 464 | + */ |
|
| 465 | + protected $input_element; |
|
| 466 | + |
|
| 467 | + /** |
|
| 468 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 469 | + * |
|
| 470 | + * @since 3.13.0 |
|
| 471 | + * @access protected |
|
| 472 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 473 | + */ |
|
| 474 | + protected $radio_input_element; |
|
| 475 | + |
|
| 476 | + /** |
|
| 477 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 478 | + * |
|
| 479 | + * @since 3.11.0 |
|
| 480 | + * @access protected |
|
| 481 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 482 | + */ |
|
| 483 | + protected $language_select_element; |
|
| 484 | + |
|
| 485 | + /** |
|
| 486 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 487 | + * |
|
| 488 | + * @since 3.18.0 |
|
| 489 | + * @access protected |
|
| 490 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 491 | + */ |
|
| 492 | + protected $country_select_element; |
|
| 493 | + |
|
| 494 | + /** |
|
| 495 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 496 | + * |
|
| 497 | + * @since 3.11.0 |
|
| 498 | + * @access protected |
|
| 499 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 500 | + */ |
|
| 501 | + protected $publisher_element; |
|
| 502 | + |
|
| 503 | + /** |
|
| 504 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 505 | + * |
|
| 506 | + * @since 3.11.0 |
|
| 507 | + * @access protected |
|
| 508 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 509 | + */ |
|
| 510 | + protected $select2_element; |
|
| 511 | + |
|
| 512 | + /** |
|
| 513 | + * The controller for the entity type list admin page |
|
| 514 | + * |
|
| 515 | + * @since 3.11.0 |
|
| 516 | + * @access private |
|
| 517 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 518 | + */ |
|
| 519 | + private $entity_type_admin_page; |
|
| 520 | + |
|
| 521 | + /** |
|
| 522 | + * The controller for the entity type settings admin page |
|
| 523 | + * |
|
| 524 | + * @since 3.11.0 |
|
| 525 | + * @access private |
|
| 526 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 527 | + */ |
|
| 528 | + private $entity_type_settings_admin_page; |
|
| 529 | + |
|
| 530 | + /** |
|
| 531 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 532 | + * |
|
| 533 | + * @since 3.11.0 |
|
| 534 | + * @access protected |
|
| 535 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 536 | + */ |
|
| 537 | + protected $related_entities_cloud_widget; |
|
| 538 | + |
|
| 539 | + /** |
|
| 540 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 541 | + * |
|
| 542 | + * @since 3.14.0 |
|
| 543 | + * @access protected |
|
| 544 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 545 | + */ |
|
| 546 | + protected $author_element; |
|
| 547 | + |
|
| 548 | + /** |
|
| 549 | + * The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 550 | + * |
|
| 551 | + * @since 3.14.0 |
|
| 552 | + * @access protected |
|
| 553 | + * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 554 | + */ |
|
| 555 | + protected $batch_analysis_service; |
|
| 556 | + |
|
| 557 | + /** |
|
| 558 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 559 | + * |
|
| 560 | + * @since 3.12.0 |
|
| 561 | + * @access protected |
|
| 562 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 563 | + */ |
|
| 564 | + protected $sample_data_service; |
|
| 565 | + |
|
| 566 | + /** |
|
| 567 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 568 | + * |
|
| 569 | + * @since 3.12.0 |
|
| 570 | + * @access protected |
|
| 571 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 572 | + */ |
|
| 573 | + protected $sample_data_ajax_adapter; |
|
| 574 | + |
|
| 575 | + /** |
|
| 576 | + * The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 577 | + * |
|
| 578 | + * @since 3.14.2 |
|
| 579 | + * @access protected |
|
| 580 | + * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 581 | + */ |
|
| 582 | + private $batch_analysis_adapter; |
|
| 583 | + |
|
| 584 | + /** |
|
| 585 | + * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 586 | + * |
|
| 587 | + * @since 3.14.3 |
|
| 588 | + * @access private |
|
| 589 | + * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 590 | + */ |
|
| 591 | + private $relation_rebuild_service; |
|
| 592 | + |
|
| 593 | + /** |
|
| 594 | + * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 595 | + * |
|
| 596 | + * @since 3.14.3 |
|
| 597 | + * @access private |
|
| 598 | + * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 599 | + */ |
|
| 600 | + private $relation_rebuild_adapter; |
|
| 601 | + |
|
| 602 | + /** |
|
| 603 | + * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 604 | + * |
|
| 605 | + * @since 3.18.0 |
|
| 606 | + * @access private |
|
| 607 | + * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 608 | + */ |
|
| 609 | + private $reference_rebuild_service; |
|
| 610 | + |
|
| 611 | + /** |
|
| 612 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 613 | + * |
|
| 614 | + * @since 3.16.0 |
|
| 615 | + * @access protected |
|
| 616 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 617 | + */ |
|
| 618 | + protected $google_analytics_export_service; |
|
| 619 | + |
|
| 620 | + /** |
|
| 621 | + * {@link Wordlift}'s singleton instance. |
|
| 622 | + * |
|
| 623 | + * @since 3.15.0 |
|
| 624 | + * @access protected |
|
| 625 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 626 | + */ |
|
| 627 | + protected $entity_type_adapter; |
|
| 628 | + |
|
| 629 | + /** |
|
| 630 | + * The {@link Wordlift_Linked_Data_Service} instance. |
|
| 631 | + * |
|
| 632 | + * @since 3.15.0 |
|
| 633 | + * @access protected |
|
| 634 | + * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance. |
|
| 635 | + */ |
|
| 636 | + protected $linked_data_service; |
|
| 637 | + |
|
| 638 | + /** |
|
| 639 | + * The {@link Wordlift_Storage_Factory} instance. |
|
| 640 | + * |
|
| 641 | + * @since 3.15.0 |
|
| 642 | + * @access protected |
|
| 643 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 644 | + */ |
|
| 645 | + protected $storage_factory; |
|
| 646 | + |
|
| 647 | + /** |
|
| 648 | + * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 649 | + * |
|
| 650 | + * @since 3.15.0 |
|
| 651 | + * @access protected |
|
| 652 | + * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 653 | + */ |
|
| 654 | + protected $rendition_factory; |
|
| 655 | + |
|
| 656 | + /** |
|
| 657 | + * The {@link Wordlift_Autocomplete_Service} instance. |
|
| 658 | + * |
|
| 659 | + * @since 3.15.0 |
|
| 660 | + * @access private |
|
| 661 | + * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance. |
|
| 662 | + */ |
|
| 663 | + private $autocomplete_service; |
|
| 664 | + |
|
| 665 | + /** |
|
| 666 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 667 | + * |
|
| 668 | + * @since 3.15.0 |
|
| 669 | + * @access private |
|
| 670 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 671 | + */ |
|
| 672 | + private $autocomplete_adapter; |
|
| 673 | + |
|
| 674 | + /** |
|
| 675 | + * The {@link Wordlift_Relation_Service} instance. |
|
| 676 | + * |
|
| 677 | + * @since 3.15.0 |
|
| 678 | + * @access protected |
|
| 679 | + * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 680 | + */ |
|
| 681 | + protected $relation_service; |
|
| 682 | + |
|
| 683 | + /** |
|
| 684 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 685 | + * |
|
| 686 | + * @since 3.16.0 |
|
| 687 | + * @access protected |
|
| 688 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 689 | + * |
|
| 690 | + */ |
|
| 691 | + protected $cached_postid_to_jsonld_converter; |
|
| 692 | + |
|
| 693 | + /** |
|
| 694 | + * The {@link Wordlift_File_Cache_Service} instance. |
|
| 695 | + * |
|
| 696 | + * @since 3.16.0 |
|
| 697 | + * @access protected |
|
| 698 | + * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance. |
|
| 699 | + */ |
|
| 700 | + protected $file_cache_service; |
|
| 701 | + |
|
| 702 | + /** |
|
| 703 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 704 | + * |
|
| 705 | + * @since 3.16.3 |
|
| 706 | + * @access protected |
|
| 707 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 708 | + */ |
|
| 709 | + protected $entity_uri_service; |
|
| 710 | + |
|
| 711 | + /** |
|
| 712 | + * The {@link Wordlift_Publisher_Service} instance. |
|
| 713 | + * |
|
| 714 | + * @since 3.19.0 |
|
| 715 | + * @access protected |
|
| 716 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 717 | + */ |
|
| 718 | + protected $publisher_service; |
|
| 719 | + |
|
| 720 | + /** |
|
| 721 | + * {@link Wordlift}'s singleton instance. |
|
| 722 | + * |
|
| 723 | + * @since 3.11.2 |
|
| 724 | + * @access private |
|
| 725 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 726 | + */ |
|
| 727 | + private static $instance; |
|
| 728 | + |
|
| 729 | + //</editor-fold> |
|
| 730 | + |
|
| 731 | + /** |
|
| 732 | + * Define the core functionality of the plugin. |
|
| 733 | + * |
|
| 734 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 735 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 736 | + * the public-facing side of the site. |
|
| 737 | + * |
|
| 738 | + * @since 1.0.0 |
|
| 739 | + */ |
|
| 740 | + public function __construct() { |
|
| 741 | + |
|
| 742 | + self::$instance = $this; |
|
| 743 | + |
|
| 744 | + $this->plugin_name = 'wordlift'; |
|
| 745 | + $this->version = '3.22.5'; |
|
| 746 | + $this->load_dependencies(); |
|
| 747 | + $this->set_locale(); |
|
| 748 | + $this->define_admin_hooks(); |
|
| 749 | + $this->define_public_hooks(); |
|
| 750 | + |
|
| 751 | + // If we're in `WP_CLI` load the related files. |
|
| 752 | + if ( class_exists( 'WP_CLI' ) ) { |
|
| 753 | + $this->load_cli_dependencies(); |
|
| 754 | + } |
|
| 755 | + |
|
| 756 | + } |
|
| 757 | + |
|
| 758 | + /** |
|
| 759 | + * Get the singleton instance. |
|
| 760 | + * |
|
| 761 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 762 | + * @since 3.11.2 |
|
| 763 | + * |
|
| 764 | + */ |
|
| 765 | + public static function get_instance() { |
|
| 766 | + |
|
| 767 | + return self::$instance; |
|
| 768 | + } |
|
| 769 | + |
|
| 770 | + /** |
|
| 771 | + * Load the required dependencies for this plugin. |
|
| 772 | + * |
|
| 773 | + * Include the following files that make up the plugin: |
|
| 774 | + * |
|
| 775 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 776 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 777 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 778 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 779 | + * |
|
| 780 | + * Create an instance of the loader which will be used to register the hooks |
|
| 781 | + * with WordPress. |
|
| 782 | + * |
|
| 783 | + * @since 1.0.0 |
|
| 784 | + * @access private |
|
| 785 | + */ |
|
| 786 | + private function load_dependencies() { |
|
| 787 | + |
|
| 788 | + /** |
|
| 789 | + * The class responsible for orchestrating the actions and filters of the |
|
| 790 | + * core plugin. |
|
| 791 | + */ |
|
| 792 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 793 | + |
|
| 794 | + // The class responsible for plugin uninstall. |
|
| 795 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 796 | + |
|
| 797 | + /** |
|
| 798 | + * The class responsible for defining internationalization functionality |
|
| 799 | + * of the plugin. |
|
| 800 | + */ |
|
| 801 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 802 | + |
|
| 803 | + /** |
|
| 804 | + * WordLift's supported languages. |
|
| 805 | + */ |
|
| 806 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 807 | + |
|
| 808 | + /** |
|
| 809 | + * WordLift's supported countries. |
|
| 810 | + */ |
|
| 811 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 812 | + |
|
| 813 | + /** |
|
| 814 | + * Provide support functions to sanitize data. |
|
| 815 | + */ |
|
| 816 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 817 | + |
|
| 818 | + /** Services. */ |
|
| 819 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 820 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 821 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 822 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 823 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 824 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 825 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 826 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 827 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 828 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 829 | + |
|
| 830 | + /** |
|
| 831 | + * The Query builder. |
|
| 832 | + */ |
|
| 833 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 834 | + |
|
| 835 | + /** |
|
| 836 | + * The Schema service. |
|
| 837 | + */ |
|
| 838 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 839 | + |
|
| 840 | + /** |
|
| 841 | + * The schema:url property service. |
|
| 842 | + */ |
|
| 843 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 844 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 845 | + |
|
| 846 | + /** |
|
| 847 | + * The UI service. |
|
| 848 | + */ |
|
| 849 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 850 | + |
|
| 851 | + /** |
|
| 852 | + * The Thumbnail service. |
|
| 853 | + */ |
|
| 854 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 855 | + |
|
| 856 | + /** |
|
| 857 | + * The Entity Types Taxonomy service. |
|
| 858 | + */ |
|
| 859 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 860 | + |
|
| 861 | + /** |
|
| 862 | + * The Entity service. |
|
| 863 | + */ |
|
| 864 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 865 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 866 | + |
|
| 867 | + // Add the entity rating service. |
|
| 868 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 869 | + |
|
| 870 | + /** |
|
| 871 | + * The User service. |
|
| 872 | + */ |
|
| 873 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 874 | + |
|
| 875 | + /** |
|
| 876 | + * The Timeline service. |
|
| 877 | + */ |
|
| 878 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 879 | + |
|
| 880 | + /** |
|
| 881 | + * The Topic Taxonomy service. |
|
| 882 | + */ |
|
| 883 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 884 | + |
|
| 885 | + /** |
|
| 886 | + * The SPARQL service. |
|
| 887 | + */ |
|
| 888 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 889 | + |
|
| 890 | + /** |
|
| 891 | + * The WordLift import service. |
|
| 892 | + */ |
|
| 893 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 894 | + |
|
| 895 | + /** |
|
| 896 | + * The WordLift URI service. |
|
| 897 | + */ |
|
| 898 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 899 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 900 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 901 | + |
|
| 902 | + /** |
|
| 903 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 904 | + */ |
|
| 905 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 906 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 907 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 908 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 909 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 910 | + |
|
| 911 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 912 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 913 | + |
|
| 914 | + /** |
|
| 915 | + * Load the converters. |
|
| 916 | + */ |
|
| 917 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 918 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 919 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 920 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 921 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 922 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 923 | + |
|
| 924 | + /** |
|
| 925 | + * Load cache-related files. |
|
| 926 | + */ |
|
| 927 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 928 | + |
|
| 929 | + /** |
|
| 930 | + * Load the content filter. |
|
| 931 | + */ |
|
| 932 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 933 | + |
|
| 934 | + /* |
|
| 935 | 935 | * Load the excerpt helper. |
| 936 | 936 | */ |
| 937 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 938 | - |
|
| 939 | - /** |
|
| 940 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 941 | - * |
|
| 942 | - * @since 3.8.0 |
|
| 943 | - */ |
|
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 945 | - |
|
| 946 | - // The Publisher Service and the AJAX adapter. |
|
| 947 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 949 | - |
|
| 950 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 951 | - |
|
| 952 | - /** |
|
| 953 | - * Load the WordLift key validation service. |
|
| 954 | - */ |
|
| 955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 956 | - |
|
| 957 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 959 | - |
|
| 960 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 962 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 963 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 964 | - |
|
| 965 | - /** Linked Data. */ |
|
| 966 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 967 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 968 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 973 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 977 | - |
|
| 978 | - /** Linked Data Rendition. */ |
|
| 979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 980 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 983 | - |
|
| 984 | - /** Services. */ |
|
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 986 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 987 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 988 | - |
|
| 989 | - /** Adapters. */ |
|
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 992 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 996 | - |
|
| 997 | - /** Async Tasks. */ |
|
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 1001 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 1002 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1003 | - |
|
| 1004 | - /** Autocomplete. */ |
|
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
| 1006 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1007 | - |
|
| 1008 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1009 | - |
|
| 1010 | - /** Analytics */ |
|
| 1011 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1012 | - |
|
| 1013 | - /** |
|
| 1014 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 1015 | - */ |
|
| 1016 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1017 | - |
|
| 1018 | - /** |
|
| 1019 | - * The class to customize the entity list admin page. |
|
| 1020 | - */ |
|
| 1021 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1022 | - |
|
| 1023 | - /** |
|
| 1024 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1025 | - */ |
|
| 1026 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1027 | - |
|
| 1028 | - /** |
|
| 1029 | - * The Notice service. |
|
| 1030 | - */ |
|
| 1031 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1032 | - |
|
| 1033 | - /** |
|
| 1034 | - * The PrimaShop adapter. |
|
| 1035 | - */ |
|
| 1036 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1037 | - |
|
| 1038 | - /** |
|
| 1039 | - * The WordLift Dashboard service. |
|
| 1040 | - */ |
|
| 1041 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1042 | - |
|
| 1043 | - /** |
|
| 1044 | - * The admin 'Install wizard' page. |
|
| 1045 | - */ |
|
| 1046 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1047 | - |
|
| 1048 | - /** |
|
| 1049 | - * The WordLift entity type list admin page controller. |
|
| 1050 | - */ |
|
| 1051 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1052 | - |
|
| 1053 | - /** |
|
| 1054 | - * The WordLift entity type settings admin page controller. |
|
| 1055 | - */ |
|
| 1056 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1057 | - |
|
| 1058 | - /** |
|
| 1059 | - * The admin 'Download Your Data' page. |
|
| 1060 | - */ |
|
| 1061 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1062 | - |
|
| 1063 | - /** |
|
| 1064 | - * The admin 'WordLift Settings' page. |
|
| 1065 | - */ |
|
| 1066 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1067 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1068 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1069 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1072 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1073 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1074 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1079 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1082 | - |
|
| 1083 | - /** Admin Pages */ |
|
| 1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1085 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1087 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1088 | - |
|
| 1089 | - /** |
|
| 1090 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 1091 | - * side of the site. |
|
| 1092 | - */ |
|
| 1093 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1094 | - |
|
| 1095 | - /** |
|
| 1096 | - * The shortcode abstract class. |
|
| 1097 | - */ |
|
| 1098 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1099 | - |
|
| 1100 | - /** |
|
| 1101 | - * The Timeline shortcode. |
|
| 1102 | - */ |
|
| 1103 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1104 | - |
|
| 1105 | - /** |
|
| 1106 | - * The Navigator shortcode. |
|
| 1107 | - */ |
|
| 1108 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1109 | - |
|
| 1110 | - /** |
|
| 1111 | - * The chord shortcode. |
|
| 1112 | - */ |
|
| 1113 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1114 | - |
|
| 1115 | - /** |
|
| 1116 | - * The geomap shortcode. |
|
| 1117 | - */ |
|
| 1118 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1119 | - |
|
| 1120 | - /** |
|
| 1121 | - * The entity cloud shortcode. |
|
| 1122 | - */ |
|
| 1123 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1124 | - |
|
| 1125 | - /** |
|
| 1126 | - * The entity glossary shortcode. |
|
| 1127 | - */ |
|
| 1128 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1129 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1130 | - |
|
| 1131 | - /** |
|
| 1132 | - * Faceted Search shortcode. |
|
| 1133 | - */ |
|
| 1134 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1135 | - |
|
| 1136 | - /** |
|
| 1137 | - * The ShareThis service. |
|
| 1138 | - */ |
|
| 1139 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1140 | - |
|
| 1141 | - /** |
|
| 1142 | - * The SEO service. |
|
| 1143 | - */ |
|
| 1144 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1145 | - |
|
| 1146 | - /** |
|
| 1147 | - * The AMP service. |
|
| 1148 | - */ |
|
| 1149 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1150 | - |
|
| 1151 | - /** Widgets */ |
|
| 1152 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1153 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1154 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1155 | - |
|
| 1156 | - /* |
|
| 937 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 938 | + |
|
| 939 | + /** |
|
| 940 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 941 | + * |
|
| 942 | + * @since 3.8.0 |
|
| 943 | + */ |
|
| 944 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 945 | + |
|
| 946 | + // The Publisher Service and the AJAX adapter. |
|
| 947 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 948 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 949 | + |
|
| 950 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 951 | + |
|
| 952 | + /** |
|
| 953 | + * Load the WordLift key validation service. |
|
| 954 | + */ |
|
| 955 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 956 | + |
|
| 957 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 958 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 959 | + |
|
| 960 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 961 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 962 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 963 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 964 | + |
|
| 965 | + /** Linked Data. */ |
|
| 966 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 967 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 968 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 969 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 970 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 971 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 972 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 973 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 974 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 975 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 976 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 977 | + |
|
| 978 | + /** Linked Data Rendition. */ |
|
| 979 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 980 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 981 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 982 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 983 | + |
|
| 984 | + /** Services. */ |
|
| 985 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 986 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 987 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 988 | + |
|
| 989 | + /** Adapters. */ |
|
| 990 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 991 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 992 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 993 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 994 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 995 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 996 | + |
|
| 997 | + /** Async Tasks. */ |
|
| 998 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 999 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1000 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 1001 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 1002 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1003 | + |
|
| 1004 | + /** Autocomplete. */ |
|
| 1005 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
| 1006 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1007 | + |
|
| 1008 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1009 | + |
|
| 1010 | + /** Analytics */ |
|
| 1011 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1012 | + |
|
| 1013 | + /** |
|
| 1014 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 1015 | + */ |
|
| 1016 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1017 | + |
|
| 1018 | + /** |
|
| 1019 | + * The class to customize the entity list admin page. |
|
| 1020 | + */ |
|
| 1021 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1022 | + |
|
| 1023 | + /** |
|
| 1024 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1025 | + */ |
|
| 1026 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1027 | + |
|
| 1028 | + /** |
|
| 1029 | + * The Notice service. |
|
| 1030 | + */ |
|
| 1031 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1032 | + |
|
| 1033 | + /** |
|
| 1034 | + * The PrimaShop adapter. |
|
| 1035 | + */ |
|
| 1036 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1037 | + |
|
| 1038 | + /** |
|
| 1039 | + * The WordLift Dashboard service. |
|
| 1040 | + */ |
|
| 1041 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1042 | + |
|
| 1043 | + /** |
|
| 1044 | + * The admin 'Install wizard' page. |
|
| 1045 | + */ |
|
| 1046 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1047 | + |
|
| 1048 | + /** |
|
| 1049 | + * The WordLift entity type list admin page controller. |
|
| 1050 | + */ |
|
| 1051 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1052 | + |
|
| 1053 | + /** |
|
| 1054 | + * The WordLift entity type settings admin page controller. |
|
| 1055 | + */ |
|
| 1056 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1057 | + |
|
| 1058 | + /** |
|
| 1059 | + * The admin 'Download Your Data' page. |
|
| 1060 | + */ |
|
| 1061 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1062 | + |
|
| 1063 | + /** |
|
| 1064 | + * The admin 'WordLift Settings' page. |
|
| 1065 | + */ |
|
| 1066 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1067 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1068 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1069 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1070 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1071 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1072 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1073 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1074 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1075 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1076 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1077 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1078 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1079 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1080 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1081 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1082 | + |
|
| 1083 | + /** Admin Pages */ |
|
| 1084 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1085 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1086 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1087 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1088 | + |
|
| 1089 | + /** |
|
| 1090 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 1091 | + * side of the site. |
|
| 1092 | + */ |
|
| 1093 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1094 | + |
|
| 1095 | + /** |
|
| 1096 | + * The shortcode abstract class. |
|
| 1097 | + */ |
|
| 1098 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1099 | + |
|
| 1100 | + /** |
|
| 1101 | + * The Timeline shortcode. |
|
| 1102 | + */ |
|
| 1103 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1104 | + |
|
| 1105 | + /** |
|
| 1106 | + * The Navigator shortcode. |
|
| 1107 | + */ |
|
| 1108 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1109 | + |
|
| 1110 | + /** |
|
| 1111 | + * The chord shortcode. |
|
| 1112 | + */ |
|
| 1113 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1114 | + |
|
| 1115 | + /** |
|
| 1116 | + * The geomap shortcode. |
|
| 1117 | + */ |
|
| 1118 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1119 | + |
|
| 1120 | + /** |
|
| 1121 | + * The entity cloud shortcode. |
|
| 1122 | + */ |
|
| 1123 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1124 | + |
|
| 1125 | + /** |
|
| 1126 | + * The entity glossary shortcode. |
|
| 1127 | + */ |
|
| 1128 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1129 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1130 | + |
|
| 1131 | + /** |
|
| 1132 | + * Faceted Search shortcode. |
|
| 1133 | + */ |
|
| 1134 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1135 | + |
|
| 1136 | + /** |
|
| 1137 | + * The ShareThis service. |
|
| 1138 | + */ |
|
| 1139 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1140 | + |
|
| 1141 | + /** |
|
| 1142 | + * The SEO service. |
|
| 1143 | + */ |
|
| 1144 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1145 | + |
|
| 1146 | + /** |
|
| 1147 | + * The AMP service. |
|
| 1148 | + */ |
|
| 1149 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1150 | + |
|
| 1151 | + /** Widgets */ |
|
| 1152 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1153 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1154 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1155 | + |
|
| 1156 | + /* |
|
| 1157 | 1157 | * Schema.org Services. |
| 1158 | 1158 | * |
| 1159 | 1159 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1160 | 1160 | */ |
| 1161 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1163 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1164 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1165 | - new Wordlift_Schemaorg_Sync_Service(); |
|
| 1166 | - $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1167 | - new Wordlift_Schemaorg_Class_Service(); |
|
| 1168 | - } else { |
|
| 1169 | - $schemaorg_property_service = null; |
|
| 1170 | - } |
|
| 1161 | + if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1162 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1163 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1164 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1165 | + new Wordlift_Schemaorg_Sync_Service(); |
|
| 1166 | + $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1167 | + new Wordlift_Schemaorg_Class_Service(); |
|
| 1168 | + } else { |
|
| 1169 | + $schemaorg_property_service = null; |
|
| 1170 | + } |
|
| 1171 | 1171 | |
| 1172 | - $this->loader = new Wordlift_Loader(); |
|
| 1172 | + $this->loader = new Wordlift_Loader(); |
|
| 1173 | 1173 | |
| 1174 | - // Instantiate a global logger. |
|
| 1175 | - global $wl_logger; |
|
| 1176 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1174 | + // Instantiate a global logger. |
|
| 1175 | + global $wl_logger; |
|
| 1176 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1177 | 1177 | |
| 1178 | - // Load the `wl-api` end-point. |
|
| 1179 | - new Wordlift_Http_Api(); |
|
| 1178 | + // Load the `wl-api` end-point. |
|
| 1179 | + new Wordlift_Http_Api(); |
|
| 1180 | 1180 | |
| 1181 | - // Load the Install Service. |
|
| 1182 | - $this->install_service = new Wordlift_Install_Service(); |
|
| 1181 | + // Load the Install Service. |
|
| 1182 | + $this->install_service = new Wordlift_Install_Service(); |
|
| 1183 | 1183 | |
| 1184 | - /** Services. */ |
|
| 1185 | - // Create the configuration service. |
|
| 1186 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1187 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1184 | + /** Services. */ |
|
| 1185 | + // Create the configuration service. |
|
| 1186 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1187 | + $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1188 | 1188 | |
| 1189 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1190 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1189 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1190 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1191 | 1191 | |
| 1192 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1193 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1192 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1193 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1194 | 1194 | |
| 1195 | - // Create an instance of the UI service. |
|
| 1196 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 1195 | + // Create an instance of the UI service. |
|
| 1196 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 1197 | 1197 | |
| 1198 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1199 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1198 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1199 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1200 | 1200 | |
| 1201 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1202 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1203 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1204 | - $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1201 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1202 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1203 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1204 | + $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1205 | 1205 | |
| 1206 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1207 | - $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
| 1208 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1209 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1210 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1206 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1207 | + $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
| 1208 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1209 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1210 | + $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1211 | 1211 | |
| 1212 | - // Instantiate the JSON-LD service. |
|
| 1213 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1212 | + // Instantiate the JSON-LD service. |
|
| 1213 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1214 | 1214 | |
| 1215 | - /** Linked Data. */ |
|
| 1216 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1217 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1215 | + /** Linked Data. */ |
|
| 1216 | + $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1217 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1218 | 1218 | |
| 1219 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1219 | + $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1220 | 1220 | |
| 1221 | - // Create a new instance of the Redirect service. |
|
| 1222 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1223 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1224 | - $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1221 | + // Create a new instance of the Redirect service. |
|
| 1222 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1223 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1224 | + $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1225 | 1225 | |
| 1226 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1227 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1226 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1227 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1228 | 1228 | |
| 1229 | - $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
| 1229 | + $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
| 1230 | 1230 | |
| 1231 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1231 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1232 | 1232 | |
| 1233 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1234 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1233 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1234 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1235 | 1235 | |
| 1236 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1237 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1236 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1237 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1238 | 1238 | |
| 1239 | - // Create an instance of the PrimaShop adapter. |
|
| 1240 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1239 | + // Create an instance of the PrimaShop adapter. |
|
| 1240 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1241 | 1241 | |
| 1242 | - // Create an import service instance to hook later to WP's import function. |
|
| 1243 | - $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 1242 | + // Create an import service instance to hook later to WP's import function. |
|
| 1243 | + $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 1244 | 1244 | |
| 1245 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1245 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1246 | 1246 | |
| 1247 | - // Create the entity rating service. |
|
| 1248 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1247 | + // Create the entity rating service. |
|
| 1248 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1249 | 1249 | |
| 1250 | - // Create entity list customization (wp-admin/edit.php). |
|
| 1251 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1250 | + // Create entity list customization (wp-admin/edit.php). |
|
| 1251 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1252 | 1252 | |
| 1253 | - // Create a new instance of the Redirect service. |
|
| 1254 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1253 | + // Create a new instance of the Redirect service. |
|
| 1254 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1255 | 1255 | |
| 1256 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1257 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1258 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1259 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1256 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1257 | + $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1258 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1259 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1260 | 1260 | |
| 1261 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1261 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1262 | 1262 | |
| 1263 | - // Instantiate the JSON-LD service. |
|
| 1264 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1265 | - $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service ); |
|
| 1266 | - $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1267 | - $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter ); |
|
| 1268 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1269 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
| 1270 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1263 | + // Instantiate the JSON-LD service. |
|
| 1264 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1265 | + $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service ); |
|
| 1266 | + $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1267 | + $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter ); |
|
| 1268 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1269 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
| 1270 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1271 | 1271 | |
| 1272 | 1272 | |
| 1273 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1274 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1275 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1276 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1277 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1278 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1273 | + $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1274 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1275 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1276 | + $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1277 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1278 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1279 | 1279 | |
| 1280 | - // Initialize the shortcodes. |
|
| 1281 | - new Wordlift_Navigator_Shortcode(); |
|
| 1282 | - new Wordlift_Chord_Shortcode(); |
|
| 1283 | - new Wordlift_Geomap_Shortcode(); |
|
| 1284 | - new Wordlift_Timeline_Shortcode(); |
|
| 1285 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1286 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1287 | - new Wordlift_Faceted_Search_Shortcode(); |
|
| 1280 | + // Initialize the shortcodes. |
|
| 1281 | + new Wordlift_Navigator_Shortcode(); |
|
| 1282 | + new Wordlift_Chord_Shortcode(); |
|
| 1283 | + new Wordlift_Geomap_Shortcode(); |
|
| 1284 | + new Wordlift_Timeline_Shortcode(); |
|
| 1285 | + new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1286 | + new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1287 | + new Wordlift_Faceted_Search_Shortcode(); |
|
| 1288 | 1288 | |
| 1289 | - // Initialize the SEO service. |
|
| 1290 | - new Wordlift_Seo_Service(); |
|
| 1289 | + // Initialize the SEO service. |
|
| 1290 | + new Wordlift_Seo_Service(); |
|
| 1291 | 1291 | |
| 1292 | - // Initialize the AMP service. |
|
| 1293 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1292 | + // Initialize the AMP service. |
|
| 1293 | + new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1294 | 1294 | |
| 1295 | - /** Services. */ |
|
| 1296 | - $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1297 | - new Wordlift_Image_Service(); |
|
| 1295 | + /** Services. */ |
|
| 1296 | + $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1297 | + new Wordlift_Image_Service(); |
|
| 1298 | 1298 | |
| 1299 | - /** Adapters. */ |
|
| 1300 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1301 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1302 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1303 | - $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
| 1304 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1299 | + /** Adapters. */ |
|
| 1300 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1301 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1302 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1303 | + $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
| 1304 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1305 | 1305 | |
| 1306 | - /* |
|
| 1306 | + /* |
|
| 1307 | 1307 | * Exclude our public js from WP-Rocket. |
| 1308 | 1308 | * |
| 1309 | 1309 | * @since 3.19.4 |
| 1310 | 1310 | * |
| 1311 | 1311 | * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
| 1312 | 1312 | */ |
| 1313 | - new Wordlift_WpRocket_Adapter(); |
|
| 1314 | - |
|
| 1315 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1316 | - $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1317 | - $this->sparql_service, |
|
| 1318 | - $uri_service |
|
| 1319 | - ); |
|
| 1320 | - |
|
| 1321 | - /** Async Tasks. */ |
|
| 1322 | - new Wordlift_Sparql_Query_Async_Task(); |
|
| 1323 | - new Wordlift_Batch_Analysis_Request_Async_Task(); |
|
| 1324 | - new Wordlift_Batch_Analysis_Complete_Async_Task(); |
|
| 1325 | - new Wordlift_Push_References_Async_Task(); |
|
| 1326 | - |
|
| 1327 | - /** WL Autocomplete. */ |
|
| 1328 | - $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
| 1329 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
| 1330 | - |
|
| 1331 | - /** WordPress Admin UI. */ |
|
| 1332 | - |
|
| 1333 | - // UI elements. |
|
| 1334 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1335 | - $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1336 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1337 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1338 | - $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1339 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1340 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1341 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1342 | - |
|
| 1343 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1344 | - $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
| 1345 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1346 | - |
|
| 1347 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1348 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1349 | - $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1350 | - |
|
| 1351 | - // Pages. |
|
| 1352 | - /* |
|
| 1313 | + new Wordlift_WpRocket_Adapter(); |
|
| 1314 | + |
|
| 1315 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1316 | + $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1317 | + $this->sparql_service, |
|
| 1318 | + $uri_service |
|
| 1319 | + ); |
|
| 1320 | + |
|
| 1321 | + /** Async Tasks. */ |
|
| 1322 | + new Wordlift_Sparql_Query_Async_Task(); |
|
| 1323 | + new Wordlift_Batch_Analysis_Request_Async_Task(); |
|
| 1324 | + new Wordlift_Batch_Analysis_Complete_Async_Task(); |
|
| 1325 | + new Wordlift_Push_References_Async_Task(); |
|
| 1326 | + |
|
| 1327 | + /** WL Autocomplete. */ |
|
| 1328 | + $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
| 1329 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
| 1330 | + |
|
| 1331 | + /** WordPress Admin UI. */ |
|
| 1332 | + |
|
| 1333 | + // UI elements. |
|
| 1334 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1335 | + $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1336 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1337 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1338 | + $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1339 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1340 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1341 | + $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1342 | + |
|
| 1343 | + $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1344 | + $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
| 1345 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1346 | + |
|
| 1347 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1348 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1349 | + $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1350 | + |
|
| 1351 | + // Pages. |
|
| 1352 | + /* |
|
| 1353 | 1353 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
| 1354 | 1354 | * |
| 1355 | 1355 | * @since 3.20.3 |
| 1356 | 1356 | * |
| 1357 | 1357 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1358 | 1358 | */ |
| 1359 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1360 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1361 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1362 | - } |
|
| 1363 | - new Wordlift_Entity_Type_Admin_Service(); |
|
| 1359 | + if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1360 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1361 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1362 | + } |
|
| 1363 | + new Wordlift_Entity_Type_Admin_Service(); |
|
| 1364 | 1364 | |
| 1365 | - // create an instance of the entity type list admin page controller. |
|
| 1366 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1365 | + // create an instance of the entity type list admin page controller. |
|
| 1366 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1367 | 1367 | |
| 1368 | - // create an instance of the entity type setting admin page controller. |
|
| 1369 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1368 | + // create an instance of the entity type setting admin page controller. |
|
| 1369 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1370 | 1370 | |
| 1371 | - /** Widgets */ |
|
| 1372 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1371 | + /** Widgets */ |
|
| 1372 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1373 | 1373 | |
| 1374 | - /* WordPress Admin. */ |
|
| 1375 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1376 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1374 | + /* WordPress Admin. */ |
|
| 1375 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1376 | + $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1377 | 1377 | |
| 1378 | - // Create an instance of the install wizard. |
|
| 1379 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1378 | + // Create an instance of the install wizard. |
|
| 1379 | + $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1380 | 1380 | |
| 1381 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1381 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1382 | 1382 | |
| 1383 | - // User Profile. |
|
| 1384 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1383 | + // User Profile. |
|
| 1384 | + new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1385 | 1385 | |
| 1386 | - $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1386 | + $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1387 | 1387 | |
| 1388 | - // Load the debug service if WP is in debug mode. |
|
| 1389 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1390 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1391 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1392 | - } |
|
| 1388 | + // Load the debug service if WP is in debug mode. |
|
| 1389 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1390 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1391 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1392 | + } |
|
| 1393 | 1393 | |
| 1394 | - // Remote Image Service. |
|
| 1395 | - new Wordlift_Remote_Image_Service(); |
|
| 1394 | + // Remote Image Service. |
|
| 1395 | + new Wordlift_Remote_Image_Service(); |
|
| 1396 | 1396 | |
| 1397 | - /* |
|
| 1397 | + /* |
|
| 1398 | 1398 | * Provides mappings between post types and entity types. |
| 1399 | 1399 | * |
| 1400 | 1400 | * @since 3.20.0 |
| 1401 | 1401 | * |
| 1402 | 1402 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1403 | 1403 | */ |
| 1404 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1405 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1406 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1404 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1405 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1406 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1407 | 1407 | |
| 1408 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1409 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1408 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1409 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1410 | 1410 | |
| 1411 | - /* |
|
| 1411 | + /* |
|
| 1412 | 1412 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
| 1413 | 1413 | * |
| 1414 | 1414 | * Eventually Batch Actions will become Batch Operations. |
| 1415 | 1415 | * |
| 1416 | 1416 | * @since 3.20.0 |
| 1417 | 1417 | */ |
| 1418 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1419 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1418 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1419 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1420 | 1420 | |
| 1421 | - /* |
|
| 1421 | + /* |
|
| 1422 | 1422 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
| 1423 | 1423 | * |
| 1424 | 1424 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1425 | 1425 | * |
| 1426 | 1426 | * @since 3.20.0 |
| 1427 | 1427 | */ |
| 1428 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1429 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1428 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1429 | + new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1430 | 1430 | |
| 1431 | - /* |
|
| 1431 | + /* |
|
| 1432 | 1432 | * Load dependencies for the front-end. |
| 1433 | 1433 | * |
| 1434 | 1434 | * @since 3.20.0 |
| 1435 | 1435 | */ |
| 1436 | - if ( ! is_admin() ) { |
|
| 1437 | - /* |
|
| 1436 | + if ( ! is_admin() ) { |
|
| 1437 | + /* |
|
| 1438 | 1438 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1439 | 1439 | * |
| 1440 | 1440 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
| 1441 | 1441 | * |
| 1442 | 1442 | * @since 3.20.0 |
| 1443 | 1443 | */ |
| 1444 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1445 | - new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1446 | - } |
|
| 1444 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1445 | + new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1446 | + } |
|
| 1447 | 1447 | |
| 1448 | - /* |
|
| 1448 | + /* |
|
| 1449 | 1449 | * Initialize the Context Cards Service |
| 1450 | 1450 | * |
| 1451 | 1451 | * @link https://github.com/insideout10/wordlift-plugin/issues/934 |
| 1452 | 1452 | * |
| 1453 | 1453 | * @since 3.22.0 |
| 1454 | 1454 | */ |
| 1455 | - $this->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1456 | - |
|
| 1457 | - } |
|
| 1458 | - |
|
| 1459 | - /** |
|
| 1460 | - * Define the locale for this plugin for internationalization. |
|
| 1461 | - * |
|
| 1462 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1463 | - * with WordPress. |
|
| 1464 | - * |
|
| 1465 | - * @since 1.0.0 |
|
| 1466 | - * @access private |
|
| 1467 | - */ |
|
| 1468 | - private function set_locale() { |
|
| 1469 | - |
|
| 1470 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 1471 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1472 | - |
|
| 1473 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1474 | - |
|
| 1475 | - } |
|
| 1476 | - |
|
| 1477 | - /** |
|
| 1478 | - * Register all of the hooks related to the admin area functionality |
|
| 1479 | - * of the plugin. |
|
| 1480 | - * |
|
| 1481 | - * @since 1.0.0 |
|
| 1482 | - * @access private |
|
| 1483 | - */ |
|
| 1484 | - private function define_admin_hooks() { |
|
| 1485 | - |
|
| 1486 | - $plugin_admin = new Wordlift_Admin( |
|
| 1487 | - $this->get_plugin_name(), |
|
| 1488 | - $this->get_version(), |
|
| 1489 | - $this->configuration_service, |
|
| 1490 | - $this->notice_service, |
|
| 1491 | - $this->user_service |
|
| 1492 | - ); |
|
| 1493 | - |
|
| 1494 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1495 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1496 | - |
|
| 1497 | - // Hook the init action to taxonomy services. |
|
| 1498 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1499 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1500 | - |
|
| 1501 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1502 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1503 | - |
|
| 1504 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 1505 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1506 | - |
|
| 1507 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1508 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1509 | - |
|
| 1510 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1511 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1512 | - |
|
| 1513 | - // Register custom allowed redirect hosts. |
|
| 1514 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1515 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1516 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1517 | - |
|
| 1518 | - /* |
|
| 1455 | + $this->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1456 | + |
|
| 1457 | + } |
|
| 1458 | + |
|
| 1459 | + /** |
|
| 1460 | + * Define the locale for this plugin for internationalization. |
|
| 1461 | + * |
|
| 1462 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1463 | + * with WordPress. |
|
| 1464 | + * |
|
| 1465 | + * @since 1.0.0 |
|
| 1466 | + * @access private |
|
| 1467 | + */ |
|
| 1468 | + private function set_locale() { |
|
| 1469 | + |
|
| 1470 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 1471 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1472 | + |
|
| 1473 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1474 | + |
|
| 1475 | + } |
|
| 1476 | + |
|
| 1477 | + /** |
|
| 1478 | + * Register all of the hooks related to the admin area functionality |
|
| 1479 | + * of the plugin. |
|
| 1480 | + * |
|
| 1481 | + * @since 1.0.0 |
|
| 1482 | + * @access private |
|
| 1483 | + */ |
|
| 1484 | + private function define_admin_hooks() { |
|
| 1485 | + |
|
| 1486 | + $plugin_admin = new Wordlift_Admin( |
|
| 1487 | + $this->get_plugin_name(), |
|
| 1488 | + $this->get_version(), |
|
| 1489 | + $this->configuration_service, |
|
| 1490 | + $this->notice_service, |
|
| 1491 | + $this->user_service |
|
| 1492 | + ); |
|
| 1493 | + |
|
| 1494 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1495 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1496 | + |
|
| 1497 | + // Hook the init action to taxonomy services. |
|
| 1498 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1499 | + $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1500 | + |
|
| 1501 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1502 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1503 | + |
|
| 1504 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 1505 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1506 | + |
|
| 1507 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1508 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1509 | + |
|
| 1510 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1511 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1512 | + |
|
| 1513 | + // Register custom allowed redirect hosts. |
|
| 1514 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1515 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1516 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1517 | + |
|
| 1518 | + /* |
|
| 1519 | 1519 | * The old dashboard is replaced with dashboard v2. |
| 1520 | 1520 | * |
| 1521 | 1521 | * The old dashboard service is still loaded because its functions are used. |
@@ -1524,300 +1524,300 @@ discard block |
||
| 1524 | 1524 | * |
| 1525 | 1525 | * @since 3.20.0 |
| 1526 | 1526 | */ |
| 1527 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1528 | - // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1529 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1530 | - // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1531 | - |
|
| 1532 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1533 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1534 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1535 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1536 | - |
|
| 1537 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1538 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1539 | - |
|
| 1540 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1541 | - // Add custom columns. |
|
| 1542 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1543 | - // no explicit entity as it prevents handling of other post types. |
|
| 1544 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1545 | - // Add 4W selection. |
|
| 1546 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1547 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1548 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1549 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1550 | - |
|
| 1551 | - /* |
|
| 1527 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1528 | + // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1529 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1530 | + // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1531 | + |
|
| 1532 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1533 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1534 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1535 | + $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1536 | + |
|
| 1537 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1538 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1539 | + |
|
| 1540 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1541 | + // Add custom columns. |
|
| 1542 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1543 | + // no explicit entity as it prevents handling of other post types. |
|
| 1544 | + $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1545 | + // Add 4W selection. |
|
| 1546 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1547 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1548 | + $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1549 | + $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1550 | + |
|
| 1551 | + /* |
|
| 1552 | 1552 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1553 | 1553 | * |
| 1554 | 1554 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1555 | 1555 | */ |
| 1556 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1557 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1558 | - } |
|
| 1556 | + if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1557 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1558 | + } |
|
| 1559 | 1559 | |
| 1560 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1561 | - // entities. |
|
| 1562 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1560 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1561 | + // entities. |
|
| 1562 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1563 | 1563 | |
| 1564 | - // Filter imported post meta. |
|
| 1565 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1564 | + // Filter imported post meta. |
|
| 1565 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1566 | 1566 | |
| 1567 | - // Notify the import service when an import starts and ends. |
|
| 1568 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1569 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1567 | + // Notify the import service when an import starts and ends. |
|
| 1568 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1569 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1570 | 1570 | |
| 1571 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1572 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1573 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1571 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1572 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1573 | + $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1574 | 1574 | |
| 1575 | - // Hook the menu to the Download Your Data page. |
|
| 1576 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1577 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1578 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1575 | + // Hook the menu to the Download Your Data page. |
|
| 1576 | + $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1577 | + $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1578 | + $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1579 | 1579 | |
| 1580 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1581 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1580 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1581 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1582 | 1582 | |
| 1583 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1584 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1585 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1586 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1583 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1584 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1585 | + $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1586 | + $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1587 | 1587 | |
| 1588 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1589 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1588 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1589 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1590 | 1590 | |
| 1591 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1592 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1591 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1592 | + $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1593 | 1593 | |
| 1594 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1595 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1594 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1595 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1596 | 1596 | |
| 1597 | - // Hook the admin_init to the settings page. |
|
| 1598 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1599 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1597 | + // Hook the admin_init to the settings page. |
|
| 1598 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1599 | + $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1600 | 1600 | |
| 1601 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1601 | + $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1602 | 1602 | |
| 1603 | - // Hook the menu creation on the general wordlift menu creation. |
|
| 1604 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1605 | - if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
| 1606 | - // Add the functionality only if a flag is set in wp-config.php . |
|
| 1607 | - $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
| 1608 | - } |
|
| 1603 | + // Hook the menu creation on the general wordlift menu creation. |
|
| 1604 | + $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1605 | + if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
| 1606 | + // Add the functionality only if a flag is set in wp-config.php . |
|
| 1607 | + $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
| 1608 | + } |
|
| 1609 | 1609 | |
| 1610 | - /* |
|
| 1610 | + /* |
|
| 1611 | 1611 | * Display the `Wordlift_Admin_Search_Rankings_Page` page. |
| 1612 | 1612 | * |
| 1613 | 1613 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1614 | 1614 | * |
| 1615 | 1615 | * @since 3.20.0 |
| 1616 | 1616 | */ |
| 1617 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1618 | - $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1619 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1620 | - } |
|
| 1617 | + if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1618 | + $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1619 | + $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1620 | + } |
|
| 1621 | 1621 | |
| 1622 | - // Hook key update. |
|
| 1623 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1624 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1622 | + // Hook key update. |
|
| 1623 | + $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1624 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1625 | 1625 | |
| 1626 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1627 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1626 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1627 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1628 | 1628 | |
| 1629 | - /* |
|
| 1629 | + /* |
|
| 1630 | 1630 | * Remove the Analytics Settings link from the plugin page. |
| 1631 | 1631 | * |
| 1632 | 1632 | * @see https://github.com/insideout10/wordlift-plugin/issues/932 |
| 1633 | 1633 | * @since 3.21.1 |
| 1634 | 1634 | */ |
| 1635 | - // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1636 | - |
|
| 1637 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1638 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1639 | - |
|
| 1640 | - // Hook row actions for the entity type list admin. |
|
| 1641 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1642 | - |
|
| 1643 | - /** Ajax actions. */ |
|
| 1644 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1645 | - |
|
| 1646 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1647 | - // page on WordPress versions before 4.7. |
|
| 1648 | - global $wp_version; |
|
| 1649 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1650 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1651 | - } |
|
| 1652 | - |
|
| 1653 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1654 | - |
|
| 1655 | - /** Adapters. */ |
|
| 1656 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1657 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
| 1658 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
| 1659 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
| 1660 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
| 1661 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1662 | - |
|
| 1663 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1664 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1665 | - |
|
| 1666 | - |
|
| 1667 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1668 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1669 | - |
|
| 1670 | - // Handle the autocomplete request. |
|
| 1671 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1672 | - $this->autocomplete_adapter, |
|
| 1673 | - 'wl_autocomplete', |
|
| 1674 | - ) ); |
|
| 1675 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1676 | - $this->autocomplete_adapter, |
|
| 1677 | - 'wl_autocomplete', |
|
| 1678 | - ) ); |
|
| 1679 | - |
|
| 1680 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1681 | - if ( is_multisite() ) { |
|
| 1682 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1683 | - } |
|
| 1684 | - |
|
| 1685 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1686 | - |
|
| 1687 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1688 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1689 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1690 | - } |
|
| 1691 | - |
|
| 1692 | - /** |
|
| 1693 | - * Register all of the hooks related to the public-facing functionality |
|
| 1694 | - * of the plugin. |
|
| 1695 | - * |
|
| 1696 | - * @since 1.0.0 |
|
| 1697 | - * @access private |
|
| 1698 | - */ |
|
| 1699 | - private function define_public_hooks() { |
|
| 1700 | - |
|
| 1701 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1702 | - |
|
| 1703 | - // Register the entity post type. |
|
| 1704 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1705 | - $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
| 1706 | - |
|
| 1707 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1708 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1709 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1710 | - $this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 ); |
|
| 1711 | - $this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 ); |
|
| 1712 | - |
|
| 1713 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1714 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1715 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1716 | - |
|
| 1717 | - // Hook the content filter service to add entity links. |
|
| 1718 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1719 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1720 | - } |
|
| 1721 | - |
|
| 1722 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1723 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1724 | - |
|
| 1725 | - // Hook the ShareThis service. |
|
| 1726 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1727 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1728 | - |
|
| 1729 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1730 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1731 | - |
|
| 1732 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1733 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1734 | - // to categories. |
|
| 1735 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1736 | - |
|
| 1737 | - /* |
|
| 1635 | + // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1636 | + |
|
| 1637 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1638 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1639 | + |
|
| 1640 | + // Hook row actions for the entity type list admin. |
|
| 1641 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1642 | + |
|
| 1643 | + /** Ajax actions. */ |
|
| 1644 | + $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1645 | + |
|
| 1646 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1647 | + // page on WordPress versions before 4.7. |
|
| 1648 | + global $wp_version; |
|
| 1649 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1650 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1651 | + } |
|
| 1652 | + |
|
| 1653 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1654 | + |
|
| 1655 | + /** Adapters. */ |
|
| 1656 | + $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1657 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
| 1658 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
| 1659 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
| 1660 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
| 1661 | + $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1662 | + |
|
| 1663 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1664 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1665 | + |
|
| 1666 | + |
|
| 1667 | + $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1668 | + $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1669 | + |
|
| 1670 | + // Handle the autocomplete request. |
|
| 1671 | + add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1672 | + $this->autocomplete_adapter, |
|
| 1673 | + 'wl_autocomplete', |
|
| 1674 | + ) ); |
|
| 1675 | + add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1676 | + $this->autocomplete_adapter, |
|
| 1677 | + 'wl_autocomplete', |
|
| 1678 | + ) ); |
|
| 1679 | + |
|
| 1680 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1681 | + if ( is_multisite() ) { |
|
| 1682 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1683 | + } |
|
| 1684 | + |
|
| 1685 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1686 | + |
|
| 1687 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1688 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1689 | + add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1690 | + } |
|
| 1691 | + |
|
| 1692 | + /** |
|
| 1693 | + * Register all of the hooks related to the public-facing functionality |
|
| 1694 | + * of the plugin. |
|
| 1695 | + * |
|
| 1696 | + * @since 1.0.0 |
|
| 1697 | + * @access private |
|
| 1698 | + */ |
|
| 1699 | + private function define_public_hooks() { |
|
| 1700 | + |
|
| 1701 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1702 | + |
|
| 1703 | + // Register the entity post type. |
|
| 1704 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1705 | + $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
| 1706 | + |
|
| 1707 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1708 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1709 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1710 | + $this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 ); |
|
| 1711 | + $this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 ); |
|
| 1712 | + |
|
| 1713 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1714 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1715 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1716 | + |
|
| 1717 | + // Hook the content filter service to add entity links. |
|
| 1718 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1719 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1720 | + } |
|
| 1721 | + |
|
| 1722 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1723 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1724 | + |
|
| 1725 | + // Hook the ShareThis service. |
|
| 1726 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1727 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1728 | + |
|
| 1729 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1730 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1731 | + |
|
| 1732 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1733 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1734 | + // to categories. |
|
| 1735 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1736 | + |
|
| 1737 | + /* |
|
| 1738 | 1738 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1739 | 1739 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1740 | 1740 | * order of start time. |
| 1741 | 1741 | */ |
| 1742 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1743 | - |
|
| 1744 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1745 | - |
|
| 1746 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1747 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1748 | - |
|
| 1749 | - // Analytics Script Frontend. |
|
| 1750 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1751 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1752 | - } |
|
| 1753 | - |
|
| 1754 | - } |
|
| 1755 | - |
|
| 1756 | - /** |
|
| 1757 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1758 | - * |
|
| 1759 | - * @since 1.0.0 |
|
| 1760 | - */ |
|
| 1761 | - public function run() { |
|
| 1762 | - $this->loader->run(); |
|
| 1763 | - } |
|
| 1764 | - |
|
| 1765 | - /** |
|
| 1766 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1767 | - * WordPress and to define internationalization functionality. |
|
| 1768 | - * |
|
| 1769 | - * @return string The name of the plugin. |
|
| 1770 | - * @since 1.0.0 |
|
| 1771 | - */ |
|
| 1772 | - public function get_plugin_name() { |
|
| 1773 | - return $this->plugin_name; |
|
| 1774 | - } |
|
| 1775 | - |
|
| 1776 | - /** |
|
| 1777 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1778 | - * |
|
| 1779 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1780 | - * @since 1.0.0 |
|
| 1781 | - */ |
|
| 1782 | - public function get_loader() { |
|
| 1783 | - return $this->loader; |
|
| 1784 | - } |
|
| 1785 | - |
|
| 1786 | - /** |
|
| 1787 | - * Retrieve the version number of the plugin. |
|
| 1788 | - * |
|
| 1789 | - * @return string The version number of the plugin. |
|
| 1790 | - * @since 1.0.0 |
|
| 1791 | - */ |
|
| 1792 | - public function get_version() { |
|
| 1793 | - return $this->version; |
|
| 1794 | - } |
|
| 1795 | - |
|
| 1796 | - /** |
|
| 1797 | - * Load dependencies for WP-CLI. |
|
| 1798 | - * |
|
| 1799 | - * @throws Exception |
|
| 1800 | - * @since 3.18.0 |
|
| 1801 | - */ |
|
| 1802 | - private function load_cli_dependencies() { |
|
| 1803 | - |
|
| 1804 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1805 | - |
|
| 1806 | - $push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service ); |
|
| 1807 | - |
|
| 1808 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1809 | - |
|
| 1810 | - } |
|
| 1811 | - |
|
| 1812 | - /** |
|
| 1813 | - * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1814 | - * |
|
| 1815 | - * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1816 | - * @since 3.20.0 |
|
| 1817 | - */ |
|
| 1818 | - public function get_dashboard_service() { |
|
| 1819 | - |
|
| 1820 | - return $this->dashboard_service; |
|
| 1821 | - } |
|
| 1742 | + $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1743 | + |
|
| 1744 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1745 | + |
|
| 1746 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1747 | + $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1748 | + |
|
| 1749 | + // Analytics Script Frontend. |
|
| 1750 | + if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1751 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1752 | + } |
|
| 1753 | + |
|
| 1754 | + } |
|
| 1755 | + |
|
| 1756 | + /** |
|
| 1757 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1758 | + * |
|
| 1759 | + * @since 1.0.0 |
|
| 1760 | + */ |
|
| 1761 | + public function run() { |
|
| 1762 | + $this->loader->run(); |
|
| 1763 | + } |
|
| 1764 | + |
|
| 1765 | + /** |
|
| 1766 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1767 | + * WordPress and to define internationalization functionality. |
|
| 1768 | + * |
|
| 1769 | + * @return string The name of the plugin. |
|
| 1770 | + * @since 1.0.0 |
|
| 1771 | + */ |
|
| 1772 | + public function get_plugin_name() { |
|
| 1773 | + return $this->plugin_name; |
|
| 1774 | + } |
|
| 1775 | + |
|
| 1776 | + /** |
|
| 1777 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1778 | + * |
|
| 1779 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1780 | + * @since 1.0.0 |
|
| 1781 | + */ |
|
| 1782 | + public function get_loader() { |
|
| 1783 | + return $this->loader; |
|
| 1784 | + } |
|
| 1785 | + |
|
| 1786 | + /** |
|
| 1787 | + * Retrieve the version number of the plugin. |
|
| 1788 | + * |
|
| 1789 | + * @return string The version number of the plugin. |
|
| 1790 | + * @since 1.0.0 |
|
| 1791 | + */ |
|
| 1792 | + public function get_version() { |
|
| 1793 | + return $this->version; |
|
| 1794 | + } |
|
| 1795 | + |
|
| 1796 | + /** |
|
| 1797 | + * Load dependencies for WP-CLI. |
|
| 1798 | + * |
|
| 1799 | + * @throws Exception |
|
| 1800 | + * @since 3.18.0 |
|
| 1801 | + */ |
|
| 1802 | + private function load_cli_dependencies() { |
|
| 1803 | + |
|
| 1804 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1805 | + |
|
| 1806 | + $push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service ); |
|
| 1807 | + |
|
| 1808 | + WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1809 | + |
|
| 1810 | + } |
|
| 1811 | + |
|
| 1812 | + /** |
|
| 1813 | + * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1814 | + * |
|
| 1815 | + * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1816 | + * @since 3.20.0 |
|
| 1817 | + */ |
|
| 1818 | + public function get_dashboard_service() { |
|
| 1819 | + |
|
| 1820 | + return $this->dashboard_service; |
|
| 1821 | + } |
|
| 1822 | 1822 | |
| 1823 | 1823 | } |