@@ -16,242 +16,242 @@ |
||
| 16 | 16 | |
| 17 | 17 | class Mentions { |
| 18 | 18 | |
| 19 | - private static $schema_descendants = array( |
|
| 20 | - 'AmpStory', |
|
| 21 | - 'ArchiveComponent', |
|
| 22 | - 'Article', |
|
| 23 | - 'Atlas', |
|
| 24 | - 'Blog', |
|
| 25 | - 'Book', |
|
| 26 | - 'Chapter', |
|
| 27 | - 'Claim', |
|
| 28 | - 'Clip', |
|
| 29 | - 'Code', |
|
| 30 | - 'Collection', |
|
| 31 | - 'ComicStory', |
|
| 32 | - 'Comment', |
|
| 33 | - 'Conversation', |
|
| 34 | - 'Course', |
|
| 35 | - 'CreativeWorkSeason', |
|
| 36 | - 'CreativeWorkSeries', |
|
| 37 | - 'DataCatalog', |
|
| 38 | - 'Dataset', |
|
| 39 | - 'DefinedTermSet', |
|
| 40 | - 'Diet', |
|
| 41 | - 'DigitalDocument', |
|
| 42 | - 'Drawing', |
|
| 43 | - 'EducationalOccupationalCredential', |
|
| 44 | - 'Episode', |
|
| 45 | - 'ExercisePlan', |
|
| 46 | - 'Game', |
|
| 47 | - 'Guide', |
|
| 48 | - 'HowTo', |
|
| 49 | - 'HowToDirection', |
|
| 50 | - 'HowToSection', |
|
| 51 | - 'HowToStep', |
|
| 52 | - 'HowToTip', |
|
| 53 | - 'HyperToc', |
|
| 54 | - 'HyperTocEntry', |
|
| 55 | - 'LearningResource', |
|
| 56 | - 'Legislation', |
|
| 57 | - 'Manuscript', |
|
| 58 | - 'Map', |
|
| 59 | - 'MathSolver', |
|
| 60 | - 'MediaObject', |
|
| 61 | - 'Menu', |
|
| 62 | - 'MenuSection', |
|
| 63 | - 'Message', |
|
| 64 | - 'Movie', |
|
| 65 | - 'MusicComposition', |
|
| 66 | - 'MusicPlaylist', |
|
| 67 | - 'MusicRecording', |
|
| 68 | - 'Painting', |
|
| 69 | - 'Photograph', |
|
| 70 | - 'Play', |
|
| 71 | - 'Poster', |
|
| 72 | - 'PublicationIssue', |
|
| 73 | - 'PublicationVolume', |
|
| 74 | - 'Quotation', |
|
| 75 | - 'Review', |
|
| 76 | - 'Sculpture', |
|
| 77 | - 'Season', |
|
| 78 | - 'SheetMusic', |
|
| 79 | - 'ShortStory', |
|
| 80 | - 'SoftwareApplication', |
|
| 81 | - 'SoftwareSourceCode', |
|
| 82 | - 'SpecialAnnouncement', |
|
| 83 | - 'Thesis', |
|
| 84 | - 'TvSeason', |
|
| 85 | - 'TvSeries', |
|
| 86 | - 'VisualArtwork', |
|
| 87 | - 'WebContent', |
|
| 88 | - 'WebPage', |
|
| 89 | - 'WebPageElement', |
|
| 90 | - 'WebSite', |
|
| 91 | - 'AdvertiserContentArticle', |
|
| 92 | - 'NewsArticle', |
|
| 93 | - 'Report', |
|
| 94 | - 'SatiricalArticle', |
|
| 95 | - 'ScholarlyArticle', |
|
| 96 | - 'SocialMediaPosting', |
|
| 97 | - 'TechArticle', |
|
| 98 | - 'AnalysisNewsArticle', |
|
| 99 | - 'AskPublicNewsArticle', |
|
| 100 | - 'BackgroundNewsArticle', |
|
| 101 | - 'OpinionNewsArticle', |
|
| 102 | - 'ReportageNewsArticle', |
|
| 103 | - 'ReviewNewsArticle', |
|
| 104 | - 'MedicalScholarlyArticle', |
|
| 105 | - 'BlogPosting', |
|
| 106 | - 'DiscussionForumPosting', |
|
| 107 | - 'LiveBlogPosting', |
|
| 108 | - 'ApiReference', |
|
| 109 | - 'Audiobook', |
|
| 110 | - 'MovieClip', |
|
| 111 | - 'RadioClip', |
|
| 112 | - 'TvClip', |
|
| 113 | - 'VideoGameClip', |
|
| 114 | - 'ProductCollection', |
|
| 115 | - 'ComicCoverArt', |
|
| 116 | - 'Answer', |
|
| 117 | - 'CorrectionComment', |
|
| 118 | - 'Question', |
|
| 119 | - 'PodcastSeason', |
|
| 120 | - 'RadioSeason', |
|
| 121 | - 'TvSeason', |
|
| 122 | - 'BookSeries', |
|
| 123 | - 'MovieSeries', |
|
| 124 | - 'Periodical', |
|
| 125 | - 'PodcastSeries', |
|
| 126 | - 'RadioSeries', |
|
| 127 | - 'TvSeries', |
|
| 128 | - 'VideoGameSeries', |
|
| 129 | - 'ComicSeries', |
|
| 130 | - 'Newspaper', |
|
| 131 | - 'DataFeed', |
|
| 132 | - 'CompleteDataFeed', |
|
| 133 | - 'CategoryCodeSet', |
|
| 134 | - 'NoteDigitalDocument', |
|
| 135 | - 'PresentationDigitalDocument', |
|
| 136 | - 'SpreadsheetDigitalDocument', |
|
| 137 | - 'TextDigitalDocument', |
|
| 138 | - 'PodcastEpisode', |
|
| 139 | - 'RadioEpisode', |
|
| 140 | - 'TvEpisode', |
|
| 141 | - 'VideoGame', |
|
| 142 | - 'Recipe', |
|
| 143 | - 'Course', |
|
| 144 | - 'Quiz', |
|
| 145 | - 'LegislationObject', |
|
| 146 | - 'AudioObject', |
|
| 147 | - 'DModel', |
|
| 148 | - 'DataDownload', |
|
| 149 | - 'ImageObject', |
|
| 150 | - 'LegislationObject', |
|
| 151 | - 'MusicVideoObject', |
|
| 152 | - 'VideoObject', |
|
| 153 | - 'Audiobook', |
|
| 154 | - 'Barcode', |
|
| 155 | - 'EmailMessage', |
|
| 156 | - 'MusicAlbum', |
|
| 157 | - 'MusicRelease', |
|
| 158 | - 'ComicIssue', |
|
| 159 | - 'ClaimReview', |
|
| 160 | - 'CriticReview', |
|
| 161 | - 'EmployerReview', |
|
| 162 | - 'MediaReview', |
|
| 163 | - 'Recommendation', |
|
| 164 | - 'UserReview', |
|
| 165 | - 'ReviewNewsArticle', |
|
| 166 | - 'MobileApplication', |
|
| 167 | - 'VideoGame', |
|
| 168 | - 'WebApplication', |
|
| 169 | - 'CoverArt', |
|
| 170 | - 'ComicCoverArt', |
|
| 171 | - 'HealthTopicContent', |
|
| 172 | - 'AboutPage', |
|
| 173 | - 'CheckoutPage', |
|
| 174 | - 'CollectionPage', |
|
| 175 | - 'ContactPage', |
|
| 176 | - 'FaqPage', |
|
| 177 | - 'ItemPage', |
|
| 178 | - 'MedicalWebPage', |
|
| 179 | - 'ProfilePage', |
|
| 180 | - 'QaPage', |
|
| 181 | - 'RealEstateListing', |
|
| 182 | - 'SearchResultsPage', |
|
| 183 | - 'MediaGallery', |
|
| 184 | - 'ImageGallery', |
|
| 185 | - 'VideoGallery', |
|
| 186 | - 'SiteNavigationElement', |
|
| 187 | - 'Table', |
|
| 188 | - 'WpAdBlock', |
|
| 189 | - 'WpFooter', |
|
| 190 | - 'WpHeader', |
|
| 191 | - 'WpSideBar', |
|
| 192 | - ); |
|
| 19 | + private static $schema_descendants = array( |
|
| 20 | + 'AmpStory', |
|
| 21 | + 'ArchiveComponent', |
|
| 22 | + 'Article', |
|
| 23 | + 'Atlas', |
|
| 24 | + 'Blog', |
|
| 25 | + 'Book', |
|
| 26 | + 'Chapter', |
|
| 27 | + 'Claim', |
|
| 28 | + 'Clip', |
|
| 29 | + 'Code', |
|
| 30 | + 'Collection', |
|
| 31 | + 'ComicStory', |
|
| 32 | + 'Comment', |
|
| 33 | + 'Conversation', |
|
| 34 | + 'Course', |
|
| 35 | + 'CreativeWorkSeason', |
|
| 36 | + 'CreativeWorkSeries', |
|
| 37 | + 'DataCatalog', |
|
| 38 | + 'Dataset', |
|
| 39 | + 'DefinedTermSet', |
|
| 40 | + 'Diet', |
|
| 41 | + 'DigitalDocument', |
|
| 42 | + 'Drawing', |
|
| 43 | + 'EducationalOccupationalCredential', |
|
| 44 | + 'Episode', |
|
| 45 | + 'ExercisePlan', |
|
| 46 | + 'Game', |
|
| 47 | + 'Guide', |
|
| 48 | + 'HowTo', |
|
| 49 | + 'HowToDirection', |
|
| 50 | + 'HowToSection', |
|
| 51 | + 'HowToStep', |
|
| 52 | + 'HowToTip', |
|
| 53 | + 'HyperToc', |
|
| 54 | + 'HyperTocEntry', |
|
| 55 | + 'LearningResource', |
|
| 56 | + 'Legislation', |
|
| 57 | + 'Manuscript', |
|
| 58 | + 'Map', |
|
| 59 | + 'MathSolver', |
|
| 60 | + 'MediaObject', |
|
| 61 | + 'Menu', |
|
| 62 | + 'MenuSection', |
|
| 63 | + 'Message', |
|
| 64 | + 'Movie', |
|
| 65 | + 'MusicComposition', |
|
| 66 | + 'MusicPlaylist', |
|
| 67 | + 'MusicRecording', |
|
| 68 | + 'Painting', |
|
| 69 | + 'Photograph', |
|
| 70 | + 'Play', |
|
| 71 | + 'Poster', |
|
| 72 | + 'PublicationIssue', |
|
| 73 | + 'PublicationVolume', |
|
| 74 | + 'Quotation', |
|
| 75 | + 'Review', |
|
| 76 | + 'Sculpture', |
|
| 77 | + 'Season', |
|
| 78 | + 'SheetMusic', |
|
| 79 | + 'ShortStory', |
|
| 80 | + 'SoftwareApplication', |
|
| 81 | + 'SoftwareSourceCode', |
|
| 82 | + 'SpecialAnnouncement', |
|
| 83 | + 'Thesis', |
|
| 84 | + 'TvSeason', |
|
| 85 | + 'TvSeries', |
|
| 86 | + 'VisualArtwork', |
|
| 87 | + 'WebContent', |
|
| 88 | + 'WebPage', |
|
| 89 | + 'WebPageElement', |
|
| 90 | + 'WebSite', |
|
| 91 | + 'AdvertiserContentArticle', |
|
| 92 | + 'NewsArticle', |
|
| 93 | + 'Report', |
|
| 94 | + 'SatiricalArticle', |
|
| 95 | + 'ScholarlyArticle', |
|
| 96 | + 'SocialMediaPosting', |
|
| 97 | + 'TechArticle', |
|
| 98 | + 'AnalysisNewsArticle', |
|
| 99 | + 'AskPublicNewsArticle', |
|
| 100 | + 'BackgroundNewsArticle', |
|
| 101 | + 'OpinionNewsArticle', |
|
| 102 | + 'ReportageNewsArticle', |
|
| 103 | + 'ReviewNewsArticle', |
|
| 104 | + 'MedicalScholarlyArticle', |
|
| 105 | + 'BlogPosting', |
|
| 106 | + 'DiscussionForumPosting', |
|
| 107 | + 'LiveBlogPosting', |
|
| 108 | + 'ApiReference', |
|
| 109 | + 'Audiobook', |
|
| 110 | + 'MovieClip', |
|
| 111 | + 'RadioClip', |
|
| 112 | + 'TvClip', |
|
| 113 | + 'VideoGameClip', |
|
| 114 | + 'ProductCollection', |
|
| 115 | + 'ComicCoverArt', |
|
| 116 | + 'Answer', |
|
| 117 | + 'CorrectionComment', |
|
| 118 | + 'Question', |
|
| 119 | + 'PodcastSeason', |
|
| 120 | + 'RadioSeason', |
|
| 121 | + 'TvSeason', |
|
| 122 | + 'BookSeries', |
|
| 123 | + 'MovieSeries', |
|
| 124 | + 'Periodical', |
|
| 125 | + 'PodcastSeries', |
|
| 126 | + 'RadioSeries', |
|
| 127 | + 'TvSeries', |
|
| 128 | + 'VideoGameSeries', |
|
| 129 | + 'ComicSeries', |
|
| 130 | + 'Newspaper', |
|
| 131 | + 'DataFeed', |
|
| 132 | + 'CompleteDataFeed', |
|
| 133 | + 'CategoryCodeSet', |
|
| 134 | + 'NoteDigitalDocument', |
|
| 135 | + 'PresentationDigitalDocument', |
|
| 136 | + 'SpreadsheetDigitalDocument', |
|
| 137 | + 'TextDigitalDocument', |
|
| 138 | + 'PodcastEpisode', |
|
| 139 | + 'RadioEpisode', |
|
| 140 | + 'TvEpisode', |
|
| 141 | + 'VideoGame', |
|
| 142 | + 'Recipe', |
|
| 143 | + 'Course', |
|
| 144 | + 'Quiz', |
|
| 145 | + 'LegislationObject', |
|
| 146 | + 'AudioObject', |
|
| 147 | + 'DModel', |
|
| 148 | + 'DataDownload', |
|
| 149 | + 'ImageObject', |
|
| 150 | + 'LegislationObject', |
|
| 151 | + 'MusicVideoObject', |
|
| 152 | + 'VideoObject', |
|
| 153 | + 'Audiobook', |
|
| 154 | + 'Barcode', |
|
| 155 | + 'EmailMessage', |
|
| 156 | + 'MusicAlbum', |
|
| 157 | + 'MusicRelease', |
|
| 158 | + 'ComicIssue', |
|
| 159 | + 'ClaimReview', |
|
| 160 | + 'CriticReview', |
|
| 161 | + 'EmployerReview', |
|
| 162 | + 'MediaReview', |
|
| 163 | + 'Recommendation', |
|
| 164 | + 'UserReview', |
|
| 165 | + 'ReviewNewsArticle', |
|
| 166 | + 'MobileApplication', |
|
| 167 | + 'VideoGame', |
|
| 168 | + 'WebApplication', |
|
| 169 | + 'CoverArt', |
|
| 170 | + 'ComicCoverArt', |
|
| 171 | + 'HealthTopicContent', |
|
| 172 | + 'AboutPage', |
|
| 173 | + 'CheckoutPage', |
|
| 174 | + 'CollectionPage', |
|
| 175 | + 'ContactPage', |
|
| 176 | + 'FaqPage', |
|
| 177 | + 'ItemPage', |
|
| 178 | + 'MedicalWebPage', |
|
| 179 | + 'ProfilePage', |
|
| 180 | + 'QaPage', |
|
| 181 | + 'RealEstateListing', |
|
| 182 | + 'SearchResultsPage', |
|
| 183 | + 'MediaGallery', |
|
| 184 | + 'ImageGallery', |
|
| 185 | + 'VideoGallery', |
|
| 186 | + 'SiteNavigationElement', |
|
| 187 | + 'Table', |
|
| 188 | + 'WpAdBlock', |
|
| 189 | + 'WpFooter', |
|
| 190 | + 'WpHeader', |
|
| 191 | + 'WpSideBar', |
|
| 192 | + ); |
|
| 193 | 193 | |
| 194 | - public function __construct() { |
|
| 195 | - add_filter( 'wl_after_get_jsonld', array( $this, 'wl_after_get_jsonld' ), 10, 2 ); |
|
| 196 | - } |
|
| 194 | + public function __construct() { |
|
| 195 | + add_filter( 'wl_after_get_jsonld', array( $this, 'wl_after_get_jsonld' ), 10, 2 ); |
|
| 196 | + } |
|
| 197 | 197 | |
| 198 | - public function wl_after_get_jsonld( $jsonld, $post_id ) { |
|
| 198 | + public function wl_after_get_jsonld( $jsonld, $post_id ) { |
|
| 199 | 199 | |
| 200 | - if ( count( $jsonld ) === 0 || ! is_array( $jsonld[0] ) || ! array_key_exists( '@type', $jsonld[0] ) || array_key_exists( 'mentions', $jsonld[0] ) ) { |
|
| 201 | - return $jsonld; |
|
| 202 | - } |
|
| 200 | + if ( count( $jsonld ) === 0 || ! is_array( $jsonld[0] ) || ! array_key_exists( '@type', $jsonld[0] ) || array_key_exists( 'mentions', $jsonld[0] ) ) { |
|
| 201 | + return $jsonld; |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - $type = $jsonld[0]['@type']; |
|
| 204 | + $type = $jsonld[0]['@type']; |
|
| 205 | 205 | |
| 206 | - if ( ! $this->entity_is_descendant_of_creative_work( $type ) && ! $this->entity_is_creative_work( $type ) ) { |
|
| 207 | - return $jsonld; |
|
| 208 | - } |
|
| 206 | + if ( ! $this->entity_is_descendant_of_creative_work( $type ) && ! $this->entity_is_creative_work( $type ) ) { |
|
| 207 | + return $jsonld; |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | - $entity_references = Object_Relation_Service::get_instance() |
|
| 211 | - ->get_references( $post_id, Object_Type_Enum::POST ); |
|
| 210 | + $entity_references = Object_Relation_Service::get_instance() |
|
| 211 | + ->get_references( $post_id, Object_Type_Enum::POST ); |
|
| 212 | 212 | |
| 213 | - $about_id = array(); |
|
| 214 | - if ( array_key_exists( 'about', $jsonld[0] ) && is_array( $jsonld[0]['about'] ) ) { |
|
| 215 | - foreach ( $jsonld[0]['about'] as $about ) { |
|
| 216 | - $about_id[] = $about['@id']; |
|
| 217 | - } |
|
| 218 | - } |
|
| 213 | + $about_id = array(); |
|
| 214 | + if ( array_key_exists( 'about', $jsonld[0] ) && is_array( $jsonld[0]['about'] ) ) { |
|
| 215 | + foreach ( $jsonld[0]['about'] as $about ) { |
|
| 216 | + $about_id[] = $about['@id']; |
|
| 217 | + } |
|
| 218 | + } |
|
| 219 | 219 | |
| 220 | - $jsonld[0]['mentions'] = array_values( |
|
| 221 | - array_filter( |
|
| 222 | - array_map( |
|
| 223 | - function ( $item ) use ( $about_id ) { |
|
| 224 | - $id = \Wordlift_Entity_Service::get_instance()->get_uri( $item->get_id() ); |
|
| 225 | - if ( ! $id || in_array( $id, $about_id, true ) ) { |
|
| 226 | - return false; |
|
| 227 | - } |
|
| 220 | + $jsonld[0]['mentions'] = array_values( |
|
| 221 | + array_filter( |
|
| 222 | + array_map( |
|
| 223 | + function ( $item ) use ( $about_id ) { |
|
| 224 | + $id = \Wordlift_Entity_Service::get_instance()->get_uri( $item->get_id() ); |
|
| 225 | + if ( ! $id || in_array( $id, $about_id, true ) ) { |
|
| 226 | + return false; |
|
| 227 | + } |
|
| 228 | 228 | |
| 229 | - return array( '@id' => $id ); |
|
| 229 | + return array( '@id' => $id ); |
|
| 230 | 230 | |
| 231 | - }, |
|
| 232 | - $entity_references |
|
| 233 | - ) |
|
| 234 | - ) |
|
| 235 | - ); |
|
| 231 | + }, |
|
| 232 | + $entity_references |
|
| 233 | + ) |
|
| 234 | + ) |
|
| 235 | + ); |
|
| 236 | 236 | |
| 237 | - // Remove mentions if the count is zero. |
|
| 238 | - if ( count( $jsonld[0]['mentions'] ) === 0 ) { |
|
| 239 | - unset( $jsonld[0]['mentions'] ); |
|
| 240 | - } |
|
| 237 | + // Remove mentions if the count is zero. |
|
| 238 | + if ( count( $jsonld[0]['mentions'] ) === 0 ) { |
|
| 239 | + unset( $jsonld[0]['mentions'] ); |
|
| 240 | + } |
|
| 241 | 241 | |
| 242 | - return $jsonld; |
|
| 243 | - } |
|
| 242 | + return $jsonld; |
|
| 243 | + } |
|
| 244 | 244 | |
| 245 | - private function entity_is_descendant_of_creative_work( $type ) { |
|
| 246 | - if ( is_string( $type ) ) { |
|
| 247 | - $type = array( $type ); |
|
| 248 | - } |
|
| 245 | + private function entity_is_descendant_of_creative_work( $type ) { |
|
| 246 | + if ( is_string( $type ) ) { |
|
| 247 | + $type = array( $type ); |
|
| 248 | + } |
|
| 249 | 249 | |
| 250 | - return count( array_intersect( $type, $this::$schema_descendants ) ) > 0; |
|
| 251 | - } |
|
| 250 | + return count( array_intersect( $type, $this::$schema_descendants ) ) > 0; |
|
| 251 | + } |
|
| 252 | 252 | |
| 253 | - private function entity_is_creative_work( $type ) { |
|
| 254 | - return ( 'CreativeWork' === $type ) || ( is_array( $type ) && in_array( 'CreativeWork', $type, true ) ); |
|
| 255 | - } |
|
| 253 | + private function entity_is_creative_work( $type ) { |
|
| 254 | + return ( 'CreativeWork' === $type ) || ( is_array( $type ) && in_array( 'CreativeWork', $type, true ) ); |
|
| 255 | + } |
|
| 256 | 256 | |
| 257 | 257 | } |
@@ -192,27 +192,27 @@ discard block |
||
| 192 | 192 | ); |
| 193 | 193 | |
| 194 | 194 | public function __construct() { |
| 195 | - add_filter( 'wl_after_get_jsonld', array( $this, 'wl_after_get_jsonld' ), 10, 2 ); |
|
| 195 | + add_filter('wl_after_get_jsonld', array($this, 'wl_after_get_jsonld'), 10, 2); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - public function wl_after_get_jsonld( $jsonld, $post_id ) { |
|
| 198 | + public function wl_after_get_jsonld($jsonld, $post_id) { |
|
| 199 | 199 | |
| 200 | - if ( count( $jsonld ) === 0 || ! is_array( $jsonld[0] ) || ! array_key_exists( '@type', $jsonld[0] ) || array_key_exists( 'mentions', $jsonld[0] ) ) { |
|
| 200 | + if (count($jsonld) === 0 || ! is_array($jsonld[0]) || ! array_key_exists('@type', $jsonld[0]) || array_key_exists('mentions', $jsonld[0])) { |
|
| 201 | 201 | return $jsonld; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | $type = $jsonld[0]['@type']; |
| 205 | 205 | |
| 206 | - if ( ! $this->entity_is_descendant_of_creative_work( $type ) && ! $this->entity_is_creative_work( $type ) ) { |
|
| 206 | + if ( ! $this->entity_is_descendant_of_creative_work($type) && ! $this->entity_is_creative_work($type)) { |
|
| 207 | 207 | return $jsonld; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | $entity_references = Object_Relation_Service::get_instance() |
| 211 | - ->get_references( $post_id, Object_Type_Enum::POST ); |
|
| 211 | + ->get_references($post_id, Object_Type_Enum::POST); |
|
| 212 | 212 | |
| 213 | 213 | $about_id = array(); |
| 214 | - if ( array_key_exists( 'about', $jsonld[0] ) && is_array( $jsonld[0]['about'] ) ) { |
|
| 215 | - foreach ( $jsonld[0]['about'] as $about ) { |
|
| 214 | + if (array_key_exists('about', $jsonld[0]) && is_array($jsonld[0]['about'])) { |
|
| 215 | + foreach ($jsonld[0]['about'] as $about) { |
|
| 216 | 216 | $about_id[] = $about['@id']; |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -220,13 +220,13 @@ discard block |
||
| 220 | 220 | $jsonld[0]['mentions'] = array_values( |
| 221 | 221 | array_filter( |
| 222 | 222 | array_map( |
| 223 | - function ( $item ) use ( $about_id ) { |
|
| 224 | - $id = \Wordlift_Entity_Service::get_instance()->get_uri( $item->get_id() ); |
|
| 225 | - if ( ! $id || in_array( $id, $about_id, true ) ) { |
|
| 223 | + function($item) use ($about_id) { |
|
| 224 | + $id = \Wordlift_Entity_Service::get_instance()->get_uri($item->get_id()); |
|
| 225 | + if ( ! $id || in_array($id, $about_id, true)) { |
|
| 226 | 226 | return false; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - return array( '@id' => $id ); |
|
| 229 | + return array('@id' => $id); |
|
| 230 | 230 | |
| 231 | 231 | }, |
| 232 | 232 | $entity_references |
@@ -235,23 +235,23 @@ discard block |
||
| 235 | 235 | ); |
| 236 | 236 | |
| 237 | 237 | // Remove mentions if the count is zero. |
| 238 | - if ( count( $jsonld[0]['mentions'] ) === 0 ) { |
|
| 239 | - unset( $jsonld[0]['mentions'] ); |
|
| 238 | + if (count($jsonld[0]['mentions']) === 0) { |
|
| 239 | + unset($jsonld[0]['mentions']); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | return $jsonld; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - private function entity_is_descendant_of_creative_work( $type ) { |
|
| 246 | - if ( is_string( $type ) ) { |
|
| 247 | - $type = array( $type ); |
|
| 245 | + private function entity_is_descendant_of_creative_work($type) { |
|
| 246 | + if (is_string($type)) { |
|
| 247 | + $type = array($type); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - return count( array_intersect( $type, $this::$schema_descendants ) ) > 0; |
|
| 250 | + return count(array_intersect($type, $this::$schema_descendants)) > 0; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - private function entity_is_creative_work( $type ) { |
|
| 254 | - return ( 'CreativeWork' === $type ) || ( is_array( $type ) && in_array( 'CreativeWork', $type, true ) ); |
|
| 253 | + private function entity_is_creative_work($type) { |
|
| 254 | + return ('CreativeWork' === $type) || (is_array($type) && in_array('CreativeWork', $type, true)); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | use Wordlift\Task\Single_Call_Task; |
| 20 | 20 | |
| 21 | 21 | if ( ! defined( 'ABSPATH' ) ) { |
| 22 | - exit; |
|
| 22 | + exit; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | define( 'WL_FOOD_KG_FILE', __FILE__ ); |
@@ -27,84 +27,84 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | function __wl_foodkg__load() { |
| 29 | 29 | |
| 30 | - // Autoloader for plugin itself. |
|
| 31 | - if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { |
|
| 32 | - require __DIR__ . '/vendor/autoload.php'; |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - $container_builder = new ContainerBuilder(); |
|
| 36 | - $loader = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) ); |
|
| 37 | - $loader->load( 'services.yml' ); |
|
| 38 | - $container_builder->compile(); |
|
| 39 | - |
|
| 40 | - $notices = $container_builder->get( 'Wordlift\Modules\Food_Kg\Notices' ); |
|
| 41 | - $notices->register_hooks(); |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * @var Preconditions $preconditions |
|
| 45 | - */ |
|
| 46 | - $preconditions = $container_builder->get( 'Wordlift\Modules\Food_Kg\Preconditions' ); |
|
| 47 | - if ( ! $preconditions->pass() ) { |
|
| 48 | - return; |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - // Meta Box. |
|
| 52 | - $meta_box = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Meta_Box' ); |
|
| 53 | - $meta_box->register_hooks(); |
|
| 54 | - |
|
| 55 | - $module = $container_builder->get( 'Wordlift\Modules\Food_Kg\Module' ); |
|
| 56 | - $module->register_hooks(); |
|
| 57 | - |
|
| 58 | - /** @var Jsonld $jsonld */ |
|
| 59 | - $jsonld = $container_builder->get( 'Wordlift\Modules\Food_Kg\Jsonld' ); |
|
| 60 | - $jsonld->register_hooks(); |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * Ingredients API. |
|
| 64 | - */ |
|
| 65 | - $ingredients_api = $container_builder->get( 'Wordlift\Modules\Food_Kg\Ingredients_API' ); |
|
| 66 | - $ingredients_api->register_hooks(); |
|
| 67 | - |
|
| 68 | - /** @var Main_Ingredient_Jsonld $jsonld */ |
|
| 69 | - $main_ingredient_jsonld = $container_builder->get( 'Wordlift\Modules\Food_Kg\Main_Ingredient_Jsonld' ); |
|
| 70 | - $main_ingredient_jsonld->register_hooks(); |
|
| 71 | - |
|
| 72 | - // Main Ingredient Background Task. |
|
| 73 | - $main_ingredient_recipe_lift = $container_builder->get( 'Wordlift\Modules\Food_Kg\Main_Ingredient_Recipe_Lift_Strategy' ); |
|
| 74 | - Background_Task_Factory::create( |
|
| 75 | - new All_Posts_Task( |
|
| 76 | - array( $main_ingredient_recipe_lift, 'process' ), |
|
| 77 | - 'wprm_recipe', |
|
| 78 | - 'sync-main-ingredient' |
|
| 79 | - ), |
|
| 80 | - '/main-ingredient', |
|
| 81 | - 'sync-main-ingredient', |
|
| 82 | - __( 'Synchronize Main Ingredient', 'wordlift' ) |
|
| 83 | - ); |
|
| 84 | - |
|
| 85 | - // Ingredients Taxonomy Background Task. |
|
| 86 | - $ingredients_taxonomy_recipe_lift = $container_builder->get( 'Wordlift\Modules\Food_Kg\Ingredients_Taxonomy_Recipe_Lift_Strategy' ); |
|
| 87 | - Background_Task_Factory::create( |
|
| 88 | - new Single_Call_Task( |
|
| 89 | - array( $ingredients_taxonomy_recipe_lift, 'run' ), |
|
| 90 | - 'sync-ingredients-taxonomy' |
|
| 91 | - ), |
|
| 92 | - '/sync-ingredients-taxonomy', |
|
| 93 | - 'sync-ingredients-taxonomy', |
|
| 94 | - __( 'Synchronize Ingredients Taxonomy', 'wordlift' ) |
|
| 95 | - ); |
|
| 96 | - |
|
| 97 | - if ( is_admin() ) { |
|
| 98 | - $page = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Page' ); |
|
| 99 | - $page->register_hooks(); |
|
| 100 | - |
|
| 101 | - $page = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Ingredients_Taxonomy_Page' ); |
|
| 102 | - $page->register_hooks(); |
|
| 103 | - |
|
| 104 | - // Download Ingredients Data. |
|
| 105 | - $download_ingredients_data = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Download_Ingredients_Data' ); |
|
| 106 | - $download_ingredients_data->register_hooks(); |
|
| 107 | - } |
|
| 30 | + // Autoloader for plugin itself. |
|
| 31 | + if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { |
|
| 32 | + require __DIR__ . '/vendor/autoload.php'; |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + $container_builder = new ContainerBuilder(); |
|
| 36 | + $loader = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) ); |
|
| 37 | + $loader->load( 'services.yml' ); |
|
| 38 | + $container_builder->compile(); |
|
| 39 | + |
|
| 40 | + $notices = $container_builder->get( 'Wordlift\Modules\Food_Kg\Notices' ); |
|
| 41 | + $notices->register_hooks(); |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * @var Preconditions $preconditions |
|
| 45 | + */ |
|
| 46 | + $preconditions = $container_builder->get( 'Wordlift\Modules\Food_Kg\Preconditions' ); |
|
| 47 | + if ( ! $preconditions->pass() ) { |
|
| 48 | + return; |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + // Meta Box. |
|
| 52 | + $meta_box = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Meta_Box' ); |
|
| 53 | + $meta_box->register_hooks(); |
|
| 54 | + |
|
| 55 | + $module = $container_builder->get( 'Wordlift\Modules\Food_Kg\Module' ); |
|
| 56 | + $module->register_hooks(); |
|
| 57 | + |
|
| 58 | + /** @var Jsonld $jsonld */ |
|
| 59 | + $jsonld = $container_builder->get( 'Wordlift\Modules\Food_Kg\Jsonld' ); |
|
| 60 | + $jsonld->register_hooks(); |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * Ingredients API. |
|
| 64 | + */ |
|
| 65 | + $ingredients_api = $container_builder->get( 'Wordlift\Modules\Food_Kg\Ingredients_API' ); |
|
| 66 | + $ingredients_api->register_hooks(); |
|
| 67 | + |
|
| 68 | + /** @var Main_Ingredient_Jsonld $jsonld */ |
|
| 69 | + $main_ingredient_jsonld = $container_builder->get( 'Wordlift\Modules\Food_Kg\Main_Ingredient_Jsonld' ); |
|
| 70 | + $main_ingredient_jsonld->register_hooks(); |
|
| 71 | + |
|
| 72 | + // Main Ingredient Background Task. |
|
| 73 | + $main_ingredient_recipe_lift = $container_builder->get( 'Wordlift\Modules\Food_Kg\Main_Ingredient_Recipe_Lift_Strategy' ); |
|
| 74 | + Background_Task_Factory::create( |
|
| 75 | + new All_Posts_Task( |
|
| 76 | + array( $main_ingredient_recipe_lift, 'process' ), |
|
| 77 | + 'wprm_recipe', |
|
| 78 | + 'sync-main-ingredient' |
|
| 79 | + ), |
|
| 80 | + '/main-ingredient', |
|
| 81 | + 'sync-main-ingredient', |
|
| 82 | + __( 'Synchronize Main Ingredient', 'wordlift' ) |
|
| 83 | + ); |
|
| 84 | + |
|
| 85 | + // Ingredients Taxonomy Background Task. |
|
| 86 | + $ingredients_taxonomy_recipe_lift = $container_builder->get( 'Wordlift\Modules\Food_Kg\Ingredients_Taxonomy_Recipe_Lift_Strategy' ); |
|
| 87 | + Background_Task_Factory::create( |
|
| 88 | + new Single_Call_Task( |
|
| 89 | + array( $ingredients_taxonomy_recipe_lift, 'run' ), |
|
| 90 | + 'sync-ingredients-taxonomy' |
|
| 91 | + ), |
|
| 92 | + '/sync-ingredients-taxonomy', |
|
| 93 | + 'sync-ingredients-taxonomy', |
|
| 94 | + __( 'Synchronize Ingredients Taxonomy', 'wordlift' ) |
|
| 95 | + ); |
|
| 96 | + |
|
| 97 | + if ( is_admin() ) { |
|
| 98 | + $page = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Page' ); |
|
| 99 | + $page->register_hooks(); |
|
| 100 | + |
|
| 101 | + $page = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Ingredients_Taxonomy_Page' ); |
|
| 102 | + $page->register_hooks(); |
|
| 103 | + |
|
| 104 | + // Download Ingredients Data. |
|
| 105 | + $download_ingredients_data = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Download_Ingredients_Data' ); |
|
| 106 | + $download_ingredients_data->register_hooks(); |
|
| 107 | + } |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | add_action( 'plugins_loaded', '__wl_foodkg__load' ); |
@@ -18,94 +18,94 @@ |
||
| 18 | 18 | use Wordlift\Task\Background\Background_Task_Factory; |
| 19 | 19 | use Wordlift\Task\Single_Call_Task; |
| 20 | 20 | |
| 21 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 21 | +if ( ! defined('ABSPATH')) { |
|
| 22 | 22 | exit; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | -define( 'WL_FOOD_KG_FILE', __FILE__ ); |
|
| 26 | -define( 'WL_FOOD_KG_DIR_PATH', dirname( WL_FOOD_KG_FILE ) ); |
|
| 25 | +define('WL_FOOD_KG_FILE', __FILE__); |
|
| 26 | +define('WL_FOOD_KG_DIR_PATH', dirname(WL_FOOD_KG_FILE)); |
|
| 27 | 27 | |
| 28 | 28 | function __wl_foodkg__load() { |
| 29 | 29 | |
| 30 | 30 | // Autoloader for plugin itself. |
| 31 | - if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { |
|
| 32 | - require __DIR__ . '/vendor/autoload.php'; |
|
| 31 | + if (file_exists(__DIR__.'/vendor/autoload.php')) { |
|
| 32 | + require __DIR__.'/vendor/autoload.php'; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $container_builder = new ContainerBuilder(); |
| 36 | - $loader = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) ); |
|
| 37 | - $loader->load( 'services.yml' ); |
|
| 36 | + $loader = new YamlFileLoader($container_builder, new FileLocator(__DIR__)); |
|
| 37 | + $loader->load('services.yml'); |
|
| 38 | 38 | $container_builder->compile(); |
| 39 | 39 | |
| 40 | - $notices = $container_builder->get( 'Wordlift\Modules\Food_Kg\Notices' ); |
|
| 40 | + $notices = $container_builder->get('Wordlift\Modules\Food_Kg\Notices'); |
|
| 41 | 41 | $notices->register_hooks(); |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * @var Preconditions $preconditions |
| 45 | 45 | */ |
| 46 | - $preconditions = $container_builder->get( 'Wordlift\Modules\Food_Kg\Preconditions' ); |
|
| 47 | - if ( ! $preconditions->pass() ) { |
|
| 46 | + $preconditions = $container_builder->get('Wordlift\Modules\Food_Kg\Preconditions'); |
|
| 47 | + if ( ! $preconditions->pass()) { |
|
| 48 | 48 | return; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | // Meta Box. |
| 52 | - $meta_box = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Meta_Box' ); |
|
| 52 | + $meta_box = $container_builder->get('Wordlift\Modules\Food_Kg\Admin\Meta_Box'); |
|
| 53 | 53 | $meta_box->register_hooks(); |
| 54 | 54 | |
| 55 | - $module = $container_builder->get( 'Wordlift\Modules\Food_Kg\Module' ); |
|
| 55 | + $module = $container_builder->get('Wordlift\Modules\Food_Kg\Module'); |
|
| 56 | 56 | $module->register_hooks(); |
| 57 | 57 | |
| 58 | 58 | /** @var Jsonld $jsonld */ |
| 59 | - $jsonld = $container_builder->get( 'Wordlift\Modules\Food_Kg\Jsonld' ); |
|
| 59 | + $jsonld = $container_builder->get('Wordlift\Modules\Food_Kg\Jsonld'); |
|
| 60 | 60 | $jsonld->register_hooks(); |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Ingredients API. |
| 64 | 64 | */ |
| 65 | - $ingredients_api = $container_builder->get( 'Wordlift\Modules\Food_Kg\Ingredients_API' ); |
|
| 65 | + $ingredients_api = $container_builder->get('Wordlift\Modules\Food_Kg\Ingredients_API'); |
|
| 66 | 66 | $ingredients_api->register_hooks(); |
| 67 | 67 | |
| 68 | 68 | /** @var Main_Ingredient_Jsonld $jsonld */ |
| 69 | - $main_ingredient_jsonld = $container_builder->get( 'Wordlift\Modules\Food_Kg\Main_Ingredient_Jsonld' ); |
|
| 69 | + $main_ingredient_jsonld = $container_builder->get('Wordlift\Modules\Food_Kg\Main_Ingredient_Jsonld'); |
|
| 70 | 70 | $main_ingredient_jsonld->register_hooks(); |
| 71 | 71 | |
| 72 | 72 | // Main Ingredient Background Task. |
| 73 | - $main_ingredient_recipe_lift = $container_builder->get( 'Wordlift\Modules\Food_Kg\Main_Ingredient_Recipe_Lift_Strategy' ); |
|
| 73 | + $main_ingredient_recipe_lift = $container_builder->get('Wordlift\Modules\Food_Kg\Main_Ingredient_Recipe_Lift_Strategy'); |
|
| 74 | 74 | Background_Task_Factory::create( |
| 75 | 75 | new All_Posts_Task( |
| 76 | - array( $main_ingredient_recipe_lift, 'process' ), |
|
| 76 | + array($main_ingredient_recipe_lift, 'process'), |
|
| 77 | 77 | 'wprm_recipe', |
| 78 | 78 | 'sync-main-ingredient' |
| 79 | 79 | ), |
| 80 | 80 | '/main-ingredient', |
| 81 | 81 | 'sync-main-ingredient', |
| 82 | - __( 'Synchronize Main Ingredient', 'wordlift' ) |
|
| 82 | + __('Synchronize Main Ingredient', 'wordlift') |
|
| 83 | 83 | ); |
| 84 | 84 | |
| 85 | 85 | // Ingredients Taxonomy Background Task. |
| 86 | - $ingredients_taxonomy_recipe_lift = $container_builder->get( 'Wordlift\Modules\Food_Kg\Ingredients_Taxonomy_Recipe_Lift_Strategy' ); |
|
| 86 | + $ingredients_taxonomy_recipe_lift = $container_builder->get('Wordlift\Modules\Food_Kg\Ingredients_Taxonomy_Recipe_Lift_Strategy'); |
|
| 87 | 87 | Background_Task_Factory::create( |
| 88 | 88 | new Single_Call_Task( |
| 89 | - array( $ingredients_taxonomy_recipe_lift, 'run' ), |
|
| 89 | + array($ingredients_taxonomy_recipe_lift, 'run'), |
|
| 90 | 90 | 'sync-ingredients-taxonomy' |
| 91 | 91 | ), |
| 92 | 92 | '/sync-ingredients-taxonomy', |
| 93 | 93 | 'sync-ingredients-taxonomy', |
| 94 | - __( 'Synchronize Ingredients Taxonomy', 'wordlift' ) |
|
| 94 | + __('Synchronize Ingredients Taxonomy', 'wordlift') |
|
| 95 | 95 | ); |
| 96 | 96 | |
| 97 | - if ( is_admin() ) { |
|
| 98 | - $page = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Page' ); |
|
| 97 | + if (is_admin()) { |
|
| 98 | + $page = $container_builder->get('Wordlift\Modules\Food_Kg\Admin\Page'); |
|
| 99 | 99 | $page->register_hooks(); |
| 100 | 100 | |
| 101 | - $page = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Ingredients_Taxonomy_Page' ); |
|
| 101 | + $page = $container_builder->get('Wordlift\Modules\Food_Kg\Admin\Ingredients_Taxonomy_Page'); |
|
| 102 | 102 | $page->register_hooks(); |
| 103 | 103 | |
| 104 | 104 | // Download Ingredients Data. |
| 105 | - $download_ingredients_data = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Download_Ingredients_Data' ); |
|
| 105 | + $download_ingredients_data = $container_builder->get('Wordlift\Modules\Food_Kg\Admin\Download_Ingredients_Data'); |
|
| 106 | 106 | $download_ingredients_data->register_hooks(); |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | -add_action( 'plugins_loaded', '__wl_foodkg__load' ); |
|
| 110 | +add_action('plugins_loaded', '__wl_foodkg__load'); |
|
| 111 | 111 | |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | 'version' => 'dev-master', |
| 6 | 6 | 'reference' => '0c42b5a8a77b14e188ff09b4d4edff93cd7dbb39', |
| 7 | 7 | 'type' => 'wordpress-plugin', |
| 8 | - 'install_path' => __DIR__ . '/../../', |
|
| 8 | + 'install_path' => __DIR__.'/../../', |
|
| 9 | 9 | 'aliases' => array(), |
| 10 | 10 | 'dev' => true, |
| 11 | 11 | ), |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | 'version' => 'dev-master', |
| 16 | 16 | 'reference' => '0c42b5a8a77b14e188ff09b4d4edff93cd7dbb39', |
| 17 | 17 | 'type' => 'wordpress-plugin', |
| 18 | - 'install_path' => __DIR__ . '/../../', |
|
| 18 | + 'install_path' => __DIR__.'/../../', |
|
| 19 | 19 | 'aliases' => array(), |
| 20 | 20 | 'dev_requirement' => false, |
| 21 | 21 | ), |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | public static function getVersionRanges($packageName) |
| 138 | 138 | { |
| 139 | 139 | foreach (self::getInstalled() as $installed) { |
| 140 | - if (!isset($installed['versions'][$packageName])) { |
|
| 140 | + if ( ! isset($installed['versions'][$packageName])) { |
|
| 141 | 141 | continue; |
| 142 | 142 | } |
| 143 | 143 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | return implode(' || ', $ranges); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 161 | + throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed'); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -168,18 +168,18 @@ discard block |
||
| 168 | 168 | public static function getVersion($packageName) |
| 169 | 169 | { |
| 170 | 170 | foreach (self::getInstalled() as $installed) { |
| 171 | - if (!isset($installed['versions'][$packageName])) { |
|
| 171 | + if ( ! isset($installed['versions'][$packageName])) { |
|
| 172 | 172 | continue; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if (!isset($installed['versions'][$packageName]['version'])) { |
|
| 175 | + if ( ! isset($installed['versions'][$packageName]['version'])) { |
|
| 176 | 176 | return null; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | return $installed['versions'][$packageName]['version']; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 182 | + throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed'); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -189,18 +189,18 @@ discard block |
||
| 189 | 189 | public static function getPrettyVersion($packageName) |
| 190 | 190 | { |
| 191 | 191 | foreach (self::getInstalled() as $installed) { |
| 192 | - if (!isset($installed['versions'][$packageName])) { |
|
| 192 | + if ( ! isset($installed['versions'][$packageName])) { |
|
| 193 | 193 | continue; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - if (!isset($installed['versions'][$packageName]['pretty_version'])) { |
|
| 196 | + if ( ! isset($installed['versions'][$packageName]['pretty_version'])) { |
|
| 197 | 197 | return null; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | return $installed['versions'][$packageName]['pretty_version']; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 203 | + throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed'); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -210,18 +210,18 @@ discard block |
||
| 210 | 210 | public static function getReference($packageName) |
| 211 | 211 | { |
| 212 | 212 | foreach (self::getInstalled() as $installed) { |
| 213 | - if (!isset($installed['versions'][$packageName])) { |
|
| 213 | + if ( ! isset($installed['versions'][$packageName])) { |
|
| 214 | 214 | continue; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - if (!isset($installed['versions'][$packageName]['reference'])) { |
|
| 217 | + if ( ! isset($installed['versions'][$packageName]['reference'])) { |
|
| 218 | 218 | return null; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | return $installed['versions'][$packageName]['reference']; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 224 | + throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed'); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -231,14 +231,14 @@ discard block |
||
| 231 | 231 | public static function getInstallPath($packageName) |
| 232 | 232 | { |
| 233 | 233 | foreach (self::getInstalled() as $installed) { |
| 234 | - if (!isset($installed['versions'][$packageName])) { |
|
| 234 | + if ( ! isset($installed['versions'][$packageName])) { |
|
| 235 | 235 | continue; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 241 | + throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed'); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | // only require the installed.php file if this file is loaded from its dumped location, |
| 268 | 268 | // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 |
| 269 | 269 | if (substr(__DIR__, -8, 1) !== 'C') { |
| 270 | - self::$installed = include __DIR__ . '/installed.php'; |
|
| 270 | + self::$installed = include __DIR__.'/installed.php'; |
|
| 271 | 271 | } else { |
| 272 | 272 | self::$installed = array(); |
| 273 | 273 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | // only require the installed.php file if this file is loaded from its dumped location, |
| 341 | 341 | // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 |
| 342 | 342 | if (substr(__DIR__, -8, 1) !== 'C') { |
| 343 | - self::$installed = require __DIR__ . '/installed.php'; |
|
| 343 | + self::$installed = require __DIR__.'/installed.php'; |
|
| 344 | 344 | } else { |
| 345 | 345 | self::$installed = array(); |
| 346 | 346 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | public static function loadClassLoader($class) |
| 10 | 10 | { |
| 11 | 11 | if ('Composer\Autoload\ClassLoader' === $class) { |
| 12 | - require __DIR__ . '/ClassLoader.php'; |
|
| 12 | + require __DIR__.'/ClassLoader.php'; |
|
| 13 | 13 | } |
| 14 | 14 | } |
| 15 | 15 | |
@@ -22,13 +22,13 @@ discard block |
||
| 22 | 22 | return self::$loader; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - require __DIR__ . '/platform_check.php'; |
|
| 25 | + require __DIR__.'/platform_check.php'; |
|
| 26 | 26 | |
| 27 | 27 | spl_autoload_register(array('ComposerAutoloaderInit718e370ed095fd597a1f1d468c2b59f4', 'loadClassLoader'), true, true); |
| 28 | 28 | self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); |
| 29 | 29 | spl_autoload_unregister(array('ComposerAutoloaderInit718e370ed095fd597a1f1d468c2b59f4', 'loadClassLoader')); |
| 30 | 30 | |
| 31 | - require __DIR__ . '/autoload_static.php'; |
|
| 31 | + require __DIR__.'/autoload_static.php'; |
|
| 32 | 32 | call_user_func(\Composer\Autoload\ComposerStaticInit718e370ed095fd597a1f1d468c2b59f4::getInitializer($loader)); |
| 33 | 33 | |
| 34 | 34 | $loader->register(true); |
@@ -4,23 +4,23 @@ |
||
| 4 | 4 | |
| 5 | 5 | $issues = array(); |
| 6 | 6 | |
| 7 | -if (!(PHP_VERSION_ID >= 50600)) { |
|
| 8 | - $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.'; |
|
| 7 | +if ( ! (PHP_VERSION_ID >= 50600)) { |
|
| 8 | + $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running '.PHP_VERSION.'.'; |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | if ($issues) { |
| 12 | - if (!headers_sent()) { |
|
| 12 | + if ( ! headers_sent()) { |
|
| 13 | 13 | header('HTTP/1.1 500 Internal Server Error'); |
| 14 | 14 | } |
| 15 | - if (!ini_get('display_errors')) { |
|
| 15 | + if ( ! ini_get('display_errors')) { |
|
| 16 | 16 | if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { |
| 17 | - fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); |
|
| 18 | - } elseif (!headers_sent()) { |
|
| 19 | - echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; |
|
| 17 | + fwrite(STDERR, 'Composer detected issues in your platform:'.PHP_EOL.PHP_EOL.implode(PHP_EOL, $issues).PHP_EOL.PHP_EOL); |
|
| 18 | + } elseif ( ! headers_sent()) { |
|
| 19 | + echo 'Composer detected issues in your platform:'.PHP_EOL.PHP_EOL.str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)).PHP_EOL.PHP_EOL; |
|
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | trigger_error( |
| 23 | - 'Composer detected issues in your platform: ' . implode(' ', $issues), |
|
| 23 | + 'Composer detected issues in your platform: '.implode(' ', $issues), |
|
| 24 | 24 | E_USER_ERROR |
| 25 | 25 | ); |
| 26 | 26 | } |
@@ -5,41 +5,41 @@ |
||
| 5 | 5 | * @package test_cases\lock |
| 6 | 6 | */ |
| 7 | 7 | class ActionScheduler_OptionLock_Test extends ActionScheduler_UnitTestCase { |
| 8 | - public function test_instance() { |
|
| 9 | - $lock = ActionScheduler::lock(); |
|
| 10 | - $this->assertInstanceOf( 'ActionScheduler_Lock', $lock ); |
|
| 11 | - $this->assertInstanceOf( 'ActionScheduler_OptionLock', $lock ); |
|
| 12 | - } |
|
| 8 | + public function test_instance() { |
|
| 9 | + $lock = ActionScheduler::lock(); |
|
| 10 | + $this->assertInstanceOf( 'ActionScheduler_Lock', $lock ); |
|
| 11 | + $this->assertInstanceOf( 'ActionScheduler_OptionLock', $lock ); |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - public function test_is_locked() { |
|
| 15 | - $lock = ActionScheduler::lock(); |
|
| 16 | - $lock_type = md5( rand() ); |
|
| 14 | + public function test_is_locked() { |
|
| 15 | + $lock = ActionScheduler::lock(); |
|
| 16 | + $lock_type = md5( rand() ); |
|
| 17 | 17 | |
| 18 | - $this->assertFalse( $lock->is_locked( $lock_type ) ); |
|
| 18 | + $this->assertFalse( $lock->is_locked( $lock_type ) ); |
|
| 19 | 19 | |
| 20 | - $lock->set( $lock_type ); |
|
| 21 | - $this->assertTrue( $lock->is_locked( $lock_type ) ); |
|
| 22 | - } |
|
| 20 | + $lock->set( $lock_type ); |
|
| 21 | + $this->assertTrue( $lock->is_locked( $lock_type ) ); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - public function test_set() { |
|
| 25 | - $lock = ActionScheduler::lock(); |
|
| 26 | - $lock_type = md5( rand() ); |
|
| 24 | + public function test_set() { |
|
| 25 | + $lock = ActionScheduler::lock(); |
|
| 26 | + $lock_type = md5( rand() ); |
|
| 27 | 27 | |
| 28 | - $lock->set( $lock_type ); |
|
| 29 | - $this->assertTrue( $lock->is_locked( $lock_type ) ); |
|
| 30 | - } |
|
| 28 | + $lock->set( $lock_type ); |
|
| 29 | + $this->assertTrue( $lock->is_locked( $lock_type ) ); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - public function test_get_expiration() { |
|
| 33 | - $lock = ActionScheduler::lock(); |
|
| 34 | - $lock_type = md5( rand() ); |
|
| 32 | + public function test_get_expiration() { |
|
| 33 | + $lock = ActionScheduler::lock(); |
|
| 34 | + $lock_type = md5( rand() ); |
|
| 35 | 35 | |
| 36 | - $lock->set( $lock_type ); |
|
| 36 | + $lock->set( $lock_type ); |
|
| 37 | 37 | |
| 38 | - $expiration = $lock->get_expiration( $lock_type ); |
|
| 39 | - $current_time = time(); |
|
| 38 | + $expiration = $lock->get_expiration( $lock_type ); |
|
| 39 | + $current_time = time(); |
|
| 40 | 40 | |
| 41 | - $this->assertGreaterThanOrEqual( 0, $expiration ); |
|
| 42 | - $this->assertGreaterThan( $current_time, $expiration ); |
|
| 43 | - $this->assertLessThan( $current_time + MINUTE_IN_SECONDS + 1, $expiration ); |
|
| 44 | - } |
|
| 41 | + $this->assertGreaterThanOrEqual( 0, $expiration ); |
|
| 42 | + $this->assertGreaterThan( $current_time, $expiration ); |
|
| 43 | + $this->assertLessThan( $current_time + MINUTE_IN_SECONDS + 1, $expiration ); |
|
| 44 | + } |
|
| 45 | 45 | } |
@@ -7,39 +7,39 @@ |
||
| 7 | 7 | class ActionScheduler_OptionLock_Test extends ActionScheduler_UnitTestCase { |
| 8 | 8 | public function test_instance() { |
| 9 | 9 | $lock = ActionScheduler::lock(); |
| 10 | - $this->assertInstanceOf( 'ActionScheduler_Lock', $lock ); |
|
| 11 | - $this->assertInstanceOf( 'ActionScheduler_OptionLock', $lock ); |
|
| 10 | + $this->assertInstanceOf('ActionScheduler_Lock', $lock); |
|
| 11 | + $this->assertInstanceOf('ActionScheduler_OptionLock', $lock); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | public function test_is_locked() { |
| 15 | 15 | $lock = ActionScheduler::lock(); |
| 16 | - $lock_type = md5( rand() ); |
|
| 16 | + $lock_type = md5(rand()); |
|
| 17 | 17 | |
| 18 | - $this->assertFalse( $lock->is_locked( $lock_type ) ); |
|
| 18 | + $this->assertFalse($lock->is_locked($lock_type)); |
|
| 19 | 19 | |
| 20 | - $lock->set( $lock_type ); |
|
| 21 | - $this->assertTrue( $lock->is_locked( $lock_type ) ); |
|
| 20 | + $lock->set($lock_type); |
|
| 21 | + $this->assertTrue($lock->is_locked($lock_type)); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function test_set() { |
| 25 | 25 | $lock = ActionScheduler::lock(); |
| 26 | - $lock_type = md5( rand() ); |
|
| 26 | + $lock_type = md5(rand()); |
|
| 27 | 27 | |
| 28 | - $lock->set( $lock_type ); |
|
| 29 | - $this->assertTrue( $lock->is_locked( $lock_type ) ); |
|
| 28 | + $lock->set($lock_type); |
|
| 29 | + $this->assertTrue($lock->is_locked($lock_type)); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function test_get_expiration() { |
| 33 | 33 | $lock = ActionScheduler::lock(); |
| 34 | - $lock_type = md5( rand() ); |
|
| 34 | + $lock_type = md5(rand()); |
|
| 35 | 35 | |
| 36 | - $lock->set( $lock_type ); |
|
| 36 | + $lock->set($lock_type); |
|
| 37 | 37 | |
| 38 | - $expiration = $lock->get_expiration( $lock_type ); |
|
| 38 | + $expiration = $lock->get_expiration($lock_type); |
|
| 39 | 39 | $current_time = time(); |
| 40 | 40 | |
| 41 | - $this->assertGreaterThanOrEqual( 0, $expiration ); |
|
| 42 | - $this->assertGreaterThan( $current_time, $expiration ); |
|
| 43 | - $this->assertLessThan( $current_time + MINUTE_IN_SECONDS + 1, $expiration ); |
|
| 41 | + $this->assertGreaterThanOrEqual(0, $expiration); |
|
| 42 | + $this->assertGreaterThan($current_time, $expiration); |
|
| 43 | + $this->assertLessThan($current_time + MINUTE_IN_SECONDS + 1, $expiration); |
|
| 44 | 44 | } |
| 45 | 45 | } |
@@ -15,62 +15,62 @@ |
||
| 15 | 15 | * @group migration |
| 16 | 16 | */ |
| 17 | 17 | class Controller_Test extends ActionScheduler_UnitTestCase { |
| 18 | - /** |
|
| 19 | - * Test to ensure the Migration Controller will schedule the migration. |
|
| 20 | - */ |
|
| 21 | - public function test_schedules_migration() { |
|
| 22 | - as_unschedule_action( Scheduler::HOOK ); |
|
| 23 | - Controller::instance()->schedule_migration(); |
|
| 18 | + /** |
|
| 19 | + * Test to ensure the Migration Controller will schedule the migration. |
|
| 20 | + */ |
|
| 21 | + public function test_schedules_migration() { |
|
| 22 | + as_unschedule_action( Scheduler::HOOK ); |
|
| 23 | + Controller::instance()->schedule_migration(); |
|
| 24 | 24 | |
| 25 | - $this->assertTrue( |
|
| 26 | - as_next_scheduled_action( Scheduler::HOOK ) > 0, |
|
| 27 | - 'Confirm that the Migration Controller scheduled the migration.' |
|
| 28 | - ); |
|
| 25 | + $this->assertTrue( |
|
| 26 | + as_next_scheduled_action( Scheduler::HOOK ) > 0, |
|
| 27 | + 'Confirm that the Migration Controller scheduled the migration.' |
|
| 28 | + ); |
|
| 29 | 29 | |
| 30 | - as_unschedule_action( Scheduler::HOOK ); |
|
| 31 | - } |
|
| 30 | + as_unschedule_action( Scheduler::HOOK ); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Test to ensure that if an essential table is missing, the Migration |
|
| 35 | - * Controller will not schedule a migration. |
|
| 36 | - * |
|
| 37 | - * @see https://github.com/woocommerce/action-scheduler/issues/653 |
|
| 38 | - */ |
|
| 39 | - public function test_migration_not_scheduled_if_tables_are_missing() { |
|
| 40 | - as_unschedule_action( Scheduler::HOOK ); |
|
| 41 | - $this->rename_claims_table(); |
|
| 42 | - Controller::instance()->schedule_migration(); |
|
| 33 | + /** |
|
| 34 | + * Test to ensure that if an essential table is missing, the Migration |
|
| 35 | + * Controller will not schedule a migration. |
|
| 36 | + * |
|
| 37 | + * @see https://github.com/woocommerce/action-scheduler/issues/653 |
|
| 38 | + */ |
|
| 39 | + public function test_migration_not_scheduled_if_tables_are_missing() { |
|
| 40 | + as_unschedule_action( Scheduler::HOOK ); |
|
| 41 | + $this->rename_claims_table(); |
|
| 42 | + Controller::instance()->schedule_migration(); |
|
| 43 | 43 | |
| 44 | - $this->assertFalse( |
|
| 45 | - as_next_scheduled_action( Scheduler::HOOK ), |
|
| 46 | - 'When required tables are missing, the migration will not be scheduled.' |
|
| 47 | - ); |
|
| 44 | + $this->assertFalse( |
|
| 45 | + as_next_scheduled_action( Scheduler::HOOK ), |
|
| 46 | + 'When required tables are missing, the migration will not be scheduled.' |
|
| 47 | + ); |
|
| 48 | 48 | |
| 49 | - $this->restore_claims_table_name(); |
|
| 50 | - } |
|
| 49 | + $this->restore_claims_table_name(); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Rename the claims table, so that it cannot be used by the library. |
|
| 54 | - */ |
|
| 55 | - private function rename_claims_table() { |
|
| 56 | - global $wpdb; |
|
| 57 | - $normal_table_name = $wpdb->prefix . Schema::CLAIMS_TABLE; |
|
| 58 | - $modified_table_name = $normal_table_name . 'x'; |
|
| 52 | + /** |
|
| 53 | + * Rename the claims table, so that it cannot be used by the library. |
|
| 54 | + */ |
|
| 55 | + private function rename_claims_table() { |
|
| 56 | + global $wpdb; |
|
| 57 | + $normal_table_name = $wpdb->prefix . Schema::CLAIMS_TABLE; |
|
| 58 | + $modified_table_name = $normal_table_name . 'x'; |
|
| 59 | 59 | |
| 60 | - // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared |
|
| 61 | - $wpdb->query( "RENAME TABLE {$normal_table_name} TO {$modified_table_name}" ); |
|
| 62 | - } |
|
| 60 | + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared |
|
| 61 | + $wpdb->query( "RENAME TABLE {$normal_table_name} TO {$modified_table_name}" ); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Restore the expected name of the claims table, so that it can be used by the library |
|
| 66 | - * and any further tests. |
|
| 67 | - */ |
|
| 68 | - private function restore_claims_table_name() { |
|
| 69 | - global $wpdb; |
|
| 70 | - $normal_table_name = $wpdb->prefix . Schema::CLAIMS_TABLE; |
|
| 71 | - $modified_table_name = $normal_table_name . 'x'; |
|
| 64 | + /** |
|
| 65 | + * Restore the expected name of the claims table, so that it can be used by the library |
|
| 66 | + * and any further tests. |
|
| 67 | + */ |
|
| 68 | + private function restore_claims_table_name() { |
|
| 69 | + global $wpdb; |
|
| 70 | + $normal_table_name = $wpdb->prefix . Schema::CLAIMS_TABLE; |
|
| 71 | + $modified_table_name = $normal_table_name . 'x'; |
|
| 72 | 72 | |
| 73 | - // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared |
|
| 74 | - $wpdb->query( "RENAME TABLE {$modified_table_name} TO {$normal_table_name}" ); |
|
| 75 | - } |
|
| 73 | + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared |
|
| 74 | + $wpdb->query( "RENAME TABLE {$modified_table_name} TO {$normal_table_name}" ); |
|
| 75 | + } |
|
| 76 | 76 | } |
@@ -19,15 +19,15 @@ discard block |
||
| 19 | 19 | * Test to ensure the Migration Controller will schedule the migration. |
| 20 | 20 | */ |
| 21 | 21 | public function test_schedules_migration() { |
| 22 | - as_unschedule_action( Scheduler::HOOK ); |
|
| 22 | + as_unschedule_action(Scheduler::HOOK); |
|
| 23 | 23 | Controller::instance()->schedule_migration(); |
| 24 | 24 | |
| 25 | 25 | $this->assertTrue( |
| 26 | - as_next_scheduled_action( Scheduler::HOOK ) > 0, |
|
| 26 | + as_next_scheduled_action(Scheduler::HOOK) > 0, |
|
| 27 | 27 | 'Confirm that the Migration Controller scheduled the migration.' |
| 28 | 28 | ); |
| 29 | 29 | |
| 30 | - as_unschedule_action( Scheduler::HOOK ); |
|
| 30 | + as_unschedule_action(Scheduler::HOOK); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | * @see https://github.com/woocommerce/action-scheduler/issues/653 |
| 38 | 38 | */ |
| 39 | 39 | public function test_migration_not_scheduled_if_tables_are_missing() { |
| 40 | - as_unschedule_action( Scheduler::HOOK ); |
|
| 40 | + as_unschedule_action(Scheduler::HOOK); |
|
| 41 | 41 | $this->rename_claims_table(); |
| 42 | 42 | Controller::instance()->schedule_migration(); |
| 43 | 43 | |
| 44 | 44 | $this->assertFalse( |
| 45 | - as_next_scheduled_action( Scheduler::HOOK ), |
|
| 45 | + as_next_scheduled_action(Scheduler::HOOK), |
|
| 46 | 46 | 'When required tables are missing, the migration will not be scheduled.' |
| 47 | 47 | ); |
| 48 | 48 | |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | private function rename_claims_table() { |
| 56 | 56 | global $wpdb; |
| 57 | - $normal_table_name = $wpdb->prefix . Schema::CLAIMS_TABLE; |
|
| 58 | - $modified_table_name = $normal_table_name . 'x'; |
|
| 57 | + $normal_table_name = $wpdb->prefix.Schema::CLAIMS_TABLE; |
|
| 58 | + $modified_table_name = $normal_table_name.'x'; |
|
| 59 | 59 | |
| 60 | 60 | // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared |
| 61 | - $wpdb->query( "RENAME TABLE {$normal_table_name} TO {$modified_table_name}" ); |
|
| 61 | + $wpdb->query("RENAME TABLE {$normal_table_name} TO {$modified_table_name}"); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | private function restore_claims_table_name() { |
| 69 | 69 | global $wpdb; |
| 70 | - $normal_table_name = $wpdb->prefix . Schema::CLAIMS_TABLE; |
|
| 71 | - $modified_table_name = $normal_table_name . 'x'; |
|
| 70 | + $normal_table_name = $wpdb->prefix.Schema::CLAIMS_TABLE; |
|
| 71 | + $modified_table_name = $normal_table_name.'x'; |
|
| 72 | 72 | |
| 73 | 73 | // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared |
| 74 | - $wpdb->query( "RENAME TABLE {$modified_table_name} TO {$normal_table_name}" ); |
|
| 74 | + $wpdb->query("RENAME TABLE {$modified_table_name} TO {$normal_table_name}"); |
|
| 75 | 75 | } |
| 76 | 76 | } |
@@ -6,44 +6,44 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | abstract class ActionScheduler_Store_Deprecated { |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * Mark an action that failed to fetch correctly as failed. |
|
| 11 | - * |
|
| 12 | - * @since 2.2.6 |
|
| 13 | - * |
|
| 14 | - * @param int $action_id The ID of the action. |
|
| 15 | - */ |
|
| 16 | - public function mark_failed_fetch_action( $action_id ) { |
|
| 17 | - _deprecated_function( __METHOD__, '3.0.0', 'ActionScheduler_Store::mark_failure()' ); |
|
| 18 | - self::$store->mark_failure( $action_id ); |
|
| 19 | - } |
|
| 9 | + /** |
|
| 10 | + * Mark an action that failed to fetch correctly as failed. |
|
| 11 | + * |
|
| 12 | + * @since 2.2.6 |
|
| 13 | + * |
|
| 14 | + * @param int $action_id The ID of the action. |
|
| 15 | + */ |
|
| 16 | + public function mark_failed_fetch_action( $action_id ) { |
|
| 17 | + _deprecated_function( __METHOD__, '3.0.0', 'ActionScheduler_Store::mark_failure()' ); |
|
| 18 | + self::$store->mark_failure( $action_id ); |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Add base hooks |
|
| 23 | - * |
|
| 24 | - * @since 2.2.6 |
|
| 25 | - */ |
|
| 26 | - protected static function hook() { |
|
| 27 | - _deprecated_function( __METHOD__, '3.0.0' ); |
|
| 28 | - } |
|
| 21 | + /** |
|
| 22 | + * Add base hooks |
|
| 23 | + * |
|
| 24 | + * @since 2.2.6 |
|
| 25 | + */ |
|
| 26 | + protected static function hook() { |
|
| 27 | + _deprecated_function( __METHOD__, '3.0.0' ); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Remove base hooks |
|
| 32 | - * |
|
| 33 | - * @since 2.2.6 |
|
| 34 | - */ |
|
| 35 | - protected static function unhook() { |
|
| 36 | - _deprecated_function( __METHOD__, '3.0.0' ); |
|
| 37 | - } |
|
| 30 | + /** |
|
| 31 | + * Remove base hooks |
|
| 32 | + * |
|
| 33 | + * @since 2.2.6 |
|
| 34 | + */ |
|
| 35 | + protected static function unhook() { |
|
| 36 | + _deprecated_function( __METHOD__, '3.0.0' ); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Get the site's local time. |
|
| 41 | - * |
|
| 42 | - * @deprecated 2.1.0 |
|
| 43 | - * @return DateTimeZone |
|
| 44 | - */ |
|
| 45 | - protected function get_local_timezone() { |
|
| 46 | - _deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' ); |
|
| 47 | - return ActionScheduler_TimezoneHelper::get_local_timezone(); |
|
| 48 | - } |
|
| 39 | + /** |
|
| 40 | + * Get the site's local time. |
|
| 41 | + * |
|
| 42 | + * @deprecated 2.1.0 |
|
| 43 | + * @return DateTimeZone |
|
| 44 | + */ |
|
| 45 | + protected function get_local_timezone() { |
|
| 46 | + _deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' ); |
|
| 47 | + return ActionScheduler_TimezoneHelper::get_local_timezone(); |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -13,9 +13,9 @@ discard block |
||
| 13 | 13 | * |
| 14 | 14 | * @param int $action_id The ID of the action. |
| 15 | 15 | */ |
| 16 | - public function mark_failed_fetch_action( $action_id ) { |
|
| 17 | - _deprecated_function( __METHOD__, '3.0.0', 'ActionScheduler_Store::mark_failure()' ); |
|
| 18 | - self::$store->mark_failure( $action_id ); |
|
| 16 | + public function mark_failed_fetch_action($action_id) { |
|
| 17 | + _deprecated_function(__METHOD__, '3.0.0', 'ActionScheduler_Store::mark_failure()'); |
|
| 18 | + self::$store->mark_failure($action_id); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @since 2.2.6 |
| 25 | 25 | */ |
| 26 | 26 | protected static function hook() { |
| 27 | - _deprecated_function( __METHOD__, '3.0.0' ); |
|
| 27 | + _deprecated_function(__METHOD__, '3.0.0'); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @since 2.2.6 |
| 34 | 34 | */ |
| 35 | 35 | protected static function unhook() { |
| 36 | - _deprecated_function( __METHOD__, '3.0.0' ); |
|
| 36 | + _deprecated_function(__METHOD__, '3.0.0'); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @return DateTimeZone |
| 44 | 44 | */ |
| 45 | 45 | protected function get_local_timezone() { |
| 46 | - _deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' ); |
|
| 46 | + _deprecated_function(__FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()'); |
|
| 47 | 47 | return ActionScheduler_TimezoneHelper::get_local_timezone(); |
| 48 | 48 | } |
| 49 | 49 | } |