I am trying to include gigya php sdk in my application. The file is under /app/vendors/GSSDK.php I included it in my controller as
App::import('Vendor', 'GSSDK');
And in my view
$request = new GSRequest($apiKey,$secretKey,$method);
I get a error missing class GSRequest. I am facing problems including the php sdk.
Make sure you include vendor files into the correct directory /vendors/ or /app/vendors both should work. Try including with different styles as sugguested by book cakephp and remember CASE does matter.
Related
REPHRASED QUESTION
Please atleast check this out https://github.com/vipertecpro/simplesamllaravel.git
it might help others to implement saml integration in laravel.
I've been trying to implement azure saml login integration in laravel so i came across this https://simplesamlphp.org/ , now I've downloaded the whole repo. and put it into my public folder and it's working great, but it's vulnerable so i decided to put it into laravel root directory so that i can get access to environment variable or other laravel helper methods, i've been searching alot how can i get hold onto laravel helper methods inside public folder, but unfortunately it doesn't work , so i decided to put saml repo. into my laravel root directory to get access of laravel helper methods.
so here i am stuck with this problem.
am i clear now ?
Here is the screen shot of my project directory
Problem : I've have many config files which needs to be set as per ENV file, i just couldn't figure it out how can i get use of environment variables into samllogin directory.
Here is what i've tried in my _include.php file which is the root of samllogin directory
require_once '../vendor/autoload.php';
// require_once '../vendor/laravel/framework/src/Illuminate/Foundation/helpers.php';
echo env('APP_URL');
die();
I'm very close to resolve this. Any help or reference appreciated.
Explanation:
Using CodeIgniter v3.1.2 with Ion Auth 2
I separated the admin area and user area into 2 different applications to improve security.
I wanted to share config files between two apps so for application_admin/config/ion_auth.php I did this:
require_once(__DIR__.'/../../application_users/config/ion_auth.php');
The script stopped working and after some hours I realized the file is being loaded twice because when I use require instead of require_once everything work's fine.
Questions:
Shouldn't CodeIgniter check and prevent loading files that are already loaded twice? if yes then why is this happening, and if not is it okay if I just use require instead of require_once?
Is my approach the correct way of sharing config files and helpers between multiple applications in a single CI install?
Edit:
I put the require_once in the admin/config/ion_auth.php to include user/config/ion_auth.php so basically I'm putting the content of that config file in this config file "only when CodeIgniter itself loads this config file".
Also even if I put the normal ion_auth config file without any require/include etc, it is still loaded twice (I noticed by putting a simple echo 'loaded<br>'; in the end of config file.)
Shouldn't CodeIgniter check and prevent loading files that are already
loaded twice? if yes then why is this happening, and if not is it okay
By making direct call to require or require_once you are bypassing Codeigniter (CI) so it has no way of knowing what you have or have not included.
if I just use require instead of require_once? Is my approach the
correct way of sharing config files and helpers between multiple
applications in a single CI install?
Loading a config file in CI should be done using the Config class. If you dig into the source code for Ion Auth and look at __construct in Ion-auth_model.php you will find heavy use of the config class to read the config file and access various config items. It a good example of the "CI way" to handle configuration.
I'm trying to bring in an outside PHP library into my WP instance. I'd like to reference it in various plugins I'm creating, but am not sure how to include or instantiate it.
Specifically, I'm looking at the Library here: https://github.com/lobostome/FurryBear/wiki
I've tried a few different ways to include it without success, including using the SPLClassLoader command described here: https://github.com/lobostome/FurryBear/wiki/Installation
I'm not sure where to put the full library and then how to get it recognized by / loaded into WordPress so that it can be used.
Any help would be appreciated. Thanks
if your writing your own plugin you can put the FurryBear code in your plugin folder and then include it manually like
require_once 'SplClassLoader.php';
// Instantiate the SplClassLoader with the location directory of the source files.
$classLoader = new SplClassLoader(__DIR__ . '/src');
$classLoader->register();
Thanks. Basically, the require_once call to SplClassLoader.php they give on the wiki, and you mention above, is how it should be done. The problem was that the files were buried deep within the default build and were meant to be referenced from the same top level directory.
I moved the SplClassLoader.php file out as well as the src folder, putting both in the top level plugins folder and all worked as expected.
Thanks again.
Using Symfony2, Twig, and Prismic:
I have looked at the following resources, but I am still unclear how to extend certain methods in Symfony2
http://symfony.com/doc/current/cookbook/bundles/inheritance.html
http://symfony.com/doc/current/cookbook/bundles/override.html
There is a prismic folder in my vendors directory, which includes the following dirs:
vendors/prismic
php-sdk
prismic-bundle
For my application, I duplicated the prismic-bundle directory and moved it here:
src/VAP/Bundle/PrismicBundle
then changed the AppKernal.php to include this bundle:
// new Prismic\Bundle\PrismicBundle\PrismicBundle() ..removed the connection to the vendor dir
new VAP\Bundle\PrismicBundle\PrismicBundle() ..use this custom directory
which works fine.
However, there are methods in the php-sdk directory that are called from my custom PrismicBundle, which I need to extend or override. For instance, a twig template may call
var.getStructuredText('blog.body').asHtml(ctx.linkResolver)
which is located here:
vendor/prismic/php-sdk/src/Prismic/Fragment/StructuredText.php
How/where would I create a file that would extend/overwrite the above file?
I am also confused if php-sdk is a bundle, or is it part of the original PrismicBundle from the vendor directory?
First, you say that you duplicated the PrismicBundle in your src folder, why did you not use the bundle inheritence process ?
public function getParent()
{
return 'PrismicBundle';
}
For you question, you have to change the behavior of the prismic php-sdk, possible reasons:
1) This sdk is not well built
2) You do not use it correctly
3) You want a very custom behavior not supported by prismic
IMO, possible solutions are:
1) Fork the sdk to add compatibility to your need
2) Think about a different way to reach your need
3) Create a new service in your custom PrismicBundle that call prismic api as you want.
Faor your final question, afaik prismic/php-sdk is the api implementation in raw php, and prismic/prismic-bundle is a bridge between this raw php SDK and Symfony, implementing services and all comodities provided by Symfony.
I have developed the CRM based web application what i need to do is to integrate the wordpres with my CI first i have the problem when i include the main WP file
require('./wp-blog-header.php');
in my one of the CI view file the error i was getting that function site_url() conflicts this function is the base function of both WP and CI ,although i found a solution to include the WP file in the main index.php file of CI but there is uncertainity too that after this the session library of CI stops working is.
How to show the posts of WP in the footer of my CRM?
When using include or require in my CodeIgniter views I make sure the files I am linking to are outside of the CodeIgniter application folder as I had trouble using files there because of some permission problems. My solution was to just keep a folder in my web directory. You also cannot use base_url or site_url CodeIgniter functions here since you want to get the server path not the web address of the file. So you can use the php variable $_SERVER['DOCUMENT_ROOT'] which will return the root of your web directory.
It might look something like this:
require($_SERVER['DOCUMENT_ROOT'].'wp-blog-header.php');
Which would work if wp-blog-header.php was in your web root directory.