2017 © Pedro Peláez
 

library php-utilities

Generic PHP functions for standardized data manipulation.

image

cnp/php-utilities

Generic PHP functions for standardized data manipulation.

  • Thursday, October 5, 2017
  • by cnp
  • Repository
  • 3 Watchers
  • 0 Stars
  • 66 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 15 Versions
  • 2 % Grown

The README.md

PHP-Utilities

Generic PHP functions for data manipulation., (*1)

Functions

getAcfFieldsAsArray

Gets a bunch of specific ACF fields at once. Especially useful for option page settings, which only have a way to get one field at a time., (*2)

Parameters

$fields_names_arr (array|required): An array of the field names., (*3)

$option (boolean|optional): Set to true if the fields are from an options page., (*4)

Return Values

$data_arr (array): Data array keyed to the field names from the input array., (*5)

multidimensionalArrayMap

Like array_map, but for multidimensional arrays., (*6)

Parameters

$function The callback function to apply to each value of the array, (*7)

$array The multi-dimensional array, (*8)

Return Values

(array) The formatted array., (*9)

parseClassesAsArray

Take a string or array of classes, trim them and then return classes as an array., (*10)

Parameters

$classes (required): An flat array or comma-delimited string of classes., (*11)

Return Values

(boolean or array) If the formatted array is empty, returns false. Otherwise, returns array of classes., (*12)

printOnPresent

Like the proverbial weasel, this function pops out markup if data is present. It's a more efficient way of doing an if ( '' !== $data ) or if ( !empty( $data ) ) check: 3 lines for the price of one!, (*13)

If you pass in a function name, the function will be executed. You can use anonymous functions too!, (*14)

Usage

<?php CNP\Utility::printOnPresent( $string, '<h1 class="title">'. $string .'</h1>' ); ?>

Parameters

$string_or_array (required): The variable to check for data, which can be a string or an array. Objects are not supported., (*15)

$markup_or_function (required): What to do with the data if it is present. You can supply a string of markup, or call a function for more complex scenarios., (*16)

Return Values

(boolean or string) If the data check fails, printOnPresent returns false. If the data check is successful, then printOnPresent echoes the markup or function output from the $markup_or_function variable., (*17)

The Versions

05/10 2017

dev-master

9999999-dev https://github.com/Clark-Nikdel-Powell/PHP-Utilities

Generic PHP functions for standardized data manipulation.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

05/10 2017

v1.0.0

1.0.0.0 https://github.com/Clark-Nikdel-Powell/PHP-Utilities

Generic PHP functions for standardized data manipulation.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

13/12 2016

v0.9

0.9.0.0 https://github.com/Clark-Nikdel-Powell/PHP-Utilities

Generic PHP functions for standardized data manipulation.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

25/10 2016

v0.8

0.8.0.0 https://github.com/Clark-Nikdel-Powell/PHP-Utilities

Generic PHP functions for standardized data manipulation.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

19/09 2016

v0.7.5

0.7.5.0 https://github.com/Clark-Nikdel-Powell/PHP-Utilities

Generic PHP functions for standardized data manipulation.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

27/06 2016

v0.7.4

0.7.4.0 https://github.com/Clark-Nikdel-Powell/PHP-Utilities

Generic PHP functions for standardized data manipulation.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

20/06 2016

v0.7.3

0.7.3.0 https://github.com/Clark-Nikdel-Powell/PHP-Utilities

Generic PHP functions for standardized data manipulation.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

20/06 2016

v0.7.2

0.7.2.0 https://github.com/Clark-Nikdel-Powell/PHP-Utilities

Generic PHP functions for standardized data manipulation.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

20/06 2016

v0.7.1

0.7.1.0 https://github.com/Clark-Nikdel-Powell/PHP-Utilities

Generic PHP functions for standardized data manipulation.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

20/06 2016

v0.7

0.7.0.0 https://github.com/Clark-Nikdel-Powell/PHP-Utilities

Generic PHP functions for standardized data manipulation.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

06/06 2016

v0.6

0.6.0.0 https://github.com/Clark-Nikdel-Powell/PHP-Utilities

Generic PHP functions for standardized data manipulation.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

18/05 2016

v0.5

0.5.0.0 https://github.com/Clark-Nikdel-Powell/PHP-Utilities

Generic PHP functions for standardized data manipulation.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

05/05 2016

v0.4

0.4.0.0 https://github.com/Clark-Nikdel-Powell/PHP-Utilities

Generic PHP functions for standardized data manipulation.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

03/05 2016

v0.3

0.3.0.0 https://github.com/Clark-Nikdel-Powell/PHP-Utilities

Generic PHP functions for standardized data manipulation.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

02/05 2016

v0.2

0.2.0.0 https://github.com/Clark-Nikdel-Powell/PHP-Utilities

Generic PHP functions for standardized data manipulation.

  Sources   Download

MIT

The Requires

  • php >=5.3.3