Hook in codeIgniter for display_error, How to implement? - codeigniter

How am I able to alter display_error (DB_driver.php) by hook?

Hooks must be enabled, in ./application/config/config.php (about line 94)
$config['enable_hooks'] = FALSE;
Must be set to true.

Related

How do I disable ngAria in ngMaterial?

ngAria (an accessibility module) is adding an unnecessary bower import to my Angular Material project - and now it is throwing warnings:
Attribute " aria-label ", required for accessibility, is missing on node
I only added ngAria because it appeared necessary for ngMaterial. My app does not need screen-reader accessibility.
Anyways, how can I remove ngAria from ngMaterial? or at least disable all warnings.
EDIT: It seems the only easy way to disable ngAria's warnings is console.warn = function() {}; which will just turn off your browser's warnings (I do not recommend doing this, since it may hide warnings unrelated to aria)
Disabling messages globally is possible as of 1.1.0:
app.config(function($mdAriaProvider) {
// Globally disables all ARIA warnings.
$mdAriaProvider.disableWarnings();
});
(But do note the discussion in other answers about aria labels being important for accessibility!)
ngAria, to my knowledge, cannot be disabled and should not be disabled it is core part of angular-material.
To disable warnings you can add aria-label="..." to the specific following items
input
md-button
md-dialog
md-icon
md-checkbox
md-radio-button
md-slider
md-switch
I think, I have covered all of them, but there might be other so watch-out!
I think Salal Aslam's answer is better, but if you want to disable the Aria warnings temporarily you could just do a tweak on the console.warn override you suggested in the original question. Something like this perhaps:
console.realWarn = console.warn;
console.warn = function (message) {
if (message.indexOf("ARIA") == -1) {
console.realWarn.apply(console, arguments);
}
};
Edit: for complex situations, more elaborate solutions may be required. Check out Shaun Scovil's Angular Quiet Console
Just add another tag aria-label="WriteHereAnyLabelYouLike" on md-checkbox and it will resolve the issue.
<md-checkbox type="checkbox" ng-model="account.accountant" class="md-primary" layout-align="end" ng-true-value="1" ng-false-value="0" aria-label="ShowHideAccountant" ></md-checkbox>
aria-label="WriteHereAnyLabelYouLike"
If you really want to disable it, you can by simply overwriting or as angular calls it decorating the original mdAria service that's located inside the angular-material library.
angular.module('appname').decorator('$mdAria', function mdAriaDecorator($delegate) {
$delegate.expect = angular.noop;
$delegate.expectAsync = angular.noop;
$delegate.expectWithText = angular.noop;
return $delegate;
});
This is working in angular-material v1.0.6 but you may have to check that all methods have been cleared.
Basically all the above does is replace the public methods exposed to the $mdAria service and it will replace those methods with a noop (no operation).

IPropertyStory doing SetValue without Commit

I'm following this blog to write the same code to change the System.AppUserModel.ID of a window: The Old New Thing :: How do I prevent users from pinning my program to the taskbar?
He is doing:
hr = pps->SetValue(pkey, var);
PropVariantClear(&var);
He does not do a pps->Commit(), I'm getting confused because I have written the code, I do SetValue and I do Commit but my changes won't take.
How come he doesn't do Commit? Is he mistaken? Or is his a special case where you don't need Commit?
Thanks
The issue was, the var was set to a propvariant which was not properly initailized. My InitFromString function was messing up it would forget to set the var.vt. I dont know why a succesful hr was being returned though.

How to read session variables from bootstrap.php file

Is there any any way to read session from bootstrap file.
App::uses('CakeSession', 'Model/Datasource');
$value = CakeSession::read('User.id');
I tried this code. But fail to read. Please help me out ..
For future visitors,
Looking for Cakesession object in bootstrap.php is a little weird but if you really must do it, do it this way:
App::import('Model/Datasource', 'CakeSession');
$Session = new CakeSession();
// $userId = $Session->read("Auth.User.id");
Check the difference between App::uses() (attempted by OP) and App::import() in documentation.
rather than do all the initialisation overhead, I would here (and just here in bootstrap.php) resort to a basic php stuff:
session_start();
debug($_SESSION);

Drupal 7 AJAX and "CAPTCHA session reuse attack detected." in captcha-7.x-1.x-dev

I am experiencing problems with the captcha-7.x-1.x-dev version , In a form if i used any AJAX processed fields, after I submit it I receive the error CAPTCHA session reuse attack detected.. If there are no AJAX processed fields means it is working properly.
This is still an issue in the current 7.x-1.0-beta2 version of the Captcha module. However, jay.daysand put in a comment on a issue saying he created a module to fix this issue that you can download and use:
Check out the experimental fix module
http://drupal.org/sandbox/dansandj/1970786 and let me know if it
solves your problems. I can easily add support for more endpoints than
just "file/ajax", just let me know.
I downloaded this module and it works great, but had to modify the captcha_ajax_fix_captcha_element_value() method to check for FAPI ajax calls:
// If this is form is an AJAX submission to "file/ajax", don't process the
// CAPTCHA element.
if (arg(0) == 'file' && arg(1) == 'ajax' || arg(0) == 'system' && arg(1) == 'ajax') {
$element['#processed'] = TRUE;
}
This is a known issue and i was searching for a patch and i found it.
this might be useful
https://www.drupal.org/node/1395184
https://drupal.stackexchange.com/questions/27936/captcha-session-reuse-attack-detected-error-message-when-form-is-submitted

Check if extension installed without notice on fail

The method JComponentHelper::isEnabled('com_extension', true); checks if an extension is installed and returns a boolean.
The function will also throw an exception notice it the component is not installed due to the self::getComponent($option, $strict); in the same helper class.
Is there a way to avoid the notice if the component is not installed?
Check your database to see if the component is installed and enabled.
$db = JFactory::getDbo();
$db->setQuery("SELECT enabled FROM #__extensions WHERE name = 'component name'");
$is_enabled = $db->loadResult();
if the value of $is_enabled is 1, then your component is enabled.
While realizing that this is an old question, it is also one of Google's first results and I wanted to share what works for me while avoiding extra database queries.
To avoid the exception you can also check to see if the entry point file of the extension exists like:
if (file_exists(JPATH_ADMINISTRATOR . '/components/com_extension/extension.php') && JComponentHelper::isEnabled('com_extension', true))
{
// Your code here
}
You could use the same function isEnabled and catch that exception, so if the exception is thrown then the component is not installed.
Check out
JComponentHelper::isInstalled('com_extension');

Resources