Skip to content

Commit

Permalink
EPRESS-103 Fixes PHP warning for Gists
Browse files Browse the repository at this point in the history
  • Loading branch information
Anderson Grudtner Martins committed Mar 13, 2017
1 parent 5b4dfa8 commit d8f9f4b
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/EmbedPress/Shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,14 +540,25 @@ private static function extractContentFromHeaderAsArray($headerPattern, $headers
*/
private static function sanitizeUrlData($data)
{
$attributes = get_object_vars($data);

foreach ($attributes as $key => $value) {
if (substr_count($key, '-')) {
unset($data->$key);

$key = str_replace('-', '_', $key);
$data->$key = $value;
if (is_object($data)) {
$attributes = get_object_vars($data);

foreach ($attributes as $key => $value) {
if (substr_count($key, '-')) {
unset($data->$key);

$key = str_replace('-', '_', $key);
$data->$key = $value;
}
}
} elseif (is_array($data)) {
foreach ($data as $key => $value) {
if (substr_count($key, '-')) {
unset($data[$key]);

$key = str_replace('-', '_', $key);
$data[$key] = $value;
}
}
}

Expand Down

0 comments on commit d8f9f4b

Please sign in to comment.