Add hooks for front-end functionalities

@since 0.9.0
514971
public static function init() {
		$active_types = Menu_Icons_Settings::get( 'global', 'icon_types' );

		if ( empty( $active_types ) ) {
			return;
		}

		foreach ( Menu_Icons::get( 'types' ) as $type ) {
			if ( in_array( $type->id, $active_types, true ) ) {
				self::$icon_types[ $type->id ] = $type;
			}
		}

		/**
		 * Allow themes/plugins to override the hidden label class
		 *
		 * @since  0.8.0
		 * @param  string $hidden_label_class Hidden label class.
		 * @return string
		 */
		self::$hidden_label_class = apply_filters( 'menu_icons_hidden_label_class', self::$hidden_label_class );

		/**
		 * Allow themes/plugins to override default inline style
		 *
		 * @since  0.9.0
		 * @param  array $default_style Default inline style.
		 * @return array
		 */
		self::$default_style = apply_filters( 'menu_icons_default_style', self::$default_style );

		add_action( 'wp_enqueue_scripts', array( __CLASS__, '_enqueue_styles' ), 7 );
		add_filter( 'wp_nav_menu_args', array( __CLASS__, '_add_menu_item_title_filter' ) );
		add_filter( 'wp_nav_menu', array( __CLASS__, '_remove_menu_item_title_filter' ) );
	}
481341
function setupHooks (InstanceModel, config) {
  const ourHookedFnNames = ['save', 'remove', 'index']
  const schema = InstanceModel.schema
  const hooks = _.values(schema.hooks)

  _.forEach(hooks, ho => {
    let addHookFn = 'addDynamicHooks'
    if (!config.promisify) {
      addHookFn = 'addFlexibleHooks'
    }
    InstanceModel.prototype[addHookFn](ho.name)
    const mwopts = { passParams: true }
    _.forEach(ho.fns, (fn, index) => {
      if (ourHookedFnNames.indexOf(ho.name) >= 0) {
        const mwFn = fn
        if (ho.hook === 'post') {
          ho.fns[index] = function (next) {
            mwFn.apply(this)
            next()
          }
        }

        mwopts.passParams = false
      }
    })
    InstanceModel.prototype[ho.hook](ho.name, ho.fns, mwopts)
  })
}
1163866
def register_all_hooks():
    
    global _all_hooks_registered
    if not _all_hooks_registered:
        logger.debug("Searching for hooks")
        hooks = list(get_app_submodules('auth_hooks'))
        logger.debug("Got %s hooks" % len(hooks))
        _all_hooks_registered = True
18559
final private function add_hooks($hooks)
    {
        foreach ($hooks as $tag => $filter) {
            if (\is_string($filter)) {
                $this->add_filter($tag, $filter);
            } else {
                foreach ($filter as $priority => $callbacks) {
                    if (\is_string($callbacks)) {
                        $this->add_filter($tag, $callbacks, $priority);
                    } else {
                        $count = \count($callbacks);

                        for ($i = 0; $i < $count; $i++) {
                            $this->add_filter($tag, $callbacks[ $i ], $priority);
                        }
                    }
                }
            }
        }
    }
915369
def execute_hooks_for(type, name)
      model.hooks[name][type].each { |hook| hook.call(self) }
    end
655293
function executeHooks(data, allHooks, checkHooks, creationMode) {
    var hooksToCall = creationMode ? allHooks : checkHooks;
    if (hooksToCall) {
        callHooks(data, hooksToCall);
    }
}
1275020
function addHooks(method) {
            // Add Pre hooks
            callQueue[method].pres.forEach((fn) => {
                self.pre(method, fn);
            });

            // Add Post hooks
            callQueue[method].post.forEach((fn) => {
                self.post(method, fn);
            });
        }
1237745
public function createHooks()
	{
		global $context;

		// Get the hooks.
		$hooks = $this['config']->get('availableHooks');
		$overwriteHooks = $this['config']->get('overwriteHooks');

		// Don't execute on uninstall.
		if (!empty($context['uninstalling']) || $this['data']->get('sa') == 'uninstall2' || !$hooks)
			return;

		foreach ($hooks as $hook => $hook_name)
		{
			// The $hook_name value acts as an "enable" check, empty means you do not want to use this hook.
			if (empty($hook_name))
				continue;

			// Gotta replace our tokens.
			if ($overwriteHooks && !empty($overwriteHooks[$hook]))
				$overwriteHooks[$hook]['file'] = $this['tools']->parser($overwriteHooks[$hook]['file'], array(
					'$sourcedir' => $this->sourceDir,
					'$scripturl' => $this->scriptUrl,
					'$boarddir' => $this->boardDir,
					'$boardurl' => $this->boardUrl,
				));

			else
				$overwriteHooks[$hook] = [];

			// Set some default values.
			$defaultValues = array(
				'hookName' => $hook_name,
				'func' => $this->name .'::add'. ucfirst($hook),
				'permanent' => false,
				'file' => '$sourcedir/'. $this->name .'.php',
				'object' => true,
			);

			// You might or might not want to overwrite this...
			extract(array_merge($defaultValues, $overwriteHooks[$hook]));

			// You can also disable any hook used by this mod from the mod's admin settings if the mod has that feature.
			$hookAction = ($this->enable('disable_hook_'. $hook_name) ? 'remove' : 'add') .'_integration_function';

			$hookAction($hookName, $func, $permanent, $file, $object);
		}
	}
535948
public function hooks()
    {
        $this->hook->action(
            'show_user_profile',
            [$this->profile, 'fill']
        )->dispatch();

        $this->hook->action(
            'edit_user_profile',
            [$this->profile, 'fill']
        )->dispatch();

        $this->hook->action(
            'personal_options_update',
            [$this->profile, 'save']
        )->dispatch();

        $this->hook->action(
            'edit_user_profile_update',
            [$this->profile, 'save']
        )->dispatch();
    }
555608
private function hook_plugin_action_links() {
            $this->_logger->entrance();

            $this->_action_links_hooked = true;

            $this->_logger->log( 'Adding action links hooks.' );

            // Add action link to settings page.
            add_filter( 'plugin_action_links_' . $this->_plugin_basename, array(
                &$this,
                '_modify_plugin_action_links_hook'
            ), WP_FS__DEFAULT_PRIORITY, 2 );
            add_filter( 'network_admin_plugin_action_links_' . $this->_plugin_basename, array(
                &$this,
                '_modify_plugin_action_links_hook'
            ), WP_FS__DEFAULT_PRIORITY, 2 );
        }
599596
def load_hooks
      self.site_hooks = instantiate_subclasses(Octopress::Hooks::Site) || []
      self.page_hooks = instantiate_subclasses(Octopress::Hooks::Page) || []
      self.post_hooks = instantiate_subclasses(Octopress::Hooks::Post) || []
      self.doc_hooks  = instantiate_subclasses(Octopress::Hooks::Document) || []
      self.all_hooks  = instantiate_subclasses(Octopress::Hooks::All) || []
    end
861775
function loadHooks() {
  var events = this._events;
  var jsFile = /\.js$/i;
  var hooksPath = this.fullPath('hook');
  var loadedHooks = [];
  if (fs.existsSync(hooksPath)) {
    var files = protos.util.ls(hooksPath, jsFile);
    for (var cb,idx,evt,file,len=files.length,i=0; i < len; i++) {
      file = files[i];
      evt = file.replace(jsFile, '');
      loadedHooks.push(evt);
      cb = protos.require(hooksPath + '/' + file, true);
      if (cb instanceof Function) {
        if (RELOADING) {
          var origCb = this.hooks[evt];
          if (origCb instanceof Function) {
            // Hook was added previously
            if (events[evt] instanceof Array) {
              idx = events[evt].indexOf(origCb);
              if (idx >= 0) {
                // If old function is in events array, replace it
                events[evt][idx] = this.hooks[evt] = cb;
              } else {
                // Otherwise, append to events array (add a new event handler)
                events[evt].push(cb);
                this.hooks[evt] = cb;
              }
            } else if (events[evt] instanceof Function) {
              if (events[evt] === origCb) {
                // If evt has only one callback, replace it
                events[evt] = this.hooks[evt] = cb;
              } else {
                // Otherwise, create an array with the old and new events
                events[evt] = [origCb, cb];
              }
            } // No else clause is needed here, it's either Function or Array
          } else {
            // This is a new event handler
            this.hooks[evt] = cb;
            this.on(evt, cb);
          }
        } else {
          // Add the event handler normally
          this.hooks[evt] = cb;
          this.on(evt, cb);
        }
      }
    }
  }

  // Remove any inexisting hooks
  for (evt in this.hooks) {
    if (loadedHooks.indexOf(evt) === -1) {
      app.removeListener(evt, this.hooks[evt]);
      delete this.hooks[evt];
    }
  }

}
716475
function _hook(slf, name, handlerInfo, params) {
  if (!slf.__hooks[name]) return;

  slf.__hooks[name].forEach(function (hook) {
    hook(handlerInfo, params);
  });
}
829017
def _add_hookimpl(self, hookimpl):
        
        if hookimpl.hookwrapper:
            methods = self._wrappers
        else:
            methods = self._nonwrappers

        if hookimpl.trylast:
            methods.insert(0, hookimpl)
        elif hookimpl.tryfirst:
            methods.append(hookimpl)
        else:
            # find last non-tryfirst method
            i = len(methods) - 1
            while i >= 0 and methods[i].tryfirst:
                i -= 1
            methods.insert(i + 1, hookimpl)

        if "__multicall__" in hookimpl.argnames:
            warnings.warn(
                "Support for __multicall__ is now deprecated and will be"
                "removed in an upcoming release.",
                DeprecationWarning,
            )
            self.multicall = _legacymulticall
848200
protected function defineActivationHooks(): void {
		$backend = $this->getBackend();
		$pluginName = $this->getFilename();
		$handlers = ["activate", "deactivate", "uninstall"];
		foreach ($handlers as $handler) {
			
			// for each of our handlers, we hook an action handler to our
			// backend component.  the purpose of the BackendInterface is
			// to guarantee that we have three methods, one for each of
			// these hooks.
			
			$hook = $handler . "_" . $pluginName;
			$this->loader->addAction($hook, $backend, $handler);
		}
	}
1112622
def hook(self, name):
        
        def wrapper(func):
            self.hooks.add(name, func)
            return func
        return wrapper
284424
def enabled_builtin_hooks(hook_context)
      @hash[hook_context.hook_class_name].keys.
        reject { |hook_name| hook_name == 'ALL' }.
        select { |hook_name| built_in_hook?(hook_context, hook_name) }.
        select { |hook_name| hook_enabled?(hook_context, hook_name) }
    end