How do I set up FirePHP version 1.0? - firephp

I love FirePHP and I've been using it for a while, but they've put out this massive upgrade and I'm completely flummoxed trying to get it to work. I think I'm copying the "Quick Start" code (kind of guessing at whatever changes are necessary for my server configuration), but for some reason, FirePHP's "primary" function, FirePHP::to() isn't doing anything. Can anyone please help me figure out what I'm doing wrong? Thanks.
<?php
define('INSIGHT_IPS', '*');
define('INSIGHT_AUTHKEYS', '290AA9215205F24E5104F48D61B60FFC');
define('INSIGHT_PATHS', __DIR__);
define('INSIGHT_SERVER_PATH', '/doc_root/hello_firephp2.php');
set_include_path(get_include_path . ":/home8/jayharri/php/FirePHP/lib"); // path to FirePHP library
require_once('FirePHP/Init.php');
$inpector = FirePHP::to('page');
var_dump($inspector);
$console = $inspector->console();
$console->log('hello firephp');
?>
Output:
NULL
Fatal error: Call to a member function console() on a non-object in /home8/jayharri/public_html/if/doc_root/hello_firephp2.php on line 14

The inspector variable is spelled wrong where you are assigning it and you are missing a bracket when getting the include path.
Try the following:
define('INSIGHT_IPS', '*');
define('INSIGHT_AUTHKEYS', '290AA9215205F24E5104F48D61B60FFC');
define('INSIGHT_PATHS', __DIR__);
define('INSIGHT_SERVER_PATH', '/doc_root/hello_firephp2.php');
set_include_path(get_include_path() . ":/home8/jayharri/php/FirePHP/lib");
require_once('FirePHP/Init.php');
$inspector = FirePHP::to('page');
$console = $inspector->console();
$console->log('hello firephp');
Also, according to the INSIGHT_SERVER_PATH constant make sure you have a script with FirePHP installed at:
http:://<hostname>/doc_root/hello_firephp2.php

Related

Using Wordpress Force Login plugin to have security feature for only a certain page. An error keeps popping up and i cant seem to find it

I can't see anything wrong with the code, this is the error below and this is the link to where i got it https://www.greengeeks.com/tutorials/force-login-before-visitors-access-wordpress/
Error:
Your PHP code changes were rolled back due to an error on line 15 of file wp-content/themes/flatsome/functions.php. Please fix and try saving again.
syntax error, unexpected 'mstyle' (T_STRING), expecting ']'
Code:
[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]
function my_forcelogin_redirect( $url ) {
return home_url( ‘/mypage/’ );
}
add_filter( ‘v_forcelogin_redirect’, ‘my_forcelogin_redirect’ );[/ht_message]

Facebook CrashReporter Error detected api facebook-business-php

I started with facebook business sdk for php. Was following this doc: https://developers.facebook.com/docs/business-sdk/getting-started/ installed without trouble, then tried testing as they instructed, created src/test.php
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Campaign;
use FacebookAds\Object\Fields\CampaignFields;
$app_id = "{app-id}";
$app_secret = "{appsecret}";
$access_token = "{access-token}";
$account_id = "act_{{adaccount-id}}";
Api::init($app_id, $app_secret, $access_token);
$account = new AdAccount($account_id);
$cursor = $account->getCampaigns();
// Loop over objects
foreach ($cursor as $campaign) {
echo $campaign->{CampaignFields::NAME}.PHP_EOL;
}
filled in the required values. and ran the file. Getting this:
FacebookAds\CrashReporter : Enabled
FacebookAds\CrashReporter : Error detected!
PHP Catchable fatal error: Argument 1 passed to FacebookAds\CrashReporter::buildParamsFromException() must be an instance of Throwable, instance of ErrorException given, called in /var/www/clients/client1/web1/web/vendor/facebook/php-business-sdk/src/FacebookAds/CrashReporter.php on line 146 and defined in /var/www/clients/client1/web1/web/vendor/facebook/php-business-sdk/src/FacebookAds/CrashReporter.php on line 167
Not sure what I am doing wrong. Didnt find much by searching. Can anyone please help?

How to add object to smarty without error: undefined extension class 'Smarty_Internal_Method_Register_Object'

I added Smarty 3.1.33 to my project with composer. The basic functionality works fine, but now to my I want to add an object to Smarty. For this I follow the documentation and have this code:
class My_Object {
function meth1($params, &$smarty_obj) {
return 'this is my meth1';
}
}
$myobj = new My_Object;
require_once __DIR__.'/vendor/autoload.php';
$smarty = new Smarty;
$smarty->register_object('foobar',$myobj);
Very basic according to the documentation, but the result is this:
Notice: Undefined property: Smarty_Internal_Undefined::$objMap in /home/svn/test1/trunk/smarty/vendor/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php on line 132
Fatal error: Uncaught --> Smarty: undefined extension class 'Smarty_Internal_Method_Register_Object' <-- thrown in /home/svn/test1/trunk/smarty/vendor/smarty/smarty/libs/sysplugins/smarty_internal_undefined.php on line 62
I cannot find anything on the web about this, so am I the only one who ran into this issue? I hope someone here can help me out so I do not have to start debugging Smarty.
Thanks!
I hat a similar Problem when switching from Smarty 2.x to 3.x with the error:
Notice: Undefined property: Smarty_Internal_Undefined::$objMap in smarty\sysplugins\smarty_internal_extension_handler.php on line 132
Fatal error: Uncaught --> Smarty: undefined extension class 'Smarty_Internal_Method_Register_Resource' <-- thrown in smarty\sysplugins\smarty_internal_undefined.php on line 62
The reason was you musst change register_object to registerObject and register_resource to registerResource.
Thats all.
So in your case replace the line:
$smarty->register_object('foobar',$myobj);
with
$smarty->registerObject('foobar',$myobj);
There was one answer that you should:
The reason was you musst change register_object to registerObject and register_resource to registerResource. Thats all.
Sorry but that is not all ...
I've had the same problem and I needed to change:
register_object --> registerObject
register_resource --> registerResource
get_config_vars --> getConfigVars
config_load --> configLoad
get_template_vars --> getTemplateVars
I guess there could be more - those are the ones that I've used for my old project.
Simply include <path to Smarty>/libs/SmartyBC.class.php instead of <path to Smarty>/libs/Smarty.class.php in your project. It represents a backward compatibility wrapper class with the old function names.
See Chapter 19. SmartyBC - Backwards Compatibility Wrapper for example.
I guess you should add the invocation () parenthesis beside each constructor (i.e.
$smarty = new Smarty();
$myObj = new MyObject();

Error 500 Call to undefined function thrive_get_theme_options() when trying to get to customize in WP

My site uninstalled all plugins so I reactivated and since then I have been greeted by Error 500 everytime I try to get to Customise (WP).
I checked out error_log and it's pointing to the funtions.php line 659 (starts 3rd line down):
function thrive_exclude_category($query)
{
$hide_cat_option = thrive_get_theme_options('hide_cats_from_blog');
if (!is_string($hide_cat_option)) {
$hide_cat_option = "";
}
$hide_categories = is_array(json_decode($hide_cat_option)) ? json_decode($hide_cat_option) : array();
$temp_query_string_part = "";
foreach ($hide_categories as $temp_cat_id) {
$temp_query_string_part .= "-" . $temp_cat_id . " ";
}
This is probably simple stuff, however, I suck. I have been lumbered with maintaining the sites and really have no say in the matter. Thanks in advance
In one of the projects I found this problem too. After study logs and debug project I find this function don't know about another function which used in theme PHP message: PHP Fatal error: Uncaught Error: Call to undefined function thrive_get_theme_options(). The main problem here in filter which running before all files will be included in theme. So function thrive_exclude_category don't find where declared thrive_get_theme_options because pre_get_posts running before we included files:
add_filter('pre_get_posts', 'thrive_exclude_category')
We need run this filter after use after_setup_theme
function run_func(){
add_filter('pre_get_posts', 'thrive_exclude_category', 999);
}
add_action('after_setup_theme', 'run_func`);
After this you not get any error and you can use your filter.
Try reactivate all plugins required by Thrive theme because of Fatal: Call to undefined function thrive_get_theme_options()

Must manually load PHP ActiveRecord models

I'm drawing a blank. I have code working locally (which is MAMP). When moving to a nginx ubuntu box (running php-fpm), for some reason, phpactiverecord is acting up.
I finally traced it down to this - All of my model classes, I have to load manually. If I add a require_once() underneath my code, then it works fine. If I don't, then I get errors like:
PHP Fatal Error: Class not found ... on the models I've created..
Does anyone have ANY idea what direction I could troubleshoot this in? I checked permissions to the models folder (which is not in the public root), echo'd out the path that is sent over to cfg->set_model_directory is correct, etc..
This sound like a nginx or php thing? I'm guessing nginx since this works on my MAMP?
Doesn't work:
ActiveRecord\Config::initialize(
function ($cfg) {
$cfg->set_model_directory(BASE_PATH . '/models');
$cfg->set_connections(
array(
'development' => 'mysql://blah:removed#localhost/com_dbname'
)
);
}
);
Works:
ActiveRecord\Config::initialize(
function ($cfg) {
$cfg->set_model_directory(BASE_PATH . '/models');
$cfg->set_connections(
array(
'development' => 'mysql://blah:removed#localhost/com_dbname'
)
);
}
);
require_once(BASE_PATH . '/models/model1.php');
require_once(BASE_PATH . '/models/model2.php');
Update
Adding in actual code to help identify issue:
require_once ('../lib/php-activerecord/ActiveRecord.php');
ActiveRecord\Config::initialize(
function ($cfg) {
$cfg->set_model_directory('/var/www/uc1/models');
$cfg->set_connections(
array(
'development' => 'mysql://test_usr:test_pwd#localhost/test_db'
)
);
}
);
require_once ('/var/www/uc1/models/ucurls.php'); //Name of model file. Must manually include to get this to work on my nginx server.
$_record = UCUrls::find_by_urlkey('example.com/123');
echo "urlkey=" . $_record->urlkey;
I solved this issue in windows adding a line in the file ActiveRecord.php,
in the function activerecord_autoload($class_name)
at the line 39 or 40
$file = "$root/$class_name.php";
//add this line
$file = strtolower($file);
Set trace in ActiveRecord.php too look where are ActiveRecord is searching for models.
But I think your issue is in filesystem - Mac OS X by default uses Case Insensitive filesystem, while Ubuntu's Case Sensitive filesystem.
So your model UCUrls should be in file /var/www/uc1/models/UCUrls.php, not in /var/www/uc1/models/ucurls.php

Resources