Remove unused row actions

@since 2.0.5

@param $actions
@param $post

@return
180974
public function remove_row_actions( $actions, $post ) {

		global $current_screen;

		if ( ! is_object( $current_screen ) || $this->object_type != $current_screen->post_type ) {
			return $actions;
		}

		if ( isset( $actions['view'] ) ) {
			unset( $actions['view'] );
		}

		if ( isset( $actions['inline hide-if-no-js'] ) ) {
			unset( $actions['inline hide-if-no-js'] );
		}

		// W3 Total Cache
		if ( isset( $actions['pgcache_purge'] ) ) {
			unset( $actions['pgcache_purge'] );
		}

		return $actions;
	}
909999
public function removeAction( $action, $callback )
    {
        $i = 0;

        foreach( $this->actions as $key => $value )
        {
            if ( $action === $key )
            {
                foreach( $value as $a => $call )
                {
                    if ( get_class( $callback[ 0 ] ) === get_class( $call[ 'callback' ][ 0 ] ) )
                    {
                        if ( $callback[ 1 ] === $call[ 'callback' ][ 1 ] )
                        {
                            unset( $this->actions[ $key ][ $i ] );

                            if ( $this->debug )
                            {
                                echo PHP_EOL . '-ACTION: ' . $action . ' -> '
                                        . $this->_serializeCallback( $callback )
                                        . ' + Priority: ' . $call[ 'priority' ]
                                        . PHP_EOL;
                            }

                            return TRUE;
                        }
                    }
                }
            }

            $i++;
        }

        return FALSE;
    }
298775
public function purgeTreeMenuTransientForAncestors($postId)
    {
        // Get page ancestors
        $ancestors = get_post_ancestors($postId);
        $ancestors[] = $postId;

        // Remove front page from ancestors array
        $ancestors = array_reverse($ancestors);

        if ($ancestors[0] == get_option('page_on_front')) {
            unset($ancestors[0]);
        }

        $ancestors = array_values($ancestors);

        // Delete transient for page ancestors
        foreach ($ancestors as $postId) {
            $children = get_children(array(
                'post_parent' => $postId,
                'numberofposts' => -1,
                'post_type' => 'page',
            ));

            foreach ($children as $child) {
                delete_transient('main_menu_' . $child->ID);
                delete_transient('mobile_menu_' . $child->ID);
                delete_transient('sidebar_menu_' . $child->ID);

                delete_transient('main_menu_' . $child->ID . '_loggedin');
                delete_transient('mobile_menu_' . $child->ID . '_loggedin');
                delete_transient('sidebar_menu_' . $child->ID . '_loggedin');
            }
        }
    }
211497
protected function setListActions(array $actions)
    {
        $this->parsedListActions = false;

        $this->listActions = $this->mergeActions($this->defaultListActions(), $actions);

        return $this;
    }
466622
public function podiumDeletePosts($posts)
    {
        $transaction = static::getDb()->beginTransaction();
        try {
            foreach ($posts as $post) {
                if (!is_numeric($post) || $post < 1) {
                    throw new Exception('Incorrect post ID');
                }
                $nPost = Post::find()
                            ->where([
                                'id' => $post,
                                'thread_id' => $this->id,
                                'forum_id' => $this->forum->id
                            ])
                            ->limit(1)
                            ->one();
                if (!$nPost) {
                    throw new Exception('No post of given ID found');
                }
                if (!$nPost->delete()) {
                    throw new Exception('Post deleting error!');
                }
            }
            $wholeThread = false;
            if ($this->postsCount) {
                $this->updateCounters(['posts' => -count($posts)]);
                $this->forum->updateCounters(['posts' => -count($posts)]);
            } else {
                $wholeThread = true;
                if (!$this->delete()) {
                    throw new Exception('Thread deleting error!');
                }
                $this->forum->updateCounters(['posts' => -count($posts), 'threads' => -1]);
            }
            $transaction->commit();
            PodiumCache::clearAfter('postDelete');
            Log::info('Posts deleted', null, __METHOD__);
            return true;
        } catch (Exception $e) {
            $transaction->rollBack();
            Log::error($e->getMessage(), null, __METHOD__);
        }
        return false;
    }
1363679
def delete(self, action, **kwds):
        
        return self._client.post("/action/%s/delete.json" %
                                 self._extract_id(action),
                                 **kwds)["result"]
1354
def actions(*actions_to_keep)
        raise ArgumentError, 'Wrong number of arguments. You have to provide which actions you want to keep.' if actions_to_keep.empty?

        options = actions_to_keep.extract_options!
        actions_to_remove = Array(options[:except])
        actions_to_remove += ACTIONS - actions_to_keep.map { |a| a.to_sym } unless actions_to_keep.first == :all
        actions_to_remove.map! { |a| a.to_sym }.uniq!
        (instance_methods.map { |m| m.to_sym } & actions_to_remove).each do |action|
          undef_method action, "#{action}!"
        end
      end
515242
def process_remove_action(processors, action, argument):
    """"""
    for processor in processors:
        processor(action, argument)
    db.session.commit()
424332
public function except($methods, $pattern, $action)
    {
        return $this->match(array_diff(explode(" ", self::HTTP_METHODS), (array) $methods), $pattern, $action);
    }
498295
private function internalDataListUpdateData($data, $actions): array
    {
        if (is_callable($data)) {
            $actionsList = [];
            foreach ($actions as $actionData) {
                if ($actionData[0] === 'filterBy') {
                    $class = $this->internalDataListClasses['IvoPetkov\DataListFilterByAction'];
                    $action = new $class();
                    $action->property = $actionData[1];
                    $action->value = $actionData[2];
                    $action->operator = $actionData[3];
                } elseif ($actionData[0] === 'sortBy') {
                    $class = $this->internalDataListClasses['IvoPetkov\DataListSortByAction'];
                    $action = new $class();
                    $action->property = $actionData[1];
                    $action->order = $actionData[2];
                } elseif ($actionData[0] === 'sliceProperties') {
                    $class = $this->internalDataListClasses['IvoPetkov\DataListSlicePropertiesAction'];
                    $action = new $class();
                    $action->properties = $actionData[1];
                } elseif ($actionData[0] === 'slice') {
                    $class = $this->internalDataListClasses['IvoPetkov\DataListSliceAction'];
                    $action = new $class();
                    $action->offset = $actionData[1];
                    $action->limit = $actionData[2];
                } else {
                    $class = $this->internalDataListClasses['IvoPetkov\DataListAction'];
                    $action = new $class();
                }
                $action->name = $actionData[0];
                $actionsList[] = $action;
            }
            $class = $this->internalDataListClasses['IvoPetkov\DataListContext'];
            $context = new $class();
            $context->actions = $actionsList;
            $dataSource = call_user_func($data, $context);
            if (is_array($dataSource) || $dataSource instanceof \Traversable) {
                $data = [];
                foreach ($dataSource as $value) {
                    $data[] = $value;
                }
            } else {
                throw new \InvalidArgumentException('The data source callback result is not iterable!');
            }
        }
        foreach ($actions as $action) {
            if ($action[0] === 'filter') {
                $this->internalDataListUpdateAllValuesIfNeeded($data);
                $temp = [];
                foreach ($data as $object) {
                    if (call_user_func($action[1], $object) === true) {
                        $temp[] = $object;
                    }
                }
                $data = $temp;
                unset($temp);
            } else if ($action[0] === 'filterBy') {
                $this->internalDataListUpdateAllValuesIfNeeded($data);
                $temp = [];
                foreach ($data as $object) {
                    $propertyName = $action[1];
                    $targetValue = $action[2];
                    $operator = $action[3];
                    $add = false;
                    if (!isset($object->$propertyName)) {
                        if ($operator === 'equal' && $targetValue === null) {
                            $add = true;
                        } elseif ($operator === 'notEqual' && $targetValue !== null) {
                            $add = true;
                        } elseif ($operator === 'inArray' && is_array($targetValue) && array_search(null, $targetValue) !== false) {
                            $add = true;
                        } elseif ($operator === 'notInArray' && !(is_array($targetValue) && array_search(null, $targetValue) !== false)) {
                            $add = true;
                        } else {
                            continue;
                        }
                    }
                    if (!$add) {
                        $value = $object->$propertyName;
                        if ($operator === 'equal') {
                            $add = $value === $targetValue;
                        } elseif ($operator === 'notEqual') {
                            $add = $value !== $targetValue;
                        } elseif ($operator === 'regExp') {
                            $add = preg_match('/' . $targetValue . '/', $value) === 1;
                        } elseif ($operator === 'notRegExp') {
                            $add = preg_match('/' . $targetValue . '/', $value) === 0;
                        } elseif ($operator === 'startWith') {
                            $add = substr($value, 0, strlen($targetValue)) === $targetValue;
                        } elseif ($operator === 'notStartWith') {
                            $add = substr($value, 0, strlen($targetValue)) !== $targetValue;
                        } elseif ($operator === 'endWith') {
                            $add = substr($value, -strlen($targetValue)) === $targetValue;
                        } elseif ($operator === 'notEndWith') {
                            $add = substr($value, -strlen($targetValue)) !== $targetValue;
                        } elseif ($operator === 'inArray') {
                            $add = is_array($targetValue) && array_search($value, $targetValue) !== false;
                        } elseif ($operator === 'notInArray') {
                            $add = !(is_array($targetValue) && array_search($value, $targetValue) !== false);
                        }
                    }
                    if ($add) {
                        $temp[] = $object;
                    }
                }
                $data = $temp;
                unset($temp);
            } elseif ($action[0] === 'sort') {
                $this->internalDataListUpdateAllValuesIfNeeded($data);
                usort($data, $action[1]);
            } elseif ($action[0] === 'sortBy') {
                $this->internalDataListUpdateAllValuesIfNeeded($data);
                $sortData = []; // save the index and the property needed for the sort in a temp array
                foreach ($data as $index => $object) {
                    $sortValue = isset($object->{$action[1]}) ? $object->{$action[1]} : null;
                    if (is_object($sortValue)) {
                        if ($sortValue instanceof \DateTime) {
                            $sortValue = $sortValue->getTimestamp();
                        } else {
                            $sortValue = null;
                        }
                    }
                    $sortData[] = [$index, $sortValue];
                }
                usort($sortData, function($value1SortData, $value2SortData) use ($action) {
                    if ($value1SortData[1] === null && $value2SortData[1] === null) {
                        $result = 0;
                    } else {
                        if ($value1SortData[1] === null) {
                            return $action[2] === 'asc' ? -1 : 1;
                        }
                        if ($value2SortData[1] === null) {
                            return $action[2] === 'asc' ? 1 : -1;
                        }
                        if ((is_int($value1SortData[1]) || is_float($value1SortData[1])) && (is_int($value2SortData[1]) || is_float($value2SortData[1]))) {
                            $result = $value1SortData[1] < $value2SortData[1] ? -1 : 1;
                        } else {
                            $result = strcmp($value1SortData[1], $value2SortData[1]);
                        }
                    }
                    if ($result === 0) { // if the sort property is the same, maintain the order by index
                        return $value1SortData[0] - $value2SortData[0];
                    }
                    return $result * ($action[2] === 'asc' ? 1 : -1);
                });
                $temp = [];
                foreach ($sortData as $sortedValueData) {
                    $temp[] = $data[$sortedValueData[0]];
                }
                unset($sortData);
                $data = $temp;
                unset($temp);
            } elseif ($action[0] === 'reverse') {
                $data = array_reverse($data);
            } elseif ($action[0] === 'shuffle') {
                shuffle($data);
            } elseif ($action[0] === 'map') {
                $this->internalDataListUpdateAllValuesIfNeeded($data);
                $data = array_map($action[1], $data);
            }
        }
        return $data;
    }
654337
public function remove(Games_PushTokenId $postBody, $optParams = array())
  {
    $params = array('postBody' => $postBody);
    $params = array_merge($params, $optParams);
    return $this->call('remove', array($params));
  }
398043
def removed_or_inserted_action(mapper, connection, target):
    """"""
    current_access.delete_action_cache(get_action_cache_key(target.action,
                                                            target.argument))
516528
public function wipeAction($get, $post, $data)
    {
        // Wipe test table and check if was successful
        if ($this->db->query('TRUNCATE TABLE test')) {
            Tools::redir($this->basepath . 'DB?success');
        } else {
            Tools::redir($this->basepath . 'DB?fail');
        }
    }
1207688
public function addActions(array $actions): self
    {
        foreach ($actions as $action) {
            $this->addAction($action);
        }

        return $this;
    }
232873
public function setActions($actions) {
        if (!is_array($actions)) {
            $actions = array($actions);
        }
        $this->actions = array_filter($actions, array($this, 'isValidAction'));
        return $this;
    }
743980
public function remove($action, $id = null)
    {
        /** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */
        $query = $this->dbHandler->createDeleteQuery();
        $query->deleteFrom(
            $this->dbHandler->quoteTable($this->table)
        )->where(
            $query->expr->eq(
                $this->dbHandler->quoteColumn('action'),
                $query->bindValue($action, null, \PDO::PARAM_STR)
            )
        );

        if ($id !== null) {
            $query->where(
                $query->expr->lAnd(
                    $query->expr->eq(
                        $this->dbHandler->quoteColumn('is_alias'),
                        $query->bindValue(0, null, \PDO::PARAM_INT)
                    ),
                    $query->expr->eq(
                        $this->dbHandler->quoteColumn('id'),
                        $query->bindValue($id, null, \PDO::PARAM_INT)
                    )
                )
            );
        }

        $query->prepare()->execute();
    }
362967
public static function deleteGroupAndContent($nids, $posts, &$context) {
    $results = [];
    // Load each node and delete it.
    foreach ($nids as $nid) {
      $node = Node::load($nid);
      $message = t('Delete @type "@title"', ['@type' => $node->getType(), '@title' => $node->getTitle()]);
      $results[] = $node->delete();
    }
    // Load each post and delete it.
    foreach ($posts as $post_id) {
      $post = Post::load($post_id);
      $message = t("Deleting @type\'s", ['@type' => $post->bundle()]);
      $results[] = $post->delete();
    }
    $context['message'] = $message;
    $context['results'] = $results;
  }