_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q258500
Translations.defineCategoryTranslations
test
public static function defineCategoryTranslations() { // Bail if translation plugin is not active if (!is_plugin_active('polylang-pro/polylang.php') || empty($apiUrl = get_field('event_api_url', 'option'))) { return; } // Build request URL $apiUrl = rtrim($apiUrl...
php
{ "resource": "" }
q258501
Event.beforeSave
test
public function beforeSave() { $this->post_title = strip_tags(html_entity_decode($this->post_title)); $this->post_content = html_entity_decode($this->post_content); }
php
{ "resource": "" }
q258502
Event.afterSave
test
public function afterSave() { $this->saveOccasions(); $this->saveCategories(); $this->saveGroups(); $this->saveTags(); $this->saveLocation(); $this->saveAddLocations(); $this->saveLanguage(); if (!empty($this->gallery)) { foreach ($this->g...
php
{ "resource": "" }
q258503
Event.saveLocation
test
public function saveLocation() { if ($this->location != null) { if (!empty($this->location['parent']) && $this->location['parent']['id'] > 0) { $this->location['title'] = $this->location['parent']['title'].', '.$this->location['title']; } if (!empty($loca...
php
{ "resource": "" }
q258504
Event.saveAddLocations
test
public function saveAddLocations() { if (is_array($this->additional_locations) && !empty($this->additional_locations)) { foreach ($this->additional_locations as &$location) { if (!empty($location['parent']) && $location['parent']['id'] > 0) { $location['title'...
php
{ "resource": "" }
q258505
Event.saveCategories
test
public function saveCategories() { if (empty($this->categories)) { $terms = wp_get_post_terms($this->ID, 'event_categories', array('fields' => 'all')); if (!empty($terms)) { foreach ($terms as $term) { wp_remove_object_terms($this->ID, $term->term_...
php
{ "resource": "" }
q258506
Event.saveGroups
test
public function saveGroups() { // Save group names as new array $event_groups = array(); if (!empty($this->groups) && is_array($this->groups)) { foreach ($this->groups as $group) { $event_groups[] .= $group['name']; } } wp_set_object_te...
php
{ "resource": "" }
q258507
Event.saveTags
test
public function saveTags() { if (empty($this->tags)) { $terms = wp_get_post_terms($this->ID, 'event_tags', array('fields' => 'all')); if (!empty($terms)) { foreach ($terms as $term) { wp_remove_object_terms($this->ID, $term->term_id, 'event_tags');...
php
{ "resource": "" }
q258508
Event.saveOccasions
test
public function saveOccasions() { global $wpdb; // Delete all occasions related to the event $db_table = $wpdb->prefix."integrate_occasions"; $wpdb->delete($db_table, array('event_id' => $this->ID), array('%d')); // Remove post if occasions is missing if ($this->occ...
php
{ "resource": "" }
q258509
Event.saveLanguage
test
public function saveLanguage() { // Bail if Polylang is not active if (!is_plugin_active('polylang-pro/polylang.php')) { return; } // Apply language to the event if (!empty($this->lang)) { pll_set_post_language($this->ID, $this->lang); } ...
php
{ "resource": "" }
q258510
Event.getEventByOriginalId
test
public function getEventByOriginalId($id) { $args = array( 'meta_query' => array( array( 'key' => '_event_manager_id', 'value' => $id, ), ), 'post_type' => $this->post_type, 'posts_per_pag...
php
{ "resource": "" }
q258511
EventManagerApi.checkFilters
test
public function checkFilters($cat_filter, $tag_filter): bool { $tax_filter = (empty(get_field('event_filter_cat', 'options')) && empty( get_field( 'event_filter_tag', 'options' ) )) ? true : false; // Check category filters ...
php
{ "resource": "" }
q258512
EventManagerApi.removeExpiredOccasions
test
public function removeExpiredOccasions() { global $wpdb; $date_limit = strtotime("midnight now") - 1; // Get all occasions from database $db_table = $wpdb->prefix."integrate_occasions"; $occasions = $wpdb->get_results("SELECT * FROM $db_table ORDER BY start_date DESC", ARRAY_...
php
{ "resource": "" }
q258513
EventManagerApi.removeDeletedEvents
test
public function removeDeletedEvents($ids) { global $wpdb; $table = $wpdb->prefix . "integrate_occasions"; // Get all locally stored events $localEvents = $wpdb->get_results("SELECT event_id FROM {$table} GROUP BY event_id", ARRAY_N); $localEvents = array_map(function($id) { ...
php
{ "resource": "" }
q258514
EventManagerApi.removeExpiredEvents
test
public function removeExpiredEvents() { global $wpdb; $post_type = 'event'; // Get all events from databse $query = "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND (post_status = %s or post_status = %s)"; $completeQuery = $wpdb->prepare($query, $post_type, 'publish', 'd...
php
{ "resource": "" }
q258515
EventManagerApi.filterTaxonomies
test
public function filterTaxonomies($taxonomies, $type) { $passes = true; $tax_array = ($type == 0) ? get_field('event_filter_cat', 'options') : get_field('event_filter_tag', 'options'); if (!empty($tax_array)) { $filters = array_map('trim', explode(',', $tax_array)); $...
php
{ "resource": "" }
q258516
EventManagerApi.deleteEmptyTaxonomies
test
public function deleteEmptyTaxonomies() { if (!empty(get_object_taxonomies('event'))) { foreach (get_object_taxonomies('event') as $taxonomy) { // Skip Event Groups and categories if ($taxonomy == 'event_groups' || $taxonomy == 'event_categories') { ...
php
{ "resource": "" }
q258517
Location.renderLocationList
test
public function renderLocationList($post) { $api_url = get_field('event_api_url', 'option'); $location_endpoint = rtrim($api_url, '/') . '/location/complete'; @$json = file_get_contents($location_endpoint); if ($json == false) { $markup = '<em>' . __('Something went wron...
php
{ "resource": "" }
q258518
Location.saveLocation
test
public function saveLocation($post_id, $post, $update) { $api_url = get_field('event_api_url', 'option'); $location_endpoint = rtrim($api_url, '/') . '/location/'; if (isset($_POST['mod_location'])) { $location_endpoint = rtrim($api_url, '/') . '/location/' . $_POST['mod_locatio...
php
{ "resource": "" }
q258519
CacheBust.getRevManifest
test
public static function getRevManifest() { $jsonPath = EVENTMANAGERINTEGRATION_PATH . apply_filters('EventManagerIntegration/Helper/CacheBust/RevManifestPath', 'dist/rev-manifest.json'); if (file_exists($jsonPath)) { return json_decode(file_get_contents($jsonPath), true); } elsei...
php
{ "resource": "" }
q258520
AdminDisplayEvent.removeMetaBoxes
test
public function removeMetaBoxes() { if (function_exists('get_field')) { if (get_field('event_update_button', 'option') == false) { remove_meta_box('submitdiv', $this->post_type, 'side'); } } remove_meta_box('acf-group_56c33cf1470dc', $this->post_type, ...
php
{ "resource": "" }
q258521
AdminDisplayEvent.outputMeta
test
public function outputMeta($data) { $unserialized = @unserialize($data); if ($unserialized !== false) { return $this->multiImplode($unserialized, ', '); } else { return $data; } }
php
{ "resource": "" }
q258522
AdminDisplayEvent.multiImplode
test
public function multiImplode($array, $glue) { $string = ''; foreach ($array as $key => $item) { if (empty($item)) { continue; } if (is_array($item)) { $string .= '<p>' . $this->multiImplode($item, $glue) . '</p>'; } else { $string .= $item . $...
php
{ "resource": "" }
q258523
CustomPostType.registerPostType
test
public function registerPostType() { $labels = array( 'name' => $this->nameSingular, 'singular_name' => $this->nameSingular, 'add_new' => sprintf(__('Add new %s', 'event-manager'), $this->nameSingular), 'add_new_item' =>...
php
{ "resource": "" }
q258524
CustomPostType.addTableColumn
test
public function addTableColumn($key, $title, $sortable = false, $contentCallback = false) { $this->tableColumns[$key] = $title; if ($sortable === true) { $this->tableSortableColumns[$key] = $key; } if ($contentCallback !== false) { $this->tableColumnsContent...
php
{ "resource": "" }
q258525
CustomPostType.tableColumns
test
public function tableColumns($columns) { if (!empty($this->tableColumns) && is_array($this->tableColumns)) { $columns = $this->tableColumns; } return $columns; }
php
{ "resource": "" }
q258526
CustomPostType.tableSortableColumns
test
public function tableSortableColumns($columns) { if (!empty($this->tableSortableColumns) && is_array($this->tableSortableColumns)) { $columns = $this->tableColumns; } function arraytolower(array $columns, $round = 0) { return unserialize(strtolower(serialize(...
php
{ "resource": "" }
q258527
CustomPostType.tableColumnsContent
test
public function tableColumnsContent($column, $postId) { if (!isset($this->tableColumnsContentCallback[$column])) { return; } call_user_func_array($this->tableColumnsContentCallback[$column], array($column, $postId)); }
php
{ "resource": "" }
q258528
EventManagerGroups.saveTerms
test
public function saveTerms($name, $slug, $taxonomy, $parent = 0) { $term = get_term_by('slug', $slug, $taxonomy); if ($term == false) { $new_term = wp_insert_term($name, $taxonomy, array('slug' => $slug, 'parent' => $parent)); $term_id = $new_term['term_id']; $thi...
php
{ "resource": "" }
q258529
EventManagerGroups.activateNewGroup
test
public function activateNewGroup($termId, $parentId) { $selectedGroups = get_option('options_event_filter_group', false); if (is_array($selectedGroups) && !empty($selectedGroups)) { if (in_array($parentId, $selectedGroups)) { // Add children to option array ...
php
{ "resource": "" }
q258530
PostManager.removeEmpty
test
public function removeEmpty($metaValue) { if (is_array($metaValue)) { return $metaValue; } return ($metaValue !== null && $metaValue !== false && $metaValue !== ''); }
php
{ "resource": "" }
q258531
PostManager.getEmptyValues
test
public function getEmptyValues($metaValue) { if (is_array($metaValue) && empty($metaValue)) { return $metaValue; } return ($metaValue == null || $metaValue == false || $metaValue == ''); }
php
{ "resource": "" }
q258532
PostManager.removeEmptyMeta
test
public function removeEmptyMeta($meta, $post_id) { foreach ($meta as $key => $value) { $meta = get_post_meta($post_id, $key, true); if ($meta) { delete_post_meta($post_id, $key); } } }
php
{ "resource": "" }
q258533
PostManager.save
test
public function save() { $this->beforeSave(); // Arrays for holding save data $post = array(); $meta = array(); $post['post_status'] = $this->post_status; // Get the default class variables and set it's keys to forbiddenKeys $defaultData = get_class_vars(get...
php
{ "resource": "" }
q258534
PostManager.attachmentExists
test
private function attachmentExists($src) { global $wpdb; $query = "SELECT ID FROM {$wpdb->posts} WHERE guid = '$src'"; $id = $wpdb->get_var($query); if (!empty($id) && $id > 0) { return $id; } return false; }
php
{ "resource": "" }
q258535
SubmitForm.submitFormCallback
test
public function submitFormCallback($atts = [], $content = null, $tag = '') { // Normalize attribute keys, lowercase $atts = array_change_key_case((array)$atts, CASE_LOWER); // Override default attributes with user attributes $data = shortcode_atts([ 'user_groups' => '', ...
php
{ "resource": "" }
q258536
EventArchive.addEventDateArgsToPermalinks
test
public function addEventDateArgsToPermalinks($permalink, $post, $leavename) { if (!isset($post->start_date) || $post->post_type != $this->eventPostType) { return $permalink; } return esc_url(add_query_arg('date', preg_replace('/\D/', '', $post->start_date), $permalink)); }
php
{ "resource": "" }
q258537
EventArchive.eventFilterWhere
test
public function eventFilterWhere($where) { $from = null; $to = null; if (isset($_GET['from']) && !empty($_GET['from'])) { $from = sanitize_text_field($_GET['from']); } if (isset($_GET['to']) && !empty($_GET['to'])) { $to = date('Y-m-d', strtotime("+1...
php
{ "resource": "" }
q258538
SingleEventData.singleEventDate
test
public static function singleEventDate() { global $post; $singleOccasion = array(); $get_date = (!empty(get_query_var('date'))) ? get_query_var('date') : false; $occasions = QueryEvents::getEventOccasions($post->ID); //Get nearest occasions from time if no date arg ...
php
{ "resource": "" }
q258539
SingleEventData.getNextOccasionDate
test
public static function getNextOccasionDate($occasions, $dateFormat = 'YmdHis') { if (!is_array($occasions) || empty($occasions)) { return false; } $startDates = array(); foreach ($occasions as $occasion) { //Skip if event has ended if (time() > st...
php
{ "resource": "" }
q258540
SingleEventData.getClosest
test
public static function getClosest($search, $arr) { $closest = null; foreach ($arr as $item) { if ($closest === null || abs($search - $closest) > abs($item - $search)) { $closest = $item; } } return $closest; }
php
{ "resource": "" }
q258541
SingleEventData.dateParts
test
public static function dateParts($start_date) { $start = date('Y-m-d H:i:s', strtotime($start_date)); $date = array( 'date' => mysql2date('j', $start, true), 'month' => mysql2date('F', $start, true), 'month_short' => substr(mysql2date('F', $start, true), 0, 3), ...
php
{ "resource": "" }
q258542
Options.saveDrawPoints
test
public function saveDrawPoints() { if (!isset($_POST['coordinates']) && !empty($_POST['coordinates'])) { wp_send_json_error("Missing coordinates"); } $points = $_POST['coordinates']; // Convert coordinates to float foreach ($points as &$point) { $poin...
php
{ "resource": "" }
q258543
App.enqueueAdmin
test
public function enqueueAdmin() { // Styles wp_register_style('event-integration-admin', EVENTMANAGERINTEGRATION_URL . '/dist/' . Helper\CacheBust::name('css/event-manager-integration-admin.css')); wp_enqueue_style('event-integration-admin'); // Scripts wp_registe...
php
{ "resource": "" }
q258544
App.enqueueFront
test
public function enqueueFront() { // Styles wp_enqueue_style( 'event-integration', EVENTMANAGERINTEGRATION_URL . '/dist/' . Helper\CacheBust::name('css/event-manager-integration.css')); // Scripts // Google Maps JS Api if ($googleApiKey = get_field('g...
php
{ "resource": "" }
q258545
App.formatShortDate
test
public static function formatShortDate($start_date) { $start = date('Y-m-d H:i:s', strtotime($start_date)); $today = (date('Ymd') == date('Ymd', strtotime($start_date))) ? true : false; $date = array( 'today' => $today, 'date' => mysql2date('j', $start, true), ...
php
{ "resource": "" }
q258546
App.importEventsCron
test
public function importEventsCron() { if (get_field('event_daily_import', 'option') == true && $apiUrl = Helper\ApiUrl::buildApiUrl()) { new Parser\EventManagerApi($apiUrl); } }
php
{ "resource": "" }
q258547
App.importPublishingGroups
test
public static function importPublishingGroups() { $api_url = get_field('event_api_url', 'option'); if ($api_url) { $api_url = rtrim($api_url, '/') . '/user_groups'; new Parser\EventManagerGroups($api_url); } }
php
{ "resource": "" }
q258548
App.checkDatabaseTable
test
public static function checkDatabaseTable() { global $wpdb; $table_name = $wpdb->prefix . 'integrate_occasions'; if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) { self::databaseCreation(); } return; }
php
{ "resource": "" }
q258549
App.databaseCreation
test
public static function databaseCreation() { global $wpdb; global $event_db_version; $table_name = $wpdb->prefix . 'integrate_occasions'; $charset_collate = $wpdb->get_charset_collate(); $sql = "CREATE TABLE $table_name ( ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,...
php
{ "resource": "" }
q258550
Parser.checkIfEventExists
test
public function checkIfEventExists($event_manager_id) { global $wpdb; $results = $wpdb->get_results( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_event_manager_id' AND meta_value = $event_manager_id LIMIT 1", ARRAY_A ); if (!empty($results[0]['post_...
php
{ "resource": "" }
q258551
Parser.requestApi
test
public static function requestApi($url) { // Dont verify ssl cert in dev mode $args = array( 'timeout' => 120, 'sslverify' => defined('DEV_MODE') && DEV_MODE == true ? false : true, 'headers' => array( 'ClientSolution' => 'WordPress Integration '.E...
php
{ "resource": "" }
q258552
QueryEvents.getEventOccasions
test
public static function getEventOccasions($post_id, $custom = false) { global $wpdb; $db_table = $wpdb->prefix."integrate_occasions"; $query = " SELECT * FROM $db_table WHERE $db_table.event_id = %d "; $query .= ($custom == true) ? "A...
php
{ "resource": "" }
q258553
QueryEvents.getEventMeta
test
public static function getEventMeta($post_id) { global $wpdb; $query = " SELECT * FROM $wpdb->postmeta WHERE $wpdb->postmeta.post_id = %s "; $completeQuery = $wpdb->prepare($query, $post_id); $event_meta = $wpdb->get_results($comple...
php
{ "resource": "" }
q258554
QueryEvents.stringLimiter
test
public static function stringLimiter($string, $limit) { if (strlen($string) <= $limit || $limit == -1) { return $string; } else { $y = mb_substr($string, 0, $limit, "utf-8").'...'; return $y; } }
php
{ "resource": "" }
q258555
QueryEvents.getNearbyLocations
test
public static function getNearbyLocations($lat, $lng, $distance = 0) { global $wpdb; // Radius of the earth in kilometers. $earth_radius = 6371; $sql = $wpdb->prepare( " SELECT DISTINCT latitude.post_id, post.post_t...
php
{ "resource": "" }
q258556
DisplayEvents.update
test
public function update($new_instance, $old_instance) { $instance = array(); $instance['title'] = (! empty($new_instance['title'])) ? strip_tags($new_instance['title']) : ''; $instance['limit'] = absint($new_instance['limit']); $instance['days_ahead'] = absint($new_instance['days_ahea...
php
{ "resource": "" }
q258557
Event.ajaxPagination
test
public function ajaxPagination() { echo \EventManagerIntegration\Helper\RenderBlade::blade( 'partials/list', $this->data(), $this->templateDir ); wp_die(); }
php
{ "resource": "" }
q258558
Event.getEvents
test
public function getEvents($module_id, $page = 1, $useLimit = true) { $fields = json_decode(json_encode(get_fields($module_id))); $display_limit = ($useLimit == true && isset($fields->mod_event_limit)) ? $fields->mod_event_limit : -1; $days_ahead = isset($fields->mod_event_interval) ? $fields...
php
{ "resource": "" }
q258559
Event.getModuleCategories
test
public function getModuleCategories($moduleId): array { $categories = array(); $showAllCategories = get_field('mod_event_categories_show', $moduleId); $moduleCategories = get_field('mod_event_categories_list', $moduleId); if ($showAllCategories === false && !empty($moduleCategories)...
php
{ "resource": "" }
q258560
Event.getFilterableCategories
test
public function getFilterableCategories($moduleId): array { $categories = array(); $showAllCategories = get_field('mod_event_categories_show', $moduleId); $moduleCategories = get_field('mod_event_categories_list', $moduleId); if ($showAllCategories === false && !empty($moduleCategor...
php
{ "resource": "" }
q258561
Event.getModuleGroups
test
public function getModuleGroups($moduleId): array { $groups = array(); $showAllGroups = get_field('mod_event_groups_show', $moduleId); $moduleGroups = get_field('mod_event_groups_list', $moduleId); if ($showAllGroups === false && !empty($moduleGroups) && is_array($moduleGroups)) { ...
php
{ "resource": "" }
q258562
Event.getModuleTags
test
public function getModuleTags($moduleId): array { $tags = array(); $showAllTags = get_field('mod_event_tags_show', $moduleId); $moduleTags = get_field('mod_event_tags_list', $moduleId); if ($showAllTags === false && !empty($moduleTags) && is_array($moduleTags)) { $tags =...
php
{ "resource": "" }
q258563
Event.getAgeFilterRange
test
public function getAgeFilterRange($moduleId): array { $years = array(); $from = (int)get_field('mod_event_filter_age_range_from', $moduleId); $to = (int)get_field('mod_event_filter_age_range_to', $moduleId); if ($from < $to) { foreach (range($from, $to) as $value) { ...
php
{ "resource": "" }
q258564
OAuthAdmin.oauthRequestCallback
test
public function oauthRequestCallback() { ?> <div class="wrap"> <h1><?php _e('API authentication', 'event-integration' ); ?></h1> </div> <div class="error notice hidden"></div> <div class="updated notice hidden"></div> <?php if (get_option('_event_authorized'...
php
{ "resource": "" }
q258565
OAuthRequests.sanitizeInput
test
public function sanitizeInput(&$array) { foreach ($array as $key => &$value) { if(!is_array($value)) { if ($key == 'content') { $value = sanitize_textarea_field($value); } else { $value = sanitize_text_field($value); ...
php
{ "resource": "" }
q258566
Events.singleViewData
test
public function singleViewData($data) { // Bail if not event if (get_post_type() !== self::$postTypeSlug || is_archive()) { return $data; } global $post; // Gather event data $eventData = array(); $eventData['occasion'] = \EventManagerIntegration...
php
{ "resource": "" }
q258567
Events.getUserGroups
test
public function getUserGroups($value, $post_id, $field) { if (!empty($value)) { \EventManagerIntegration\App::importPublishingGroups(); } return $value; }
php
{ "resource": "" }
q258568
Events.updateGroupValue
test
public function updateGroupValue($value, $post_id, $field) { // Get old value if ($post_id === 'options') { $selectedGroups = get_field('event_filter_group', 'options'); } else { $selectedGroups = get_field('mod_event_groups_list', $post_id); } // Retu...
php
{ "resource": "" }
q258569
Events.eventContent
test
public function eventContent($content) { if (!is_singular($this->slug)) { return $content; } $custom_content = $this->getCustomContent(); if ($custom_content) { $content = $custom_content; } return $content; }
php
{ "resource": "" }
q258570
Events.eventContentLead
test
public function eventContentLead($lead) { if (!is_singular($this->slug)) { return $lead; } $custom_content = $this->getCustomContent(); if ($custom_content) { $lead = null; } return $lead; }
php
{ "resource": "" }
q258571
Events.getCustomContent
test
public function getCustomContent() { global $post; $get_date = (!empty(get_query_var('date'))) ? get_query_var('date') : false; if ($get_date != false) { $occasions = \EventManagerIntegration\Helper\QueryEvents::getEventOccasions($post->ID, false); foreach ($occasion...
php
{ "resource": "" }
q258572
Events.registerEventCategories
test
public function registerEventCategories() { $labels = array( 'name' => _x('Event categories', 'Taxonomy plural name', 'event-integration'), 'singular_name' => _x('Event category', 'Taxonomy singular name', 'event-integration'), 'search_items' ...
php
{ "resource": "" }
q258573
Events.registerEventTags
test
public function registerEventTags() { $labels = array( 'name' => _x('Event tags', 'Taxonomy plural name', 'event-integration'), 'singular_name' => _x('Event tag', 'Taxonomy singular name', 'event-integration'), 'search_items' => __('Searc...
php
{ "resource": "" }
q258574
Events.registerEventGroups
test
public function registerEventGroups() { $labels = array( 'name' => _x('Event groups', 'Taxonomy plural name', 'event-integration'), 'singular_name' => _x('Event group', 'Taxonomy singular name', 'event-integration'), 'search_items' => __(...
php
{ "resource": "" }
q258575
Events.addImportButtons
test
public function addImportButtons($views) { if (current_user_can('administrator') || current_user_can('editor')) { $button = '<div class="import-buttons actions" style="position: relative;">'; if (get_field('event_api_url', 'option')) { $button .= '<div id="importeve...
php
{ "resource": "" }
q258576
Events.importEvents
test
public function importEvents() { if ($apiUrl = \EventManagerIntegration\Helper\ApiUrl::buildApiUrl()) { $importer = new \EventManagerIntegration\Parser\EventManagerApi($apiUrl); $data = $importer->getCreatedData(); wp_send_json($data); } wp_die(); }
php
{ "resource": "" }
q258577
Events.acceptOrDeny
test
public function acceptOrDeny() { if (!isset($_POST['postId']) || !isset($_POST['value'])) { echo _e('Something went wrong!', 'event-integration'); die(); } $postId = $_POST['postId']; $value = $_POST['value']; $post = get_post($postId); if ($...
php
{ "resource": "" }
q258578
CreateTunnel.createTunnel
test
protected function createTunnel() { $this->runCommand(sprintf('%s %s >> %s 2>&1 &', config('tunneler.nohup_path'), $this->sshCommand, config('tunneler.nohup_log') )); // Ensure we wait long enough for it to actually connect. usleep(config('tunneler...
php
{ "resource": "" }
q258579
CreateTunnel.verifyTunnel
test
protected function verifyTunnel() { if (config('tunneler.verify_process') == 'bash') { return $this->runCommand($this->bashCommand); } return $this->runCommand($this->ncCommand); }
php
{ "resource": "" }
q258580
CreateTunnel.runCommand
test
protected function runCommand($command) { $return_var = 1; exec($command, $this->output, $return_var); return (bool)($return_var === 0); }
php
{ "resource": "" }
q258581
Listener.setSignalHandler
test
public function setSignalHandler(int $signal, callable $closure = null){ if (empty($closure)){ return pcntl_signal($signal, array($this, 'sigHandler')); } return pcntl_signal($signal, $closure); }
php
{ "resource": "" }
q258582
Listener.sigHandler
test
public function sigHandler( int $signo ){ $this->handleWorkerOutput('warn', sprintf("Signal %d Caught, asking the daemon to stop gracefully.", $signo)); $this->stopGracefully = true; }
php
{ "resource": "" }
q258583
Listener.runProcess
test
public function runProcess(Process $process, $memory) { try { $process->run(function ($type, $line) { $this->handleWorkerOutput($type, $line); }); }catch (\Exception $e){ dd($e); } // If we caught a signal and need to stop graceful...
php
{ "resource": "" }
q258584
FrontendEditor.editFor
test
public function editFor($containerName, $defaultAction = 'showAll'): string { $environment = $this->createDcGeneral($containerName); $actionName = $environment->getInputProvider()->getParameter('act') ?: $defaultAction; $action = new Action($actionName); $event = new Acti...
php
{ "resource": "" }
q258585
FrontendEditor.createDcGeneral
test
public function createDcGeneral($containerName): EnvironmentInterface { if (!array_key_exists($containerName, self::$environments)) { $dcGeneral = (new DcGeneralFactory()) ->setContainerName($containerName) ->setEventDispatcher($this->dispatcher) -...
php
{ "resource": "" }
q258586
WidgetManager.getWidget
test
public function getWidget($property, PropertyValueBag $valueBag = null) { $environment = $this->getEnvironment(); $dispatcher = $environment->getEventDispatcher(); $propertyDefinitions = $environment->getDataDefinition()->getPropertiesDefinition(); if (!$propertyDef...
php
{ "resource": "" }
q258587
WidgetManager.renderWidget
test
public function renderWidget($property, $ignoreErrors = false, PropertyValueBag $valueBag = null) { $widget = $this->getWidget($property, $valueBag); if (!$widget) { throw new DcGeneralRuntimeException('No widget for property ' . $property); } if ($ignoreErrors) { ...
php
{ "resource": "" }
q258588
WidgetManager.processInput
test
public function processInput(PropertyValueBag $valueBag) { $post = $this->hijackPost($valueBag); // Now get and validate the widgets. foreach (array_keys($valueBag->getArrayCopy()) as $property) { $this->processProperty($valueBag, $property); } $this->restorePos...
php
{ "resource": "" }
q258589
WidgetManager.processProperty
test
private function processProperty(PropertyValueBag $valueBag, $property) { // NOTE: the passed input values are RAW DATA from the input provider - aka widget known values and not // native data as in the model. // Therefore we do not need to decode them but MUST encode them. $widget =...
php
{ "resource": "" }
q258590
WidgetManager.hijackPost
test
private function hijackPost(PropertyValueBag $valueBag) { $post = $_POST; $_POST = []; Input::resetCache(); // Set all POST data, these get used within the Widget::validate() method. foreach ($valueBag as $property => $value) { $_POST[$property] = $value; ...
php
{ "resource": "" }
q258591
DeleteHandler.handleEvent
test
public function handleEvent(ActionEvent $event): void { if (!$this->scopeDeterminator->currentScopeIsFrontend()) { return; } $action = $event->getAction(); // Only handle if we do not have a manual sorting or we know where to insert. // Manual sorting is handled ...
php
{ "resource": "" }
q258592
ImagineFactory.create
test
public function create($className = 'Imagine') { $this->configureDriverSpecificSettings(); $className = 'Imagine\\' . $this->settings['driver'] . '\\' . $className; $arguments = array_slice(func_get_args(), 1); switch (count($arguments)) { case 0: $object = new $classNa...
php
{ "resource": "" }
q258593
ImagineFactory.configureImagickSettings
test
protected function configureImagickSettings() { if (!isset($this->settings['driverSpecific']['Imagick'])) { return; } $limits = $this->settings['driverSpecific']['Imagick']['limits'] ? $this->settings['driverSpecific']['Imagick']['limits'] : []; foreach ($limits as $reso...
php
{ "resource": "" }
q258594
AbstractImagineFactory.injectSettings
test
public function injectSettings(array $settings) { $this->settings = $settings; if (!isset($settings['enabledDrivers'])) { // FIXME: This is a hotfix and should actually be fixed in the Neos setup step. As soon as it is fixed there, this condition can be removed. return; ...
php
{ "resource": "" }
q258595
DefaultWidgetBuilder.handleEvent
test
public function handleEvent(BuildWidgetEvent $event) { // Only run in the frontend or when the widget is not build yet if (false === $this->scopeDeterminator->currentScopeIsFrontend() || null !== $event->getWidget()) { return; } $widget = $this->buildWidget($event->getEn...
php
{ "resource": "" }
q258596
DefaultWidgetBuilder.getWidgetClass
test
private function getWidgetClass(PropertyInterface $property) { if (!isset($GLOBALS['TL_FFL'][$property->getWidgetType()])) { return null; } $className = $GLOBALS['TL_FFL'][$property->getWidgetType()]; if (!class_exists($className)) { return null; } ...
php
{ "resource": "" }
q258597
DefaultWidgetBuilder.getOptionsForWidget
test
private function getOptionsForWidget( EnvironmentInterface $environment, PropertyInterface $propInfo, ModelInterface $model ) { $dispatcher = $environment->getEventDispatcher(); $options = $propInfo->getOptions(); $event = new GetPropertyOptionsEvent($environm...
php
{ "resource": "" }
q258598
EditMask.execute
test
public function execute() { $inputProvider = $this->environment->getInputProvider(); $palettesDefinition = $this->definition->getPalettesDefinition(); $isSubmitted = ($inputProvider->getValue('FORM_SUBMIT') === $this->definition->getName()); $isAutoSubmit = ($inputP...
php
{ "resource": "" }
q258599
EditMask.enforceModelRelationship
test
private function enforceModelRelationship() { $event = new EnforceModelRelationshipEvent($this->environment, $this->model); $this->dispatcher->dispatch(DcGeneralEvents::ENFORCE_MODEL_RELATIONSHIP, $event); }
php
{ "resource": "" }