Skip to content

Commit

Permalink
Merge pull request #272 from codepress/release/4.1
Browse files Browse the repository at this point in the history
Release/4.1
  • Loading branch information
DGStefan authored Mar 31, 2020
2 parents c5b952e + 1c66ec0 commit a4e9630
Show file tree
Hide file tree
Showing 351 changed files with 7,342 additions and 5,943 deletions.
55 changes: 38 additions & 17 deletions api.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php

use AC\Admin;
use AC\EncodedListScreenDataFactory;
use AC\Helper;
use AC\ListScreen;
use AC\ListScreenCollection;
use AC\Type\ListScreenId;

/**
* @return AC\AdminColumns
Expand Down Expand Up @@ -53,7 +56,7 @@ function ac_get_site_utm_url( $path, $utm_medium, $utm_content = null, $utm_camp
$utm_campaign = 'plugin-installation';
}

$args = array(
$args = [
// Referrer: plugin
'utm_source' => 'plugin-installation',

Expand All @@ -65,23 +68,22 @@ function ac_get_site_utm_url( $path, $utm_medium, $utm_content = null, $utm_camp

// Used for differentiation of medium
'utm_content' => $utm_content,
);
];

$args = array_map( 'sanitize_key', array_filter( $args ) );

return add_query_arg( $args, $url );
}

/**
* Admin Columns Twitter username
* @return string
*/
function ac_get_twitter_handle() {
return 'admincolumns';
}

/**
* Simple helper methods for AC_Column objects
* Simple helper methods for AC/Column objects
* @since 3.0
*/
function ac_helper() {
Expand All @@ -97,7 +99,7 @@ function ac_helper() {
*/
function ac_register_columns( $list_screen_keys, $column_data ) {
foreach ( (array) $list_screen_keys as $key ) {
AC\ListScreenApiData::push( [ $key => $column_data ] );
ac_load_columns( [ $key => $column_data ] );
}
}

Expand All @@ -111,23 +113,42 @@ function ac_register_columns( $list_screen_keys, $column_data ) {
*
* @param array $data
*
* @since 4.0.0
* @deprecated 4.1
* @since 4.0.0
*/
function ac_load_columns( array $data ) {
AC\ListScreenApiData::push( $data );
$factory = new EncodedListScreenDataFactory();
$factory->create()->add( $data );
}

/**
* @param string $slug Page slug
* @param string|null $slug
*
* @return string
*/
function ac_get_admin_url( $slug = null ) {
if ( null === $slug ) {
$slug = 'columns';
}
function ac_get_admin_url( $slug ) {
return add_query_arg(
[
Admin::QUERY_ARG_PAGE => Admin::NAME,
Admin::QUERY_ARG_TAB => $slug,
],
admin_url( 'options-general.php' )
);
}

return AC()->admin()->get_url( $slug );
/**
* @param string|null $slug
*
* @return string
*/
function ac_get_admin_network_url( $slug = null ) {
return add_query_arg(
[
Admin::QUERY_ARG_PAGE => Admin::NAME,
Admin::QUERY_ARG_TAB => $slug,
],
network_admin_url( 'settings.php' )
);
}

/**
Expand All @@ -139,9 +160,9 @@ function ac_get_admin_url( $slug = null ) {
* @return string
*/
function ac_convert_site_url( $label, $action = 'encode' ) {
$input = array( site_url(), '[cpac_site_url]' );
$input = [ site_url(), '[cpac_site_url]' ];

if ( 'decode' == $action ) {
if ( 'decode' === $action ) {
$input = array_reverse( $input );
}

Expand All @@ -155,7 +176,7 @@ function ac_convert_site_url( $label, $action = 'encode' ) {
* @since 4.0.0
*/
function ac_get_list_screen( $id ) {
return AC()->get_listscreen_repository()->find( $id );
return AC()->get_storage()->find( new ListScreenId( $id ) );
}

/**
Expand All @@ -165,7 +186,7 @@ function ac_get_list_screen( $id ) {
* @since 4.0.0
*/
function ac_get_list_screens( $key ) {
return AC()->get_listscreen_repository()->find_all( [ 'key' => $key ] );
return AC()->get_storage()->find_all( [ 'key' => $key ] );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion assets/css/admin-general.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/css/admin-page-columns.css

Large diffs are not rendered by default.

Loading

0 comments on commit a4e9630

Please sign in to comment.