Premium Financial Widgets
PHP Plugin
Copy and unzip the contents of the plugin archive to the web root folder of your website (preferably) or any other folder as per your website structure.
Open license/.license file in a text editor and input the plugin purchase code and the licensee email (where is my purchase code?). The content of the file should look like this:
PURCHASE_CODE=abcdefgh-abcd-abcd-abcdefgh EMAIL=user@domain.com
Load the plugin JavaScript code by adding the following line at the end of the web page right before the closing <BODY> tag (please note, it will not function if added to the <HEAD> section instead):
<script src="/assets/dist/app.js"></script>
Just in case you copied the plugin files to a folder other than the web root folder of your website (domain), you need to specify the relative path to the folder containing the plugin files by setting the pluginUrl property as well as the relative path to ajax.php by setting the ajaxUrl property in the premiumStockMarketWidgets global config object as follows:
<script>
var premiumStockMarketWidgets = {
pluginUrl: '/alternative/path/to/plugin-folder',
ajaxUrl: '/alternative/path/to/plugin-folder/ajax.php',
}
</script>
The above code should be placed anywhere before loading the main app.js file.
As the final step please make sure that the data sub folder exists and is writable by the web server. This folder is used to store cached market data.
After the steps above are done you can start adding financial widgets to your web page. To do so open Widgets Builder, choose a widget you need and customize it, obtain its shortcode and paste it anywhere to your page. Here is a sample PHP page to illustrate how to use the plugin.
Please note that the above are PHP pages, so they will only work when installed on a web server.
You can override some default settings (such as decimal or thousands separator) by passing premiumStockMarketWidgets global configuration object. The config object needs to be defined before loading the main app.js file. Possible configuration options are listed below:
<script>
var premiumStockMarketWidgets = {
pluginUrl: typeof premiumStockMarketWidgets.pluginUrl !== 'undefined' ? premiumStockMarketWidgets.pluginUrl : '',
ajaxNonce: premiumStockMarketWidgets.ajaxNonce || '',
companyLogoImages: {}, // company logo images, see below for more details
cryptoLogoImages: {}, // crypto logo images, see below for more details
decimalSeparator: '.', // decimal separator
thousandsSeparator: ',', // thousands separator
defaultNumberFormat: '0,0.00', // default number format. Supported formats: http://numeraljs.com/#format
// individual number format for specific fields
numberFormats: {
// refer to "json/number-formats.json" for a list of all available properties
"price": "$0,0.00",
"market_cap": "$0,0.00a",
"volume": "$0,0.00a"
},
defaultDateFormat: 'LL', // date format. Supported formats: https://momentjs.com/docs/#/displaying/
// individual date format for specific fields
dateFormats: {
// refer to "json/date-formats.json" for a list of all available properties
"date": "ll",
"time": "H:mm"
},
nullValueFormat: '-', // empty (N/A) value format
defaultAssetLogoUrl: null, // default asset logo URL (displayed when an individual logo is not defined)
hideSymbolSuffix: false, // ability to hide asset symbol market suffix (relevant for non-US markets)
locale: 'en', // https://stackoverflow.com/a/55827203
// custom company names
assetNamesOverrides: {
AAPL: 'Some company name'
},
googleMapsApiKey: '', // Google Maps API key for the company map widget
text: {} // custom translations. See below for more details
}
</script>
Some widgets can display asset logo images. In order to make the plugin load a logo image you need:
<script>
var premiumStockMarketWidgets = {
companyLogoImages: {
AAPL: '/psmw/assets/images/companies/AAPL.png',
GOOG: '/psmw/assets/images/companies/GOOG.png',
AMZN: '/psmw/assets/images/companies/AMZN.jpg'
},
cryptoLogoImages: {
BTC: '/psmw/assets/images/cryptocurrencies/BTC.png',
ETH: '/psmw/assets/images/cryptocurrencies/ETH.png',
XRP: '/psmw/assets/images/cryptocurrencies/XRP.png'
}
}
</script>
It's possible to automatically pass all available logo images to the plugin with a bit of PHP code. Please check the builder.php source code to find out how to do it.
All static text strings within the plugin are customizable for translation into any language. To achieve this, you can simply configure the text property within the global configuration object premiumStockMarketWidgets. These text strings are located in the json/text.json file (please avoid modifying this file directly, as it will not yield the desired results). Below is an example of how to translate specific text strings:
<script>
var premiumStockMarketWidgets = {
text: {
website: 'webseite',
industry: 'industrie',
sector: 'sektor'
}
}
</script>
A calculated field is a custom field, which allows you to perform automatic calculations on existing data fields, such as price, volume, market cap etc. Calculated fields can be added to button, inline, table, comparison widgets.
The configuration for calculated fields is stored in the fields.php file. Price per 1000 shares calculated field is provided by default as an example:
[
[
'id' => 'price_per_1k',
'title' => 'Price per 1000 shares',
'formula' => '{price}*1000',
]
];
As you can see from the formula, this field's value is determined by multiplying the current asset price by 1000. Please note, that any fields referenced in the formula should be enclosed within curly braces { }. Refer to json/quote-fields.json for a list of all available reference fields.
You can also use any mathematical PHP functions.
To override information (e.g. description) for a company you have to locate the information file for that company stored in data sub folder. The file is created automatically when the company information is requested for the first time. The file is named SYMBOL_company.json (e.g. AAPL_info.json, MSFT_info.json, etc). Copy this file to the data-udf sub folder. Then open the copied file using a text editor and make the necessary modifications to the default data. Ensure that the edited file maintains its validity as a JSON file.
var premiumStockMarketWidgets = {
...
addons: {
options: {
installed: true
}
}
}
If you need any further help submit a new support ticket at support.financialplugins.com. Please note that you need to have a valid support period to be able to open new tickets (how to renew my support?).