Converts given verb to past sense. E.g., "install" -> "installed",
"activate" -> "activated" etc.
public static verbToPastTense ( string $verb ) : string | ||
$verb | string | |
return | string |
public function getChangeDescription() { if ($this->count === 1) { return $this->changeInfos[0]->getChangeDescription(); } return Strings::firstUpper(StringUtils::verbToPastTense($this->getAction())) . " {$this->count} term-meta"; }
public function getChangeDescription() { if ($this->action === 'switch') { return "Theme switched to '{$this->themeName}'"; } return Strings::capitalize(StringUtils::verbToPastTense($this->action)) . " theme '{$this->themeName}'"; }
public function getChangeDescription() { if ($this->action === 'activate') { return "Site language switched to '{$this->languageName}'"; } return Strings::capitalize(StringUtils::verbToPastTense($this->action)) . " translation '{$this->languageName}'"; }
public function getChangeDescription() { if ($this->count === 1) { return $this->changeInfos[0]->getChangeDescription(); } return sprintf("%s %d %s", Strings::capitalize(StringUtils::verbToPastTense($this->getAction())), $this->count, StringUtils::pluralize($this->getEntityName())); }
public function getChangeDescription() { if ($this->count === 1) { return $this->changeInfos[0]->getChangeDescription(); } return Strings::capitalize(StringUtils::verbToPastTense($this->getAction())) . " {$this->count} options"; }
public function getChangeDescription() { $verb = "Edited"; $subject = "term-meta '{$this->metaKey}'"; $rest = "for term '{$this->termName}'"; if ($this->getAction() === "create" || $this->getAction() === "delete") { $verb = Strings::firstUpper(StringUtils::verbToPastTense($this->getAction())); } return sprintf("%s %s %s", $verb, $subject, $rest); }
public function getChangeDescription() { $entityName = $this->getScope(); $action = $this->getAction(); if ($this->count === 1) { $defaultDescription = $this->changeInfos[0]->getChangeDescription(); } else { $defaultDescription = sprintf("%s %d %s", Strings::capitalize(StringUtils::verbToPastTense($action)), $this->count, StringUtils::pluralize($entityName)); } $tags = array_map(function (TrackedChangeInfo $changeInfo) { return $changeInfo->getCustomTags(); }, $this->changeInfos); return apply_filters("vp_bulk_change_description_{$entityName}", $defaultDescription, $action, $this->count, $tags); }
public function getChangeDescription() { switch ($this->action) { case "install": // Pre-1.0-beta2 message, see also WP-219 return "Installed VersionPress"; case "activate": return "Activated VersionPress " . $this->versionPressVersion; case "deactivate": return "Deactivated VersionPress"; default: // just in case, this path shouldn't really be reached return Strings::capitalize(StringUtils::verbToPastTense($this->action)) . " VersionPress"; } }
public function getChangeDescription() { $verb = "Edited"; $subject = "post-meta '{$this->metaKey}'"; $rest = "for {$this->postType} '{$this->postTitle}'"; if ($this->metaKey === "_thumbnail_id") { // featured image $verb = "Changed"; $subject = "featured image"; if ($this->getAction() === "create") { $verb = "Set"; } if ($this->getAction() === "delete") { $verb = "Removed"; } } elseif ($this->getAction() === "create" || $this->getAction() === "delete") { $verb = Strings::firstUpper(StringUtils::verbToPastTense($this->getAction())); } return sprintf("%s %s %s", $verb, $subject, $rest); }
public function getChangeDescription() { return Strings::capitalize(StringUtils::verbToPastTense($this->getAction())) . " {$this->count} translations"; }
/** @var \VersionPress\Storages\StorageFactory $storageFactory */ $storageFactory = $versionPressContainer->resolve(VersionPressServices::STORAGE_FACTORY); /** @var \VersionPress\Storages\DirectoryStorage $termStorage */ $termStorage = $storageFactory->getStorage('term'); $termId = isset($newEntity['vp_term_id']) ? $newEntity['vp_term_id'] : $oldEntity['vp_term_id']; $term = $termStorage->loadEntity($termId); $tags['VP-Term-Name'] = $term['name']; return $tags; }, 10, 4); add_filter('vp_entity_files_term_taxonomy', function ($files, $oldEntity, $newEntity) { $files[] = ["type" => "all-storage-files", "entity" => "option"]; // sometimes term change can affect option (e.g. deleting menu) return $files; }, 10, 3); add_filter('vp_bulk_change_description_composer', function ($description, $action, $count) { return sprintf("%s %d Composer packages", Strings::capitalize(StringUtils::verbToPastTense($action)), $count); }, 10, 3); add_filter('vp_bulk_change_description_revert', function ($description, $action, $count) { if ($action === 'undo' || $action === 'rollback') { return "Reverted" . " {$count} changes"; } return $description; }, 10, 3); add_filter('vp_meta_entity_tags_postmeta', function ($tags, $oldEntity, $newEntity, $action, $oldParent, $newParent) { $tags['VP-Post-Type'] = isset($newParent['post_type']) ? $newParent['post_type'] : $oldParent['post_type']; $tags['VP-Post-Title'] = isset($newParent['post_title']) ? $newParent['post_title'] : $oldParent['post_title']; return $tags; }, 10, 6); add_filter('vp_meta_entity_files_postmeta', function ($files, $oldEntity, $newEntity, $oldParentEntity, $newParentEntity) { $postType = isset($newParentEntity['post_type']) ? $newParentEntity['post_type'] : $oldParentEntity['post_type']; if ($postType !== "attachment") {
public function getChangeDescription() { return Strings::capitalize(StringUtils::verbToPastTense($this->action)) . " plugin '{$this->pluginName}'"; }
function getChangeDescription() { return Strings::capitalize(StringUtils::verbToPastTense($this->getAction())) . " option '{$this->getEntityId()}'"; }