Skip to content

Commit

Permalink
EE3 Compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ignetic committed Feb 25, 2019
1 parent 2e3fa53 commit a77eaa0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 21 deletions.
35 changes: 16 additions & 19 deletions README.md → in_array/README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,44 @@
In Array
=================

ExpressionEngine 2 Plugin
In Array Usage
====================

Searches for a value within given pipe or comma separated values
----------------------------------------------------------------

To use this plugin, enter the value to search for in the value parameter
and pipe or comma delimited values in the array parameter:

`{exp:in_array value="3" array="2|4|5|20"}`
{exp:in_array value="3" array="2|4|5|20"}

`{exp:in_array value="Cow" array="The|Cow|Jumped|Over|The|Moon"}`
{exp:in_array value="Cow" array="The|Cow|Jumped|Over|The|Moon"}

**Typical use:**
Typical use:

`{if '{exp:in_array value="2" array="1|2|3"}'}
{if '{exp:in_array value="2" array="1|2|3"}'}
We found your value
{/if}`
{/if}

`{if '{exp:in_array not="4|5" array="1|2|3"}'}
{if '{exp:in_array not="4|5" array="1|2|3"}'}
We did not find your value
{/if}`
{/if}

**Tag Pair:**
Tag Pair:

`{exp:in_array:pair value="2" array="1|2|3"}
{exp:in_array:pair value="2" array="1|2|3"}
{if no_results}Value not found{/if}
We found your value
{/exp:in_array:pair}`
{/exp:in_array:pair}

Alternative no_results: Note that this only works with no "if" conditions inside it.

`{exp:in_array:pair value="2" array="1|2|3"}
{exp:in_array:pair value="2" array="1|2|3"}
{if in_array:no_results}Value not found{/if}
We found your value
{/exp:in_array:pair}`
{/exp:in_array:pair}


**Available parameters:**
Available parameters:

value="X" : The value to find in the array
not="X" : The value not to find in the array
array="1|2|3|4" : the values in the array to search
delimiter="|" : change the default pipe delimiter
case_insensitive="y" : make the search case insensitive
case_insensitive="y" : make the search case insensitive
11 changes: 11 additions & 0 deletions in_array/addon.setup.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

return array(
'author' => 'Simon Andersohn',
'author_url' => '',
'name' => 'In Array',
'description' => 'Searches for a value within given pipe or comma separated values',
'version' => '1.4',
'namespace' => '\\',
'docs_url' => ''
);
8 changes: 8 additions & 0 deletions changelog.txt → in_array/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ Changelog for In Array
==================================


## 1.4

- ExpressionEngine 3 compatibility

## 1.3.1

- **Fix**: PHP 5.6+ fix - changed usage() function to static

## 1.3

- **Update**: Various updates

## 1.2

- **Added**: Ability to define the array delimiter (default is | pipe)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

$plugin_info = array(
'pi_name' => 'In Array',
'pi_version' => '1.3.1',
'pi_version' => '1.4',
'pi_author' => 'Simon Andersohn',
'pi_author_url' => '',
'pi_description' => 'Searches for a value within given pipe or comma separated values',
Expand All @@ -22,7 +22,7 @@ class In_array {
*/
public function __construct()
{
$this->EE =& get_instance();
$this->EE = get_instance();

$this->return_data = $this->compare_array();
}
Expand Down

0 comments on commit a77eaa0

Please sign in to comment.