This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Finds pages that contain a particular Gravity Form. | |
*/ | |
class Gravity_Forms_Shortcode_Finder { | |
/** | |
* ID of the Gravity Form to search for. | |
* | |
* @var int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Require the file that contains the GravityFormsShortcodeFinder class. | |
require_once plugin_dir_path( __FILE__ ) . 'src/GravityFormsShortcodeFinder.php'; | |
// Find all the pages that contain the Gravity Forms with an ID of 36. | |
$pages_with_form = ( new Gravity_Forms_Shortcode_Finder( 36 ) )->find(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
private function get_foremen_in_division( $division ) { | |
$original_user_id = get_current_user_id(); | |
// Set current user to be a Super Admin so the user query below works during the AJAX requests & WP-Cron jobs. | |
$super_admins = get_super_admins(); | |
if ( $super_admins ) { | |
$super_admins = array_values( $super_admins ); | |
wp_set_current_user( null, $super_admins[0] ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get a list of all pages that contain a shortcode. | |
* | |
* @param string $shortcode The shortcode to look for without square brackets. | |
* | |
* @return array List of pages in the format $post_id => $post_title. | |
*/ | |
function get_pages_with_shortcode( $shortcode ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get a list of Gravity Forms whose fields have a CSS class. | |
* | |
* @param string $css_class The CSS class to search for. | |
* | |
* @return array The list of forms in this format: [<form ID> - <form title>] => <array of fields that have CSS class> | |
*/ | |
function get_gravity_forms_with_css_class( $css_class ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Array | |
( | |
[0] => Car Object | |
( | |
[model:Car:private] => Mustang | |
) | |
[1] => Car Object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Car { | |
private $model; | |
public function __construct( $model ) { | |
$this->model = $model; | |
} | |
public function get_model() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get all Super Admin users on the current site. | |
* | |
* @return array WP_User objects. | |
*/ | |
function get_all_superadmin_users() { | |
return get_users([ | |
'login__in' => get_super_admins() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get all non-Super Admin users on the current site. | |
* | |
* @return array WP_User objects. | |
*/ | |
function get_all_non_superadmin_users() { | |
return get_users([ | |
'login__not_in' => get_super_admins() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
1 => [ | |
'en-us' => [ | |
'name' => 'Puff Pastry', | |
'description' => 'Sign up for Puff Pastry news...' | |
], | |
'fr-ca' => [ | |
'name' => {French translation}, | |
'description' => {French transalation} | |
] |