function parseSkins()
 {
     $skinPaths = glob(dirname($this->_file()) . '/skins/*', GLOB_ONLYDIR);
     lava::currentPlugin($this->_this());
     //make sure theme files can access the plugin easily
     foreach ($skinPaths as $skinPath) {
         $includePath = $skinPath . '/skin.php';
         if (file_exists($includePath)) {
             $dir = str_replace('\\', '/', $skinPath);
             $dir = explode('/', $dir);
             $dir = end($dir);
             $this->currentSkinSlug = $dir;
             $skinName = $dir;
             $skinAuthor = "Undefined";
             if ($this->_request("admin")) {
                 //only parse file headers on admin requests
                 $skinHeader = file_get_contents($includePath);
                 if (strpos(substr($skinHeader, 0, 20), '/*') === false) {
                     //the substr prevents the search incorrectly matching the string in code (like on this line) by only searching the top of the file (where the header should be)
                     //File has no header so leave defaults
                 } else {
                     $skinHeader = explode('/*', $skinHeader);
                     $skinHeader = $skinHeader[1];
                     $skinHeader = explode('*/', $skinHeader);
                     $skinHeader = $skinHeader[0];
                     $skinHeader = explode("\n", $skinHeader);
                     foreach ($skinHeader as $head) {
                         $head = trim($head);
                         if (!empty($head)) {
                             $head = explode(":", $head);
                             if (count($head == 2)) {
                                 $property = strtoupper($head[0]);
                                 $value = trim($head[1]);
                                 switch ($property) {
                                     case 'NAME':
                                     case 'TITLE':
                                         $skinName = $value;
                                         break;
                                     case 'AUTHOR':
                                         $skinAuthor = $value;
                                         break;
                                 }
                             }
                         }
                     }
                 }
             }
             $this->registerSkin()->setName($skinName)->setAuthor($skinAuthor);
             include_once $includePath;
         }
     }
 }
Esempio n. 2
0
<?php

/*
	Serves media files
*/
// include wordpress
$current = __FILE__;
$junction = true;
for ($i = 0; $i < 5; $i++) {
    $current = dirname($current);
    if (file_exists($current . '/wp-load.php')) {
        require_once $current . '/wp-load.php';
        $junction = false;
        break;
    }
}
if ($junction) {
    require_once 'G:\\Projects\\_workflow_\\WordPress 3.4\\wp-load.php';
}
$thePlugin = lava::fetchPlugin('Private Blog');
$thePlugin->pluginCallbacks->doMedia();
Esempio n. 3
0
<?php

/*
Plugin Name: Private Blog
Plugin URI: http://www.volcanicpixels.com/password-protect-wordpress-plugin/
Description: Private Blog is a wordpress plugin which allows you to password protect all of your wordpress blog including all posts and feeds with a single password.
Version: 5.0.5
Author: Daniel Chatfield
Author URI: http://www.danielchatfield.com
License: GPLv2
*/
error_reporting(0);
include dirname(__FILE__) . "/lava/lava.php";
$pluginName = "Private Blog";
$pluginVersion = "5.0.5";
$thePlugin = lava::newPlugin(__FILE__, $pluginName, $pluginVersion);
$pluginSlug = $thePlugin->_slug();
/**
 *
 * Define the plugin settings:
 *	Enabled
 *	Multiple Passwords
 *	Passwords
 *	Login Duration
 *	Add logout button
 */
// To change maximum passwords change the value of the variable below
global $maxPasswords;
$maxPasswords = 10;
$thePlugin->_settings()->addSetting("enabled")->setName(__("Enable Password Protection", $pluginSlug))->setType("checkbox")->setDefault("on")->setHelp(__("When enabled visitors to your site will need to login to access it.", $pluginSlug))->addSetting("use_template_hook")->setName(__("Enable this ONLY if the login page never appears (RSS feeds will not be public)", $pluginSlug))->setType("checkbox")->setDefault("off")->addSetting("multiple_passwords")->setName(__("Enable multiple passwords", $pluginSlug))->setType("checkbox")->setDefault("off")->setHelp(sprintf(__("When enabled, upto %s different passwords can be set.", $pluginSlug), 10))->addTag("is-premium");
for ($i = 1; $i <= $maxPasswords; $i++) {
Esempio n. 4
0
 static function currentPlugin($thePlugin = null)
 {
     if (!is_null($thePlugin)) {
         self::$currentPlugin = $thePlugin;
     }
     return self::$currentPlugin;
 }
Esempio n. 5
0
 public function graficarBarras(Request $request)
 {
     $datos = array();
     $productos = Producto::all();
     if ($request->id == 'Id') {
         $opcion = $request->id;
         foreach ($productos as $producto) {
             $datos1 = array($producto->nombre, $producto->id);
             array_push($datos, $datos1);
         }
     }
     if ($request->existencias == 'Existencias') {
         $opcion = $request->existencias;
         foreach ($productos as $producto) {
             $datos1 = array($producto->nombre, $producto->existencias);
             array_push($datos, $datos1);
         }
     }
     if ($request->precio == 'Precio') {
         $opcion = $request->precio;
         foreach ($productos as $producto) {
             $datos1 = array($producto->nombre, $producto->precio);
             array_push($datos, $datos1);
         }
     }
     if ($request->id == null && $request->existencias == null && $request->precio == null) {
         $opcion = "ighjh";
         $datos = null;
         return view('admi.graficas')->with(['errorBarras' => 'Tiene que seleccionar por lo menos una opcion']);
     }
     $tabla = \Lava::DataTable();
     $tabla->addStringColumn('Nombre')->addNumberColumn($opcion);
     foreach ($datos as $dato) {
         $tabla->addRow($dato);
     }
     $barchart = \lava::ColumnChart('Barras')->dataTable($tabla)->title('Grafica de Barras');
     return view('admi.graficas')->with(['barchart' => $barchart]);
 }
Esempio n. 6
0
<?php

/*
Title: Default with options
Author: Daniel Chatfield
*/
$thePlugin = lava::currentPlugin();
$skinUrl = $thePlugin->_skins()->getSkin(__FILE__)->skinUrl();
$thePlugin->_skins()->getSkin(__FILE__)->addSkinSetting("logo")->setName(__("Logo", $thePlugin->_slug()))->setType("image")->setDefault($skinUrl . 'static/images/logo.png')->addTag("is-premium")->addSkinSetting("enable_message")->setName(__("Display a message", $thePlugin->_slug()))->setHelp(__("Set a message to appear above the form. Any urls and email addresses will be converted into links.", $thePlugin->_slug()))->setType("checkbox")->setDefault("off")->settingToggle("message")->addTag("is-premium")->addSkinSetting("message")->setType("textarea")->addTag("no-margin")->addTag("align-center")->addTag("is-premium")->addPresetSkinSetting("custom_css")->addTag("is-premium");