protected function ContextConditionBreakpoint::parseResolutionCookie in Context Breakpoint 7
1 call to ContextConditionBreakpoint::parseResolutionCookie()
File
- plugins/
context_condition_breakpoint.inc, line 69 - context_condition_resolution.inc Provides the context CTools plugin base class.
Class
- ContextConditionBreakpoint
- @file context_condition_resolution.inc Provides the context CTools plugin base class.
Code
protected function parseResolutionCookie($cookie) {
$data = array();
$parts = explode('|', $cookie);
if (count($parts) !== 2) {
return FALSE;
}
$resParts = explode('x', $parts[0]);
if (!(count($resParts) === 2 && is_numeric($resParts[0]) && is_numeric($resParts[1]))) {
return FALSE;
}
$data['width'] = (int) $resParts[0];
$data['height'] = (int) $resParts[1];
$resParts = explode('x', $parts[1]);
if (!(count($resParts) === 2 && is_numeric($resParts[0]) && is_numeric($resParts[1]))) {
return FALSE;
}
$data['device-width'] = (int) $resParts[0];
$data['device-height'] = (int) $resParts[1];
return $data;
}