verbToPastTense() public static method

Converts given verb to past sense. E.g., "install" -> "installed", "activate" -> "activated" etc.
public static verbToPastTense ( string $verb ) : string
$verb string
return string
Ejemplo n.º 1
0
 public function getChangeDescription()
 {
     if ($this->count === 1) {
         return $this->changeInfos[0]->getChangeDescription();
     }
     return Strings::firstUpper(StringUtils::verbToPastTense($this->getAction())) . " {$this->count} term-meta";
 }
Ejemplo n.º 2
0
 public function getChangeDescription()
 {
     if ($this->action === 'switch') {
         return "Theme switched to '{$this->themeName}'";
     }
     return Strings::capitalize(StringUtils::verbToPastTense($this->action)) . " theme '{$this->themeName}'";
 }
Ejemplo n.º 3
0
 public function getChangeDescription()
 {
     if ($this->action === 'activate') {
         return "Site language switched to '{$this->languageName}'";
     }
     return Strings::capitalize(StringUtils::verbToPastTense($this->action)) . " translation '{$this->languageName}'";
 }
Ejemplo n.º 4
0
 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()));
 }
Ejemplo n.º 5
0
 public function getChangeDescription()
 {
     if ($this->count === 1) {
         return $this->changeInfos[0]->getChangeDescription();
     }
     return Strings::capitalize(StringUtils::verbToPastTense($this->getAction())) . " {$this->count} options";
 }
Ejemplo n.º 6
0
 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);
 }
Ejemplo n.º 7
0
 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);
 }
Ejemplo n.º 8
0
 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";
     }
 }
Ejemplo n.º 9
0
 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";
 }
Ejemplo n.º 11
0
    /** @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") {
Ejemplo n.º 12
0
 public function getChangeDescription()
 {
     return Strings::capitalize(StringUtils::verbToPastTense($this->action)) . " plugin '{$this->pluginName}'";
 }
Ejemplo n.º 13
0
 function getChangeDescription()
 {
     return Strings::capitalize(StringUtils::verbToPastTense($this->getAction())) . " option '{$this->getEntityId()}'";
 }