* From getID3() by James Heinrich <[email protected]> under GNU GPL */ if(!function_exists('utf8_decode')){ function utf8_decode($string){ $newcharstring = ''; $offset = 0; $stringlength = strlen($string); while ($offset < $stringlength) { if ((ord($string{$offset}) | 0x07) == 0xF7) { $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) & ((ord($string{($offset + 1)}) & 0x3F) << 12) & ((ord($string{($offset + 2)}) & 0x3F) << 6) & (ord($string{($offset + 3)}) & 0x3F); $offset += 4; } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) { $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) & ((ord($string{($offset + 1)}) & 0x3F) << 6) & (ord($string{($offset + 2)}) & 0x3F);
namespace cleantalk\antispam; require_once(__DIR__.'/../php-antispam/lib/Cleantalk.php'); require_once(__DIR__.'/../php-antispam/lib/CleantalkRequest.php'); require_once(__DIR__.'/../php-antispam/lib/CleantalkHelper.php'); require_once(__DIR__.'/../php-antispam/lib/CleantalkResponse.php'); require_once(__DIR__.'/../php-antispam/lib/CleantalkAPI.php'); require_once(__DIR__.'/../php-antispam/lib/cleantalk-php-patch.php'); use lib\Cleantalk; use lib\CleantalkRequest; use InvalidArgumentException; use Yii;
namespace cleantalk\antispam; require_once(__DIR__.'/../php-antispam/lib/Cleantalk.php'); require_once(__DIR__.'/../php-antispam/lib/CleantalkRequest.php'); require_once(__DIR__.'/../php-antispam/lib/CleantalkHelper.php'); require_once(__DIR__.'/../php-antispam/lib/CleantalkResponse.php'); require_once(__DIR__.'/../php-antispam/lib/CleantalkAPI.php'); require_once(__DIR__.'/../php-antispam/lib/cleantalk-php-patch.php'); use lib\Cleantalk; use lib\CleantalkRequest; use InvalidArgumentException; use Yii;
* Scope isolated include. * * Prevents access to $this/self from included files. */ function includeFile($file) { include $file; }
* @param string $class The name of the class * @return bool|null True if loaded, null otherwise */ public function loadClass($class) { if ($file = $this->findFile($class)) { includeFile($file); return true; } } /**
if (isset($this->_reflections[$class])) { return [$this->_reflections[$class], $this->_dependencies[$class]]; } $dependencies = []; try { $reflection = new ReflectionClass($class); } catch (\ReflectionException $e) { throw new InvalidConfigException('Failed to instantiate component or class "' . $class . '".', 0, $e); } $constructor = $reflection->getConstructor(); if ($constructor !== null) {
* @return object the newly created instance of the specified class * @throws NotInstantiableException If resolved to an abstract class or an interface (since 2.0.9) */ protected function build($class, $params, $config) { /* @var $reflection ReflectionClass */ list($reflection, $dependencies) = $this->getDependencies($class); foreach ($params as $index => $param) { $dependencies[$index] = $param; } $dependencies = $this->resolveDependencies($dependencies, $reflection);
public function get($class, $params = [], $config = []) { if (isset($this->_singletons[$class])) { // singleton return $this->_singletons[$class]; } elseif (!isset($this->_definitions[$class])) { return $this->build($class, $params, $config); } $definition = $this->_definitions[$class]; if (is_callable($definition, true)) { $params = $this->resolveDependencies($this->mergeParams($class, $params));
{ if (is_string($type)) { return static::$container->get($type, $params); } elseif (is_array($type) && isset($type['class'])) { $class = $type['class']; unset($type['class']); return static::$container->get($class, $params, $type); } elseif (is_callable($type, true)) { return static::$container->invoke($type, $params); } elseif (is_array($type)) { throw new InvalidConfigException('Object configuration must be an array containing a "class" element.'); }
if (isset($this->_definitions[$id])) { $definition = $this->_definitions[$id]; if (is_object($definition) && !$definition instanceof Closure) { return $this->_components[$id] = $definition; } return $this->_components[$id] = Yii::createObject($definition); } elseif ($throwException) { throw new InvalidConfigException("Unknown component ID: $id"); } return null; }
* Since version 2.0.13, if a component isn't defined in the module, it will be looked up in the parent module. * The parent module may be the application. */ public function get($id, $throwException = true) { if (!isset($this->module)) { return parent::get($id, $throwException); } $component = parent::get($id, false); if ($component === null) { $component = $this->module->get($id, $throwException); }
/** * @return \cleantalk\antispam\Component */ protected function getComponent() { return Yii::$app->get($this->apiComponentId); } }
return Html::hiddenInput('ct_checkjs', -1, ['id' => $this->checkJsHtmlId]) . Html::hiddenInput('ct_formid', $this->checkJsHtmlId); } protected function registerClientScript() { $js = 'setTimeout(function(){document.getElementById("' . $this->checkJsHtmlId . '").value="' . $this->getComponent()->getCheckJsCode() . '";}, 1000)'; $this->getView() ->registerJs($js); } /** * @return \cleantalk\antispam\Component
/** * @inheritdoc */ public function run() { $this->registerClientScript(); $this->getComponent()->startFormSubmitTime($this->checkJsHtmlId); return Html::hiddenInput('ct_checkjs', -1, ['id' => $this->checkJsHtmlId]) . Html::hiddenInput('ct_formid', $this->checkJsHtmlId); } protected function registerClientScript()
try { /* @var $widget Widget */ $config['class'] = get_called_class(); $widget = Yii::createObject($config); $out = ''; if ($widget->beforeRun()) { $result = $widget->run(); $out = $widget->afterRun($result); } } catch (\Exception $e) { // close the output buffer opened above if it has not been closed already if (ob_get_level() > 0) { ob_end_clean();
<?= $form->field($model, 'username')->textInput(['autofocus' => true]) ?> <?= $form->field($model, 'email')->textInput() ?> <?= $form->field($model, 'password')->passwordInput() ?> <?= \cleantalk\antispam\Widget::widget()?> <?= $form->field($model, 'firstname')->hiddenInput()->label(false) ?> <?= $form->field($model, 'photo')->hiddenInput()->label(false) ?> <?= $form->field($model, 'businessaddressline1')->hiddenInput()->label(false) ?> <?= $form->field($model, 'phonenumber')->hiddenInput()->label(false) ?> <?= $form->field($model, 'website')->hiddenInput()->label(false) ?>
{ $_obInitialLevel_ = ob_get_level(); ob_start(); ob_implicit_flush(false); extract($_params_, EXTR_OVERWRITE); try { require $_file_; return ob_get_clean(); } catch (\Exception $e) { while (ob_get_level() > $_obInitialLevel_) { if (!@ob_end_clean()) { ob_clean(); }
$this->renderers[$ext] = Yii::createObject($this->renderers[$ext]); } /* @var $renderer ViewRenderer */ $renderer = $this->renderers[$ext]; $output = $renderer->render($this, $viewFile, $params); } else { $output = $this->renderPhpFile($viewFile, $params); } $this->afterRender($viewFile, $params, $output); } array_pop($this->_viewFiles); $this->context = $oldContext;
* @throws InvalidCallException if the view cannot be resolved. * @see renderFile() */ public function render($view, $params = [], $context = null) { $viewFile = $this->findViewFile($view, $context); return $this->renderFile($viewFile, $params, $context); } /** * Finds the view file based on the given view name. * @param string $view the view name or the [path alias](guide:concept-aliases) of the view file. Please refer to [[render()]] * on how to specify this parameter.
* These parameters will not be available in the layout. * @return string the rendering result. * @throws InvalidArgumentException if the view file or the layout file does not exist. */ public function render($view, $params = []) { $content = $this->getView()->render($view, $params, $this); return $this->renderContent($content); } /** * Renders a static string by applying a layout. * @param string $content the static string being rendered
$model->rating = $glawyer->rating; } } } return $this->render('create', [ 'model' => $model, ]); } else if($user->role == 'client') { return $this->redirect(['client/profile']); }
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require(__DIR__ . '/../../common/config/main-local.php'), require(__DIR__ . '/../config/main.php'), require(__DIR__ . '/../config/main-local.php') ); $application = new yii\web\Application($config); $application->run();
$_GET = [ 'id' => 'ChIJDxOCURpqkFQRJOCn0kh0QUM', ];