Coder Social home page Coder Social logo

ip-cam / array-helper-opencart-v.2.0.x Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 8sun/opencart-array-helper

0.0 0.0 1.0 10 KB

Opencart Array Helper provides additional array functionality that you can use in your application.

PHP 100.00%

array-helper-opencart-v.2.0.x's Introduction

opencart-array-helper

Opencart Array Helper provides additional array functionality that you can use in your application.

For more details and usage information on ArrayHelper, see the guide article on array helpers.

This module from Yii2 Framework is adapted by Mefistophell Nill and Zoturn (8sun Empire) especially for OpenCart.

Tested on Opencart 2.0. If you find an error, let us know.

Version: 1.0

See also: Opencart Html Helper

Install

  1. You need copy the files to /system/helper/ directory.

  2. Further add Helpers to /system/startup.php how is shown below:

require_once(DIR_SYSTEM . 'helper/ArrayHelper.php');
require_once(DIR_SYSTEM . 'helper/InvalidParamException.php');

Usage

Just use Helpers into your template files. You may get something following:

$array = [
    ['id' => '123', 'data' => 'abc'],
    ['id' => '345', 'data' => 'def'],
];
$result = ArrayHelper::getColumn($array, 'id');
// the result is: ['123', '345']

Here is the list of available features

MethodDescription
filter() Filters array according to rules specified.
getColumn() Returns the values of a specified column in an array.
getValue() Retrieves the value of an array element or object property with the given key or property name.
htmlDecode() Decodes HTML entities into the corresponding characters in an array of strings.
htmlEncode() Encodes special characters in an array of strings into HTML entities.
index() Indexes and/or groups the array according to a specified key.
isAssociative() Returns a value indicating whether the given array is an associative array.
isIn() Check whether an array or Traversable contains an element.
isIndexed() Returns a value indicating whether the given array is an indexed array.
isSubset() Checks whether an array or Traversable is a subset of another array or Traversable.
isTraversable() Checks whether a variable is an array or Traversable.
keyExists() Checks if the given array contains the specified key.
map() Builds a map (key-value pairs) from a multidimensional array or an array of objects.
merge() Merges two or more arrays into one recursively.
multisort() Sorts an array of objects or arrays (with the same structure) by one or several keys.
remove() Removes an item from an array and returns the value. If the key does not exist in the array, the default value will be returned instead.
removeValue() Removes items with matching values from the array and returns the removed items.
toArray() Converts an object or an array of objects into an array.

array-helper-opencart-v.2.0.x's People

Contributors

mefistophell avatar

Forkers

ducquyen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.