public function hasCollisions() { $this->collisions = array(); $this->namespace = AkInflector::underscore(Ak::first(explode(':', $this->task_name . ':'))); $this->task_name = AkInflector::underscore(Ak::last(explode(':', ':' . $this->task_name))); $this->destination_path = AK_TASKS_DIR . DS . $this->namespace; if (file_exists($this->destination_path . DS . $this->task_name . '.task.php')) { $this->collisions[] = Ak::t('%path already exists', array('%path' => $this->destination_path . DS . $this->task_name . '.task.php')); } return count($this->collisions) > 0; }
protected function addFormatToParams(&$params) { if (!AK_AUTOMATICALLY_ACCEPT_KNOW_FORMATS || empty($params) || isset($params['format'])) { return; } $last_key = Ak::last(array_keys($params)); if (!is_string($params[$last_key])) { return; } if ($format = strrchr($params[$last_key], '.')) { $trimmed_format = trim($format, '.'); if (!AkMimeType::isFormatRegistered($trimmed_format)) { return; } $params[$last_key] = substr($params[$last_key], 0, strpos($params[$last_key], $format)); $params['format'] = $trimmed_format; } }
function test_decode_encoded_attachment_filename() { $TestMailer =& new TestMailer(); $Mail =& $TestMailer->receive(file_get_contents(AK_TEST_DIR."/fixtures/data/action_mailer/raw_email8")); $Attachment = Ak::last($Mail->attachments); $this->assertEqual("01QuienTeDijat.Pitbull.mp3", $Attachment->original_filename); }
public function test_decode_encoded_attachment_filename() { $TestMailer = new TestMailer(); $Mail = $TestMailer->receive(file_get_contents(AkConfig::getDir('fixtures') . DS . "raw_email8")); $Attachment = Ak::last($Mail->attachments); $this->assertEqual("01QuienTeDijat.Pitbull.mp3", $Attachment->original_filename); }
protected function _partialCounterName($partial_name) { return Ak::last(explode('/', $partial_name)) . '_counter'; }
public function guessApplicationName() { $application_name = Ak::last(explode('/', AK_SITE_URL_SUFFIX)); $application_name = empty($application_name) ? substr(AK_BASE_DIR, strrpos(AK_BASE_DIR, DS) + 1) : $application_name; return empty($application_name) ? 'my_app' : $application_name; }
public function instantiateHelperAsHandlerAttribute($helper, $file) { $helper_class_name = AkInflector::camelize(strstr($helper, 'Helper') ? $helper : $helper . 'Helper'); if (!($file_path = $this->getHelperFileName($file))) { return false; } include_once $file_path; if (strstr($file_path, AK_ACTION_PACK_DIR . DS . 'helpers') && substr($helper_class_name, 0, 2) != 'Ak') { $helper_class_name = 'Ak' . $helper_class_name; $using_core_helper_alias = true; } if (class_exists($helper_class_name)) { $attribute_name = Ak::last(explode(DS, substr($file_path, 0, -4))); $this->_Handler->{$attribute_name} = new $helper_class_name($this->_Handler); if (isset($using_core_helper_alias)) { $attribute_name_alias = substr($attribute_name, 3); if (!isset($this->_Handler->{$attribute_name_alias})) { $this->_Handler->{$attribute_name_alias} = $this->_Handler->{$attribute_name}; } } if (method_exists($this->_Handler->{$attribute_name}, 'setController')) { $this->_Handler->{$attribute_name}->setController($this->_Handler); } elseif (method_exists($this->_Handler->{$attribute_name}, 'setMailer')) { $this->_Handler->{$attribute_name}->setMailer($this->_Handler); } if (method_exists($this->_Handler->{$attribute_name}, 'init')) { $this->_Handler->{$attribute_name}->init(); } $this->_HelperInstances[$attribute_name] = $this->_Handler->{$attribute_name}; } }
public function testMimetypeParserRecoginzesAdditionalParameters() { $this->Request->env['HTTP_ACCEPT'] = 'text/html;q=0.9;key=value;throw_away'; $this->assertEqual(array('type' => 'text/html', 'q' => '0.9', 'key' => 'value', 'throw_away'), Ak::last($this->Request->getAcceptHeader())); }