/** * Shows the table structure */ public function actionStructure() { $table = $this->loadTable(); if (!$table instanceof Table) { $response = new AjaxResponse(); $response->addNotification("error", Yii::t("core", "tableLoadErrorTitle", array("{table}" => $this->table)), Yii::t("core", "tableLoadErrorMessage", array("{table}" => $this->table))); $response->executeJavaScript("sideBar.loadTables(schema)"); $this->sendJSON($response); } // Constraints if (StorageEngine::check($table->ENGINE, StorageEngine::SUPPORTS_FOREIGN_KEYS)) { $foreignKeys = array(); $sql = 'SELECT * FROM KEY_COLUMN_USAGE ' . 'WHERE TABLE_SCHEMA = :tableSchema ' . 'AND TABLE_NAME = :tableName ' . 'AND REFERENCED_TABLE_SCHEMA IS NOT NULL'; $table->foreignKeys = ForeignKey::model()->findAllBySql($sql, array('tableSchema' => $table->TABLE_SCHEMA, 'tableName' => $table->TABLE_NAME)); foreach ($table->foreignKeys as $key) { $foreignKeys[] = $key->COLUMN_NAME; } } else { $foreignKeys = false; } // Indices $sql = 'SELECT * FROM STATISTICS ' . 'WHERE TABLE_SCHEMA = :tableSchema ' . 'AND TABLE_NAME = :tableName ' . 'GROUP BY INDEX_NAME ' . 'ORDER BY INDEX_NAME = \'PRIMARY\' DESC, INDEX_NAME'; $table->indices = Index::model()->findAllBySql($sql, array('tableSchema' => $table->TABLE_SCHEMA, 'tableName' => $table->TABLE_NAME)); foreach ($table->indices as $index) { $index->columns = IndexColumn::model()->findAllByAttributes(array('TABLE_SCHEMA' => $table->TABLE_SCHEMA, 'TABLE_NAME' => $table->TABLE_NAME, 'INDEX_NAME' => $index->INDEX_NAME)); } // Indices (seperate for each column) $indicesRaw = Index::model()->findAllByAttributes(array('TABLE_SCHEMA' => $table->TABLE_SCHEMA, 'TABLE_NAME' => $table->TABLE_NAME)); // Triggers $table->triggers = Trigger::model()->findAllByAttributes(array('EVENT_OBJECT_SCHEMA' => $table->TABLE_SCHEMA, 'EVENT_OBJECT_TABLE' => $table->TABLE_NAME)); $this->render('structure', array('table' => $table, 'canAlter' => Yii::app()->user->privileges->checkTable($table->TABLE_SCHEMA, $table->TABLE_NAME, 'ALTER'), 'foreignKeys' => $foreignKeys, 'indicesRaw' => $indicesRaw)); }
/** * Function: set * Adds or replaces a configuration setting with the given value. * * Parameters: * $setting - The setting name. * $value - The value. * $overwrite - If the setting exists and is the same value, should it be overwritten? */ public function set($setting, $value, $overwrite = true) { if (isset($this->{$setting}) and $this->{$setting} == $value and !$overwrite) { return false; } if (isset($this->file) and file_exists($this->file)) { $contents = str_replace("<?php header(\"Status: 403\"); exit(\"Access denied.\"); ?>\n", "", file_get_contents($this->file)); $this->yaml = YAML::load($contents); } # Add the setting $this->yaml[$setting] = $this->{$setting} = $value; if (class_exists("Trigger")) { Trigger::current()->call("change_setting", $setting, $value, $overwrite); } # Add the PHP protection! $contents = "<?php header(\"Status: 403\"); exit(\"Access denied.\"); ?>\n"; # Generate the new YAML settings $contents .= YAML::dump($this->yaml); if (!@file_put_contents(INCLUDES_DIR . "/config.yaml.php", $contents)) { Flash::warning(_f("Could not set \"<code>%s</code>\" configuration setting because <code>%s</code> is not writable.", array($setting, "/includes/config.yaml.php"))); return false; } else { return true; } }
public function swfupload($admin, $post = null) { if (isset($post) and $post->feather != "audio" or isset($_GET['feather']) and $_GET['feather'] != "audio") { return; } Trigger::current()->call("prepare_swfupload", "audio", "*.mp3"); }
public function swfupload($admin, $post = null) { if (isset($post) and $post->feather != "photo" or isset($_GET['feather']) and $_GET['feather'] != "photo") { return; } Trigger::current()->call("prepare_swfupload", "photo", "*.jpg;*.jpeg;*.png;*.gif;*.bmp"); }
public function onAfterUpdate(Db_Object $object) { if (!$this->_cache) { return; } parent::onAfterUpdate($object); $this->clearBlockCache($object); }
/** * (non-PHPdoc) * @see Db_Object_Event_Manager::fireEvent() */ public function fireEvent($code, Db_Object $object) { $objectName = ucfirst($object->getName()); $triggerClass = Utils_String::classFromString('Trigger_' . $objectName); if (class_exists($triggerClass) && method_exists($triggerClass, $code)) { $trigger = new $triggerClass(); if ($this->_cache) { $trigger->setCache($this->_cache); } $trigger->{$code}($object); } elseif (method_exists('Trigger', $code)) { $trigger = new Trigger(); if ($this->_cache) { $trigger->setCache($this->_cache); } $trigger->{$code}($object); } }
/** * tests return value of getCreateTrigger method * and tries to insert a triggesr */ public function testGetCreateTrigger() { $triggerObj = Trigger::model()->findByPk(array('TRIGGER_SCHEMA' => 'triggertest', 'TRIGGER_NAME' => 'trigger1')); $createTrigger = $triggerObj->getCreateTrigger(); $this->assertType('string', $createTrigger); $this->assertType('string', $triggerObj->delete()); $cmd = Trigger::$db->createCommand($createTrigger); $this->assertEquals(0, $cmd->execute()); $triggerObj = Trigger::model()->findByPk(array('TRIGGER_SCHEMA' => 'triggertest', 'TRIGGER_NAME' => 'trigger1')); $this->assertType('Trigger', $triggerObj); }
public function prepare_cache_updaters() { $regenerate = array("add_post", "add_page", "update_post", "update_page", "delete_post", "delete_page", "change_setting"); Trigger::current()->filter($regenerate, "cacher_regenerate_triggers"); foreach ($regenerate as $action) { $this->addAlias($action, "regenerate"); } $post_triggers = array(); foreach (Trigger::current()->filter($post_triggers, "cacher_regenerate_posts_triggers") as $action) { $this->addAlias($action, "remove_post_cache"); } }
/** * This is called like an ordinary filter just with the name of the filter * as first argument. Currently we just raise an exception here but it * would make sense in the future to allow dynamic filter lookup for plugins * or something like that. */ function twig_missing_filter($name) { $args = func_get_args(); array_shift($args); $text = $args[0]; array_shift($args); array_unshift($args, $name); unretarded_array_unshift($args, $text); $trigger = Trigger::current(); if ($trigger->exists($name)) { return call_user_func_array(array($trigger, "filter"), $args); } return $text; }
/** * Upgrade the Set Future Permissions and Set Future Status trigger actions * present in existing Trigger assets to the new values expected in version 0.2 * of these assets * * @param Trigger &$trigger The Trigger Asset to upgrade * * @return void * @access public */ function upgradeTrigger(Trigger &$trigger) { $trigger_actions = $trigger->attr('actions'); $trigger_modified = FALSE; foreach ($trigger_actions as $key => &$trigger_action) { $trigger_action_data =& $trigger_action['data']; // Set Future Permissions and Status triggers < v0.2 will not have an "offset_used" value if (($trigger_action['type'] == 'trigger_action_set_future_permissions' || $trigger_action['type'] == 'trigger_action_set_future_status') && !isset($trigger_action_data['offset_used'])) { // Modify data associated with the Trigger Action (using a reference for ease and fun) // Add new "offset_used" value $trigger_action_data['offset_used'] = FALSE; // Convert to new "by_attr_value" when_type and enable offset if one was specified if ($trigger_action_data['when_type'] == 'attr_interval' || $trigger_action_data['when_type'] == 'attr_exact') { $trigger_action_data['when_type'] = 'by_attr_value'; $trigger_action_data['offset_used'] = $trigger_action_data['when_type'] == 'attr_interval'; } // Convert "explicit_interval" to "explicit_exact", as the offset is now handled separately if ($trigger_action_data['when_type'] == 'explicit_interval') { $trigger_action_data['when_type'] = 'explicit_exact'; $trigger_action_data['offset_used'] = TRUE; } // Restock the main Trigger Actions array for this Trigger $trigger_actions[$key] = $trigger_action; $trigger_modified = TRUE; } } if ($trigger_modified) { // Supply the new Trigger Actions values and save the Trigger if it was modified echo "\n- Upgrading Trigger " . $trigger->id . '... '; // Ok we need the Attributes lock now... $GLOBALS['SQ_SYSTEM']->acquireLock($trigger->id, 'attributes'); $trigger->setAttrValue('actions', $trigger_actions); $trigger->saveAttributes(); $GLOBALS['SQ_SYSTEM']->releaseLock($trigger->id, 'attributes'); echo 'done'; } }
public function update($filename = null, $path = null, $entity_type = null, $entity_id = null) { if ($this->no_results) { return false; } $sql = SQL::current(); $trigger = Trigger::current(); $old = clone $this; foreach (array("filename", "path", "entity_type", "entity_id") as $attr) { if ($attr == "updated_at" and $updated_at === null) { $this->updated_at = $updated_at = datetime(); } else { $this->{$attr} = ${$attr} = ${$attr} === null ? $this->{$attr} : ${$attr}; } } $sql->update("attachments", array("id" => $this->id), array("filename" => $filename, "path" => $path, "entity_type" => $entity_type, "entity_id" => $entity_id)); $trigger->call("update_attachment", $this, $old); }
/** * Connects to the specified schema and assigns it to all models which need it. * * @param $schema schema * @return CDbConnection */ protected function connectDb($schema) { // Assign request $this->request = Yii::app()->getRequest(); // Check parameter if (is_null($schema)) { $this->db = null; return null; } // Connect to database $connectionString = 'mysql:host=' . Yii::app()->user->host . ';port=' . Yii::app()->user->port . ';dbname=' . $schema . '; charset=utf8'; $this->db = new CDbConnection($connectionString, utf8_decode(Yii::app()->user->name), utf8_decode(Yii::app()->user->password)); $this->db->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, 'SET NAMES \'utf8\''); $this->db->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, 'SET CHARACTER SET \'utf8\''); $this->db->charset = 'utf8'; $this->db->emulatePrepare = true; $this->db->active = true; // Schema name is set in connection string // $this->db->createCommand('USE ' . $this->db->quoteTableName($schema))->execute(); // Assign to all models which need it ActiveRecord::$db = Routine::$db = Row::$db = Trigger::$db = View::$db = $this->db; // Return connection return $this->db; }
/** * Function: delete * Deletes a given object. Calls the @delete_(model)@ trigger with the objects ID. * * Parameters: * $model - The model name. * $id - The ID of the object to delete. */ protected static function destroy($model, $id) { $model = strtolower($model); if (Trigger::current()->exists("delete_" . $model)) { Trigger::current()->call("delete_" . $model, new $model($id)); } SQL::current()->delete(pluralize($model), array("id" => $id)); }
/** * Function: display * Display the page. * * If "posts" is in the context and the visitor requested a feed, they will be served. * * Parameters: * $file - The theme file to display. * $context - The context for the file. * $title - The title for the page. */ public function display($file, $context = array(), $title = "") { if (is_array($file)) { for ($i = 0; $i < count($file); $i++) { $check = ($file[$i][0] == "/" or preg_match("/[a-zA-Z]:\\\\/", $file[$i])) ? $file[$i] : THEME_DIR . "/" . $file[$i]; if (file_exists($check . ".twig") or $i + 1 == count($file)) { return $this->display($file[$i], $context, $title); } } } $this->displayed = true; $route = Route::current(); $trigger = Trigger::current(); # Serve feeds. if ($this->feed) { if ($trigger->exists($route->action . "_feed")) { return $trigger->call($route->action . "_feed", $context); } if (isset($context["posts"])) { return $this->feed($context["posts"]); } } $this->context = array_merge($context, $this->context); $visitor = Visitor::current(); $config = Config::current(); $theme = Theme::current(); $theme->title = $title; $this->context["theme"] = $theme; $this->context["flash"] = Flash::current(); $this->context["trigger"] = $trigger; $this->context["modules"] = Modules::$instances; $this->context["feathers"] = Feathers::$instances; $this->context["title"] = $title; $this->context["site"] = $config; $this->context["visitor"] = $visitor; $this->context["route"] = Route::current(); $this->context["hide_admin"] = isset($_COOKIE["hide_admin"]); $this->context["version"] = CHYRP_VERSION; $this->context["now"] = time(); $this->context["debug"] = DEBUG; $this->context["POST"] = $_POST; $this->context["GET"] = $_GET; $this->context["sql_queries"] =& SQL::current()->queries; $this->context["visitor"]->logged_in = logged_in(); $this->context["enabled_modules"] = array(); foreach ($config->enabled_modules as $module) { $this->context["enabled_modules"][$module] = true; } $context["enabled_feathers"] = array(); foreach ($config->enabled_feathers as $feather) { $this->context["enabled_feathers"][$feather] = true; } $this->context["sql_debug"] =& SQL::current()->debug; $trigger->filter($this->context, array("main_context", "main_context_" . str_replace("/", "_", $file))); $file = ($file[0] == "/" or preg_match("/[a-zA-Z]:\\\\/", $file)) ? $file : THEME_DIR . "/" . $file; if (!file_exists($file . ".twig")) { error(__("Template Missing"), _f("Couldn't load template: <code>%s</code>", array($file . ".twig"))); } try { return $this->twig->getTemplate($file . ".twig")->display($this->context); } catch (Exception $e) { $prettify = preg_replace("/([^:]+): (.+)/", "\\1: <code>\\2</code>", $e->getMessage()); $trace = debug_backtrace(); $twig = array("file" => $e->filename, "line" => $e->lineno); array_unshift($trace, $twig); error(__("Error"), $prettify, $trace); } }
public function trigger($field, Trigger $trigger) { // Allow the context to be this field $context = $field !== NULL ? $this->find($field) : $this; // Set the context of the trigger $trigger->context($context); // Add the trigger to the bunch $context->add_validator('triggers', $trigger); return $this; }
/** * Function: email * Send an email. Function arguments are exactly the same as the PHP mail() function. * * This is intended so that modules can provide an email method if the server cannot use mail(). */ function email() { $function = "mail"; Trigger::current()->filter($function, "send_mail"); $args = func_get_args(); # Looks redundant, but it must be so in order to meet PHP's retardation requirements. return call_user_func_array($function, $args); }
<?php $config = Config::current(); $trigger = Trigger::current(); $theme = Theme::current(); $title = !empty($_GET['title']) ? ": " . html_entity_decode($_GET['title']) : ""; echo "<" . '?xml version="1.0" encoding="utf-8"?' . ">\r"; ?> <feed xmlns="http://www.w3.org/2005/Atom"> <title><?php echo $config->name . $title; ?> </title> <?php if (!empty($config->description)) { ?> <subtitle><?php echo fix($config->description); ?> </subtitle> <?php } ?> <id><?php echo fix(self_url()); ?> </id> <updated><?php echo date("c", $latest_timestamp); ?> </updated>
/** * Function: display * Renders the page. * * Parameters: * $action - The template file to display, in (theme dir)/pages. * $context - Context for the template. * $title - The title for the page. Defaults to a camlelization of the action, e.g. foo_bar -> Foo Bar. */ public function display($action, $context = array(), $title = "") { $this->displayed = true; fallback($title, camelize($action, true)); $this->context = array_merge($context, $this->context); $trigger = Trigger::current(); $trigger->filter($this->context, array("admin_context", "admin_context_" . str_replace("/", "_", $action))); # Are there any extension-added pages? foreach (array("write" => array(), "manage" => array("import", "export"), "settings" => array(), "extend" => array("modules", "feathers", "themes")) as $main_nav => $val) { ${$main_nav} = $val; $trigger->filter(${$main_nav}, $main_nav . "_pages"); } $visitor = Visitor::current(); $route = Route::current(); $this->context["theme"] = Theme::current(); $this->context["flash"] = Flash::current(); $this->context["trigger"] = $trigger; $this->context["title"] = $title; $this->context["site"] = Config::current(); $this->context["visitor"] = $visitor; $this->context["logged_in"] = logged_in(); $this->context["route"] = $route; $this->context["hide_admin"] = isset($_SESSION["hide_admin"]); $this->context["now"] = time(); $this->context["version"] = CHYRP_VERSION; $this->context["debug"] = DEBUG; $this->context["feathers"] = Feathers::$instances; $this->context["modules"] = Modules::$instances; $this->context["admin_theme"] = $this->admin_theme; $this->context["theme_url"] = Config::current()->chyrp_url . "/admin/themes/" . $this->admin_theme; $this->context["POST"] = $_POST; $this->context["GET"] = $_GET; $this->context["navigation"] = array(); $show = array("write" => array($visitor->group->can("add_draft", "add_post", "add_page")), "manage" => array($visitor->group->can("view_own_draft", "view_draft", "edit_own_draft", "edit_own_post", "edit_post", "delete_own_draft", "delete_own_post", "delete_post", "add_page", "edit_page", "delete_page", "add_user", "edit_user", "delete_user", "add_group", "edit_group", "delete_group")), "settings" => array($visitor->group->can("change_settings")), "extend" => array($visitor->group->can("toggle_extensions"))); foreach ($show as $name => &$arr) { $trigger->filter($arr, $name . "_nav_show"); } $this->context["navigation"]["write"] = array("title" => __("Write"), "show" => in_array(true, $show["write"]), "selected" => in_array($action, $write) or match("/^write_/", $action)); $this->context["navigation"]["manage"] = array("title" => __("Manage"), "show" => in_array(true, $show["manage"]), "selected" => in_array($action, $manage) or match(array("/^manage_/", "/^edit_/", "/^delete_/", "/^new_/"), $action)); $this->context["navigation"]["settings"] = array("title" => __("Settings"), "show" => in_array(true, $show["settings"]), "selected" => in_array($action, $settings) or match("/_settings\$/", $action)); $this->context["navigation"]["extend"] = array("title" => __("Extend"), "show" => in_array(true, $show["extend"]), "selected" => in_array($action, $extend)); $this->subnav_context($route->action); $trigger->filter($this->context["selected"], "nav_selected"); $this->context["sql_debug"] = SQL::current()->debug; $file = MAIN_DIR . "/admin/themes/%s/pages/" . $action . ".twig"; $template = file_exists(sprintf($file, $this->admin_theme)) ? sprintf($file, $this->admin_theme) : sprintf($file, "default"); $config = Config::current(); if (!file_exists($template)) { foreach (array(MODULES_DIR => $config->enabled_modules, FEATHERS_DIR => $config->enabled_feathers) as $path => $try) { foreach ($try as $extension) { if (file_exists($path . "/" . $extension . "/pages/admin/" . $action . ".twig")) { $template = $path . "/" . $extension . "/pages/admin/" . $action . ".twig"; } } } if (!file_exists($template)) { error(__("Template Missing"), _f("Couldn't load template: <code>%s</code>", array($template))); } } # Try the theme first try { $this->theme->getTemplate($template)->display($this->context); } catch (Exception $t) { # Fallback to the default try { $this->default->getTemplate($template)->display($this->context); } catch (Exception $e) { $prettify = preg_replace("/([^:]+): (.+)/", "\\1: <code>\\2</code>", $e->getMessage()); $trace = debug_backtrace(); $twig = array("file" => $e->filename, "line" => $e->lineno); array_unshift($trace, $twig); error(__("Error"), $prettify, $trace); } } }
/** * @before _secure */ public function status($id, $value) { $m = strtolower($model); $trigger = Registry::get("MongoDB")->triggers; $live = (bool) (int) $value; if ($this->user->admin) { $trigger->update(array('trigger_id' => (int) $id), array('$set' => array('live' => $live))); parent::edit('trigger', $id, 'live', $value); } else { $trigger->update(array('trigger_id' => (int) $id, 'user_id' => $this->user->id), array('$set' => array('live' => $live))); $t = Trigger::first(array("id = ?" => $id, "user_id = ?" => $this->user->id)); if ($t) { $t->live = $value; $t->save(); } $this->redirect(RequestMethods::server('HTTP_REFERER', '/member')); } }
$a->save(); } } break; case 'enable': $module_data['active'] = 1; $a->save(); clean_pcache(); Trigger::instance()->run('admin/System/components/modules/enable', ['name' => $module_name]); unset($Cache->functionality, $Cache->languages); break; case 'disable': $module_data['active'] = 0; $a->save(); clean_pcache(); Trigger::instance()->run('admin/System/components/modules/disable', ['name' => $module_name]); unset($Cache->functionality, $Cache->languages); break; case 'remove': if ($module_name == 'System' || $module_data['active'] != '-1') { break; } $ok = true; get_files_list(MODULES . "/{$module_name}", false, 'fd', true, true, false, false, true, function ($item) use(&$ok) { if (is_writable($item)) { is_dir($item) ? @rmdir($item) : @unlink($item); } else { $ok = false; } }); if ($ok && @rmdir(MODULES . "/{$module_name}")) {
/** * Function: from_url * Attempts to grab a post from its clean URL. */ static function from_url($attrs = null, $options = array()) { fallback($attrs, $_GET); $where = array(); $times = array("year", "month", "day", "hour", "minute", "second"); preg_match_all("/\\(([^\\)]+)\\)/", Config::current()->post_url, $matches); $params = array(); foreach ($matches[1] as $attr) { if (in_array($attr, $times)) { $where[strtoupper($attr) . "(created_at)"] = $attrs[$attr]; } elseif ($attr == "author") { $user = new User(array("login" => $attrs['author'])); $where["user_id"] = $user->id; } elseif ($attr == "feathers") { $where["feather"] = depluralize($attrs['feathers']); } else { $tokens = array($where, $params, $attr); Trigger::current()->filter($tokens, "post_url_token"); list($where, $params, $attr) = $tokens; if ($attr !== null) { if (!isset($attrs[$attr])) { continue; } $where[$attr] = $attrs[$attr]; } } } return new self(null, array_merge($options, array("where" => $where, "params" => $params))); }
/** * Function: update * Updates the milestone. * * Parameters: * $name - The new name. * $description - The new description. */ public function update($name = null, $description = null, $due = null) { if ($this->no_results) { return false; } $old = clone $this; $this->name = $name === null ? $this->name : $name; $this->description = $description === null ? $this->description : $description; $this->due = $due === null ? $this->due : $due; $sql = SQL::current(); $sql->update("milestones", array("id" => $this->id), array("name" => $this->name, "description" => $this->description, "due" => $this->due)); Trigger::current()->call("update_milestone", $this, $old); if (module_enabled("cacher")) { Modules::$instances["cacher"]->regenerate(); } }
$.post("<?php echo $config->chyrp_url; ?> /includes/ajax.php", { action: "delete_comment", id: id }, function(response){ $("#comment_"+id).loader(true) if (isError(response)) return if (Comment.delete_wrap != "") $("#comment_"+id).wrap(Comment.delete_wrap).parent().animate(Comment.delete_animations, function(){ $(this).remove() }) else $("#comment_"+id).animate(Comment.delete_animations, function(){ $(this).remove() }) if ($(".comment_count").size() && $(".comment_plural").size()) { var count = parseInt($(".comment_count:first").text()) count-- $(".comment_count").text(count) var plural = (count == 1) ? "" : "s" $(".comment_plural").text(plural) } }, "html") } } <?php Trigger::current()->call("comments_javascript"); ?> <!-- --></script>
public function mt_setPostCategories($args) { $this->auth($args[1], $args[2], 'edit'); global $user; $post = new Post($args[0], array('filter' => false)); if ($post->no_results) { return new IXR_Error(500, __("Post not found.")); } else { if (!$post->deletable($user)) { return new IXR_Error(500, __("You don't have permission to edit this post.")); } } Trigger::current()->call('mt_setPostCategories', $args[3], $post); return true; }
<?php /** * @package HybridAuth * @category modules * @author HybridAuth authors * @author Nazar Mokrynskyi <*****@*****.**> (integration with CleverStyle CMS) * @copyright HybridAuth authors * @license MIT License, see license.txt */ namespace cs; Trigger::instance()->register('System/Config/pre_routing_replace', function () { switch (Config::instance()->components['modules']['HybridAuth']['active']) { case 1: require __DIR__ . '/trigger/enabled.php'; } }); Trigger::instance()->register('System/Index/construct', function () { if (!ADMIN) { return; } switch (Config::instance()->components['modules']['HybridAuth']['active']) { case -1: require __DIR__ . '/trigger/uninstalled.php'; break; } });
/** * Function: addAlias * Allows a module to respond to a trigger with multiple functions and custom priorities. * * Parameters: * $name - Name of the trigger to respond to. * $function - Name of the class function to respond with. * $priority - Priority of the response. */ protected function addAlias($name, $function, $priority = 10) { Trigger::current()->priorities[$name][] = array("priority" => $priority, "function" => array($this, $function)); }
public static function getArrayFromTrigger(Trigger $trigger) { return array('MODULE_ID' => $trigger->getModuleId(), 'CODE' => $trigger->getCode(), 'NAME' => $trigger->getName(), 'IS_CLOSED_TRIGGER' => $trigger->isClosed() ? 'Y' : 'N', 'CAN_RUN_FOR_OLD_DATA' => $trigger->canRunForOldData() ? 'Y' : 'N', 'CLOSED_TRIGGER_INTERVAL' => '1440', 'CLOSED_TRIGGER_TIME' => '00:00', 'EVENT_MODULE_ID' => $trigger->getEventModuleId(), 'EVENT_TYPE' => $trigger->getEventType()); }
<?php /** * @package Plupload * @category modules * @author Moxiecode Systems AB * @author Nazar Mokrynskyi <*****@*****.**> (integration with CleverStyle CMS) * @copyright Moxiecode Systems AB * @license GNU GPL v2, see license.txt */ namespace cs; Trigger::instance()->register('admin/System/components/modules/install/process', function ($data) { if ($data['name'] == 'Plupload') { $Config = Config::instance(); $Config->module('Plupload')->max_file_size = '5mb'; $Config->module('Plupload')->confirmation_time = '900'; } });
/** * Function: respondTo * Allows a Feather to respond to a Trigger as a Module would. * * Parameters: * $name - Name of the trigger to respond to. * $function - Name of the class function to respond with. * $priority - Priority of the response. * * See Also: * <Trigger> */ protected function respondTo($name, $function = null, $priority = 10) { fallback($function, $name); Trigger::current()->priorities[$name][] = array("priority" => $priority, "function" => array($this, $function)); }
public function DoActivate($aContextArgs) { $bGo = true; if (isset($aContextArgs['this->object()'])) { $bGo = $this->IsTargetObject($aContextArgs['this->object()']->GetKey()); } if ($bGo) { parent::DoActivate($aContextArgs); } }