code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
4
991
language
stringclasses
9 values
license
stringclasses
15 values
size
int32
3
1.05M
import { Recipe, RecipeContainer } from '../class/recipe'; import { Items as i } from '../constants/items'; import { Equipment as e } from '../class/equipment'; import { Categories as c } from '../constants/categories'; import { Units as u } from '../constants/units'; import { Text as text } from '../class/text'; import { Timer } from '../class/timer'; export class MealRecipe extends RecipeContainer { constructor() { super(); this.recipeGroup = c.meal; this.recipeName = 'Spaghetti' this.variations = [ LentilPenne, LentilSpaghetti, LentilSpaghettiInstantPot, DontUseModernBrandLentilPenne ] } } export class LentilPenne extends Recipe { constructor() { super(); this.steps = [ e.pot().add([ i.water(18, u.second), ]), Timer.set(10, 'm', 'Wait for water to boil'), i.Groups.mushroom(4, u.unit).cutIntoStrips(), Timer.end(), e.pot().add([ i.lentilSpaghetti(8, u.ounce), ]), Timer.set(10, 'm', 'let lentil penne cook'), e.pan().add([ i.Groups.mushroom(4, u.unit), ]), e.pan().cook(8, 'm'), e.pan().add([ i.spaghettiSauce(25, u.ounce), ]), e.pan().cook(2, 'm'), Timer.end(), Timer.end(['pan']), Timer.end(['pot']), text.set(['Top with', i.parmesanCheese(8, u.ounce)]), ]; } } export class LentilSpaghetti extends Recipe { constructor() { super(); this.steps = [ e.pot().add([ i.water(25, u.second), ]), Timer.set(15, 'm', 'Wait for water to boil'), i.Groups.mushroom(4, u.unit).cutIntoStrips(), Timer.end(), e.pot().add([ i.lentilSpaghetti(8, u.ounce), ]), Timer.set(18, 'm', 'let lentil spaghetti cook'), e.pan().add([ i.Groups.mushroom(4, u.unit), ]), e.pan().cook(8, 'm'), e.pan().add([ i.spaghettiSauce(25, u.ounce), ]), e.pan().cook(8, 'm'), Timer.end(), Timer.end(), Timer.end(), text.set(['Top with', i.parmesanCheese(8, u.ounce)]), ]; } } export class LentilSpaghettiInstantPot extends Recipe { constructor() { super(); this.steps = [ e.instantPot().add([ i.spaghettiSauce(25, u.ounce), i.water(1, u.cup), i.lentilSpaghetti(8, u.ounce), i.oliveOil(1, u.ounce) ]), text.set(['Stir instant pot and break up pasta']), e.instantPot().pressureCook(15, 13, 'm'), text.set(['Top with', i.parmesanCheese(8, u.ounce)]), ]; } } export class DontUseModernBrandLentilPenne extends Recipe { constructor() { super(); this.steps = [ e.instantPot().add([ i.spaghettiSauce(25, u.ounce), i.water(1, u.cup), i.penneLentil(8, u.ounce), i.oliveOil(1, u.ounce) ]), text.set(['Stir instant pot and break up pasta']), e.instantPot().pressureCook(15, 7, 'm'), Timer.end(), ]; } }
clickthisnick/recipes
src/recipeDebug/pasta.ts
TypeScript
mit
3,529
using System; using System.Collections.Generic; using System.Linq; using System.Drawing; using Foundation; using UIKit; using Alliance.Carousel; namespace Sample { public class ZeroItemLinearViewController : UIViewController { public List<nint> items; CarouselView carousel; public ZeroItemLinearViewController() : base() { } public override void ViewDidLoad() { base.ViewDidLoad(); // Setup the item list we will display // your carousel should always be driven by an array/list of // data of some kind - don't store data in your item views // or the recycling mechanism will destroy your data once // your item views move off-screen items = new List<nint>(); // Setup Background image var imgView = new UIImageView(UIImage.FromBundle("background")) { ContentMode = UIViewContentMode.ScaleToFill, AutoresizingMask = UIViewAutoresizing.All, Frame = View.Bounds }; View.AddSubview(imgView); // Setup CarouselView view carousel = new CarouselView(View.Bounds); carousel.DataSource = new ZeroItemLinearDataSource(this); carousel.Delegate = new ZeroItemLinearDelegate(this); carousel.CarouselType = CarouselType.Linear; carousel.ConfigureView(); View.AddSubview(carousel); } public class ZeroItemLinearDataSource : CarouselViewDataSource { ZeroItemLinearViewController vc; public ZeroItemLinearDataSource(ZeroItemLinearViewController vc) { this.vc = vc; } public override nint NumberOfItems(CarouselView carousel) { return (nint)vc.items.Count; } public override UIView ViewForItem(CarouselView carousel, nint index, UIView reusingView) { UILabel label; // create new view if no view is available for recycling if (reusingView == null) { // don't do anything specific to the index within // this `if (view == null) {...}` statement because the view will be // recycled and used with other index values later var imgView = new UIImageView(new RectangleF(0, 0, 200, 200)) { Image = UIImage.FromBundle("page"), ContentMode = UIViewContentMode.Center }; label = new UILabel(imgView.Bounds) { BackgroundColor = UIColor.Clear, TextAlignment = UITextAlignment.Center, Tag = 1 }; label.Font = label.Font.WithSize(50); imgView.AddSubview(label); reusingView = imgView; } else { // get a reference to the label in the recycled view label = (UILabel)reusingView.ViewWithTag(1); } // set item label // remember to always set any properties of your carousel item // views outside of the `if (view == null) {...}` check otherwise // you'll get weird issues with carousel item content appearing // in the wrong place in the carousel label.Text = vc.items[(int)index].ToString(); return reusingView; } } public class ZeroItemLinearDelegate : CarouselViewDelegate { ZeroItemLinearViewController vc; public ZeroItemLinearDelegate(ZeroItemLinearViewController vc) { this.vc = vc; } public override nfloat ValueForOption(CarouselView carousel, CarouselOption option, nfloat aValue) { if (option == CarouselOption.Spacing) { return aValue * 1.1f; } return aValue; } public override void DidSelectItem(CarouselView carousel, nint index) { Console.WriteLine("Selected: " + ++index); } } } }
chuonglqspkt/App
Components/Alliance.Carousel-3.0/samples/Sample/Sample/ZeroItemLinearViewController.cs
C#
mit
4,517
declare namespace Xrm { interface EntityDefinition { EntitySetName: string; } namespace Attributes { interface LookupAttribute { getLookupTypes(): LookupValue[]; } } namespace Controls { interface Control { getAttribute(): Xrm.Attributes.Attribute; } } namespace Page { interface LookupValue { type: string; typename: string; } } interface Ui { getCurrentControl(): Xrm.Controls.Control; } interface XrmStatic { Internal: XrmInternal; } interface XrmInternal { getEntityCode(entityName: string): number; isUci(): boolean; } interface GlobalContext { isOffice365(): boolean; isOnPremises(): boolean; } }
rajyraman/Levelup-for-Dynamics-CRM
app/tsd/xrm.d.ts
TypeScript
mit
715
export interface DetectedFeatures { draggable:boolean; dragEvents:boolean; userAgentSupportingNativeDnD:boolean; } export function detectFeatures():DetectedFeatures { let features:DetectedFeatures = { dragEvents: ("ondragstart" in document.documentElement), draggable: ("draggable" in document.documentElement), userAgentSupportingNativeDnD: undefined }; const isBlinkEngine = !!((<any>window).chrome) || /chrome/i.test( navigator.userAgent ); features.userAgentSupportingNativeDnD = !( // if is mobile safari or android browser -> no native dnd (/iPad|iPhone|iPod|Android/.test( navigator.userAgent )) || // OR //if is blink(chrome/opera) with touch events enabled -> no native dnd (isBlinkEngine && ("ontouchstart" in document.documentElement)) ); return features; } export function supportsPassiveEventListener():boolean { let supportsPassiveEventListeners = false; // reference https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md try { let opts = Object.defineProperty( {}, "passive", { get: function() { supportsPassiveEventListeners = true; } } ); window.addEventListener( "test", null, opts ); } // tslint:disable-next-line:no-empty catch( e ) { } return supportsPassiveEventListeners; }
timruffles/ios-html5-drag-drop-shim
src/internal/feature-detection.ts
TypeScript
mit
1,424
(function () { window.onload = function () { var stage, layer, layerBG, ball, constants, onJump, isOver; stage = new Kinetic.Stage({ container: 'kinetic-container', width: document.body.clientWidth, height: document.body.clientHeight }); layer = new Kinetic.Layer(); layerBG = new Kinetic.Layer(); constants = { BALL_X: 25, BALL_Y: stage.getHeight() * 0.75 - 25, BALL_RADIUS: 25, BALL_X_ACCELERATION: 0.1, BALL_X_DECELERATION: 0.15, BALL_Y_ACCELERATION: 0.2, BALL_Y_DECELERATION: 0.25, FUNDAMENTALS_WIDTH: 175, FUNDAMENTALS_HEIGHT: 50, GAME_OVER_IMG: 'https://lh3.googleusercontent.com/-hk3-q7XFs1w/U5105G5F8SI/AAAAAAAAAfQ/OMHmsK6-Dco/zoom_games_18.normal.color_000000.png', IMAGES_SOURCES: ['http://3.bp.blogspot.com/-zt_wXhDvv_Q/VI0u3M65zFI/AAAAAAAAAM0/eQHiw5EuhFI/s1600/apple-logo-black.png', 'http://4.bp.blogspot.com/-kp9dUl08xCA/UODmryuwAYI/AAAAAAAApn4/-nFoS6F0cFE/s1600/AxFoCM-CMAEH868.jpg', 'http://hdw.datawallpaper.com/nature/the-beauty-of-nature-wide-wallpaper-499995.jpg', 'http://cs304304.vk.me/v304304772/59cc/DStHQW-F20A.jpg'] }; window.onkeydown = function(ev){ switch (ev.keyCode) { case 32: if (!onJump) { onJump = true; ball.deltaY = -1; ball.speedY = constants.BALL_Y_ACCELERATION * 50; } break; case 37: if (onJump) { ball.deltaX = -1; ball.speedX += constants.BALL_X_ACCELERATION * 5; } else { ball.deltaX = -1; ball.speedX += constants.BALL_X_ACCELERATION * 10; } break; case 39: if (onJump) { ball.deltaX = 1; ball.speedX += constants.BALL_X_ACCELERATION * 5; } else { ball.deltaX = 1; ball.speedX += constants.BALL_X_ACCELERATION * 10; } break; default: break; } }; function start() { onJump = false; isOver = false; ball = getBall(); for (var i = 0; i < 6; i += 1) { getFundamental(i * 200, stage.getHeight() * 0.75 - i * 100); } getTrophy((i - 1) * 200, stage.getHeight() * 0.75 - (i - 1) * 100 - constants.FUNDAMENTALS_HEIGHT * 2); layer.add(ball); stage.add(layerBG); stage.add(layer); step(); } function step() { // y if (ball.deltaY === 1) { if (checkFundamentals()) { onJump = false; ball.deltaY = 0; ball.speedY = 0; } else if (ball.getY() >= stage.getHeight() - ball.getRadius()) { gameOverText(); gameOverImage(); } } else if (ball.deltaY === -1) { if (ball.getY() <= 0 + ball.getRadius()) { happyEnd(); ball.deltaY = 1; } else if (ball.speedY <= 0) { ball.deltaY = 1; ball.speedY = 0; } } else { if (!checkFundamentals()) { ball.deltaY = 1; } } // x if (ball.deltaX === 1) { if (ball.getX() >= stage.getWidth() - ball.getRadius()) { ball.deltaX = 0; } else if (ball.speedX <= 0) { ball.deltaX = 0; ball.speedX = 0; } } else if (ball.deltaX === -1) { if (ball.getX() <= 0 + ball.getRadius()) { ball.deltaX = 0; } else if (ball.speedX <= 0) { ball.deltaX = 0; ball.speedX = 0; } } moveBall(); layer.draw(); if (!isOver) { requestAnimationFrame(step); } else { window.onkeydown = null; } } function checkFundamentals() { return layerBG.find('Rect').some(function (fundamental) { if (ball.getX() > fundamental.getX() && ball.getX() < fundamental.getX() + fundamental.getWidth() && ball.getY() > fundamental.getY() - ball.getRadius() && ball.getY() <= fundamental.getY() + fundamental.getHeight() - ball.getRadius()) { ball.setY(fundamental.getY() - ball.getRadius()); return true } return false; }); } function moveBall() { if (ball.deltaX === 1) { ball.speedX -= ball.decelerationX; } else if (ball.deltaX === -1) { ball.speedX -= ball.decelerationX; } else { ball.speedX = 0; } if (ball.deltaY === 1) { ball.speedY += ball.accelerationY; } else if (ball.deltaY === -1) { ball.speedY -= ball.decelerationY; } else { ball.speedY = 0; } ball.setX(ball.getX() + ball.deltaX * ball.speedX); ball.setY(ball.getY() + ball.deltaY * ball.speedY); } function getBall() { var ball = new Kinetic.Circle({ x: constants.BALL_X, y: constants.BALL_Y, radius: constants.BALL_RADIUS, fill: getRandomColor() }); ball.deltaX = 0; ball.deltaY = 0; ball.speedX = 0; ball.speedY = 0; ball.accelerationX = constants.BALL_X_ACCELERATION; ball.decelerationX = constants.BALL_X_DECELERATION; ball.accelerationY = constants.BALL_Y_ACCELERATION; ball.decelerationY = constants.BALL_Y_DECELERATION; return ball; } function getFundamental(x, y) { layerBG.add(new Kinetic.Rect({ x: x, y: y, width: constants.FUNDAMENTALS_WIDTH, height: constants.FUNDAMENTALS_HEIGHT, fill: 'purple' })); layerBG.draw(); } function getTrophy(x, y) { var canvasImage, kineticImage; canvasImage = new Image(); canvasImage.src = constants.IMAGES_SOURCES[0]; canvasImage.onload = function () { kineticImage = new Kinetic.Image({ x: x, y: y, width: 150, height: 100, image: canvasImage, draggable: true }); layerBG.add(kineticImage); layerBG.draw(); }; } function happyEnd() { var canvasImage, kineticImage; canvasImage = new Image(); canvasImage.src = constants.IMAGES_SOURCES[3]; canvasImage.onload = function () { kineticImage = new Kinetic.Image({ x: 0, y: 0, width: stage.getWidth(), height: stage.getHeight(), image: canvasImage, draggable: true }); layerBG.add(kineticImage); layerBG.draw(); }; isOver = true; } function gameOverText() { var gameOver = 'GAME OVER'; var text = new Kinetic.Text({ x: (stage.getWidth() - gameOver.length * 36) / 2, y: stage.getHeight() / 2, text: gameOver, fontSize: 72, fontFamily: 'Calibri', align: 'center', fill: 'blue' }); layerBG.add(text); layerBG.draw(); isOver = true; } function gameOverImage() { var canvasImage, kineticImage; canvasImage = new Image(); canvasImage.src = constants.GAME_OVER_IMG; canvasImage.onload = function () { kineticImage = new Kinetic.Image({ x: 0, y: 0, width: stage.getWidth(), height: stage.getHeight(), image: canvasImage, draggable: true }); layerBG.add(kineticImage); layerBG.draw(); }; isOver = true; } function getRandomColor() { const COLOR_STRING_LENGTH = 6; const HEXADECIMAL_BASE = 16; const HEXADECIMAL_SIGNS = '0123456789ABCDEF'; var letters = HEXADECIMAL_SIGNS.split(''); var color = '#'; for (var i = 0; i < COLOR_STRING_LENGTH; i += 1) { color += letters[Math.floor(Math.random() * HEXADECIMAL_BASE)]; } return color; } return start(); }; }());
iKostov86/JavaScriptUI-DOM
Demos/Demos-JS-UI-DOM/WebStorm/KineticJS/script-jumping.js
JavaScript
mit
9,883
package com.github.twitch4j.helix.domain; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.PropertyNamingStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; import lombok.AccessLevel; import lombok.Data; import lombok.NoArgsConstructor; import lombok.Setter; @Data @Setter(AccessLevel.PRIVATE) @NoArgsConstructor @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) @JsonIgnoreProperties(ignoreUnknown = true) public class ExtensionTransaction { /** * Unique identifier of the Bits in Extensions Transaction. */ private String id; /** * UTC timestamp when this transaction occurred. */ private String timestamp; /** * Twitch User ID of the channel the transaction occurred on. */ private String broadcasterId; /** * Twitch Display Name of the broadcaster. */ private String broadcasterName; /** * Twitch User ID of the user who generated the transaction. */ private String userId; /** * Twitch Display Name of the user who generated the transaction. */ private String userName; /** * Enum of the product type. Currently only BITS_IN_EXTENSION. */ private String productType; /** * Known "product_type" enum values. */ public static class ProductType { // "Currently" only valid product type public static String BITS_IN_EXTENSION = "BITS_IN_EXTENSION"; } /** * JSON Object representing the product acquired, as it looked at the time of the transaction. */ private ProductData productData; @Data @Setter(AccessLevel.PRIVATE) @NoArgsConstructor @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) @JsonIgnoreProperties(ignoreUnknown = true) public static class ProductData { /** * Unique identifier for the product across the extension. */ private String sku; /** * JSON Object representing the cost to acquire the product. */ private Cost cost; /** * Display Name of the product. */ @JsonProperty("displayName") private String displayName; /** * Flag used to indicate if the product is in development. Either true or false. */ @JsonProperty("inDevelopment") private Boolean inDevelopment; @Data @Setter(AccessLevel.PRIVATE) @NoArgsConstructor @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) @JsonIgnoreProperties(ignoreUnknown = true) public static class Cost { /** * Number of Bits required to acquire the product. */ private Integer amount; /** * Always the string “Bits”. */ private String type; /** * Known "type" enum values */ public static class CostType { // "Currently" only valid cost type. public static final String BITS = "bits"; } } } }
PhilippHeuer/twitch4j
rest-helix/src/main/java/com/github/twitch4j/helix/domain/ExtensionTransaction.java
Java
mit
2,884
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; //Core require('../../rxjs-extensions'); var core_1 = require('@angular/core'); var platform_browser_1 = require('@angular/platform-browser'); var forms_1 = require('@angular/forms'); var http_1 = require('@angular/http'); var app_routing_1 = require('./app.routing'); //Services //Common Components var page_footer_component_1 = require('../userinterface/page-footer.component'); var page_header_component_1 = require('../userinterface/page-header.component'); //Module Components var app_component_1 = require('./app.component'); var home_content_component_1 = require('./home-content.component'); var AppModule = (function () { function AppModule() { } AppModule = __decorate([ core_1.NgModule({ imports: [ platform_browser_1.BrowserModule, forms_1.FormsModule, forms_1.ReactiveFormsModule, http_1.HttpModule, app_routing_1.routing ], declarations: [ app_component_1.AppComponent, page_footer_component_1.PageFooterComponent, page_header_component_1.PageHeaderComponent, home_content_component_1.HomeContentComponent ], bootstrap: [app_component_1.AppComponent] }), __metadata('design:paramtypes', []) ], AppModule); return AppModule; }()); exports.AppModule = AppModule; //# sourceMappingURL=app.module.js.map
Infindant/Master-Template-MVC-Angular2-Gulp
Web.Portal/Scripts/shared/home/app.module.js
JavaScript
mit
2,225
/** * MIT License * * Copyright (c) 2017 ITGorillaz * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ 'use strict'; const HttpException = require('./http-exception'); const HttpStatus = require('http-status-codes'); /** * The GoneException class. * * This is a concrete class of the the HttpException class. * It represents a gone http response. * * @author tommelo */ class GoneException extends HttpException { /** * The class constructor * * @param {Object} entity The object to be serialized as response body * @param {Error} cause The error cause */ constructor(entity, cause) { cause = cause || new Error('GoneException'); super(entity, HttpStatus.GONE, cause); } } module.exports = GoneException;
it-gorillaz/aws-wave
lib/exception/gone-exception.js
JavaScript
mit
1,818
<?php /** * Class CreateTableLogger */ class CreateTableLogger extends SQLLoggerAbstract { /** * */ function prepare() { } /** * */ function setHint() { $this->hint = "Добавлена таблица"; } }
Sohorev/bitrix-zf1
site1/local/library/ChangeLogger/SQLLoggers/class.CreateTableLogger.php
PHP
mit
294
using System; using NetOffice; using NetOffice.Attributes; namespace NetOffice.MSHTMLApi.Enums { /// <summary> /// SupportByVersion MSHTML 4 /// </summary> [SupportByVersion("MSHTML", 4)] [EntityType(EntityType.IsEnum)] public enum _styleWordWrap { /// <summary> /// SupportByVersion MSHTML 4 /// </summary> /// <remarks>0</remarks> [SupportByVersion("MSHTML", 4)] styleWordWrapNotSet = 0, /// <summary> /// SupportByVersion MSHTML 4 /// </summary> /// <remarks>1</remarks> [SupportByVersion("MSHTML", 4)] styleWordWrapOff = 1, /// <summary> /// SupportByVersion MSHTML 4 /// </summary> /// <remarks>2</remarks> [SupportByVersion("MSHTML", 4)] styleWordWrapOn = 2, /// <summary> /// SupportByVersion MSHTML 4 /// </summary> /// <remarks>2147483647</remarks> [SupportByVersion("MSHTML", 4)] styleWordWrap_Max = 2147483647 } }
NetOfficeFw/NetOffice
Source/MSHTML/Enums/_styleWordWrap.cs
C#
mit
913
<?php defined('BASEPATH') OR exit('No direct script access allowed'); $this->load->view('layout/header'); $fname = isset($cust[0])? $cust[0]->name : ''; $ntn = isset($cust[0])? $cust[0]->ntn : ''; $adress= isset($cust[0])? $cust[0]->adress : ''; $email = isset($cust[0])? $cust[0]->email : ''; $phone = isset($cust[0])? $cust[0]->phone : ''; $contact1 = isset($cust[0])? $cust[0]->contact1 : ''; $contact1_name = isset($cust[0])? $cust[0]->contact1_name: ''; $contact1_email = isset($cust[0])? $cust[0]->contact1_email : ''; $contact2 = isset($cust[0])? $cust[0]->contact2 : ''; $contact2_name = isset($cust[0])? $cust[0]->contact2_name : ''; $contact2_email = isset($cust[0])? $cust[0]->contact2_email : ''; $contact3 = isset($cust[0])? $cust[0]->contact3 : ''; $contact3_name= isset($cust[0])? $cust[0]->contact3_name : ''; $contact3_email = isset($cust[0])? $cust[0]->contact3_email : ''; $contact4 = isset($cust[0])? $cust[0]->contact4 : ''; $contact4_name = isset($cust[0])? $cust[0]->contact4_name : ''; $contact4_email = isset($cust[0])? $cust[0]->contact4_email : ''; $citySel= isset($desig[0])? $desig[0]->city : ''; //$cityId = array('id'=>'cityId','type'=>'text','class'=>'col-xs-10 col-sm-5','value'=>'','name'=>'cityId','placeholder'=>'City ID' ); $fname = array('id'=>'fname','type'=>'text','class'=>'col-xs-10 ','value'=>$fname,'name'=>'name','placeholder'=>'Company Name' ); $ntn = array('id'=>'lname','type'=>'text','class'=>'col-xs-10 ','value'=>$ntn,'name'=>'ntn','placeholder'=>'NTN' ); $adress= array('id'=>'adress','type'=>'text','class'=>'col-xs-10','value'=>$adress,'name'=>'adress','placeholder'=>'Home Address' ); $email= array('id'=>'email','type'=>'text','class'=>'col-xs-10','value'=>$email,'name'=>'email','placeholder'=>'Email Address' ); $phone = array('id'=>'phone','type'=>'text','class'=>'col-xs-10','value'=>$phone,'name'=>'phone','placeholder'=>'Mobile Number' ); $contact1 = array('id'=>'contact1 ','type'=>'text','class'=>'col-xs-10','value'=>$contact1,'name'=>'contact1','placeholder'=>'Contact Person' ); $contact1_name = array('id'=>'contact1_name ','type'=>'text','class'=>'col-xs-10','value'=>$contact1_name,'name'=>'contact1_name','placeholder'=>'Contact Person Name' ); $contact1_email = array('id'=>'contact1_email ','type'=>'text','class'=>'col-xs-10','value'=>$contact1_email,'name'=>'contact1_email','placeholder'=>'Contact Person Email' ); $cityName = array('id'=>'cityName','type'=>'text','class'=>'col-xs-10','value'=>$citySel,'name'=>'city','placeholder'=>'City Name' ); ?> <div id="container"> <div class="main-content"> <div class="main-content-inner"> <div class="breadcrumbs" id="breadcrumbs"> <script type="text/javascript"> try { ace.settings.check('breadcrumbs', 'fixed') } catch (e) { } </script> <ul class="breadcrumb"> <li> <i class="ace-icon fa fa-home home-icon"></i> <a>Home</a> </li> <li> <a>Admin</a> </li> <li class="active"> <a href="<?php echo site_url('Person/customerManage'); ?>">Create Customer</a> </li> <li class="active">Edit Customer</li> </ul><!-- /.breadcrumb --> </div> <div class="page-content"> <div class="page-header"> <h1> Customer Management <small> <i class="ace-icon fa fa-angle-double-right"></i> Edit Customer </small> </h1> </div><!-- /.page-header --> <?php if($this->session->flashdata('error_message')) { ?> <div class="alert alert-danger"> <button data-dismiss="alert" class="close" type="button"> <i class="ace-icon fa fa-times"></i> </button> <strong> <i class="ace-icon fa fa-times"></i> <?php echo $this->session->flashdata('error_message'); ?> </strong> </div> <?php } else if($this->session->flashdata('sucess_message')) { ?> <div class="alert alert-block alert-success"> <button data-dismiss="alert" class="close" type="button"> <i class="ace-icon fa fa-times"></i> </button> <p> <strong> <i class="ace-icon fa fa-check"></i> <?php echo $this->session->flashdata('sucess_message'); ?> </strong> </p> </div> <?php } ?> <div class="row"> <div class="col-xs-12"> <!-- PAGE CONTENT BEGINS --> <?php // if(!isset($id)) // { // $id = ''; // } $hidden = array('class'=>'form-horizontal','role'=>'form','custid'=>$id); echo form_open_multipart('Person/updateCustomer',$hidden ); ?> <input type="hidden" name="custid" value="<?php echo $id; ?>"> <div class="form-group col-lg-4"> <label class="col-sm-12" for="form-field-1"> Company Name </label> <div class="col-sm-12"> <?php echo form_input($fname); ?> </div> </div> <div class="form-group col-lg-4"> <label class="col-sm-12" for="form-field-1"> NTN </label> <div class="col-sm-12"> <?php echo form_input($ntn); ?> </div> </div> <div class="form-group col-lg-4"> <label class="col-sm-12" for="form-field-1"> Home Address </label> <div class="col-sm-12"> <?php echo form_input($adress); ?> </div> </div> <div class="form-group col-lg-4"> <label class="col-sm-12" for="form-field-1">Company Phone </label> <div class="col-sm-12"> <?php echo form_input($phone); ?> </div> </div> <div class="form-group col-lg-4"> <label class="col-sm-12" for="form-field-1"> Contact Person Name</label> <div class="col-sm-12"> <?php echo form_input($contact1_name); ?> </div> </div> <div class="form-group col-lg-4"> <label class="col-sm-12" for="form-field-1"> Contact Person Email</label> <div class="col-sm-12"> <?php echo form_input($contact1_email); ?> </div> </div> <div class="form-group col-lg-4"> <label class="col-sm-12" for="form-field-1"> Contact Person Number</label> <div class="col-sm-12"> <?php echo form_input($contact1); ?> </div> </div> <div class="form-group col-xs-4"> <label class="col-sm-12" for="form-field-1"> City </label> <div class="col-sm-12"> <?php echo form_dropdown($cityName,$cities,$citySel);?> </div> </div> <div class="form-group col-lg-4"> <label class="col-sm-12" for="form-field-1"> Company Email Address </label> <div class="col-sm-12"> <?php echo form_input($email); ?> </div> </div> <div class="form-group col-lg-12"> <h3 class="header smaller lighter">Contact Persons<small>(Optional )</small></h3> <div class="input_fields_wrap col-lg-12"> <div class="form-group col-lg-12"> <button type="button" class="btn btn-primary add_field_button">Add Contacts</button> </div> <?php // foreach ($hidden as $value) { ?> <div class="form-group col-lg-12" > <label class="col-sm-4" for="form-field-1"> Contact Person </label> <label class="col-sm-4" for="form-field-1"> Email </label> <label class="col-sm-4" for="form-field-1"> Contact Person Number </label> <div class="col-sm-4"> <input class="col-lg-12" type="text" value="<?php echo $contact2_name; ?>" name="contact_name[]"/> </div> <div class="col-sm-4"> <input class="col-lg-12 " type="text" value="<?php echo $contact2_email; ?>" name="contact_email[]"/> </div> <input class="col-lg-3 dynamic-field" type="text" value="<?php echo $contact2; ?>" name="contact[]"/> <a href="#" class="col-lg-1 btn fa fa-close btn-danger remove_field"></a> </div> <div class="form-group col-lg-12" > <label class="col-sm-4" for="form-field-1"> Contact Person </label> <label class="col-sm-4" for="form-field-1"> Email </label> <label class="col-sm-4" for="form-field-1"> Contact Person Number </label> <div class="col-sm-4"> <input class="col-lg-12" type="text" value="<?php echo $contact3_name; ?>" name="contact_name[]"/> </div> <div class="col-sm-4"> <input class="col-lg-12 " type="text" value="<?php echo $contact3_email; ?>" name="contact_email[]"/> </div> <input class="col-lg-3 dynamic-field" type="text" value="<?php echo $contact3; ?>" name="contact[]"/> <a href="#" class="col-lg-1 btn fa fa-close btn-danger remove_field"></a> </div> <div class="form-group col-lg-12" > <label class="col-sm-4" for="form-field-1"> Contact Person </label> <label class="col-sm-4" for="form-field-1"> Email </label> <label class="col-sm-4" for="form-field-1"> Contact Person Number </label> <div class="col-sm-4"> <input class="col-lg-12" type="text" value="<?php echo $contact4_name; ?>" name="contact_name[]"/> </div> <div class="col-sm-4"> <input class="col-lg-12 " type="text" value="<?php echo $contact4_email; ?>" name="contact_email[]"/> </div> <input class="col-lg-3 dynamic-field" type="text" value="<?php echo $contact4; ?>" name="contact[]"/> <a href="#" class="col-lg-1 btn fa fa-close btn-danger remove_field"></a> </div> <?php // } ?> </div> </div> <div class="modal-footer col-lg-12"> <a href="<?php echo site_url('Person/customerManage'); ?>" class="btn btn-sm btn-primary pull-left"> <i class="ace-icon fa fa-chevron-left"></i> Back </a> <button type="submit" class="btn btn-sm btn-primary"> <i class="ace-icon fa fa-pencil"></i> Update </button> </div> <?php echo form_close(); ?> </div> </div> <!--USER DATA---> <div class="row"> <div class="col-xs-12"> <h3 class="header smaller lighter blue">Customer Record</h3> <div class="clearfix"> <div class="pull-right tableTools-container"></div> </div> <!-- div.table-responsive --> <!-- div.dataTables_borderWrap --> <div> <table id="customer_table" class="display" cellspacing="0" width="100%" > <thead> <tr> <th class="center">Sr. No.</th> <th class="center">Company Name</th> <th class="center">NTN</th> <th class="center">City</th> <th class="center">Email Address</th> <th class="center">Home Address</th> <th class="center">Company Phone</th> <th class="center">Contact Person Name</th> <th class="center">Contact Person Email</th> <th class="center">Contact Person Number</th> <th class="center">Action</th> </tr> </thead> <tbody> <?php $count = 0; foreach ($customers as $customer) { ?> <tr> <td class="hidden-480 center"> <?php echo $count++; ?> </td> <td class="hidden-480 center"><?php echo $customer->name; ?></td> <td class="hidden-480 center"><?php echo $customer->ntn; ?></td> <td class="hidden-480 center"><?php echo $cities[$customer->city]; ?></td> <td class="hidden-480 center"><?php echo $customer->email; ?></td> <td class="hidden-480 center"><?php echo $customer->adress; ?></td> <td class="hidden-480 center"><?php echo $customer->phone; ?></td> <td class="hidden-480 center"><?php echo $customer->contact1_name; ?></td> <td class="hidden-480 center"><?php echo $customer->contact1_email; ?></td> <td class="hidden-480 center"><?php echo $customer->contact1; ?></td> <td class="hidden-480 center"> <div class="hidden-sm hidden-xs action-buttons"> <a class="green" href="<?php echo base_url();?>Person/updateCustomer/<?php echo $customer->id; ?>" > <i class="ace-icon fa fa-pencil bigger-130"></i> </a> <a class="red" href="<?php echo base_url();?>Person/deleteCustomer/<?php echo $customer->id; ?>"> <i class="ace-icon fa fa-trash-o bigger-130"></i> </a> </div> <div class="hidden-md hidden-lg"> <div class="inline pos-rel"> <button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto"> <i class="ace-icon fa fa-caret-down icon-only bigger-120"></i> </button> <ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close"> <li> <a href="#" class="tooltip-info" data-rel="tooltip" title="View"> <span class="blue"> <i class="ace-icon fa fa-search-plus bigger-120"></i> </span> </a> </li> <li> <a href="#" class="tooltip-success" data-rel="tooltip" title="Edit"> <span class="green"> <i class="ace-icon fa fa-pencil-square-o bigger-120"></i> </span> </a> </li> <li> <a href="#" class="tooltip-error" data-rel="tooltip" title="Delete"> <span class="red"> <i class="ace-icon fa fa-trash-o bigger-120"></i> </span> </a> </li> </ul> </div> </div> </td> </tr> <?php } ?> </tbody> </table> </div> </div> <!-- PAGE CONTENT ENDS --> </div><!-- /.col --> </div><!-- /.row --> </div><!-- PAGE CONTENT ENDS --> </div><!-- /.col --> </div><!-- /.row --> </div><!-- /.page-content --> </div> </div><!-- /.main-content --> </div> <?php $this->load->view('layout/footer'); ?>
umerm-work/spine
application/views/admin/editcustomer.php
PHP
mit
21,992
(function($){ DashboardModel = Backbone.Model.extend({ url: "/sync" }); SyncStatusModel = Backbone.Model.extend({ url: "/sync/status" }); DeleteModel = Backbone.Model.extend(); DashboardView = Backbone.View.extend({ el: $("#form_block"), events: { "click .sync-now": "syncNow", "click .delete-now": "deleteNow", "deleteMessage": "showDeleteMessage", }, showMessage: function(message) { $("#message").animate({height: 90}, 5000); $("#message span").text(message); $("#message").animate({height: 0}, 1000); }, showDeleteMessage: function(e, message) { this.showMessage(message); }, syncNow: function(e) { var id = $(e.currentTarget).attr("data-id"); prepareAjaxCall(); this.syncmodel = new SyncStatusModel({ "idAttribute": id }); this.model = new DashboardModel({ "idAttribute": id }); this.model.save({}, { success: function(model, response) { $(e.currentTarget).text("Importing ...").show(); $("#progress").animate({height: 90}, 1000); }, }); var syncmodel = this.syncmodel; var self = this; syncStatusInterval = setInterval(function(){ syncmodel.save({}, { success: function(model, response) { if (response.status != "error") { $("#status").animate({width: response.progress + "%"}, 1000); if (response.status === "running") { var insertedRows = response.inserted_rows; var rowsToBeInserted = response.rows_to_be_inserted; $("#progress span").text("Syncing: " + insertedRows + " out of " + rowsToBeInserted); } else if (response.status === "completed") { clearInterval(syncStatusInterval); var parent = $(e.currentTarget).parent(); parent.prev().text("0"); parent.prev().prev().text(response.last_synced); parent.find(".all_synced").show(); $(e.currentTarget).hide(); $("#progress span").text(response.message); $("#progress").animate({height: 0}, 1000); } } else { // error clearInterval(syncStatusInterval); $(e.currentTarget).text("Sync Now"); self.showMessage(response.message); $("#progress").animate({height: 0}, 1000); } }}); }, 5000); }, deleteNow: function(e) { if (confirm("Are you sure?")) { var id = $(e.currentTarget).attr("data-id"); prepareAjaxCall(); this.model = new DeleteModel({ "id": id }); this.model.url = "/sync/delete/" + id; this.model.destroy(); $(e.currentTarget).parent().parent().remove(); this.$el.trigger("deleteMessage", ["Sync successfully removed."]); } } }); window.view = new DashboardView; // Dashboard functions $(".tooltip").tooltip({ position: "top center", offset: [-3, 0]}); })(jQuery);
rebelact/mailsync-app
mailsync/media/js/dashboard.js
JavaScript
mit
3,260
const Homeassistant = require('./../index') // Connect to home-assistant let ha = new Homeassistant({ host: '192.168.1.166' }) ha.connect() .then(() => { // subscribe to state changes ha.on('state:media_player.spotify', data => { console.log(data) }) // access current state console.log(ha.state('sun.sun')) // call a service return ha.call({ domain: 'light', service: 'turn_on' }) }) .catch(console.error) ha.on('connection', info => { console.log('connection changed', info) })
Mawalu/node-homeassistant
examples/simple.js
JavaScript
mit
545
# -*- coding: utf-8 -*- # pylint: disable=not-context-manager,useless-object-inheritance # NOTE: The pylint not-content-manager warning is disabled pending the fix of # a bug in pylint https://github.com/PyCQA/pylint/issues/782 # NOTE: useless-object-inheritance needed for Python 2.x compatability """This module contains the classes underlying SoCo's caching system.""" from __future__ import unicode_literals import threading from time import time from . import config from .compat import dumps class _BaseCache(object): """An abstract base class for the cache.""" # pylint: disable=no-self-use, unused-argument def __init__(self, *args, **kwargs): super().__init__() self._cache = {} #: `bool`: whether the cache is enabled self.enabled = True def put(self, item, *args, **kwargs): """Put an item into the cache.""" raise NotImplementedError def get(self, *args, **kwargs): """Get an item from the cache.""" raise NotImplementedError def delete(self, *args, **kwargs): """Delete an item from the cache.""" raise NotImplementedError def clear(self): """Empty the whole cache.""" raise NotImplementedError class NullCache(_BaseCache): """A cache which does nothing. Useful for debugging. """ def put(self, item, *args, **kwargs): """Put an item into the cache.""" def get(self, *args, **kwargs): """Get an item from the cache.""" return None def delete(self, *args, **kwargs): """Delete an item from the cache.""" def clear(self): """Empty the whole cache.""" class TimedCache(_BaseCache): """A simple thread-safe cache for caching method return values. The cache key is generated by from the given ``*args`` and ``**kwargs``. Items are expired from the cache after a given period of time. Example: >>> from time import sleep >>> cache = TimedCache() >>> cache.put("item", 'some', kw='args', timeout=3) >>> # Fetch the item again, by providing the same args and kwargs. >>> assert cache.get('some', kw='args') == "item" >>> # Providing different args or kwargs will not return the item. >>> assert not cache.get('some', 'otherargs') == "item" >>> # Waiting for less than the provided timeout does not cause the >>> # item to expire. >>> sleep(2) >>> assert cache.get('some', kw='args') == "item" >>> # But waiting for longer does. >>> sleep(2) >>> assert not cache.get('some', kw='args') == "item" Warning: At present, the cache can theoretically grow and grow, since entries are not automatically purged, though in practice this is unlikely since there are not that many different combinations of arguments in the places where it is used in SoCo, so not that many different cache entries will be created. If this becomes a problem, use a thread and timer to purge the cache, or rewrite this to use LRU logic! """ def __init__(self, default_timeout=0): """ Args: default_timeout (int): The default number of seconds after which items will be expired. """ super().__init__() #: `int`: The default caching expiry interval in seconds. self.default_timeout = default_timeout # A thread lock for the cache self._cache_lock = threading.Lock() def get(self, *args, **kwargs): """Get an item from the cache for this combination of args and kwargs. Args: *args: any arguments. **kwargs: any keyword arguments. Returns: object: The object which has been found in the cache, or `None` if no unexpired item is found. This means that there is no point storing an item in the cache if it is `None`. """ if not self.enabled: return None # Look in the cache to see if there is an unexpired item. If there is # we can just return the cached result. cache_key = self.make_key(args, kwargs) # Lock and load with self._cache_lock: if cache_key in self._cache: expirytime, item = self._cache[cache_key] if expirytime >= time(): return item else: # An expired item is present - delete it del self._cache[cache_key] # Nothing found return None def put(self, item, *args, **kwargs): """Put an item into the cache, for this combination of args and kwargs. Args: *args: any arguments. **kwargs: any keyword arguments. If ``timeout`` is specified as one of the keyword arguments, the item will remain available for retrieval for ``timeout`` seconds. If ``timeout`` is `None` or not specified, the ``default_timeout`` for this cache will be used. Specify a ``timeout`` of 0 (or ensure that the ``default_timeout`` for this cache is 0) if this item is not to be cached. """ if not self.enabled: return # Check for a timeout keyword, store and remove it. timeout = kwargs.pop("timeout", None) if timeout is None: timeout = self.default_timeout cache_key = self.make_key(args, kwargs) # Store the item, along with the time at which it will expire with self._cache_lock: self._cache[cache_key] = (time() + timeout, item) def delete(self, *args, **kwargs): """Delete an item from the cache for this combination of args and kwargs.""" cache_key = self.make_key(args, kwargs) with self._cache_lock: try: del self._cache[cache_key] except KeyError: pass def clear(self): """Empty the whole cache.""" with self._cache_lock: self._cache.clear() @staticmethod def make_key(*args, **kwargs): """Generate a unique, hashable, representation of the args and kwargs. Args: *args: any arguments. **kwargs: any keyword arguments. Returns: str: the key. """ # This is not entirely straightforward, since args and kwargs may # contain mutable items and unicode. Possibilities include using # __repr__, frozensets, and code from Py3's LRU cache. But pickle # works, and although it is not as fast as some methods, it is good # enough at the moment cache_key = dumps((args, kwargs)) return cache_key class Cache(NullCache): """A factory class which returns an instance of a cache subclass. A `TimedCache` is returned, unless `config.CACHE_ENABLED` is `False`, in which case a `NullCache` will be returned. """ def __new__(cls, *args, **kwargs): if config.CACHE_ENABLED: new_cls = TimedCache else: new_cls = NullCache instance = super(Cache, cls).__new__(new_cls) instance.__init__(*args, **kwargs) return instance
KennethNielsen/SoCo
soco/cache.py
Python
mit
7,367
import { SkyColorpickerOutput } from './colorpicker-output'; /** * Indicates the color that users apply when they select Apply in the colorpicker. */ export interface SkyColorpickerResult { /** * Describes the color that users select in the colorpicker. */ color: SkyColorpickerOutput; }
blackbaud/skyux
libs/components/colorpicker/src/lib/modules/colorpicker/types/colorpicker-result.ts
TypeScript
mit
301
/** * Created by whobird on 17/4/10. */ var winResizeDuration=null; $(document).ready(function(){ if(!IsPC()){ window.location="./index.html"; return; } //project init //start $("img.lazy").lazyload({ event : "sporty", effect : "fadeIn" }); setPage(); $('#preloader').delay(350).fadeOut(function(){ $("img.lazy").trigger("sporty"); }); var slideCount=$(".section-wrapper").find(".section-slide").length; var curIndex=0; var curIndexProgress=0; var lastProgress=0; var checkPositionWorker=null; function setPosition(){ console.log("timeout=============action================="); console.log(curIndex); mySwiper.slideTo(curIndex); setTimeout(function(){ if(curIndex<0){curIndex=0;} if(curIndex>=(slideCount-1)){ curIndex=slideCount-1; //console.log(">=slide count -1===================") //最后一张动画要反向; //console.log("translate3d("+(-20*(curIndex-2))+"%, 0px, 0px)"); $(".section-wrapper").css({ "transform": "translate3d("+(-50*(curIndex-2))+"%, 0px, 0px)", }); tweenAnim.setBox(curIndex,-1); for(i=0;i<slideCount;i++) { if (i == (curIndex - 1) || i == (curIndex - 2)) { $("#section-" + i).removeClass("active").css("width", "20%"); } else if (i == curIndex) { $("#section-" + curIndex).addClass("active").css("width", "50%"); } else { $("#section-" + i).removeClass("active").css("width", "50%"); } } }else{ //console.log("curIndex:"+curIndex); //console.log("translate3d("+(-20*curIndex)+"%, 0px, 0px)"); $(".section-wrapper").css({ "transform": "translate3d("+(-50*curIndex)+"%, 0px, 0px)", }); tweenAnim.setBox(curIndex,0); for(i=0;i<slideCount;i++){ if(i>curIndex){ $("#section-"+i).removeClass("active").css("width","20%"); }else if(i<curIndex){ $("#section-"+i).removeClass("active").css("width","50%"); }else{ $("#section-"+curIndex).addClass("active").css("width","50%"); } } } },100); clearTimeout(checkPositionWorker); checkPositionWorker=null; }; var mySwiper = new Swiper('.swiper-container', { // slidesPerView: 3.2, freeMode:true, freeModeMomentum:false, /* freeModeMomentumBounce : true, freeModeMomentumBounceRatio:10,*/ slidesPerView: 'auto', observer:true, observerParents:true, mousewheelControl:true, mousewheelSensitivity :1.8, watchSlidesProgress : true, touchRatio:3.8, //shortSwipes:false, //threshold : 100, /*freeModeSticky:true, freeModeMomentumBounce : true, freeModeMomentumBounceRatio:10,*/ grabCursor : true, onProgress: function(swiper, progress){ //根据 progress 计算当前的index var indexRate=100/(slideCount-1); var index=Math.round(progress*100/indexRate)||0; if(index<0){index=0;} if(index>=(slideCount-1)){ index=slideCount-1; //最后一张动画要反向; var indexProgress=swiper.slides[index].progress; $(".section-wrapper").css({ "transform": "translate3d("+((-50*(index-2))-(50*indexProgress) )+"%, 0px, 0px)", }); }else if(index==(slideCount-2)){ var indexProgress=swiper.slides[index].progress; //倒数第二张情况分两种 if(indexProgress>0){ //当前slide移走 时,最后一张进入,动画要反向 $(".section-wrapper").css({ "transform": "translate3d("+((-50*(index))+(50*indexProgress) )+"%, 0px, 0px)", }); }else if(indexProgress<0){ //当前slide 移过来 $(".section-wrapper").css({ "transform": "translate3d("+((-50*(index))-(50*indexProgress) )+"%, 0px, 0px)", }); } }else{ var indexProgress=swiper.slides[index].progress; $(".section-wrapper").css({ "transform": "translate3d("+((-50*(index))-(50*indexProgress) )+"%, 0px, 0px)", }); } curIndex=index; if(index>0 && index<slideCount-1){ if(indexProgress>0){ //当前slide移走 var $targetSection=$("#section-"+(index+1)); $targetSection.css("width",(20+30*indexProgress)+"%"); tweenAnim.update(curIndex+1,indexProgress,1); }else if(indexProgress<0){ //当前slide 移过来 var $curSection=$("#section-"+index); $curSection.css("width",(50+30*indexProgress)+"%"); tweenAnim.update(curIndex,indexProgress,0); } }else if(index==0){ //index==0只处理slide移走情况 if(indexProgress>0){ var $targetSection=$("#section-"+(index+1)); $targetSection.css("width",(20+30*indexProgress)+"%"); tweenAnim.update(curIndex+1,indexProgress,1); } }else if(index==(slideCount-1)){ //最后一张考虑 slide 移过来 if(indexProgress<0){ //当前slide 移过来 var $curSection=$("#section-"+index); var $prevSection=$("#section-"+(index-1)); var $prevSection2=$("#section-"+(index-2)); $curSection.css("width",(50+30*indexProgress)+"%"); $prevSection.css("width",(20-30*indexProgress)+"%"); $prevSection.css("width",(20-30*indexProgress)+"%"); tweenAnim.update(curIndex,indexProgress,0); tweenAnim.update(curIndex-1,indexProgress,-2); tweenAnim.update(curIndex-2,indexProgress,-3); } } clearTimeout(checkPositionWorker); checkPositionWorker=null; if(!checkPositionWorker){ //console.log("timeout============="); checkPositionWorker=setTimeout(setPosition,300); } }, onTransitionEnd: function(swiper){ console.log("transitionEnd======================"); } }); $(".nav-btn").on("click",function(e){ $(".main").toggleClass("nav-active"); }); $(".swiper-slide > div.col-next").on("click",function(e){ e.preventDefault(); var index=$(this).data("index"); console.log("index============"+index); var offset=parseInt($(".swiper-slide").css("width"))*(index-0.3); console.log(offset); mySwiper.setWrapperTranslate(-offset); }); $(window).on("resize",function(e){ cancelAnimationFrame (winResizeDuration); winResizeDuration=null; if(!winResizeDuration){ winResizeDuration=requestAnimationFrame(setPage); } }); }); function setPage(){ setBottom(); setScale(); } function setBottom(){ //计算底部比例,保证底部放大时正好触底 var w=parseFloat($(".section-slide.active").css("width")); var h=parseFloat($("body").css("height")); var imageRate=(1000/1980)//根据设计稿 var bottomPercent=(w-22)*imageRate/h; $(".slide-content-set").css("height",bottomPercent*100+"%"); } function setScale(){ var curW=parseFloat($(".section-slide.active").css("width"))*0.4; var targetW=400; var scaleRate=curW/targetW; if(scaleRate>1){ scaleRate=1; } $(".slide-head").css({ "-webkit-transform":"scale("+scaleRate+")", "transform":"scale("+scaleRate+")" }); $(".slide-header-index").css({ "-webkit-transform":"scale("+scaleRate+")", "transform":"scale("+scaleRate+")" }); $(".slide-head-list").css({ "-webkit-transform":"scale("+scaleRate+")", "transform":"scale("+scaleRate+")" }); var fontScaleSize=14*scaleRate<10?(10/scaleRate):14; $(".slide-head").find("p").css("font-size",(fontScaleSize)+"px"); $(".section-list-title").css("font-size",(fontScaleSize)+"px"); var contentScaleRate=fontScaleSize*scaleRate/12; if(contentScaleRate>1){ contentScaleRate=1; } console.log("contentScaleRate============="+contentScaleRate); var contentWidth=curW/contentScaleRate; $(".content-main").css({ "min-width":contentWidth+"px", "-webkit-transform":"scale("+contentScaleRate+")", "transform":"scale("+contentScaleRate+")", //"font-size": }); $("#section-0 .slide-head").css({ "-webkit-transform":"scale("+contentScaleRate+")", "transform":"scale("+contentScaleRate+")" }) }
ghrhome/yueweb17
src/js/test/test_itemmotion_2.js
JavaScript
mit
9,632
import { Component, OnInit, Input } from '@angular/core'; @Component({ selector: 'app-punch', templateUrl: './punch.component.html', styleUrls: ['./punch.component.css'] }) export class PunchComponent implements OnInit { @Input() value: string; step: number = 0.1; min: number = 0.0; max: number = 23.99; autocorrect: boolean = true; decimals: number = 2; format: string = "n2"; showbuttons: boolean = false; constructor() { } ngOnInit() { } }
htschan/Tp
TpAdmin/src/app/+timepuncher/punch/punch.component.ts
TypeScript
mit
479
import config from './config'; describe('config', function(){ it('should exist', function(){ expect(config).to.be.an('object'); }); it('should contain the required keys', function(){ expect(config.ngxDirective).to.be.an('object'); expect(config.ngxDirective.name).to.be.a('string'); }); });
ngx-components/angular-directive
ngx/_build/config.spec.js
JavaScript
mit
315
from logika import IGRALEC_R, IGRALEC_Y, PRAZNO, NEODLOCENO, NI_KONEC, MAKSIMALNO_STEVILO_POTEZ, nasprotnik from five_logika import Five_logika from powerup_logika import Powerup_logika, POWER_STOLPEC, POWER_ZETON, POWER_2X_NW, POWER_2X_W from pop10_logika import Pop10_logika from pop_logika import Pop_logika import random ####################### ## ALGORITEM MINIMAX ## ####################### class AlphaBeta: # Algoritem alphabeta def __init__(self, globina): self.globina = globina # Kako globoko iščemo? self.prekinitev = False # Želimo algoritem prekiniti? self.igra = None # Objekt, ki predstavlja igro self.jaz = None # Katerega igralca igramo? self.poteza = None # Sem vpišemo potezo, ko jo najdemo def prekini(self): '''Metoda, ki jo pokliče GUI, če je treba nehati razmišljati, ker je uporabnik zapr okno ali izbral novo igro.''' self.prekinitev = True def izracunaj_potezo(self, igra): '''Izračunaj potezo za trenutno stanje dane igre.''' # To metodo pokličemo iz vzporednega vlakna self.igra = igra self.jaz = self.igra.na_potezi self.prekinitev = False # Glavno vlakno bo to nastavilo na True, če bomo morali prekiniti self.poteza = None # Sem napišemo potezo, ko jo najdemo # Poženemo alphabeta (poteza, vrednost) = self.alphabeta(self.globina, -AlphaBeta.NESKONCNO, AlphaBeta.NESKONCNO, True) self.jaz = None self.igra = None if not self.prekinitev: # Nismo bili prekinjeni, torej potezo izvedemo self.poteza = poteza def uredi_poteze(self, poteze): '''Vrne urejen seznam potez, ki ga nato uporabimo v alphabeta.''' urejene_poteze = [] # Urejen seznam potez if isinstance(self.igra, Five_logika): # Imamo 5 v vrsto zeljen_vrstni_red = [1,4,7] # Željen vrstni red, če so na voljo vse poteze zeljen_vrstni_red = random.sample(zeljen_vrstni_red, 3) for i in range(1,3): dodajamo = [4-i,4+i] # Poteze, ki jih želimo dodati dodajamo = random.sample(dodajamo, 2) for j in dodajamo: zeljen_vrstni_red.append(j) elif isinstance(self.igra, Powerup_logika): # Imamo Power Up igro # Dodajmo dvojne poteze brez možnosti zmage # Najprej dodamo te, ker če bi takšne z možnostjo zmage, # bi jih (lahek) algoritem že na začetku porabil zeljen_vrstni_red = [74] for i in range(1,4): zeljen_vrstni_red += random.sample([74+i, 74-i], 2) # Dodajmo dvojne poteze z možno zmago zeljen_vrstni_red.append(84) for i in range(1,4): zeljen_vrstni_red += random.sample([84+i, 84-i], 2) # Dodajmo 'navadne' poteze zeljen_vrstni_red.append(4) for i in range(1,4): zeljen_vrstni_red += random.sample([4+i, 4-i], 2) # Dodajmo poteze, ki poteptajo stolpec pod sabo zeljen_vrstni_red.append(14) for i in range(1,4): zeljen_vrstni_red += random.sample([14+i, 14-i], 2) # Dodajmo poteze, ki odstranijo nasprotnikov žeton zeljen_vrstni_red += random.sample([24+7*i for i in range(6)], 6) for i in range(1,4): dodajamo = [24+i+7*j for j in range(6)] + [24-i+7*j for j in range(6)] zeljen_vrstni_red += random.sample(dodajamo, 12) elif isinstance(self.igra, Pop10_logika): # Imamo Pop 10 igro if self.igra.faza == 1: # Smo v fazi odstranjevanja žetonov zeljen_vrstni_red = random.sample([18, 68, 25, 75], 4) # Središčni dve polji dodajamo = [10, 11, 12, 17, 19, 24, 26, 31, 32, 33] dodajamo += [50+i for i in dodajamo] zeljen_vrstni_red += random.sample(dodajamo, len(dodajamo)) dodajamo = [i for i in range(2, 7)] + [i for i in range(37, 42)] + [9+7*i for i in range(4)] + [13+7*i for i in range(4)] dodajamo += [50+i for i in dodajamo] zeljen_vrstni_red += random.sample(dodajamo, len(dodajamo)) dodajamo = [1+7*i for i in range(6)] + [7+7*i for i in range(6)] dodajamo += [50+i for i in dodajamo] zeljen_vrstni_red += random.sample(dodajamo, len(dodajamo)) else: # Smo v fazi dodajanja žetonov (lahko faza 0 ali 2) zeljen_vrstni_red = [4] for i in range(1,4): zeljen_vrstni_red += random.sample([4+i, 4-i], 2) else: # Imamo 4 v vrsto ali Pop Out zeljen_vrstni_red = [4,-4] # Željen vrstni red, če so na voljo vse poteze for i in range(1,4): dodajamo = [4-i,-4+i,4+i,-4-i] # Poteze, ki jih želimo dodati dodajamo = random.sample(dodajamo, 4) for j in dodajamo: zeljen_vrstni_red.append(j) for i in zeljen_vrstni_red: if i in poteze: # Poteza je na voljo, treba jo je dodati urejene_poteze.append(i) else: # Poteza ni na voljo continue return urejene_poteze # Vrednosti igre ZMAGA = 10**5 NESKONCNO = ZMAGA + 1 # Več kot zmaga def vrednost_pozicije(self): '''Vrne oceno vrednosti polozaja.''' vrednost = 0 if self.igra is None: # Če bi se slučajno zgodilo, da ne bi bila izbrana nobena igra return vrednost elif self.igra.na_potezi is None: # Igre je konec # Sem ne bi smeli nikoli priti zaradi if stavkov v alphabeta return vrednost else: delez = 0.8 # Faktor za katerega mu je izguba manj vredna kot dobiček tocke = [0, 0] # Sem bomo shranili število točk igralcev [R,Y] # Najprej preverimo kateri tip igre imamo if isinstance(self.igra, Five_logika): # Imamo 5 v vrsto, torej imamo zmagovalne štirke (robne) # ter petke, pokličimo jih spodaj stirke_R = self.igra.stirke_R stirke_Y = self.igra.stirke_Y petke = self.igra.petke # Pojdimo skozi vse štirke & petke ter jih primerno ovrednotimo # Štirke / petke, ki vsebujejo žetone obeh igralcev so vredne 0 točk # Prazne petke so vredne 0.1 točke # Štirke so vredne 0.2 + a/5 točke, kjer je a število žetonov v štirki, # če je igralec pravilne barve za to štirko. # Petke so vredne a/5 točke, kjer je a število žetonov v petki. for s in stirke_R: # Štirke na voljo rdečemu ((i1,j1),(i2,j2),(i3,j3),(i4,j4)) = s stirka = [self.igra.polozaj[i1][j1], self.igra.polozaj[i2][j2], self.igra.polozaj[i3][j3], self.igra.polozaj[i4][j4]] if IGRALEC_Y in stirka: continue else: tocke[0] += 0.2 + stirka.count(IGRALEC_R) / 5 for s in stirke_Y: # Štirke na voljo rumenemu ((i1,j1),(i2,j2),(i3,j3),(i4,j4)) = s stirka = [self.igra.polozaj[i1][j1], self.igra.polozaj[i2][j2], self.igra.polozaj[i3][j3], self.igra.polozaj[i4][j4]] if IGRALEC_R in stirka: continue else: tocke[1] += 0.2 + stirka.count(IGRALEC_Y) / 5 for p in petke: ((i1,j1),(i2,j2),(i3,j3),(i4,j4),(i5,j5)) = p petka = [self.igra.polozaj[i1][j1], self.igra.polozaj[i2][j2], self.igra.polozaj[i3][j3], self.igra.polozaj[i4][j4], self.igra.polozaj[i5][j5]] barve = list(set(stirka)) if len(barve) == 2: if PRAZNO in barve: # V petki so žetoni samo 1 barve b = list(set(barve) - set([PRAZNO]))[0] if b == IGRALEC_R: tocke[0] += petka.count(b) / 5 else: tocke[1] += petka.count(b) / 5 else: # V petki so rdeči in rumeni continue elif barve == [PRAZNO]: # Petka je prazna tocke[0] += 0.1 tocke[1] += 0.1 else: # V petki so rumeni in rdeči žetoni continue elif isinstance(self.igra, Pop10_logika): # Naš cilj tukaj je, da bi imeli čim več štirk in še pomembneje, # da bi izločili čim več žetonov vrednost_tocke = AlphaBeta.ZMAGA / 30 # Da ne bomo nikoli imeli > ZMAGA brez da smo zmagali. To je vbistvu vrednost zmagovalne štirke. for s in self.igra.stirke: ((i1,j1),(i2,j2),(i3,j3),(i4,j4)) = s stirka = [self.igra.polozaj[i1][j1], self.igra.polozaj[i2][j2], self.igra.polozaj[i3][j3], self.igra.polozaj[i4][j4]] tocke[0] += stirka.count(IGRALEC_R) / 4 / (10-self.igra.odstranjeni[0]) tocke[1] += stirka.count(IGRALEC_Y) / 4 / (10-self.igra.odstranjeni[1]) vrednost_razlike_ods = (self.igra.odstranjeni[0] - self.igra.odstranjeni[1]) * 3 # Vrednost razlike odstranjenih if self.jaz == IGRALEC_R: vrednost += (tocke[0] - delez*tocke[1] + vrednost_razlike_ods) * vrednost_tocke elif self.jaz == IGRALEC_Y: vrednost += (tocke[1] - delez*tocke[0] - vrednost_razlike_ods) * vrednost_tocke vrednost *= 0.984**(max(self.igra.stevilo_potez - 42, 0)) / 10 return vrednost else: # Imamo normalno, popout ali powerup igro # Pojdimo sedaj skozi vse možne zmagovalne štirke in jih # primerno ovrednotimo # Stirke, ki ze vsebujejo zetone obeh igralec so vredne 0 tock # Prazne stirke so vredne 0.1 tocke # Ostale so vredne a/4 tock, kjer je a stevilo zetonov znotraj stirke for s in self.igra.stirke: ((i1,j1),(i2,j2),(i3,j3),(i4,j4)) = s stirka = [self.igra.polozaj[i1][j1], self.igra.polozaj[i2][j2], self.igra.polozaj[i3][j3], self.igra.polozaj[i4][j4]] barve = list(set(stirka)) # barve bo dolžine 2 ali 3, če bi bilo dolžine 1, # bi bilo igre že konec if len(barve) == 2: if PRAZNO in barve: # V štirki so žetoni samo 1 barve b = list(set(barve) - set([PRAZNO]))[0] if b == IGRALEC_R: tocke[0] += stirka.count(b) / 4 else: tocke[1] += stirka.count(b) / 4 else: continue elif barve == [PRAZNO]: # Štirka je prazna tocke[0] += 0.1 tocke[1] += 0.1 else: # V štirki so rumene in rdeče continue if self.jaz == IGRALEC_R: vrednost += (tocke[0] - delez*tocke[1]) / 69 * 0.1 * AlphaBeta.ZMAGA else: vrednost += (tocke[1] - delez*tocke[0]) / 69 * 0.1 * AlphaBeta.ZMAGA if isinstance(self.igra, Pop_logika): k = 0.984**self.igra.stevilo_potez elif isinstance(self.igra, Powerup_logika): k = 1 - self.igra.stevilo_potez / (2*58) else: k = 1 - self.igra.stevilo_potez / (2*6*7) vrednost *= k return vrednost def alphabeta(self, globina, alpha, beta, maksimiziramo): '''Glavna metoda AlphaBeta. Vrne zmagovalno potezo in njeno vrednost, če jo najde, sicer (None, 0).''' if self.prekinitev: # Sporočili so nam, da moramo prekiniti return (None, 0) (zmagovalec, stirka) = self.igra.stanje_igre() if zmagovalec in (IGRALEC_R, IGRALEC_Y, NEODLOCENO): if isinstance(self.igra, Pop10_logika): k = 0.984**(max(self.igra.stevilo_potez - 42, 0)) elif isinstance(self.igra, Pop_logika): k = 0.984**self.igra.stevilo_potez elif isinstance(self.igra, Powerup_logika): k = 1 - self.igra.stevilo_potez / (2*58) # Kjer je 58 max število potez v tej igri else: k = 1 - self.igra.stevilo_potez / (2*6*7) # Igre je konec, vrnemo njeno vrednost if zmagovalec == self.jaz: return (None, AlphaBeta.ZMAGA * k) elif zmagovalec == nasprotnik(self.jaz): return (None, -AlphaBeta.ZMAGA * k) else: return (None, 0) elif zmagovalec == NI_KONEC: # Igre ni konec if globina == 0: return (None, self.vrednost_pozicije()) else: # Naredimo en korak alphabeta metode if maksimiziramo: # Maksimiziramo najboljsa_poteza = None for p in self.uredi_poteze(self.igra.veljavne_poteze()): self.igra.povleci_potezo(p, True) if (p > 70 and isinstance(self.igra, Powerup_logika)) or (isinstance(self.igra, Pop10_logika) and self.igra.faza == 2): # Imamo dvojno potezo for p2 in self.uredi_poteze(self.igra.veljavne_poteze()): self.igra.povleci_potezo(p2, True) vrednost = self.alphabeta(max(globina-2, 0), alpha, beta, not maksimiziramo)[1] self.igra.razveljavi() if vrednost > alpha: najboljsa_poteza = [p, p2] alpha = vrednost if najboljsa_poteza is None: najboljsa_poteza = [p, p2] if beta <= alpha: break self.igra.razveljavi() if beta <= alpha: break else: vrednost = self.alphabeta(globina-1, alpha, beta, not maksimiziramo)[1] self.igra.razveljavi() if vrednost > alpha: najboljsa_poteza = p alpha = vrednost if najboljsa_poteza is None: najboljsa_poteza = p if beta <= alpha: break else: # Minimiziramo najboljsa_poteza = None for p in self.uredi_poteze(self.igra.veljavne_poteze()): self.igra.povleci_potezo(p, True) if (p > 70 and isinstance(self.igra, Powerup_logika)) or (isinstance(self.igra, Pop10_logika) and self.igra.faza == 2): # Imamo dvojno potezo for p2 in self.uredi_poteze(self.igra.veljavne_poteze()): self.igra.povleci_potezo(p2, True) vrednost = self.alphabeta(max(globina-2, 0), alpha, beta, not maksimiziramo)[1] self.igra.razveljavi() if vrednost < beta: najboljsa_poteza = [p, p2] beta = vrednost if najboljsa_poteza is None: najboljsa_poteza = [p, p2] if beta <= alpha: break self.igra.razveljavi() if beta <= alpha: break else: vrednost = self.alphabeta(globina-1, alpha, beta, not maksimiziramo)[1] self.igra.razveljavi() if vrednost < beta: najboljsa_poteza = p beta = vrednost if najboljsa_poteza is None: najboljsa_poteza = p if beta <= alpha: break assert (najboljsa_poteza is not None), 'alphabeta: izračunana poteza je None, veljavne_poteze={0}, globina={1}'.format(self.igra.veljavne_poteze(), globina) return (najboljsa_poteza, alpha if maksimiziramo else beta) else: assert False, 'alphabeta: nedefinirano stanje igre'
SamoFMF/stiri_v_vrsto
alphabeta.py
Python
mit
17,907
"use strict"; var Q = require("q"); var winston = require("winston"); var check = require('validator').check; var Rule = function() {}; Rule.prototype.initializeFromJson = function(json) { var self = this; return Q.fcall(function() { if(!json) throw new Error("JSON was not provided."); if(!json.url) throw new Error("URL was not provided."); check(json.url).isUrl(); if(!json.headers && !json.body) throw new Error("Either headers or a body must be present."); self.rules = json; winston.info("Set Rule: " + self.toString()); return self; }); }; Rule.prototype.getUrl = function() { return this.rules.url; }; Rule.prototype.getHeaders = function() { return this.rules.headers; }; Rule.prototype.getBody = function() { return this.rules.body; }; Rule.prototype.getUrlReplacement = function() { return this.rules.replaceUrls; }; Rule.prototype.toString = function() { return JSON.stringify(this.rules); }; module.exports = Rule;
reverse-entropy/frontline
lib/Rules/Rule.js
JavaScript
mit
1,028
using System.Collections.Generic; using System.Linq; using System.Web.Hosting; using RestSharp; using Swagolicious.Models; namespace Swagolicious.Service { public class Meetup { public List<Result> LoadFromMeetup() { return new InMemoryCache().Get("Meetup.Attendees", () => { var api = new MeetupApiCall(Settings.MeetupApiKey); //Get upcoming events var request = new RestRequest { Resource = Settings.MeetupEventsUrl }; request.AddUrlSegment("groupname", Settings.MeetupGroupName); var events = api.Execute<EventDto>(request); var nextEvent = events.Results.First(); //Get RSVP list from first event request = new RestRequest { Resource = Settings.MeetupRsvpUrl }; request.AddUrlSegment("eventid", nextEvent.Id); var rsvpList = api.Execute<RsvpDto>(request); //Do we have any guests? var guestCount = nextEvent.YesRsvpCount - rsvpList.Results.Count; //exclude coordinators var results = rsvpList.Results .Where(w => !Settings.AttendeesExcludeList.Contains(w.Member.Name)) .ToList(); BuildMemberModel(results, guestCount); BuildSwagModel(); return results; }); } private void BuildSwagModel() { var result = new FileService().LoadSwagFromDisc(); if (result.Count == 0) { //Default swag ApplicationData.Swag.Add(new Swag { Thing = "TShirt", Claimed = false }); ApplicationData.Swag.Add(new Swag { Thing = "TShirt", Claimed = false }); ApplicationData.Swag.Add(new Swag { Thing = "TShirt", Claimed = false }); } else { foreach (var dto in result) { for (var i = 0; i < dto.Quantity; i++) { ApplicationData.Swag.Add(new Swag { Claimed = false, Thing = dto.Name }); } } } ApplicationData.Swag.Shuffle(); } private void BuildMemberModel(IEnumerable<Result> results, int guestCount) { ApplicationData.Initialise(); //lets fill the attendee and swag lists foreach (var result in results) { ApplicationData.Attendees.Add( new Attendee { Name = result.Member.Name.FirstNameAndSurnameInitial(), Photo = result.MemberPhoto != null ? result.MemberPhoto.PhotoLink : "http://img2.meetupstatic.com/img/2982428616572973604/noPhoto_80.gif", WonSwag = false, SwagThing = "?", MemberId = result.Member.MemberId }); } for (var i = 1; i <= guestCount; i++) { ApplicationData.Attendees.Add( new Attendee { Name = "Guest " + i, Photo = "http://img2.meetupstatic.com/img/2982428616572973604/noPhoto_80.gif", WonSwag = false, SwagThing = "?", MemberId = -i }); } ApplicationData.Attendees.Shuffle(); } public void Reload() { new InMemoryCache().Remove("Meetup.Attendees"); LoadFromMeetup(); } } }
rippo/swagolicious
Swagolicious/Service/Meetup.cs
C#
mit
3,792
<?php namespace Hvanoch\Component\DateIntervalParser; class DateIntervalParser { /** @var array */ protected $aliases = array( 'y' => 'y,yr,yrs,year,years', 'm' => 'm,mo,mon,mos,mons,month,months', 'w' => 'w,we,wk,week,weeks', 'd' => 'd,dy,dys,day,days', 'h' => 'h,hr,hrs,hour,hours', 'i' => 'i,min,mins,minute,minutes', 's' => 's,sec,secs,second,seconds' ); /** @var array */ protected $tokens = array(); /** @var \DateInterval */ private $dateTimeInterval; /** * @param array $additionalAliases */ public function __construct($additionalAliases = array()) { $this->mergeAdditionalAliases($additionalAliases); $tokens = array(); foreach ($this->aliases as $key => $aliasConcat) { $aliasList = explode(',', $aliasConcat); foreach ($aliasList as $alias) { $tokens[$alias] = $key; } } $this->tokens = $tokens; } /** * @param $additionalAliases * @throws DateIntervalParseException */ private function mergeAdditionalAliases($additionalAliases) { $aliasKeys = array_keys($this->aliases); foreach ($additionalAliases as $key => $alias) { if (!in_array($key, $aliasKeys)) { throw new DateIntervalParseException(sprintf('Key "%" for aliases "%" is not valid', $key, $alias)); } $this->aliases[$key] .= ',' . str_replace(' ', '', $alias); } } /** * @param $input * @return \DateInterval */ public function parse($input) { $this->dateTimeInterval = new \DateInterval('P0D'); $this->process($input); return $this->dateTimeInterval; } /** * @param string $input */ private function cleanupString(&$input) { $input = trim($input); } /** * @param string $input * @throws DateIntervalParseException */ private function process($input) { $this->cleanupString($input); $this->checkInvert($input); $matches = preg_split("/[\s]+/", $input); foreach ($matches as $match) { $this->processTerm($match); } } /** * @param $input */ private function checkInvert(&$input) { if (substr($input, 0, 1) == '-') { $this->dateTimeInterval->invert = 1; $input = substr($input, 1); } } /** * @param $input * @throws \Exception */ private function processTerm($input) { if (!preg_match('/(\d+)\s*([a-z]+)/i', $input, $matches)) { throw new DateIntervalParseException(sprintf('Unable to parse "%s"', $input)); } $tokenAliased = $matches[2]; if (!array_key_exists($tokenAliased, $this->tokens)) { throw new DateIntervalParseException(sprintf('No token found for "%s"', $tokenAliased)); } $token = $this->tokens[$tokenAliased]; $number = (int)$matches[1]; /** Convert weeks to days */ if ($token == 'w') { $token = 'd'; $number = $number * 7; } $this->dateTimeInterval->{$token} += $number; } }
hvanoch/daterangeparser
DateIntervalParser.php
PHP
mit
3,293
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Tevent_1 = require("../../../events/Tevent"); class TagentEvent extends Tevent_1.Tevent { constructor(type, eventData = null, cancelable = true) { super(type, eventData, cancelable); } } TagentEvent.FAILURE = "FAILURE"; exports.TagentEvent = TagentEvent; //# sourceMappingURL=TagentEvent.js.map
ctoesca/turbine
dist/lib/services/checker/agents/TagentEvent.js
JavaScript
mit
403
package com.accela.ObjectStreams; import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream; import com.accela.ObjectStreams.support.ObjectOutputStreamSupport; /** * * Ò»¡¢HP¶ÔÏóÊä³öÁ÷(ÎÒÆðµÄÃû×Ö)¡£Õâ¸ö¶ÔÏóÊä³öÁ÷ÓÉ·´Éäд³É¡£ * ¿ÉÒÔ¶ÁÈ¡»òÊä³ö£º * 1¡¢¶ÁȡӵÓпÉÒÔͨ¹ý·´ÉäÀûÓù¹Ô캯ÊýÀ´´´½¨µÄ¶ÔÏó¡£¹¹Ô캯Êý¿ÉÒÔ * ÊÇ˽Óеģ¬×îºÃÊÇÎ޲ι¹Ô캯Êý£¬µ«ÊÇÓвÎÊýµÄ¹¹Ô캯ÊýÒ²¿ÉÒÔ£¬ * Ö»ÊÇËٶȸüÂý¡£ * 2¡¢Êý×éÀàÐÍ£¬ÎÞÂÛÊý×éÔªËØÊÇ»ù±¾ÀàÐÍ»¹ÊǶÔÏóÀàÐÍ¡£ * null¡£ * 3¡¢Ã¶¾Ù±äÁ¿ * 4¡¢Äܹ»Ê¶±ðÉùÃ÷ΪtransientµÄ¶ÔÏóÀàÐ͵Ä×ֶΣ¬ÔÚÊä³öµÄʱºò»á×Ô¶¯ * дΪnull * 5¡¢Äܹ»Ê¶±ðʵÏÖÁËCollection»òMap½Ó¿ÚµÄ¶ÔÏó£¬ÓÃÓÅ»¯µÄ·½Ê½Êä³ö¡£ * µ«ÊǶÔÓÚËüÃÇ»áºöÂÔÈ¥ÖеÄtransient×ֶΣ¬µ±×÷ûÓÐÉùÃ÷transient * µÄ×Ö¶ÎÊä³ö * 6¡¢Äܹ»Êä³öºÍ¶ÁÈ¡´æÔÚÑ­»·ÒýÓõĶÔÏó * * ¶þ¡¢Óëjava.io.ObjectInputStreamºÍjava.io.ObjectOutputStreamµÄÇø±ð£º * 1¡¢Èç¹ûÔÚÎļþÖÐдÈëÒ»¸ö¶ÔÏó£¬ÓÃjava.io.ObjectInputStream¶ÁÈ¡ÎÞÂÛ * ¶àÉٴΣ¬¶¼Ö»»áÉú³ÉÒ»¸öʵÀý¡£ÕâÔÚÍøÂçÖз¢ËͶÔÏóµÄʱºò»áµ¼Ö·¢ËͶÔÏó * ·½·¢ËÍÒ»¸ö¶ÔÏóºó£¬¸ü¸Ä¸Ã¶ÔÏó£¬ÔÙ·¢ËÍ£¬¶ø½ÓÊÕ¶ÔÏó·½Ö»ÄܽÓÊÕÒ»´Î£¬ºó * ÐøµÄ½ÓÊÕ·µ»ØµÄ¶¼ÊǵÚÒ»´Î½ÓÊյĶÔÏó¡£ * 2¡¢ÓëObjectPoolÅäºÏ£¬ÓÅ»¯ÁËн¨¶ÔÏóʱµÄÄÚ´æ·ÖÅä¡£µ±·¢ËÍͬÀàÐÍµÄ¶Ô * ÏóµÄʱºò£¬Èç¹ûÿ10ms¿Ë¡һ¸±±¾²¢·¢ËÍÒ»´Î(Èç¹û²»¿Ë¡£¬java.io.ObjectInputStream£¬ * ¾ÍÖ»ÄܽÓÊÕµÚÒ»´Î·¢Ë͵ĶÔÏó)£¬Ê¹ÓÃjava.io.ObjectInputStream½ÓÊÕ¶ÔÏó * µÄʱºò»áн¨´óÁ¿¶ÔÏóʵÀý£¬¼´Ê¹ÊÍ·ÅÒ²ÄÑÒÔ±»Á¢¼´»ØÊÕ¡£¶øÊ¹ÓÃHPObjectInputStream * Ôò¿ÉÒÔÓë¶ÔÏó³ØÅäºÏ£¬ÀûÓÃÊͷŵôµÄ¶ÔÏ󣬱ÜÃâÖØ¸´Ð½¨ÊµÀý¡£ * * Èý¡¢ÐèҪעÒâµÄµØ·½£º * 1¡¢HPObjectOutputStreamºÍHPObjectInputStreamÓëjava.io.ObjectInputStream * ºÍjava.io.ObjectOutputStream²¢²»ÄܼæÈÝ¡£ÓÃÒ»ÖÖÊä³öÁ÷дµÄ¶ÔÏó£¬ÁíÒ»ÖÖÊäÈëÁ÷ * ²»ÄܶÁÈ¡¡£ * 2¡¢HPObjectOutputStreamºÍHPObjectInputStreamʹÓ÷´Éäд³É£¬·´ÉäÊÇÆäÐÔÄܵį¿ * ¾±£¬¾¡¹Ü¶ÔÏó³Ø¿ÉÒÔ´ó´óµØÓÅ»¯ÆäЧÂÊ¡£HPObjectInputStreamʹÓ÷´Éä¹¹Ô캯ÊýÀ´Ð * ½¨¶ÔϵÄǸö£¬Èç¹ûûÓÐÎ޲ι¹Ô캯Êý£¬HPObjectInputStream¾Í»áÓÃÊÔ̽²ÎÊý²âÊÔÆäËûµÄ * Óвι¹Ô캯Êý£¬À´ÊÔͼн¨¶ÔÏóʵÀý¡£Õâ»ØÔì³ÉÐÔÄÜÀË·Ñ£¬½¨ÒéÔÚ²»±ãʹÓÃÓвι¹Ô캯Êý * µÄÇé¿öÏ£¬¸øÐèÒªÊä³öµÄÀàдһ¸ö˽ÓеÄÎ޲ι¹Ô캯Êý¡£ * 3¡¢HPObjectOutputStreamºÍHPObjectInputStreamʹÓ÷´ÉäÀ´·ÃÎʶÔÏóµÄ¹¹Ô캯ÊýºÍ×Ö * ¶Î£¬µ«ÊÇÈç¹û¶ÔÏóÊÇÓÃÁËSecurityManagerÀ´½ûÖ¹£¬ÄÄÅÂʹÓÃsetAccessible(true)·½·¨£¬ * Ò²ÎÞ·¨·ÃÎʵϰ£¬HPObjectOutputStreamºÍHPObjectInputStream¾Í»áÅ׳öÒì³£¡£ * * ËÄ¡¢Î´½â¾öµÄBUG * 1¡¢ÔÚʹÓÃÖз¢ÏÖ£¬µ±Ê¹ÓÃHPObjectOutputStreamºÍHPObjectInputStreamʱ£¬¼«ÉÙÇé¿öÏ£¬ * »áËæ»úµÄ·¢ÉúConcurrentModificationException¡£Ô­Òò²»Ã÷£¬¿ÉÄܺͶÔд¼¯ºÏÀàÓйء£ * * */ public class HPObjectOutputStream extends DataOutputStream { private ObjectOutputStreamSupport support = new ObjectOutputStreamSupport(); public HPObjectOutputStream(OutputStream out) { super(out); } public void writeObject(Object object) throws IOException { support.writeObject(object, this); } }
accelazh/EngineV2
EngineV2_Branch/src/com/accela/ObjectStreams/HPObjectOutputStream.java
Java
mit
2,842
// Copyright 2019 The Gitea Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package gzip import ( "bufio" "errors" "fmt" "io" "net" "net/http" "regexp" "strconv" "strings" "sync" "gitea.com/macaron/macaron" "github.com/klauspost/compress/gzip" ) const ( acceptEncodingHeader = "Accept-Encoding" contentEncodingHeader = "Content-Encoding" contentLengthHeader = "Content-Length" contentTypeHeader = "Content-Type" rangeHeader = "Range" varyHeader = "Vary" ) const ( // MinSize is the minimum size of content we will compress MinSize = 1400 ) // noopClosers are io.Writers with a shim to prevent early closure type noopCloser struct { io.Writer } func (noopCloser) Close() error { return nil } // WriterPool is a gzip writer pool to reduce workload on creation of // gzip writers type WriterPool struct { pool sync.Pool compressionLevel int } // NewWriterPool creates a new pool func NewWriterPool(compressionLevel int) *WriterPool { return &WriterPool{pool: sync.Pool{ // New will return nil, we'll manage the creation of new // writers in the middleware New: func() interface{} { return nil }, }, compressionLevel: compressionLevel} } // Get a writer from the pool - or create one if not available func (wp *WriterPool) Get(rw macaron.ResponseWriter) *gzip.Writer { ret := wp.pool.Get() if ret == nil { ret, _ = gzip.NewWriterLevel(rw, wp.compressionLevel) } else { ret.(*gzip.Writer).Reset(rw) } return ret.(*gzip.Writer) } // Put returns a writer to the pool func (wp *WriterPool) Put(w *gzip.Writer) { wp.pool.Put(w) } var writerPool WriterPool // Options represents the configuration for the gzip middleware type Options struct { CompressionLevel int } func validateCompressionLevel(level int) bool { return level == gzip.DefaultCompression || level == gzip.ConstantCompression || (level >= gzip.BestSpeed && level <= gzip.BestCompression) } func validate(options []Options) Options { // Default to level 4 compression (Best results seem to be between 4 and 6) opt := Options{CompressionLevel: 4} if len(options) > 0 { opt = options[0] } if !validateCompressionLevel(opt.CompressionLevel) { opt.CompressionLevel = 4 } return opt } // Middleware creates a macaron.Handler to proxy the response func Middleware(options ...Options) macaron.Handler { opt := validate(options) writerPool = *NewWriterPool(opt.CompressionLevel) regex := regexp.MustCompile(`bytes=(\d+)\-.*`) return func(ctx *macaron.Context) { // If the client won't accept gzip or x-gzip don't compress if !strings.Contains(ctx.Req.Header.Get(acceptEncodingHeader), "gzip") && !strings.Contains(ctx.Req.Header.Get(acceptEncodingHeader), "x-gzip") { return } // If the client is asking for a specific range of bytes - don't compress if rangeHdr := ctx.Req.Header.Get(rangeHeader); rangeHdr != "" { match := regex.FindStringSubmatch(rangeHdr) if len(match) > 1 { return } } // OK we should proxy the response writer // We are still not necessarily going to compress... proxyWriter := &ProxyResponseWriter{ internal: ctx.Resp, } defer proxyWriter.Close() ctx.Resp = proxyWriter ctx.MapTo(proxyWriter, (*http.ResponseWriter)(nil)) // Check if render middleware has been registered, // if yes, we need to modify ResponseWriter for it as well. if _, ok := ctx.Render.(*macaron.DummyRender); !ok { ctx.Render.SetResponseWriter(proxyWriter) } ctx.Next() ctx.Resp = proxyWriter.internal } } // ProxyResponseWriter is a wrapped macaron ResponseWriter that may compress its contents type ProxyResponseWriter struct { writer io.WriteCloser internal macaron.ResponseWriter stopped bool code int buf []byte } // Header returns the header map func (proxy *ProxyResponseWriter) Header() http.Header { return proxy.internal.Header() } // Status returns the status code of the response or 0 if the response has not been written. func (proxy *ProxyResponseWriter) Status() int { if proxy.code != 0 { return proxy.code } return proxy.internal.Status() } // Written returns whether or not the ResponseWriter has been written. func (proxy *ProxyResponseWriter) Written() bool { if proxy.code != 0 { return true } return proxy.internal.Written() } // Size returns the size of the response body. func (proxy *ProxyResponseWriter) Size() int { return proxy.internal.Size() } // Before allows for a function to be called before the ResponseWriter has been written to. This is // useful for setting headers or any other operations that must happen before a response has been written. func (proxy *ProxyResponseWriter) Before(before macaron.BeforeFunc) { proxy.internal.Before(before) } // Write appends data to the proxied gzip writer. func (proxy *ProxyResponseWriter) Write(b []byte) (int, error) { // if writer is initialized, use the writer if proxy.writer != nil { return proxy.writer.Write(b) } proxy.buf = append(proxy.buf, b...) var ( contentLength, _ = strconv.Atoi(proxy.Header().Get(contentLengthHeader)) contentType = proxy.Header().Get(contentTypeHeader) contentEncoding = proxy.Header().Get(contentEncodingHeader) ) // OK if an encoding hasn't been chosen, and content length > 1400 // and content type isn't a compressed type if contentEncoding == "" && (contentLength == 0 || contentLength >= MinSize) && (contentType == "" || !compressedContentType(contentType)) { // If current buffer is less than the min size and a Content-Length isn't set, then wait if len(proxy.buf) < MinSize && contentLength == 0 { return len(b), nil } // If the Content-Length is larger than minSize or the current buffer is larger than minSize, then continue. if contentLength >= MinSize || len(proxy.buf) >= MinSize { // if we don't know the content type, infer it if contentType == "" { contentType = http.DetectContentType(proxy.buf) proxy.Header().Set(contentTypeHeader, contentType) } // If the Content-Type is not compressed - Compress! if !compressedContentType(contentType) { if err := proxy.startGzip(); err != nil { return 0, err } return len(b), nil } } } // If we got here, we should not GZIP this response. if err := proxy.startPlain(); err != nil { return 0, err } return len(b), nil } func (proxy *ProxyResponseWriter) startGzip() error { // Set the content-encoding and vary headers. proxy.Header().Set(contentEncodingHeader, "gzip") proxy.Header().Set(varyHeader, acceptEncodingHeader) // if the Content-Length is already set, then calls to Write on gzip // will fail to set the Content-Length header since its already set // See: https://github.com/golang/go/issues/14975. proxy.Header().Del(contentLengthHeader) // Write the header to gzip response. if proxy.code != 0 { proxy.internal.WriteHeader(proxy.code) // Ensure that no other WriteHeader's happen proxy.code = 0 } // Initialize and flush the buffer into the gzip response if there are any bytes. // If there aren't any, we shouldn't initialize it yet because on Close it will // write the gzip header even if nothing was ever written. if len(proxy.buf) > 0 { // Initialize the GZIP response. proxy.writer = writerPool.Get(proxy.internal) return proxy.writeBuf() } return nil } func (proxy *ProxyResponseWriter) startPlain() error { if proxy.code != 0 { proxy.internal.WriteHeader(proxy.code) proxy.code = 0 } proxy.stopped = true proxy.writer = noopCloser{proxy.internal} return proxy.writeBuf() } func (proxy *ProxyResponseWriter) writeBuf() error { if proxy.buf == nil { return nil } n, err := proxy.writer.Write(proxy.buf) // This should never happen (per io.Writer docs), but if the write didn't // accept the entire buffer but returned no specific error, we have no clue // what's going on, so abort just to be safe. if err == nil && n < len(proxy.buf) { err = io.ErrShortWrite } proxy.buf = nil return err } // WriteHeader will ensure that we have setup the writer before we write the header func (proxy *ProxyResponseWriter) WriteHeader(code int) { if proxy.code == 0 { proxy.code = code } } // Close the writer func (proxy *ProxyResponseWriter) Close() error { if proxy.stopped { return nil } if proxy.writer == nil { err := proxy.startPlain() if err != nil { return fmt.Errorf("GzipMiddleware: write to regular responseWriter at close gets error: %q", err.Error()) } } err := proxy.writer.Close() if poolWriter, ok := proxy.writer.(*gzip.Writer); ok { writerPool.Put(poolWriter) } proxy.writer = nil proxy.stopped = true return err } // Flush the writer func (proxy *ProxyResponseWriter) Flush() { if proxy.writer == nil { return } if gw, ok := proxy.writer.(*gzip.Writer); ok { gw.Flush() } proxy.internal.Flush() } // Push implements http.Pusher for HTTP/2 Push purposes func (proxy *ProxyResponseWriter) Push(target string, opts *http.PushOptions) error { pusher, ok := proxy.internal.(http.Pusher) if !ok { return errors.New("the ResponseWriter doesn't support the Pusher interface") } return pusher.Push(target, opts) } // Hijack implements http.Hijacker. If the underlying ResponseWriter is a // Hijacker, its Hijack method is returned. Otherwise an error is returned. func (proxy *ProxyResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { hijacker, ok := proxy.internal.(http.Hijacker) if !ok { return nil, nil, fmt.Errorf("the ResponseWriter doesn't support the Hijacker interface") } return hijacker.Hijack() } // verify Hijacker interface implementation var _ http.Hijacker = &ProxyResponseWriter{} func compressedContentType(contentType string) bool { switch contentType { case "application/zip": return true case "application/x-gzip": return true case "application/gzip": return true default: return false } }
sapk-fork/gitea
vendor/gitea.com/macaron/gzip/gzip.go
GO
mit
9,988
var http = require("http"); var server = http.createServer(function(request, response) { response.writeHead(200, { "Grip-Hold": "response", "Grip-Channel": "mychannel", "Grip-Timeout": "60"}); response.write('<b>Hello {{name}}</b>!'); response.end(); }); server.listen(8080); console.log("Server is listening");
fruch/compose-pushpin
server.js
JavaScript
mit
377
// // This source file is part of appleseed. // Visit https://appleseedhq.net/ for additional information and resources. // // This software is released under the MIT license. // // Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited // Copyright (c) 2014-2018 Francois Beaune, The appleseedhq Organization // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // appleseed.foundation headers. #include "foundation/core/concepts/noncopyable.h" #include "foundation/math/aabb.h" #include "foundation/math/bsp.h" #include "foundation/math/intersection/rayaabb.h" #include "foundation/math/ray.h" #include "foundation/math/split.h" #include "foundation/math/vector.h" #include "foundation/utility/test.h" // Standard headers. #include <algorithm> #include <cstddef> #include <limits> #include <memory> #include <utility> #include <vector> using namespace foundation; using namespace std; TEST_SUITE(Foundation_Math_BSP_Node) { typedef bsp::Node<double> NodeType; TEST_CASE(TestLeafNode) { NodeType node; node.make_leaf(); EXPECT_TRUE(node.is_leaf()); node.set_leaf_index(42); EXPECT_TRUE(node.is_leaf()); EXPECT_EQ(42, node.get_leaf_index()); const size_t LeafIndex = (size_t(1) << 31) - 1; node.set_leaf_index(LeafIndex); EXPECT_TRUE(node.is_leaf()); EXPECT_EQ(LeafIndex, node.get_leaf_index()); node.set_leaf_size(33); EXPECT_TRUE(node.is_leaf()); EXPECT_EQ(LeafIndex, node.get_leaf_index()); } TEST_CASE(TestInteriorNode) { NodeType node; node.make_interior(); EXPECT_TRUE(node.is_interior()); node.set_child_node_index(42); EXPECT_TRUE(node.is_interior()); EXPECT_EQ(42, node.get_child_node_index()); const size_t ChildIndex = (size_t(1) << 29) - 1; node.set_child_node_index(ChildIndex); EXPECT_TRUE(node.is_interior()); EXPECT_EQ(ChildIndex, node.get_child_node_index()); node.set_split_dim(1); EXPECT_TRUE(node.is_interior()); EXPECT_EQ(ChildIndex, node.get_child_node_index()); EXPECT_EQ(1, node.get_split_dim()); node.set_split_abs(66.0); EXPECT_TRUE(node.is_interior()); EXPECT_EQ(ChildIndex, node.get_child_node_index()); EXPECT_EQ(1, node.get_split_dim()); EXPECT_EQ(66.0, node.get_split_abs()); } } TEST_SUITE(Foundation_Math_BSP_Intersector) { class Leaf : public NonCopyable { public: void clear() { m_boxes.clear(); } size_t get_size() const { return m_boxes.size(); } void insert(const AABB3d& box) { m_boxes.push_back(box); } const AABB3d& get_box(const size_t i) const { return m_boxes[i]; } AABB3d get_bbox() const { AABB3d bbox; bbox.invalidate(); for (size_t i = 0; i < m_boxes.size(); ++i) bbox.insert(m_boxes[i]); return bbox; } size_t get_memory_size() const { return 0; } private: vector<AABB3d> m_boxes; }; struct LeafFactory : public NonCopyable { Leaf* create_leaf() { return new Leaf(); } }; struct LeafSplitter : public NonCopyable { typedef bsp::LeafInfo<double, 3> LeafInfoType; typedef Split<double> SplitType; bool m_first_leaf; LeafSplitter() : m_first_leaf(true) { } double get_priority( const Leaf& leaf, const LeafInfoType& leaf_info) { const double priority = m_first_leaf ? 1.0 : 0.0; m_first_leaf = false; return priority; } bool split( const Leaf& leaf, const LeafInfoType& leaf_info, SplitType& split) { split.m_dimension = 0; split.m_abscissa = 0.0; return true; } void sort( const Leaf& leaf, const LeafInfoType& leaf_info, const SplitType& split, Leaf& left_leaf, const LeafInfoType& left_leaf_info, Leaf& right_leaf, const LeafInfoType& right_leaf_info) { for (size_t i = 0; i < leaf.get_size(); ++i) { const AABB3d& box = leaf.get_box(i); if (box.max[split.m_dimension] <= split.m_abscissa) { left_leaf.insert(box); } else if (box.min[split.m_dimension] >= split.m_abscissa) { right_leaf.insert(box); } else { left_leaf.insert(box); right_leaf.insert(box); } } } }; class LeafVisitor : public NonCopyable { public: LeafVisitor() : m_visited_leaf_count(0) , m_closest_hit(numeric_limits<double>::max()) { } double visit( const Leaf* leaf, // todo: why not a reference? const Ray3d& ray, const RayInfo3d& ray_info) { ++m_visited_leaf_count; for (size_t i = 0; i < leaf->get_size(); ++i) { const AABB3d& box = leaf->get_box(i); double distance; if (intersect(ray, ray_info, box, distance)) m_closest_hit = min(m_closest_hit, distance); } return m_closest_hit; } size_t get_visited_leaf_count() const { return m_visited_leaf_count; } double get_closest_hit() const { return m_closest_hit; } private: size_t m_visited_leaf_count; double m_closest_hit; }; struct Fixture { typedef bsp::Tree<double, 3, Leaf> Tree; typedef bsp::Intersector<double, Tree, LeafVisitor, Ray3d> Intersector; Tree m_tree; LeafVisitor m_leaf_visitor; // todo: Visitor or LeafVisitor? Intersector m_intersector; bsp::TraversalStatistics m_traversal_stats; Fixture() { unique_ptr<Leaf> root_leaf(new Leaf()); root_leaf->insert(AABB3d(Vector3d(-1.0, -0.5, -0.2), Vector3d(0.0, 0.5, 0.2))); root_leaf->insert(AABB3d(Vector3d(0.0, -0.5, -0.7), Vector3d(1.0, 0.5, 0.7))); bsp::Builder<Tree, LeafFactory, LeafSplitter> builder; LeafFactory leaf_factory; LeafSplitter leaf_splitter; builder.build(m_tree, move(root_leaf), leaf_factory, leaf_splitter); } }; #ifdef FOUNDATION_BSP_ENABLE_TRAVERSAL_STATS #define TRAVERSAL_STATISTICS , m_traversal_stats #else #define TRAVERSAL_STATISTICS #endif #pragma warning (push) #pragma warning (disable : 4723) // potential division by 0 TEST_CASE_F(Intersect_GivenRayEmbeddedInSplitPlane_VisitsBothLeaves, Fixture) { Ray3d ray(Vector3d(0.0, 0.0, 1.0), Vector3d(0.0, 0.0, -1.0)); m_intersector.intersect(m_tree, ray, RayInfo3d(ray), m_leaf_visitor TRAVERSAL_STATISTICS); EXPECT_EQ(2, m_leaf_visitor.get_visited_leaf_count()); EXPECT_FEQ(1.0 - 0.7, m_leaf_visitor.get_closest_hit()); } TEST_CASE_F(Intersect_GivenRayPiercingLeftNode_VisitsLeftNode, Fixture) { Ray3d ray(Vector3d(-0.5, 0.0, 1.0), Vector3d(0.0, 0.0, -1.0)); m_intersector.intersect(m_tree, ray, RayInfo3d(ray), m_leaf_visitor TRAVERSAL_STATISTICS); EXPECT_EQ(1, m_leaf_visitor.get_visited_leaf_count()); EXPECT_FEQ(1.0 - 0.2, m_leaf_visitor.get_closest_hit()); } TEST_CASE_F(Intersect_GivenRayPiercingRightNode_VisitsRightNode, Fixture) { Ray3d ray(Vector3d(0.5, 0.0, 1.0), Vector3d(0.0, 0.0, -1.0)); m_intersector.intersect(m_tree, ray, RayInfo3d(ray), m_leaf_visitor TRAVERSAL_STATISTICS); EXPECT_EQ(1, m_leaf_visitor.get_visited_leaf_count()); EXPECT_FEQ(1.0 - 0.7, m_leaf_visitor.get_closest_hit()); } #pragma warning (pop) #undef TRAVERSAL_STATISTICS }
Biart95/appleseed
src/appleseed/foundation/meta/tests/test_bsp.cpp
C++
mit
9,612
<?php /** * This file is part of the GraphAware Neo4j Client package. * * (c) GraphAware Limited <http://graphaware.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace GraphAware\Neo4j\Client\HttpDriver; use GraphAware\Common\Transaction\TransactionInterface; use GraphAware\Neo4j\Client\Exception\Neo4jException; use GraphAware\Neo4j\Client\HttpDriver\Session; use GraphAware\Common\Cypher\Statement; class Transaction implements TransactionInterface { const OPENED = 'OPEN'; const COMMITED = 'COMMITED'; const ROLLED_BACK = 'ROLLED_BACK'; protected $state; protected $session; protected $closed = false; protected $transactionId; protected $expires; public function __construct(Session $session) { $this->session = $session; $this->session->transaction = $this; } public function isOpen() { return $this->state === self::OPENED; } public function isCommited() { return $this->state === self::COMMITED; } public function isRolledBack() { return $this->state === self::ROLLED_BACK; } public function getStatus() { return $this->state; } public function begin() { $this->assertNotStarted(); $response = $this->session->begin(); $body = json_decode($response->getBody(), true); $parts = explode('/', $body['commit']); $this->transactionId = (int) $parts[count($parts)-2]; $this->state = self::OPENED; $this->session->transaction = $this; } public function run(Statement $statement) { $this->assertStarted(); try { return $this->session->pushToTransaction($this->transactionId, array($statement)); } catch (Neo4jException $e) { if ($e->effect() === Neo4jException::EFFECT_ROLLBACK) { $this->closed = true; $this->state = self::ROLLED_BACK; } throw $e; } } public function runMultiple(array $statements) { try { return $this->session->pushToTransaction($this->transactionId, $statements); } catch (Neo4jException $e) { if ($e->effect() === Neo4jException::EFFECT_ROLLBACK) { $this->closed = true; $this->state = self::ROLLED_BACK; throw $e; } } } public function success() { $this->assertNotClosed(); $this->assertStarted(); $this->session->commitTransaction($this->transactionId); $this->state = self::COMMITED; $this->closed = true; $this->session->transaction = null; } public function rollback() { $this->assertNotClosed(); $this->assertStarted(); $this->session->rollbackTransaction($this->transactionId); $this->closed = true; $this->state = self::ROLLED_BACK; $this->session->transaction = null; } private function assertStarted() { if ($this->state !== self::OPENED) { throw new \RuntimeException('This transaction has not been started'); } } private function assertNotStarted() { if (null !== $this->state) { throw new \RuntimeException(sprintf('Can not begin transaction, Transaction State is "%s"', $this->state)); } } private function assertNotClosed() { if (false !== $this->closed) { throw new \RuntimeException('This Transaction is closed'); } } public function status() { return $this->state; } public function commit() { $this->success(); } public function push($query, array $parameters = array(), $tag = null) { // } public function getSession() { return $this->session; } }
aequasi/neo4j-php-client
src/HttpDriver/Transaction.php
PHP
mit
3,993
require 'php_ruby/io/functions' Object.send :include, PhpRuby::Io::Functions
romeuhcf/php-ruby-gem
lib/php_ruby/io.rb
Ruby
mit
78
class AddUserIdToTables < ActiveRecord::Migration def change add_column :parents, :user_id, :integer add_column :teachers, :user_id, :integer add_column :students, :user_id, :integer add_foreign_key :parents, :users add_foreign_key :teachers, :users add_foreign_key :students, :users end end
stephyc93/att2.0
db/migrate/20150719181403_add_user_id_to_tables.rb
Ruby
mit
314
#include "qrcodedialog.h" #include "ui_qrcodedialog.h" #include "bitcoinunits.h" #include "guiconstants.h" #include "guiutil.h" #include "optionsmodel.h" #include <QPixmap> #include <QUrl> #include <qrencode.h> QRCodeDialog::QRCodeDialog(const QString &addr, const QString &label, bool enableReq, QWidget *parent) : QDialog(parent), ui(new Ui::QRCodeDialog), model(0), address(addr) { ui->setupUi(this); setWindowTitle(QString("%1").arg(address)); ui->chkReqPayment->setVisible(enableReq); ui->lblAmount->setVisible(enableReq); ui->lnReqAmount->setVisible(enableReq); ui->lnLabel->setText(label); ui->btnSaveAs->setEnabled(false); genCode(); } QRCodeDialog::~QRCodeDialog() { delete ui; } void QRCodeDialog::setModel(OptionsModel *model) { this->model = model; if (model) connect(model, SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); // update the display unit, to not use the default ("BTC") updateDisplayUnit(); } void QRCodeDialog::genCode() { QString uri = getURI(); if (uri != "") { ui->lblQRCode->setText(""); QRcode *code = QRcode_encodeString(uri.toUtf8().constData(), 0, QR_ECLEVEL_L, QR_MODE_8, 1); if (!code) { ui->lblQRCode->setText(tr("Error encoding URI into QR Code.")); return; } myImage = QImage(code->width + 8, code->width + 8, QImage::Format_RGB32); myImage.fill(0xffffff); unsigned char *p = code->data; for (int y = 0; y < code->width; y++) { for (int x = 0; x < code->width; x++) { myImage.setPixel(x + 4, y + 4, ((*p & 1) ? 0x0 : 0xffffff)); p++; } } QRcode_free(code); ui->lblQRCode->setPixmap(QPixmap::fromImage(myImage).scaled(300, 300)); ui->outUri->setPlainText(uri); } } QString QRCodeDialog::getURI() { QString ret = QString("altcommunitycoin:%1").arg(address); int paramCount = 0; ui->outUri->clear(); if (ui->chkReqPayment->isChecked()) { if (ui->lnReqAmount->validate()) { // even if we allow a non BTC unit input in lnReqAmount, we generate the URI with BTC as unit (as defined in BIP21) ret += QString("?amount=%1").arg(BitcoinUnits::format(BitcoinUnits::BTC, ui->lnReqAmount->value())); paramCount++; } else { ui->btnSaveAs->setEnabled(false); ui->lblQRCode->setText(tr("The entered amount is invalid, please check.")); return QString(""); } } if (!ui->lnLabel->text().isEmpty()) { QString lbl(QUrl::toPercentEncoding(ui->lnLabel->text())); ret += QString("%1label=%2").arg(paramCount == 0 ? "?" : "&").arg(lbl); paramCount++; } if (!ui->lnMessage->text().isEmpty()) { QString msg(QUrl::toPercentEncoding(ui->lnMessage->text())); ret += QString("%1message=%2").arg(paramCount == 0 ? "?" : "&").arg(msg); paramCount++; } // limit URI length to prevent a DoS against the QR-Code dialog if (ret.length() > MAX_URI_LENGTH) { ui->btnSaveAs->setEnabled(false); ui->lblQRCode->setText(tr("Resulting URI too long, try to reduce the text for label / message.")); return QString(""); } ui->btnSaveAs->setEnabled(true); return ret; } void QRCodeDialog::on_lnReqAmount_textChanged() { genCode(); } void QRCodeDialog::on_lnLabel_textChanged() { genCode(); } void QRCodeDialog::on_lnMessage_textChanged() { genCode(); } void QRCodeDialog::on_btnSaveAs_clicked() { QString fn = GUIUtil::getSaveFileName(this, tr("Save QR Code"), QString(), tr("PNG Images (*.png)")); if (!fn.isEmpty()) myImage.scaled(EXPORT_IMAGE_SIZE, EXPORT_IMAGE_SIZE).save(fn); } void QRCodeDialog::on_chkReqPayment_toggled(bool fChecked) { if (!fChecked) // if chkReqPayment is not active, don't display lnReqAmount as invalid ui->lnReqAmount->setValid(true); genCode(); } void QRCodeDialog::updateDisplayUnit() { if (model) { // Update lnReqAmount with the current unit ui->lnReqAmount->setDisplayUnit(model->getDisplayUnit()); } }
altcommunitycoin/altcommunitycoin-skunk
src/qt/qrcodedialog.cpp
C++
mit
4,319
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // // $NoKeywords: $ //=============================================================================// #include "cbase.h" #include "c_AI_BaseNPC.h" #include "engine/IVDebugOverlay.h" #ifdef HL2_DLL #include "c_basehlplayer.h" #endif #include "death_pose.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" IMPLEMENT_CLIENTCLASS_DT( C_AI_BaseNPC, DT_AI_BaseNPC, CAI_BaseNPC ) RecvPropInt( RECVINFO( m_lifeState ) ), RecvPropBool( RECVINFO( m_bPerformAvoidance ) ), RecvPropBool( RECVINFO( m_bIsMoving ) ), RecvPropBool( RECVINFO( m_bFadeCorpse ) ), RecvPropInt( RECVINFO ( m_iDeathPose) ), RecvPropInt( RECVINFO( m_iDeathFrame) ), RecvPropInt( RECVINFO( m_iSpeedModRadius ) ), RecvPropInt( RECVINFO( m_iSpeedModSpeed ) ), RecvPropInt( RECVINFO( m_bSpeedModActive ) ), RecvPropBool( RECVINFO( m_bImportanRagdoll ) ), END_RECV_TABLE() extern ConVar cl_npc_speedmod_intime; bool NPC_IsImportantNPC( C_BaseAnimating *pAnimating ) { C_AI_BaseNPC *pBaseNPC = dynamic_cast < C_AI_BaseNPC* > ( pAnimating ); if ( pBaseNPC == NULL ) return false; return pBaseNPC->ImportantRagdoll(); } C_AI_BaseNPC::C_AI_BaseNPC() { } //----------------------------------------------------------------------------- // Makes ragdolls ignore npcclip brushes //----------------------------------------------------------------------------- unsigned int C_AI_BaseNPC::PhysicsSolidMaskForEntity( void ) const { // This allows ragdolls to move through npcclip brushes if ( !IsRagdoll() ) { return MASK_NPCSOLID; } return MASK_SOLID; } void C_AI_BaseNPC::ClientThink( void ) { BaseClass::ClientThink(); #ifdef HL2_DLL C_BaseHLPlayer *pPlayer = dynamic_cast<C_BaseHLPlayer*>( C_BasePlayer::GetLocalPlayer() ); if ( ShouldModifyPlayerSpeed() == true ) { if ( pPlayer ) { float flDist = (GetAbsOrigin() - pPlayer->GetAbsOrigin()).LengthSqr(); if ( flDist <= GetSpeedModifyRadius() ) { if ( pPlayer->m_hClosestNPC ) { if ( pPlayer->m_hClosestNPC != this ) { float flDistOther = (pPlayer->m_hClosestNPC->GetAbsOrigin() - pPlayer->GetAbsOrigin()).Length(); //If I'm closer than the other NPC then replace it with myself. if ( flDist < flDistOther ) { pPlayer->m_hClosestNPC = this; pPlayer->m_flSpeedModTime = gpGlobals->curtime + cl_npc_speedmod_intime.GetFloat(); } } } else { pPlayer->m_hClosestNPC = this; pPlayer->m_flSpeedModTime = gpGlobals->curtime + cl_npc_speedmod_intime.GetFloat(); } } } } #endif // HL2_DLL } void C_AI_BaseNPC::OnDataChanged( DataUpdateType_t type ) { BaseClass::OnDataChanged( type ); if ( ShouldModifyPlayerSpeed() == true ) { SetNextClientThink( CLIENT_THINK_ALWAYS ); } } void C_AI_BaseNPC::GetRagdollCurSequence( matrix3x4_t *curBones, float flTime ) { GetRagdollCurSequenceWithDeathPose( this, curBones, flTime, m_iDeathPose, m_iDeathFrame ); }
sswires/ham-and-jam
cl_dll/c_ai_basenpc.cpp
C++
mit
3,052
declare module "fscreen" { namespace fscreen { export const fullscreenEnabled: boolean; export const fullscreenElement: Element | null; export const requestFullscreen: (elem: Element) => void; export const requestFullscreenFunction: (elem: Element) => () => void; export const exitFullscreen: () => void; export let onfullscreenchange: Function; export const addEventListener: ( event: "fullscreenchange" | "fullscreenerror", handler: () => void, options?: any, ) => void; export const removeEventListener: (event: "fullscreenchange" | "fullscreenerror", handler: () => void) => void; export let onfullscreenerror: Function; } export default fscreen; }
trianglecurling/timetocurl
types/fscreen/index.d.ts
TypeScript
mit
703
<?php global $uncode_colors, $uncode_colors_w_transp; $flat_uncode_colors = array(); if (!empty($uncode_colors)) { foreach ($uncode_colors as $key => $value) { $flat_uncode_colors[$value[1]] = $value[0]; } } $units = array( '1/12' => '1', '2/12' => '2', '3/12' => '3', '4/12' => '4', '5/12' => '5', '6/12' => '6', '7/12' => '7', '8/12' => '8', '9/12' => '9', '10/12' => '10', '11/12' => '11', '12/12' => '12', ); $size_arr = array( esc_html__('Standard', 'uncode') => '', esc_html__('Small', 'uncode') => 'btn-sm', esc_html__('Large', 'uncode') => 'btn-lg', esc_html__('Extra-Large', 'uncode') => 'btn-xl', esc_html__('Button link', 'uncode') => 'btn-link', esc_html__('Standard link', 'uncode') => 'link', ); $icon_sizes = array( esc_html__('Standard', 'uncode') => '', esc_html__('2x', 'uncode') => 'fa-2x', esc_html__('3x', 'uncode') => 'fa-3x', esc_html__('4x', 'uncode') => 'fa-4x', esc_html__('5x', 'uncode') => 'fa-5x', ); $heading_semantic = array( esc_html__('h1', 'uncode') => 'h1', esc_html__('h2', 'uncode') => 'h2', esc_html__('h3', 'uncode') => 'h3', esc_html__('h4', 'uncode') => 'h4', esc_html__('h5', 'uncode') => 'h5', esc_html__('h6', 'uncode') => 'h6', esc_html__('p', 'uncode') => 'p', esc_html__('div', 'uncode') => 'div' ); $heading_size = array( esc_html__('Default CSS', 'uncode') => '', esc_html__('h1', 'uncode') => 'h1', esc_html__('h2', 'uncode') => 'h2', esc_html__('h3', 'uncode') => 'h3', esc_html__('h4', 'uncode') => 'h4', esc_html__('h5', 'uncode') => 'h5', esc_html__('h6', 'uncode') => 'h6', ); $font_sizes = (function_exists('ot_get_option')) ? ot_get_option('_uncode_heading_font_sizes') : array(); if (!empty($font_sizes)) { foreach ($font_sizes as $key => $value) { $heading_size[$value['title']] = $value['_uncode_heading_font_size_unique_id']; } } $heading_size[esc_html__('BigText', 'uncode')] = 'bigtext'; $font_heights = (function_exists('ot_get_option')) ? ot_get_option('_uncode_heading_font_heights') : array(); $heading_height = array( esc_html__('Default CSS', 'uncode') => '', ); if (!empty($font_heights)) { foreach ($font_heights as $key => $value) { $heading_height[$value['title']] = $value['_uncode_heading_font_height_unique_id']; } } $font_spacings = (function_exists('ot_get_option')) ? ot_get_option('_uncode_heading_font_spacings') : array(); $heading_space = array( esc_html__('Default CSS', 'uncode') => '', ); if (!empty($font_spacings)) { foreach ($font_spacings as $key => $value) { $heading_space[$value['title']] = $value['_uncode_heading_font_spacing_unique_id']; } } if (isset($fonts) && is_array($fonts)) { foreach ($fonts as $key => $value) { $heading_font[$value['title']] = $value['_uncode_font_group_unique_id']; } } $fonts = (function_exists('ot_get_option')) ? ot_get_option('_uncode_font_groups') : array(); $heading_font = array( esc_html__('Default CSS', 'uncode') => '', ); if (isset($fonts) && is_array($fonts)) { foreach ($fonts as $key => $value) { $heading_font[$value['title']] = $value['_uncode_font_group_unique_id']; } } $heading_weight = array( esc_html__('Default CSS', 'uncode') => '', esc_html__('100', 'uncode') => 100, esc_html__('200', 'uncode') => 200, esc_html__('300', 'uncode') => 300, esc_html__('400', 'uncode') => 400, esc_html__('500', 'uncode') => 500, esc_html__('600', 'uncode') => 600, esc_html__('700', 'uncode') => 700, esc_html__('800', 'uncode') => 800, esc_html__('900', 'uncode') => 900, ); $target_arr = array( esc_html__('Same window', 'uncode') => '_self', esc_html__('New window', 'uncode') => "_blank" ); $border_style = array( esc_html__('None', 'uncode') => '', esc_html__('Solid', 'uncode') => 'solid', esc_html__('Dotted', 'uncode') => 'dotted', esc_html__('Dashed', 'uncode') => 'dashed', esc_html__('Double', 'uncode') => 'double', esc_html__('Groove', 'uncode') => 'groove', esc_html__('Ridge', 'uncode') => 'ridge', esc_html__('Inset', 'uncode') => 'inset', esc_html__('Outset', 'uncode') => 'outset', esc_html__('Initial', 'uncode') => 'initial', esc_html__('Inherit', 'uncode') => 'inherit', ); $add_css_animation = array( 'type' => 'dropdown', 'heading' => esc_html__('Animation', 'uncode') , 'param_name' => 'css_animation', 'admin_label' => true, 'value' => array( esc_html__('No', 'uncode') => '', esc_html__('Opacity', 'uncode') => 'alpha-anim', esc_html__('Zoom in', 'uncode') => 'zoom-in', esc_html__('Zoom out', 'uncode') => 'zoom-out', esc_html__('Top to bottom', 'uncode') => 'top-t-bottom', esc_html__('Bottom to top', 'uncode') => 'bottom-t-top', esc_html__('Left to right', 'uncode') => 'left-t-right', esc_html__('Right to left', 'uncode') => 'right-t-left', ) , 'group' => esc_html__('Animation', 'uncode') , 'description' => esc_html__('Specify the entrance animation.', 'uncode') ); $add_animation_delay = array( 'type' => 'dropdown', 'heading' => esc_html__('Animation delay', 'uncode') , 'param_name' => 'animation_delay', 'value' => array( esc_html__('None', 'uncode') => '', esc_html__('ms 100', 'uncode') => 100, esc_html__('ms 200', 'uncode') => 200, esc_html__('ms 300', 'uncode') => 300, esc_html__('ms 400', 'uncode') => 400, esc_html__('ms 500', 'uncode') => 500, esc_html__('ms 600', 'uncode') => 600, esc_html__('ms 700', 'uncode') => 700, esc_html__('ms 800', 'uncode') => 800, esc_html__('ms 900', 'uncode') => 900, esc_html__('ms 1000', 'uncode') => 1000, esc_html__('ms 1100', 'uncode') => 1100, esc_html__('ms 1200', 'uncode') => 1200, esc_html__('ms 1300', 'uncode') => 1300, esc_html__('ms 1400', 'uncode') => 1400, esc_html__('ms 1500', 'uncode') => 1500, esc_html__('ms 1600', 'uncode') => 1600, esc_html__('ms 1700', 'uncode') => 1700, esc_html__('ms 1800', 'uncode') => 1800, esc_html__('ms 1900', 'uncode') => 1900, esc_html__('ms 2000', 'uncode') => 2000, ) , 'group' => esc_html__('Animation', 'uncode') , 'description' => esc_html__('Specify the entrance animation delay in milliseconds.', 'uncode') , 'admin_label' => true, 'dependency' => array( 'element' => 'css_animation', 'not_empty' => true ) ); $add_animation_speed = array( 'type' => 'dropdown', 'heading' => esc_html__('Animation speed', 'uncode') , 'param_name' => 'animation_speed', 'admin_label' => true, 'value' => array( esc_html__('Default (400)', 'uncode') => '', esc_html__('ms 100', 'uncode') => 100, esc_html__('ms 200', 'uncode') => 200, esc_html__('ms 300', 'uncode') => 300, esc_html__('ms 400', 'uncode') => 400, esc_html__('ms 500', 'uncode') => 500, esc_html__('ms 600', 'uncode') => 600, esc_html__('ms 700', 'uncode') => 700, esc_html__('ms 800', 'uncode') => 800, esc_html__('ms 900', 'uncode') => 900, esc_html__('ms 1000', 'uncode') => 1000, ) , 'group' => esc_html__('Animation', 'uncode') , 'description' => esc_html__('Specify the entrance animation speed in milliseconds.', 'uncode') , 'dependency' => array( 'element' => 'css_animation', 'not_empty' => true ) ); $add_background_repeat = array( 'type' => 'dropdown', 'heading' => '', 'description' => wp_kses(__('Define the background repeat. <a href=\'http://www.w3schools.com/cssref/pr_background-repeat.asp\' target=\'_blank\'>Check this for reference</a>', 'uncode') , array( 'a' => array( 'href' => array(),'target' => array() ) ) ), 'param_name' => 'back_repeat', 'param_holder_class' => 'background-image-settings', 'value' => array( esc_html__('background-repeat', 'uncode') => '', esc_html__('No Repeat', 'uncode') => 'no-repeat', esc_html__('Repeat All', 'uncode') => 'repeat', esc_html__('Repeat Horizontally', 'uncode') => 'repeat-x', esc_html__('Repeat Vertically', 'uncode') => 'repeat-y', esc_html__('Inherit', 'uncode') => 'inherit' ) , 'dependency' => array( 'element' => 'back_image', 'not_empty' => true, ) , "group" => esc_html__("Style", 'uncode') ); $add_background_attachment = array( 'type' => 'dropdown', 'heading' => '', "description" => wp_kses(__("Define the background attachment. <a href='http://www.w3schools.com/cssref/pr_background-attachment.asp' target='_blank'>Check this for reference</a>", 'uncode'), array( 'a' => array( 'href' => array(),'target' => array() ) ) ) , 'param_name' => 'back_attachment', 'value' => array( esc_html__('background-attachement', 'uncode') => '', esc_html__('Fixed', 'uncode') => 'fixed', esc_html__('Scroll', 'uncode') => 'scroll', esc_html__('Inherit', 'uncode') => 'inherit' ) , 'dependency' => array( 'element' => 'back_image', 'not_empty' => true, ) , "group" => esc_html__("Style", 'uncode') ); $add_background_position = array( 'type' => 'dropdown', 'heading' => '', "description" => wp_kses(__("Define the background position. <a href='http://www.w3schools.com/cssref/pr_background-position.asp' target='_blank'>Check this for reference</a>", 'uncode'), array( 'a' => array( 'href' => array(),'target' => array() ) ) ) , 'param_name' => 'back_position', 'value' => array( esc_html__('background-position', 'uncode') => '', esc_html__('Left Top', 'uncode') => 'left top', esc_html__('Left Center', 'uncode') => 'left center', esc_html__('Left Bottom', 'uncode') => 'left bottom', esc_html__('Center Top', 'uncode') => 'center top', esc_html__('Center Center', 'uncode') => 'center center', esc_html__('Center Bottom', 'uncode') => 'center bottom', esc_html__('Right Top', 'uncode') => 'right top', esc_html__('Right Center', 'uncode') => 'right center', esc_html__('Right Bottom', 'uncode') => 'right bottom' ) , 'dependency' => array( 'element' => 'back_image', 'not_empty' => true, ) , "group" => esc_html__("Style", 'uncode') ); $add_background_size = array( 'type' => 'textfield', 'heading' => '', "description" => wp_kses(__("Define the background size (Default value is 'cover'). <a href='http://www.w3schools.com/cssref/css3_pr_background-size.asp' target='_blank'>Check this for reference</a>", 'uncode'), array( 'a' => array( 'href' => array(),'target' => array() ) ) ) , 'param_name' => 'back_size', 'dependency' => array( 'element' => 'back_image', 'not_empty' => true, ) , "group" => esc_html__("Style", 'uncode') ); vc_map(array( 'name' => esc_html__('Row', 'uncode') , 'base' => 'vc_row', 'weight' => 1000, 'php_class_name' => 'uncode_row', 'is_container' => true, 'icon' => 'fa fa-align-justify', 'show_settings_on_create' => false, 'category' => esc_html__('Content', 'uncode') , 'description' => esc_html__('Row container element', 'uncode') , 'params' => array( array( "type" => 'checkbox', "heading" => esc_html__("Container width", 'uncode') , "param_name" => "unlock_row", "description" => esc_html__("Define the width of the container.", 'uncode') , "value" => Array( '' => 'yes' ) , "std" => 'yes', "group" => esc_html__("Aspect", 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Content width", 'uncode') , "param_name" => "unlock_row_content", "description" => esc_html__("Define the width of the content area.", 'uncode') , "value" => Array( '' => 'yes' ) , "group" => esc_html__("Aspect", 'uncode') , 'dependency' => array( 'element' => 'unlock_row', 'value' => 'yes' ) ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Height", 'uncode') , "param_name" => "row_height_percent", "min" => 0, "max" => 100, "step" => 1, "value" => 0, "description" => wp_kses(__("Set the row height with a percent value.<br>N.B. This value is including the top and bottom padding.", 'uncode'), array( 'br' => array( ) ) ) , "group" => esc_html__("Aspect", 'uncode') , ) , array( 'type' => 'textfield', 'heading' => esc_html__("Min height", 'uncode') , 'param_name' => 'row_height_pixel', 'description' => esc_html__("Insert the row minimum height in pixel.", 'uncode') , "group" => esc_html__("Aspect", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Custom padding", 'uncode') , "param_name" => "override_padding", "description" => esc_html__('Activate this to define custom paddings.', 'uncode') , "group" => esc_html__("Aspect", 'uncode') , "value" => array( '' => 'yes' ) ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Left and right padding", 'uncode') , "param_name" => "h_padding", "min" => 0, "max" => 7, "step" => 1, "value" => 2, "description" => esc_html__("Set the left and right padding.", 'uncode') , "group" => esc_html__("Aspect", 'uncode') , "dependency" => Array( 'element' => "override_padding", 'value' => array( 'yes' ) ) , ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Top padding", 'uncode') , "param_name" => "top_padding", "min" => 0, "max" => 7, "step" => 1, "value" => 2, "description" => esc_html__("Set the top padding.", 'uncode') , "group" => esc_html__("Aspect", 'uncode') , "dependency" => Array( 'element' => "override_padding", 'value' => array( 'yes' ) ) , ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Bottom padding", 'uncode') , "param_name" => "bottom_padding", "min" => 0, "max" => 7, "step" => 1, "value" => 2, "description" => esc_html__("Set the bottom padding.", 'uncode') , "group" => esc_html__("Aspect", 'uncode') , "dependency" => Array( 'element' => "override_padding", 'value' => array( 'yes' ) ) , ) , array( "type" => "dropdown", "heading" => esc_html__("Background color", 'uncode') , "param_name" => "back_color", "description" => esc_html__("Specify a background color for the row.", 'uncode') , "group" => esc_html__("Style", 'uncode') , "value" => $uncode_colors, ) , array( "type" => 'checkbox', "heading" => esc_html__("Automatic background", 'uncode') , "param_name" => "back_image_auto", "description" => esc_html__("Activate to pickup the background media from the category.", 'uncode') , "value" => Array( '' => 'yes' ) , "group" => esc_html__("Style", 'uncode') , ), array( "type" => "media_element", "heading" => esc_html__("Background media", 'uncode') , "param_name" => "back_image", "value" => "", "description" => esc_html__("Specify a media from the media library.", 'uncode') , "group" => esc_html__("Style", 'uncode') ) , $add_background_repeat, $add_background_attachment, $add_background_position, $add_background_size, array( "type" => 'checkbox', "heading" => esc_html__("Parallax", 'uncode') , "param_name" => "parallax", "description" => esc_html__("Activate this to have the background parallax effect.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Style", 'uncode') ) , array( "type" => "dropdown", "heading" => esc_html__("Overlay color", 'uncode') , "param_name" => "overlay_color", "description" => esc_html__("Specify an overlay color for the background.", 'uncode') , "group" => esc_html__("Style", 'uncode') , "value" => $uncode_colors, ) , array( "type" => "type_numeric_slider", "heading" => '', "param_name" => "overlay_alpha", "min" => 0, "max" => 100, "step" => 1, "value" => 50, "description" => esc_html__("Set the transparency for the overlay.", 'uncode') , "group" => esc_html__("Style", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Columns with equal height", 'uncode') , "param_name" => "equal_height", "description" => esc_html__("Activate this to have columns that are all equally tall, matching the height of the tallest.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Inner columns", 'uncode') ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Columns gap", 'uncode') , "param_name" => "gutter_size", "min" => 0, "max" => 4, "step" => 1, "value" => 3, "description" => esc_html__("Set the columns gap.", 'uncode') , "group" => esc_html__("Inner columns", 'uncode') , ) , array( 'type' => 'css_editor', 'heading' => esc_html__('Css', 'uncode') , 'param_name' => 'css', 'group' => esc_html__('Custom', 'uncode') ) , array( "type" => "dropdown", "heading" => esc_html__("Border color", 'uncode') , "param_name" => "border_color", "description" => esc_html__("Specify a border color.", 'uncode') , "group" => esc_html__("Custom", 'uncode') , "value" => $uncode_colors_w_transp, ) , array( "type" => "dropdown", "heading" => esc_html__("Border style", 'uncode') , "param_name" => "border_style", "description" => esc_html__("Specify a border style.", 'uncode') , "group" => esc_html__("Custom", 'uncode') , "value" => $border_style, ) , array( "type" => 'checkbox', "heading" => esc_html__("Desktop", 'uncode') , "param_name" => "desktop_visibility", "description" => esc_html__("Choose the visibiliy of the element in desktop layout mode (960px >).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Tablet", 'uncode') , "param_name" => "medium_visibility", "description" => esc_html__("Choose the visibiliy of the element in tablet layout mode (570px > < 960px).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Mobile", 'uncode') , "param_name" => "mobile_visibility", "description" => esc_html__("Choose the visibiliy of the element in mobile layout mode (< 570px).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Shift y-axis", 'uncode') , "param_name" => "shift_y", "min" => - 5, "max" => 5, "step" => 1, "value" => 0, "description" => esc_html__("Set how much the element has to shift in the Y axis.", 'uncode') , 'group' => esc_html__('Off-grid', 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Shift y-axis fixed", 'uncode') , "param_name" => "shift_y_fixed", "description" => esc_html__("Deactive shift-y responsiveness.", 'uncode') , 'group' => esc_html__('Off-grid', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Sticky", 'uncode') , "param_name" => "sticky", "description" => esc_html__("Activate this to stick the element when scrolling.", 'uncode') , 'group' => esc_html__('Extra', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') , "group" => esc_html__("Extra", 'uncode') ) , array( 'type' => 'textfield', 'heading' => esc_html__('Section name', 'uncode') , 'param_name' => 'row_name', 'description' => esc_html__('Required for the onepage scroll, this gives the name to the section.', 'uncode') , "group" => esc_html__("Extra", 'uncode') ) , ) , 'js_view' => 'UncodeRowView' )); vc_map(array( 'name' => esc_html__('Row', 'uncode') , 'base' => 'vc_row_inner', 'php_class_name' => 'uncode_row_inner', 'content_element' => false, 'is_container' => true, 'icon' => 'icon-wpb-row', 'weight' => 1000, 'show_settings_on_create' => false, 'params' => array( array( "type" => "type_numeric_slider", 'heading' => esc_html__("Height", 'uncode') , "param_name" => "row_inner_height_percent", "min" => 0, "max" => 100, "step" => 1, "value" => 0, "description" => wp_kses(__("Set the row height with a percent value.<br>N.B. This value is relative to the row parent.", 'uncode'), array( 'br' => array( ) ) ) , "group" => esc_html__("Aspect", 'uncode') , ) , array( 'type' => 'textfield', 'heading' => esc_html__("Min height", 'uncode') , 'param_name' => 'row_height_pixel', 'description' => esc_html__("Insert the row minimum height in pixel.", 'uncode') , "group" => esc_html__("Aspect", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Force width 100%", 'uncode') , "param_name" => "force_width_grid", "description" => wp_kses(__('Set this value if you need to force the width to 100%.<br>N.B. This is needed only when all the columns are OFF-GRID.','uncode') , array( 'br' => array( ),'b' => array( ) ) ), "group" => esc_html__("Aspect", 'uncode') , "value" => array( '' => 'yes' ) ) , array( "type" => "dropdown", "heading" => esc_html__("Background color", 'uncode') , "param_name" => "back_color", "description" => esc_html__("Specify a background color for the row.", 'uncode') , "group" => esc_html__("Style", 'uncode') , "value" => $uncode_colors, ) , array( "type" => "media_element", "heading" => esc_html__("Background media", 'uncode') , "param_name" => "back_image", "value" => "", "description" => esc_html__("Specify a media from the media library.", 'uncode') , "group" => esc_html__("Style", 'uncode') ) , $add_background_repeat, $add_background_attachment, $add_background_position, $add_background_size, array( "type" => 'checkbox', "heading" => esc_html__("Parallax", 'uncode') , "param_name" => "parallax", "description" => esc_html__("Activate this to have the background parallax effect.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "dependency" => Array( 'element' => "back_image", 'not_empty' => true ) , "group" => esc_html__("Style", 'uncode') ) , array( "type" => "dropdown", "heading" => esc_html__("Overlay color", 'uncode') , "param_name" => "overlay_color", "description" => esc_html__("Specify an overlay color for the background.", 'uncode') , "group" => esc_html__("Style", 'uncode') , "value" => $uncode_colors, ) , array( "type" => "type_numeric_slider", "heading" => '', "param_name" => "overlay_alpha", "min" => 0, "max" => 100, "step" => 1, "value" => 50, "description" => esc_html__("Set the transparency for the overlay.", 'uncode') , "group" => esc_html__("Style", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Columns with equal height", 'uncode') , "param_name" => "equal_height", "description" => esc_html__("Activate this to have columns that are all equally tall, matching the height of the tallest.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Inner columns", 'uncode') ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Columns gap", 'uncode') , "param_name" => "gutter_size", "min" => 0, "max" => 4, "step" => 1, "value" => 3, "description" => esc_html__("Set the columns gap.", 'uncode') , "group" => esc_html__("Inner columns", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Desktop", 'uncode') , "param_name" => "desktop_visibility", "description" => esc_html__("Choose the visibiliy of the element in desktop layout mode (960px >).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Tablet", 'uncode') , "param_name" => "medium_visibility", "description" => esc_html__("Choose the visibiliy of the element in tablet layout mode (570px > < 960px).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Mobile", 'uncode') , "param_name" => "mobile_visibility", "description" => esc_html__("Choose the visibiliy of the element in mobile layout mode (< 570px).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Shift y-axis", 'uncode') , "param_name" => "shift_y", "min" => - 5, "max" => 5, "step" => 1, "value" => 0, "description" => esc_html__("Set how much the element has to shift in the Y axis.", 'uncode') , 'group' => esc_html__('Off-grid', 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Shift y-axis fixed", 'uncode') , "param_name" => "shift_y_fixed", "description" => esc_html__("Deactive shift-y responsiveness.", 'uncode') , 'group' => esc_html__('Off-grid', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( 'type' => 'css_editor', 'heading' => esc_html__('Css', 'uncode') , 'param_name' => 'css', 'group' => esc_html__('Custom', 'uncode') ) , array( "type" => "dropdown", "heading" => esc_html__("Border color", 'uncode') , "param_name" => "border_color", "description" => esc_html__("Specify a border color.", 'uncode') , "group" => esc_html__("Custom", 'uncode') , "value" => $uncode_colors_w_transp, ) , array( "type" => "dropdown", "heading" => esc_html__("Border style", 'uncode') , "param_name" => "border_style", "description" => esc_html__("Specify a border style.", 'uncode') , "group" => esc_html__("Custom", 'uncode') , "value" => $border_style, ) , array( "type" => 'checkbox', "heading" => esc_html__("Sticky", 'uncode') , "param_name" => "sticky", "description" => esc_html__("Activate this to stick the element when scrolling.", 'uncode') , 'group' => esc_html__('Extra', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') , "group" => esc_html__("Extra", 'uncode') ) , ) , 'js_view' => 'UncodeRowView' )); vc_map(array( "name" => esc_html__("Column", 'uncode') , "base" => "vc_column", "is_container" => true, "content_element" => false, "params" => array( array( "type" => 'checkbox', "heading" => esc_html__("Content width", 'uncode') , "param_name" => "column_width_use_pixel", "edit_field_class" => 'vc_col-sm-12 vc_column row_height', "description" => 'Set this value if you want to constrain the column width.', "group" => esc_html__("Aspect", 'uncode') , "value" => array( '' => 'yes' ) ) , array( "type" => "type_numeric_slider", "heading" => '', "param_name" => "column_width_percent", "min" => 0, "max" => 100, "step" => 1, "value" => 100, "description" => esc_html__("Set the column width with a percent value.", 'uncode') , "group" => esc_html__("Aspect", 'uncode') , 'dependency' => array( 'element' => 'column_width_use_pixel', 'is_empty' => true, ) ) , array( 'type' => 'textfield', 'heading' => '', 'param_name' => 'column_width_pixel', 'description' => esc_html__("Insert the column width in pixel.", 'uncode') , "group" => esc_html__("Aspect", 'uncode') , 'dependency' => array( 'element' => 'column_width_use_pixel', 'value' => 'yes' ) ) , array( "type" => 'dropdown', "heading" => esc_html__("Horizontal position", 'uncode') , "param_name" => "position_horizontal", "description" => esc_html__("Specify the horizontal position of the content if you have decreased the width value.", 'uncode') , "std" => 'center', "value" => array( 'Left' => 'left', 'Center' => 'center', 'Right' => 'right' ) , 'group' => esc_html__('Aspect', 'uncode') ) , array( "type" => 'dropdown', "heading" => esc_html__("Vertical position", 'uncode') , "param_name" => "position_vertical", "description" => esc_html__("Specify the vertical position of the content.", 'uncode') , "value" => array( 'Top' => 'top', 'Middle' => 'middle', 'Bottom' => 'bottom' ) , 'group' => esc_html__('Aspect', 'uncode') ) , array( "type" => 'dropdown', "heading" => esc_html__("Text alignment", 'uncode') , "param_name" => "align_horizontal", "description" => esc_html__("Specify the alignment inside the content box.", 'uncode') , "value" => array( 'Left' => 'align_left', 'Center' => 'align_center', 'Right' => 'align_right', ) , 'group' => esc_html__('Aspect', 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Expand height to 100%", 'uncode') , "param_name" => "expand_height", "description" => esc_html__("Activate this to expand the height of the column to 100%, if you haven't activate the equal height row setting.", 'uncode') , 'group' => esc_html__('Aspect', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Custom padding", 'uncode') , "param_name" => "override_padding", "description" => esc_html__('Activate this to define custom paddings.', 'uncode') , "group" => esc_html__("Aspect", 'uncode') , "value" => array( '' => 'yes' ) ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Custom padding", 'uncode') , "param_name" => "column_padding", "min" => 0, "max" => 5, "step" => 1, "value" => 2, "description" => esc_html__("Set the column padding", 'uncode') , "group" => esc_html__("Aspect", 'uncode') , "dependency" => Array( 'element' => "override_padding", 'value' => array( 'yes' ) ) , ) , array( "type" => "dropdown", "heading" => esc_html__("Column text skin", 'uncode') , "param_name" => "style", "value" => array( esc_html__('Inherit', 'uncode') => '', esc_html__('Light', 'uncode') => 'light', esc_html__('Dark', 'uncode') => 'dark' ) , 'group' => esc_html__('Style', 'uncode') , "description" => esc_html__("Specify the text/skin color of the column.", 'uncode') ) , array( "type" => 'dropdown', "heading" => esc_html__("Column font family", 'uncode') , "param_name" => "font_family", "description" => esc_html__("Specify the column font family.", 'uncode') , "value" => $heading_font, 'std' => '', 'group' => esc_html__('Style', 'uncode') , ) , array( "type" => "dropdown", "heading" => esc_html__("Column custom background color", 'uncode') , "param_name" => "back_color", "description" => esc_html__("Specify a background color for the column.", 'uncode') , "value" => $uncode_colors, 'group' => esc_html__('Style', 'uncode') ) , array( "type" => "media_element", "heading" => esc_html__("Media", 'uncode') , "param_name" => "back_image", "value" => "", "description" => esc_html__("Specify a media from the media library.", 'uncode') , 'group' => esc_html__('Style', 'uncode') ) , $add_background_repeat, $add_background_attachment, $add_background_position, $add_background_size, array( "type" => 'checkbox', "heading" => esc_html__("Parallax", 'uncode') , "param_name" => "parallax", "description" => esc_html__("Activate this to have the background parallax effect.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "dependency" => Array( 'element' => "back_image", 'not_empty' => true ) , "group" => esc_html__("Style", 'uncode') ) , array( "type" => "dropdown", "heading" => esc_html__("Overlay color", 'uncode') , "param_name" => "overlay_color", "description" => esc_html__("Specify an overlay color for the background.", 'uncode') , "group" => esc_html__("Style", 'uncode') , "value" => $uncode_colors, ) , array( "type" => "type_numeric_slider", "heading" => '', "param_name" => "overlay_alpha", "min" => 0, "max" => 100, "step" => 1, "value" => 50, "description" => esc_html__("Set the transparency for the overlay.", 'uncode') , "group" => esc_html__("Style", 'uncode') , ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Vertical gap", 'uncode') , "param_name" => "gutter_size", "min" => 0, "max" => 6, "step" => 1, "value" => 3, "description" => esc_html__("Set the vertical space between elements.", 'uncode') , "group" => esc_html__("Inner elements", 'uncode') , ) , array( "type" => "css_editor", "heading" => esc_html__('Css', 'uncode') , "param_name" => "css", "group" => esc_html__('Custom', 'uncode') ) , array( "type" => "dropdown", "heading" => esc_html__("Border color", 'uncode') , "param_name" => "border_color", "description" => esc_html__("Specify a border color.", 'uncode') , "group" => esc_html__("Custom", 'uncode') , "value" => $uncode_colors_w_transp, ) , array( "type" => "dropdown", "heading" => esc_html__("Border style", 'uncode') , "param_name" => "border_style", "description" => esc_html__("Specify a border style.", 'uncode') , "group" => esc_html__("Custom", 'uncode') , "value" => $border_style, ) , array( "type" => 'checkbox', "heading" => esc_html__("Desktop", 'uncode') , "param_name" => "desktop_visibility", "description" => esc_html__("Choose the visibiliy of the element in desktop layout mode (960px >).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Tablet", 'uncode') , "param_name" => "medium_visibility", "description" => esc_html__("Choose the visibiliy of the element in tablet layout mode (570px > < 960px).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'dropdown', "param_name" => "align_medium", "description" => esc_html__("Specify the text alignment inside the content box in tablet layout mode.", 'uncode') , "value" => array( 'Text align (Inherit)' => '', 'Left' => 'align_left_tablet', 'Center' => 'align_center_tablet', 'Right' => 'align_right_tablet', ) , 'group' => esc_html__('Responsive', 'uncode') ) , array( "type" => "type_numeric_slider", "param_name" => "medium_width", "min" => 0, "max" => 7, "step" => 1, "value" => 0, "description" => esc_html__("COLUMN WIDTH. N.B. If you change this value for one column you must specify a value for every column of the row.", 'uncode') , "group" => esc_html__("Responsive", 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Mobile", 'uncode') , "param_name" => "mobile_visibility", "description" => esc_html__("Choose the visibiliy of the element in tablet layout mode (570px > < 960px).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'dropdown', "param_name" => "align_mobile", "description" => esc_html__("Specify the text alignment inside the content box in mobile layout mode.", 'uncode') , "value" => array( 'Text align (Inherit)' => '', 'Left' => 'align_left_mobile', 'Center' => 'align_center_mobile', 'Right' => 'align_right_mobile', ) , 'group' => esc_html__('Responsive', 'uncode') ) , array( "type" => "textfield", "param_name" => "mobile_height", "description" => esc_html__("MINIMUM HEIGHT. Insert the value in pixel.", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Shift x-axis", 'uncode') , "param_name" => "shift_x", "min" => - 5, "max" => 5, "step" => 1, "value" => 0, "description" => esc_html__("Set how much the element has to shift in the X axis.", 'uncode') , 'group' => esc_html__('Off-grid', 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Shift x-axis fixed", 'uncode') , "param_name" => "shift_x_fixed", "description" => esc_html__("Deactive shift-x responsiveness.", 'uncode') , 'group' => esc_html__('Off-grid', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Shift y-axis", 'uncode') , "param_name" => "shift_y", "min" => - 5, "max" => 5, "step" => 1, "value" => 0, "description" => esc_html__("Set how much the element has to shift in the Y axis.", 'uncode') , 'group' => esc_html__('Off-grid', 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Shift y-axis fixed", 'uncode') , "param_name" => "shift_y_fixed", "description" => esc_html__("Deactive shift-y responsiveness.", 'uncode') , 'group' => esc_html__('Off-grid', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Custom z-index", 'uncode') , "param_name" => "z_index", "min" => 0, "max" => 10, "step" => 1, "value" => 0, "description" => esc_html__("Set a custom z-index to ensure the visibility of the element.", 'uncode') , 'group' => esc_html__('Off-grid', 'uncode') ) , $add_css_animation, $add_animation_speed, $add_animation_delay, array( 'type' => 'vc_link', 'heading' => esc_html__('Custom link', 'uncode') , 'param_name' => 'link_to', 'description' => esc_html__('Enter a custom link for the column.', 'uncode') , 'group' => esc_html__('Extra', 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Sticky", 'uncode') , "param_name" => "sticky", "description" => esc_html__("Activate this to stick the element when scrolling.", 'uncode') , 'group' => esc_html__('Extra', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => "textfield", "heading" => esc_html__("Extra class", 'uncode') , "param_name" => "el_class", "description" => esc_html__("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.", 'uncode') , 'group' => esc_html__('Extra', 'uncode') ) , ) , "js_view" => 'UncodeColumnView' )); vc_map(array( "name" => esc_html__("Column", 'uncode') , "base" => "vc_column_inner", "class" => "", "icon" => "", "wrapper_class" => "", "controls" => "full", "allowed_container_element" => false, "content_element" => false, "is_container" => true, "params" => array( array( "type" => 'checkbox', "heading" => esc_html__("Content width", 'uncode') , "param_name" => "column_width_use_pixel", "edit_field_class" => 'vc_col-sm-12 vc_column row_height', "description" => 'Set this value if you want to constrain the column width.', "group" => esc_html__("Aspect", 'uncode') , "value" => array( '' => 'yes' ) ) , array( "type" => "type_numeric_slider", "heading" => '', "param_name" => "column_width_percent", "min" => 0, "max" => 100, "step" => 1, "value" => 100, "description" => esc_html__("Set the column width with a percent value.", 'uncode') , "group" => esc_html__("Aspect", 'uncode') , 'dependency' => array( 'element' => 'column_width_use_pixel', 'is_empty' => true, ) ) , array( 'type' => 'textfield', 'heading' => '', 'param_name' => 'column_width_pixel', 'description' => esc_html__("Insert the column width in pixel.", 'uncode') , "group" => esc_html__("Aspect", 'uncode') , 'dependency' => array( 'element' => 'column_width_use_pixel', 'value' => 'yes' ) ) , array( "type" => 'dropdown', "heading" => esc_html__("Horizontal position", 'uncode') , "param_name" => "position_horizontal", "description" => esc_html__("Specify the horizontal position of the content if you have decreased the width value.", 'uncode') , "std" => 'center', "value" => array( 'Left' => 'left', 'Center' => 'center', 'Right' => 'right' ) , 'group' => esc_html__('Aspect', 'uncode') ) , array( "type" => 'dropdown', "heading" => esc_html__("Vertical position", 'uncode') , "param_name" => "position_vertical", "description" => esc_html__("Specify the vertical position of the content.", 'uncode') , "value" => array( 'Top' => 'top', 'Middle' => 'middle', 'Bottom' => 'bottom' ) , 'group' => esc_html__('Aspect', 'uncode') ) , array( "type" => 'dropdown', "heading" => esc_html__("Text alignment", 'uncode') , "param_name" => "align_horizontal", "description" => esc_html__("Specify the alignment inside the content box.", 'uncode') , "value" => array( 'Left' => 'align_left', 'Center' => 'align_center', 'Right' => 'align_right', ) , 'group' => esc_html__('Aspect', 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Expand height to 100%", 'uncode') , "param_name" => "expand_height", "description" => esc_html__("Activate this to expand the height of the column to 100%, if you haven't activate the equal height row setting.", 'uncode') , 'group' => esc_html__('Aspect', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Custom padding", 'uncode') , "param_name" => "override_padding", "description" => esc_html__('Activate this to define custom paddings.', 'uncode') , "group" => esc_html__("Aspect", 'uncode') , "value" => array( '' => 'yes' ) ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Custom padding", 'uncode') , "param_name" => "column_padding", "min" => 0, "max" => 5, "step" => 1, "value" => 2, "description" => esc_html__("Set the column padding", 'uncode') , "group" => esc_html__("Aspect", 'uncode') , "dependency" => Array( 'element' => "override_padding", 'value' => array( 'yes' ) ) , ) , array( "type" => "dropdown", "heading" => esc_html__("Column text skin", 'uncode') , "param_name" => "style", "value" => array( esc_html__('Inherit', 'uncode') => '', esc_html__('Light', 'uncode') => 'light', esc_html__('Dark', 'uncode') => 'dark' ) , 'group' => esc_html__('Style', 'uncode') , "description" => esc_html__("Specify the text/skin color of the column.", 'uncode') ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Vertical gap", 'uncode') , "param_name" => "gutter_size", "min" => 0, "max" => 6, "step" => 1, "value" => 3, "description" => esc_html__("Set the vertical space between elements.", 'uncode') , "group" => esc_html__("Inner elements", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Column font family", 'uncode') , "param_name" => "font_family", "description" => esc_html__("Specify the column font family.", 'uncode') , "value" => $heading_font, 'std' => '', 'group' => esc_html__('Style', 'uncode') , ) , array( "type" => "dropdown", "heading" => esc_html__("Column custom background color", 'uncode') , "param_name" => "back_color", "description" => esc_html__("Specify a background color for the column.", 'uncode') , "value" => $uncode_colors, 'group' => esc_html__('Style', 'uncode') ) , array( "type" => "media_element", "heading" => esc_html__("Media", 'uncode') , "param_name" => "back_image", "value" => "", "description" => esc_html__("Specify a media from the media library.", 'uncode') , 'group' => esc_html__('Style', 'uncode') ) , $add_background_repeat, $add_background_attachment, $add_background_position, $add_background_size, array( "type" => 'checkbox', "heading" => esc_html__("Parallax", 'uncode') , "param_name" => "parallax", "description" => esc_html__("Activate this to have the background parallax effect.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "dependency" => Array( 'element' => "back_image", 'not_empty' => true ) , "group" => esc_html__("Style", 'uncode') ) , array( "type" => "dropdown", "heading" => esc_html__("Overlay color", 'uncode') , "param_name" => "overlay_color", "description" => esc_html__("Specify an overlay color for the background.", 'uncode') , "group" => esc_html__("Style", 'uncode') , "value" => $uncode_colors, ) , array( "type" => "type_numeric_slider", "heading" => '', "param_name" => "overlay_alpha", "min" => 0, "max" => 100, "step" => 1, "value" => 50, "description" => esc_html__("Set the transparency for the overlay.", 'uncode') , "group" => esc_html__("Style", 'uncode') , ) , array( "type" => "css_editor", "heading" => esc_html__('Css', 'uncode') , "param_name" => "css", "group" => esc_html__('Custom', 'uncode') ) , array( "type" => "dropdown", "heading" => esc_html__("Border color", 'uncode') , "param_name" => "border_color", "description" => esc_html__("Specify a border color.", 'uncode') , "group" => esc_html__("Custom", 'uncode') , "value" => $uncode_colors_w_transp, ) , array( "type" => "dropdown", "heading" => esc_html__("Border style", 'uncode') , "param_name" => "border_style", "description" => esc_html__("Specify a border style.", 'uncode') , "group" => esc_html__("Custom", 'uncode') , "value" => $border_style, ) , array( "type" => 'checkbox', "heading" => esc_html__("Desktop", 'uncode') , "param_name" => "desktop_visibility", "description" => esc_html__("Choose the visibiliy of the element in desktop layout mode (960px >).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Tablet", 'uncode') , "param_name" => "medium_visibility", "description" => esc_html__("Choose the visibiliy of the element in tablet layout mode (570px > < 960px).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'dropdown', "param_name" => "align_medium", "description" => esc_html__("Specify the text alignment inside the content box in tablet layout mode.", 'uncode') , "value" => array( 'Text align (Inherit)' => '', 'Left' => 'align_left_tablet', 'Center' => 'align_center_tablet', 'Right' => 'align_right_tablet', ) , 'group' => esc_html__('Responsive', 'uncode') ) , array( "type" => "type_numeric_slider", "param_name" => "medium_width", "min" => 0, "max" => 7, "step" => 1, "value" => 0, "description" => esc_html__("COLUMN WIDTH. N.B. If you change this value for one column you must specify a value for every column of the row.", 'uncode') , "group" => esc_html__("Responsive", 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Mobile", 'uncode') , "param_name" => "mobile_visibility", "description" => esc_html__("Choose the visibiliy of the element in mobile layout mode (< 570px).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'dropdown', "param_name" => "align_mobile", "description" => esc_html__("Specify the text alignment inside the content box in mobile layout mode.", 'uncode') , "value" => array( 'Text align (Inherit)' => '', 'Left' => 'align_left_mobile', 'Center' => 'align_center_mobile', 'Right' => 'align_right_mobile', ) , 'group' => esc_html__('Responsive', 'uncode') ) , array( "type" => "textfield", "param_name" => "mobile_height", "description" => esc_html__("MINIMUM HEIGHT. Insert the value in pixel.", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Shift x-axis", 'uncode') , "param_name" => "shift_x", "min" => - 5, "max" => 5, "step" => 1, "value" => 0, "description" => esc_html__("Set how much the element has to shift in the X axis.", 'uncode') , 'group' => esc_html__('Off-grid', 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Shift x-axis fixed", 'uncode') , "param_name" => "shift_x_fixed", "description" => esc_html__("Deactive shift-x responsiveness.", 'uncode') , 'group' => esc_html__('Off-grid', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Shift y-axis", 'uncode') , "param_name" => "shift_y", "min" => - 5, "max" => 5, "step" => 1, "value" => 0, "description" => esc_html__("Set how much the element has to shift in the Y axis.", 'uncode') , 'group' => esc_html__('Off-grid', 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Shift y-axis fixed", 'uncode') , "param_name" => "shift_y_fixed", "description" => esc_html__("Deactive shift-y responsiveness.", 'uncode') , 'group' => esc_html__('Off-grid', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Custom z-index", 'uncode') , "param_name" => "z_index", "min" => 0, "max" => 10, "step" => 1, "value" => 0, "description" => esc_html__("Set a custom z-index to ensure the visibility of the element.", 'uncode') , 'group' => esc_html__('Off-grid', 'uncode') ) , $add_css_animation, $add_animation_speed, $add_animation_delay, array( 'type' => 'vc_link', 'heading' => esc_html__('Custom link', 'uncode') , 'param_name' => 'link_to', 'description' => esc_html__('Enter a custom link for the column.', 'uncode') , 'group' => esc_html__('Extra', 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Sticky", 'uncode') , "param_name" => "sticky", "description" => esc_html__("Activate this to stick the element when scrolling.", 'uncode') , 'group' => esc_html__('Extra', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => "textfield", "heading" => esc_html__("Extra class", 'uncode') , "param_name" => "el_class", "description" => esc_html__("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.", 'uncode') , 'group' => esc_html__('Extra', 'uncode') ) , ) , "js_view" => 'UncodeColumnView' )); /* Gallery/Slideshow ---------------------------------------------------------- */ vc_map(array( 'name' => esc_html__('Media Gallery', 'uncode') , 'base' => 'vc_gallery', 'php_class_name' => 'uncode_generic_admin', 'weight' => 102, 'icon' => 'fa fa-th-large', 'category' => esc_html__('Content', 'uncode') , 'description' => esc_html__('Isotope grid or carousel layout', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('Enter text which will be used as widget title. Leave blank if no title is needed.', 'uncode') , 'group' => esc_html__('General', 'uncode') , 'admin_label' => true, ) , array( 'type' => 'textfield', 'heading' => esc_html__('Widget ID', 'uncode') , 'param_name' => 'el_id', 'value' => (function_exists('big_rand')) ? big_rand() : rand() , 'description' => esc_html__('This value has to be unique. Change it in case it\'s needed.', 'uncode') , 'group' => esc_html__('General', 'uncode') ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Gallery module', 'uncode') , 'param_name' => 'type', 'value' => array( esc_html__('Isotope', 'uncode') => 'isotope', esc_html__('Carousel', 'uncode') => 'carousel', ) , 'admin_label' => true, 'description' => esc_html__('Specify gallery module type.', 'uncode') , 'group' => esc_html__('General', 'uncode') ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Layout modes', 'uncode') , 'param_name' => 'isotope_mode', 'admin_label' => true, "description" => wp_kses(__("Specify the isotpe layout mode. <a href='http://isotope.metafizzy.co/layout-modes.html' target='_blank'>Check this for reference</a>", 'uncode'), array( 'a' => array( 'href' => array(),'target' => array() ) ) ) , "value" => array( esc_html__('Masonry', 'uncode') => 'masonry', esc_html__('Fit rows', 'uncode') => 'fitRows', esc_html__('Cells by row', 'uncode') => 'cellsByRow', esc_html__('Vertical', 'uncode') => 'vertical', esc_html__('Packery', 'uncode') => 'packery', ) , 'group' => esc_html__('General', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'isotope', ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Random order", 'uncode') , "param_name" => "random", "description" => esc_html__("Activate this to have a media random order.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("General", 'uncode') , ) , array( 'type' => 'media_element', 'heading' => esc_html__('Medias', 'uncode') , 'param_name' => 'medias', "edit_field_class" => 'vc_col-sm-12 vc_column uncode_gallery', 'value' => '', 'description' => esc_html__('Specify images from media library.', 'uncode') , 'group' => esc_html__('General', 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Style", 'uncode') , "param_name" => "style_preset", "description" => esc_html__("Select the visualization mode.", 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => array( 'isotope', ) , ) , "value" => array( esc_html__('Masonry', 'uncode') => 'masonry', esc_html__('Metro', 'uncode') => 'metro', ) , 'group' => esc_html__('Module', 'uncode') , ) , array( "type" => "dropdown", "heading" => esc_html__("Gallery background color", 'uncode') , "param_name" => "gallery_back_color", "description" => esc_html__("Specify a background color for the module.", 'uncode') , "class" => 'uncode_colors', "value" => $uncode_colors, 'group' => esc_html__('Module', 'uncode') , ) , array( 'type' => 'textfield', 'heading' => esc_html__('Number columns ( > 960px )', 'uncode') , 'param_name' => 'carousel_lg', 'value' => 3, 'description' => esc_html__('Insert the numbers of columns for the viewport from 960px.', 'uncode') , 'group' => esc_html__('Module', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel' ) , ) , array( 'type' => 'textfield', 'heading' => esc_html__('Number columns ( > 570px and < 960px )', 'uncode') , 'param_name' => 'carousel_md', 'value' => 3, 'description' => esc_html__('Insert the numbers of columns for the viewport from 570px to 960px.', 'uncode') , 'group' => esc_html__('Module', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel' ) , ) , array( 'type' => 'textfield', 'heading' => esc_html__('Number columns ( > 0px and < 570px )', 'uncode') , 'param_name' => 'carousel_sm', 'value' => 1, 'description' => esc_html__('Insert the numbers of columns for the viewport from 0 to 570px.', 'uncode') , 'group' => esc_html__('Module', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel' ) , ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Thumbnail size', 'uncode') , 'param_name' => 'thumb_size', 'description' => esc_html__('Specify the aspect ratio for the media.', 'uncode') , "value" => array( esc_html__('Regular', 'uncode') => '', '1:1' => 'one-one', '2:1' => 'two-one', '3:2' => 'three-two', '4:3' => 'four-three', '10:3' => 'ten-three', '16:9' => 'sixteen-nine', '21:9' => 'twentyone-nine', '1:2' => 'one-two', '2:3' => 'two-three', '3:4' => 'three-four', '3:10' => 'three-ten', '9:16' => 'nine-sixteen', ) , 'group' => esc_html__('Module', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel', ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Filtering", 'uncode') , "param_name" => "filtering", "description" => esc_html__("Activate this to add the isotope filtering.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Module", 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'isotope', ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Filter skin", 'uncode') , "param_name" => "filter_style", "description" => esc_html__("Specify the filter skin color.", 'uncode') , "value" => array( esc_html__('Light', 'uncode') => 'light', esc_html__('Dark', 'uncode') => 'dark' ) , 'group' => esc_html__('Module', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'isotope', ) , 'dependency' => array( 'element' => 'filtering', 'value' => 'yes', ) , ) , array( "type" => "dropdown", "heading" => esc_html__("Filter menu color", 'uncode') , "param_name" => "filter_back_color", "description" => esc_html__("Specify a background color for the filter menu.", 'uncode') , "class" => 'uncode_colors', "value" => $uncode_colors, 'group' => esc_html__('Module', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'isotope', ) , 'dependency' => array( 'element' => 'filtering', 'value' => 'yes', ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Filter menu full width", 'uncode') , "param_name" => "filtering_full_width", "description" => esc_html__("Activate this to force the full width of the filter.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Module", 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'isotope', ) , 'dependency' => array( 'element' => 'filtering', 'value' => 'yes', ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Filter menu position", 'uncode') , "param_name" => "filtering_position", "description" => esc_html__("Specify the filter menu positioning.", 'uncode') , "value" => array( esc_html__('Left', 'uncode') => 'left', esc_html__('Center', 'uncode') => 'center', esc_html__('Right', 'uncode') => 'right', ) , 'group' => esc_html__('Module', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'isotope', ) , 'dependency' => array( 'element' => 'filtering', 'value' => 'yes', ) ) , array( "type" => 'checkbox', "heading" => esc_html__("'Show all' opposite", 'uncode') , "param_name" => "filter_all_opposite", "description" => esc_html__("Activate this to position the 'Show all' button opposite to the rest.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Module", 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'isotope', ) , 'dependency' => array( 'element' => 'filtering', 'value' => 'yes', ) , 'dependency' => array( 'element' => 'filtering_position', 'value' => array( 'left', 'right' ) ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Filter menu uppercase", 'uncode') , "param_name" => "filtering_uppercase", "description" => esc_html__("Activate this to have the filter menu in uppercase.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Module", 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'isotope', ) , 'dependency' => array( 'element' => 'filtering', 'value' => 'yes', ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Filter menu mobile hidden", 'uncode') , "param_name" => "filter_mobile", "description" => esc_html__("Activate this to hide the filter menu in mobile mode.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , 'group' => esc_html__('Module', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'isotope', ) , 'dependency' => array( 'element' => 'filtering', 'value' => 'yes', ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Filter scroll", 'uncode') , "param_name" => "filter_scroll", "description" => esc_html__("Activate this to scroll to the module when filtering.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , 'group' => esc_html__('Module', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'isotope', ) , 'dependency' => array( 'element' => 'filtering', 'value' => 'yes', ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Filter sticky", 'uncode') , "param_name" => "filter_sticky", "description" => esc_html__("Activate this to have a sticky filter menu when scrolling.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , 'group' => esc_html__('Module', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'isotope', ) , 'dependency' => array( 'element' => 'filtering', 'value' => 'yes', ) , ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Items gap", 'uncode') , "param_name" => "gutter_size", "min" => 0, "max" => 4, "step" => 1, "value" => 3, "description" => esc_html__("Set the items gap.", 'uncode') , "group" => esc_html__("Module", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Inner module padding", 'uncode') , "param_name" => "inner_padding", "description" => esc_html__("Activate this to have an inner padding with the same size as the items gap.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Module", 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => array( 'isotope', 'carousel', ) , ) , ) , array( 'type' => 'sorted_list', 'heading' => esc_html__('Media', 'uncode') , 'param_name' => 'media_items', 'description' => esc_html__('Control teasers look. Enable blocks and place them in desired order. Note: This setting can be overridden on post to post basis.', 'uncode') , 'value' => 'media|lightbox|original,icon', "group" => esc_html__("Module", 'uncode') , 'options' => array( array( 'media', esc_html__('Media', 'uncode') , array( array( 'lightbox', esc_html__('Lightbox', 'uncode') ) , array( 'custom_link', esc_html__('Custom link', 'uncode') ) , array( 'nolink', esc_html__('No link', 'uncode') ) ) , array( array( 'original', esc_html__('Original', 'uncode') ) , array( 'poster', esc_html__('Poster', 'uncode') ) ) ) , array( 'icon', esc_html__('Icon', 'uncode') , ) , array( 'title', esc_html__('Title', 'uncode') , ) , array( 'caption', esc_html__('Caption', 'uncode') , ) , array( 'description', esc_html__('Description', 'uncode') , ) , array( 'category', esc_html__('Category', 'uncode') , ) , array( 'spacer', esc_html__('Spacer', 'uncode') , array( array( 'half', esc_html__('0.5x', 'uncode') ) , array( 'one', esc_html__('1x', 'uncode') ) , array( 'two', esc_html__('2x', 'uncode') ) ) ) , array( 'sep-one', esc_html__('Separator One', 'uncode') , array( array( 'full', esc_html__('Full width', 'uncode') ) , array( 'reduced', esc_html__('Reduced width', 'uncode') ) ) ) , array( 'sep-two', esc_html__('Separator Two', 'uncode') , array( array( 'full', esc_html__('Full width', 'uncode') ) , array( 'reduced', esc_html__('Reduced width', 'uncode') ) ) ) , array( 'team-social', esc_html__('Team socials', 'uncode') , ) , ) ) , array( "type" => 'dropdown', "heading" => esc_html__("Carousel items height", 'uncode') , "param_name" => "carousel_height", "description" => esc_html__("Specify the carousel items height.", 'uncode') , "value" => array( esc_html__('Auto', 'uncode') => '', esc_html__('Equal height', 'uncode') => 'equal', ) , 'group' => esc_html__('Module', 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Items vertical alignment", 'uncode') , "param_name" => "carousel_v_align", "description" => esc_html__("Specify the items vertical alignment.", 'uncode') , "value" => array( esc_html__('Top', 'uncode') => '', esc_html__('Middle', 'uncode') => 'middle', esc_html__('Bottom', 'uncode') => 'bottom' ) , 'group' => esc_html__('Module', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel', ) , 'dependency' => array( 'element' => 'carousel_height', 'is_empty' => true, ) , ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Transition type', 'uncode') , 'param_name' => 'carousel_type', "value" => array( esc_html__('Slide', 'uncode') => '', esc_html__('Fade', 'uncode') => 'fade' ) , 'description' => esc_html__('Specify the transition type.', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel', ) , 'group' => esc_html__('Module', 'uncode') ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Auto rotate slides', 'uncode') , 'param_name' => 'carousel_interval', 'value' => array( 3000, 5000, 10000, 15000, esc_html__('Disable', 'uncode') => 0 ) , 'description' => esc_html__('Specify the automatic timeout between slides in milliseconds.', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel', ) , 'group' => esc_html__('Module', 'uncode') ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Navigation speed', 'uncode') , 'param_name' => 'carousel_navspeed', 'value' => array( 200, 400, 700, 1000, esc_html__('Disable', 'uncode') => 0 ) , 'std' => 400, 'description' => esc_html__('Specify the navigation speed between slides in milliseconds.', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel', ) , 'group' => esc_html__('Module', 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Loop", 'uncode') , "param_name" => "carousel_loop", "description" => esc_html__("Activate the loop option to make the carousel infinite.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Module", 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel', ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Navigation", 'uncode') , "param_name" => "carousel_nav", "description" => esc_html__("Activate the navigation to show navigational arrows.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Module", 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel', ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Mobile navigation", 'uncode') , "param_name" => "carousel_nav_mobile", "description" => esc_html__("Activate the navigation to show navigational arrows for mobile devices.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Module", 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel', ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Navigation skin", 'uncode') , "param_name" => "carousel_nav_skin", "description" => esc_html__("Specify the navigation arrows skin.", 'uncode') , "value" => array( esc_html__('Light', 'uncode') => 'light', esc_html__('Dark', 'uncode') => 'dark' ) , "group" => esc_html__("Module", 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel', ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Dots navigation", 'uncode') , "param_name" => "carousel_dots", "description" => esc_html__("Activate the dots navigation to show navigational dots in the bottom.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Module", 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel', ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Mobile dots navigation", 'uncode') , "param_name" => "carousel_dots_mobile", "description" => esc_html__("Activate the dots navigation to show navigational dots in the bottom for mobile devices.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Module", 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel', ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Dots navigation inside", 'uncode') , "param_name" => "carousel_dots_inside", "description" => esc_html__("Activate to have the dots navigation inside the carousel.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Module", 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel', ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Autoheight", 'uncode') , "param_name" => "carousel_autoh", "description" => esc_html__("Activate to adjust the height automatically when possible.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Module", 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel', ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Textual carousel ", 'uncode') , "param_name" => "carousel_textual", "description" => esc_html__("Activate this to have a carousel with only text.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Module", 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => 'carousel', ) , ) , array( 'type' => 'textfield', 'heading' => esc_html__('Breakpoint - First step', 'uncode') , 'param_name' => 'screen_lg', 'value' => 1000, 'description' => wp_kses(__('Insert the isotope large layout breakpoint in pixel.<br />N.B. This is referring to the width of the isotope container, not to the window width.', 'uncode'), array( 'br' => array( ) ) ) , 'group' => esc_html__('Module', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => array( 'isotope', ) , ) , ) , array( 'type' => 'textfield', 'heading' => esc_html__('Breakpoint - Second step', 'uncode') , 'param_name' => 'screen_md', 'value' => 600, 'description' => wp_kses(__('Insert the isotope medium layout breakpoint in pixel.<br />N.B. This is referring to the width of the isotope container, not to the window width.', 'uncode'), array( 'br' => array( ) ) ) , 'group' => esc_html__('Module', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => array( 'isotope', ) , ) , ) , array( 'type' => 'textfield', 'heading' => esc_html__('Breakpoint - Third step', 'uncode') , 'param_name' => 'screen_sm', 'value' => 480, 'description' => wp_kses(__('Insert the isotope small layout breakpoint in pixel.<br />N.B. This is referring to the width of the isotope container, not to the window width.', 'uncode'), array( 'br' => array( ) ) ) , 'group' => esc_html__('Module', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => array( 'isotope', ) , ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Block layout", 'uncode') , "param_name" => "single_text", "description" => esc_html__("Specify the text positioning inside the box.", 'uncode') , "value" => array( esc_html__('Content overlay', 'uncode') => 'overlay', esc_html__('Content under image', 'uncode') => 'under' ) , 'group' => esc_html__('Blocks', 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Width", 'uncode') , "param_name" => "single_width", "description" => esc_html__("Specify the box width.", 'uncode') , "value" => $units, "std" => "4", 'dependency' => array( 'element' => 'type', 'value' => array( 'isotope', ) , ) , 'group' => esc_html__('Blocks', 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Height", 'uncode') , "param_name" => "single_height", "description" => esc_html__("Specify the box height.", 'uncode') , "value" => array( esc_html__("Default", 'uncode') => "" ) + $units, "std" => "", 'group' => esc_html__('Blocks', 'uncode') , 'dependency' => array( 'element' => 'type', 'value' => array( 'isotope', ) , ) , 'dependency' => array( 'element' => 'style_preset', 'value' => 'metro', ) , ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Media ratio', 'uncode') , 'param_name' => 'images_size', 'description' => esc_html__('Specify the aspect ratio for the media.', 'uncode') , "value" => array( esc_html__('Regular', 'uncode') => '', '1:1' => 'one-one', '2:1' => 'two-one', '3:2' => 'three-two', '4:3' => 'four-three', '10:3' => 'ten-three', '16:9' => 'sixteen-nine', '21:9' => 'twentyone-nine', '1:2' => 'one-two', '2:3' => 'two-three', '3:4' => 'three-four', '3:10' => 'three-ten', '9:16' => 'nine-sixteen', ) , 'group' => esc_html__('Blocks', 'uncode') , 'dependency' => array( 'element' => 'style_preset', 'value' => 'masonry', ) , 'admin_label' => true, ) , array( "type" => "dropdown", "heading" => esc_html__("Background color", 'uncode') , "param_name" => "single_back_color", "description" => esc_html__("Specify a background color for the box.", 'uncode') , "value" => $uncode_colors, 'group' => esc_html__('Blocks', 'uncode') , ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Shape', 'uncode') , 'param_name' => 'single_shape', 'value' => array( esc_html__('Select…', 'uncode') => '', esc_html__('Rounded', 'uncode') => 'round', esc_html__('Circular', 'uncode') => 'circle' ) , 'description' => esc_html__('Specify one if you want to shape the block.', 'uncode') , 'group' => esc_html__('Blocks', 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Skin", 'uncode') , "param_name" => "single_style", "description" => esc_html__("Specify the skin inside the content box.", 'uncode') , "value" => array( esc_html__('Light', 'uncode') => 'light', esc_html__('Dark', 'uncode') => 'dark' ) , 'group' => esc_html__('Blocks', 'uncode') , ) , array( "type" => "dropdown", "heading" => esc_html__("Overlay color", 'uncode') , "param_name" => "single_overlay_color", "description" => esc_html__("Specify a background color for the box.", 'uncode') , "value" => $uncode_colors, 'group' => esc_html__('Blocks', 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Overlay coloration", 'uncode') , "param_name" => "single_overlay_coloration", "description" => wp_kses(__("Specify the coloration style for the overlay.<br />N.B. For the gradient you can't customize the overlay color.", 'uncode'), array( 'br' => array( ) ) ) , "value" => array( esc_html__('Fully colored', 'uncode') => '', esc_html__('Gradient top', 'uncode') => 'top_gradient', esc_html__('Gradient bottom', 'uncode') => 'bottom_gradient', ) , 'group' => esc_html__('Blocks', 'uncode') , ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Overlay opacity", 'uncode') , "param_name" => "single_overlay_opacity", "min" => 1, "max" => 100, "step" => 1, "value" => 50, "description" => esc_html__("Set the overlay opacity.", 'uncode') , 'group' => esc_html__('Blocks', 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Overlay text visibility", 'uncode') , "param_name" => "single_text_visible", "description" => esc_html__("Activate this to show the text as starting point.", 'uncode') , "value" => array( esc_html__('Hidden', 'uncode') => 'no', esc_html__('Visible', 'uncode') => 'yes', ) , "group" => esc_html__("Blocks", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Overlay text animation", 'uncode') , "param_name" => "single_text_anim", "description" => esc_html__("Activate this to animate the text on mouse over.", 'uncode') , "value" => array( esc_html__('Animated', 'uncode') => 'yes', esc_html__('Static', 'uncode') => 'no', ) , "group" => esc_html__("Blocks", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Overlay text animation type", 'uncode') , "param_name" => "single_text_anim_type", "description" => esc_html__("Specify the animation type.", 'uncode') , "value" => array( esc_html__('Opacity', 'uncode') => '', esc_html__('Bottom to top', 'uncode') => 'btt', ) , "group" => esc_html__("Blocks", 'uncode') , 'dependency' => array( 'element' => 'single_text_anim', 'value' => 'yes', ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Overlay visibility", 'uncode') , "param_name" => "single_overlay_visible", "description" => esc_html__("Activate this to show the overlay as starting point.", 'uncode') , "value" => array( esc_html__('Hidden', 'uncode') => 'no', esc_html__('Visible', 'uncode') => 'yes', ) , "group" => esc_html__("Blocks", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Overlay animation", 'uncode') , "param_name" => "single_overlay_anim", "description" => esc_html__("Activate this to animate the overlay on mouse over.", 'uncode') , "value" => array( esc_html__('Animated', 'uncode') => 'yes', esc_html__('Static', 'uncode') => 'no', ) , "group" => esc_html__("Blocks", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Image coloration", 'uncode') , "param_name" => "single_image_coloration", "description" => esc_html__("Specify the image coloration mode.", 'uncode') , "value" => array( esc_html__('Standard', 'uncode') => '', esc_html__('Desaturated', 'uncode') => 'desaturated', ) , "group" => esc_html__("Blocks", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Image coloration animation", 'uncode') , "param_name" => "single_image_color_anim", "description" => esc_html__("Activate this to animate the image coloration on mouse over.", 'uncode') , "value" => array( esc_html__('Static', 'uncode') => '', esc_html__('Animated', 'uncode') => 'yes', ) , "group" => esc_html__("Blocks", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Image animation", 'uncode') , "param_name" => "single_image_anim", "description" => esc_html__("Activate this to animate the image on mouse over.", 'uncode') , "value" => array( esc_html__('Animated', 'uncode') => 'yes', esc_html__('Static', 'uncode') => 'no', ) , "group" => esc_html__("Blocks", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Text horizontal alignment", 'uncode') , "param_name" => "single_h_align", "description" => esc_html__("Specify the horizontal alignment.", 'uncode') , "value" => array( esc_html__('Left', 'uncode') => 'left', esc_html__('Center', 'uncode') => 'center', esc_html__('Right', 'uncode') => 'right', esc_html__('Justify', 'uncode') => 'justify' ) , 'group' => esc_html__('Blocks', 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Content vertical position", 'uncode') , "param_name" => "single_v_position", "description" => esc_html__("Specify the text vertical position.", 'uncode') , "value" => array( esc_html__('Middle', 'uncode') => '', esc_html__('Top', 'uncode') => 'top', esc_html__('Bottom', 'uncode') => 'bottom' ) , 'group' => esc_html__('Blocks', 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Content dimension reduced", 'uncode') , "param_name" => "single_reduced", "description" => esc_html__("Specify the text reduction amount to shrink the overlay content dimension.", 'uncode') , "value" => array( esc_html__('100%', 'uncode') => '', esc_html__('75%', 'uncode') => 'three_quarter', esc_html__('50%', 'uncode') => 'half', ) , "group" => esc_html__("Blocks", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Content horizontal position", 'uncode') , "param_name" => "single_h_position", "description" => esc_html__("Specify the text horizontal position.", 'uncode') , "value" => array( esc_html__('Left', 'uncode') => 'left', esc_html__('Center', 'uncode') => 'center', esc_html__('Right', 'uncode') => 'right' ) , 'group' => esc_html__('Blocks', 'uncode') , 'dependency' => array( 'element' => 'single_reduced', 'not_empty' => true, ) ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Padding around text", 'uncode') , "param_name" => "single_padding", "min" => 0, "max" => 5, "step" => 1, "value" => 2, "description" => esc_html__("Set the text padding", 'uncode') , "group" => esc_html__("Blocks", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Reduce space between elements", 'uncode') , "param_name" => "single_text_reduced", "description" => esc_html__("Activate this to have less space between all the text elements inside the box.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Blocks", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Multiple click areas", 'uncode') , "param_name" => "single_elements_click", "description" => esc_html__("Activate this to make every single elements clickable instead of the whole block (when available).", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Blocks", 'uncode') , 'dependency' => array( 'element' => 'single_text', 'value' => 'overlay', ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Title text trasnform", 'uncode') , "param_name" => "single_title_transform", "description" => esc_html__("Specify the title text transformation.", 'uncode') , "value" => array( esc_html__('Default CSS', 'uncode') => '', esc_html__('Uppercase', 'uncode') => 'uppercase', esc_html__('Lowercase', 'uncode') => 'lowercase', esc_html__('Capitalize', 'uncode') => 'capitalize' ) , "group" => esc_html__("Blocks", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Title dimension", 'uncode') , "param_name" => "single_title_dimension", "description" => esc_html__("Specify the title dimension.", 'uncode') , "value" => $heading_size, "group" => esc_html__("Blocks", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Title font family", 'uncode') , "param_name" => "single_title_family", "description" => esc_html__("Specify the title font family.", 'uncode') , "value" => $heading_font, 'std' => '', "group" => esc_html__("Blocks", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Title font weight", 'uncode') , "param_name" => "single_title_weight", "description" => esc_html__("Specify the title font weight.", 'uncode') , "value" => $heading_weight, 'std' => '', "group" => esc_html__("Blocks", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Title line height", 'uncode') , "param_name" => "single_title_height", "description" => esc_html__("Specify the title line height.", 'uncode') , "value" => $heading_height, "group" => esc_html__("Blocks", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Title letter spacing", 'uncode') , "param_name" => "single_title_space", "description" => esc_html__("Specify the title letter spacing.", 'uncode') , "value" => $heading_space, "group" => esc_html__("Blocks", 'uncode') , ) , array( 'type' => 'iconpicker', 'heading' => esc_html__('Icon', 'uncode') , 'param_name' => 'single_icon', 'description' => esc_html__('Specify icon from library.', 'uncode') , 'value' => '', 'settings' => array( 'emptyIcon' => true, // default true, display an "EMPTY" icon? 'iconsPerPage' => 1100, // default 100, how many icons per/page to display 'type' => 'uncode' ) , 'group' => esc_html__('Blocks', 'uncode') , ) , array( 'type' => 'vc_link', 'heading' => esc_html__('Custom link', 'uncode') , 'param_name' => 'single_link', 'description' => esc_html__('Enter the custom link for the item.', 'uncode') , 'group' => esc_html__('Blocks', 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Shadow", 'uncode') , "param_name" => "single_shadow", "description" => esc_html__("Activate this to have the shadow behind the block.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Blocks", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("No border", 'uncode') , "param_name" => "single_border", "description" => esc_html__("Activate this to remove the border around the block.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Blocks", 'uncode') , ) , array_merge($add_css_animation, array( "group" => esc_html__("Blocks", 'uncode') , "param_name" => 'single_css_animation' )) , array_merge($add_animation_speed, array( "group" => esc_html__("Blocks", 'uncode') , "param_name" => 'single_animation_speed', 'dependency' => array( 'element' => 'single_css_animation', 'not_empty' => true ) )) , array_merge($add_animation_delay, array( "group" => esc_html__("Blocks", 'uncode') , "param_name" => 'single_animation_delay', 'dependency' => array( 'element' => 'single_css_animation', 'not_empty' => true ) )) , array( 'type' => 'uncode_items', 'heading' => '', 'param_name' => 'items', 'description' => esc_html__('Enter text which will be used as widget title. Leave blank if no title is needed.', 'uncode') , 'group' => esc_html__('Single block', 'uncode') , ) , array( 'type' => 'dropdown', 'heading' => 'Skin', 'param_name' => 'lbox_skin', 'value' => array( esc_html__('Dark', 'uncode') => '', esc_html__('Light', 'uncode') => 'white', ) , 'description' => esc_html__('Specify the lightbox skin color.', 'uncode') , 'group' => esc_html__('Lightbox', 'uncode') , ) , array( 'type' => 'dropdown', 'heading' => 'Direction', 'param_name' => 'lbox_dir', 'value' => array( esc_html__('Horizontal', 'uncode') => '', esc_html__('Vertical', 'uncode') => 'vertical', ) , 'description' => esc_html__('Specify the lightbox sliding direction.', 'uncode') , 'group' => esc_html__('Lightbox', 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Title", 'uncode') , "param_name" => "lbox_title", "description" => esc_html__("Activate this to add the media title.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Caption", 'uncode') , "param_name" => "lbox_caption", "description" => esc_html__("Activate this to add the media caption.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Social", 'uncode') , "param_name" => "lbox_social", "description" => esc_html__("Activate this for the social sharing buttons.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Deeplinking", 'uncode') , "param_name" => "lbox_deep", "description" => esc_html__("Activate this for the deeplinking of every slide.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("No thumbnails", 'uncode') , "param_name" => "lbox_no_tmb", "description" => esc_html__("Activate this for not showing the thumbnails.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("No arrows", 'uncode') , "param_name" => "lbox_no_arrows", "description" => esc_html__("Activate this for not showing the navigation arrows.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Remove double tap", 'uncode') , "param_name" => "no_double_tap", "description" => esc_html__("Remove the double tap action on mobile.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Mobile", 'uncode') , ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') , 'group' => esc_html__('Extra', 'uncode') ) ) )); /* Text Block ---------------------------------------------------------- */ vc_map(array( 'name' => esc_html__('Text Block', 'uncode') , 'base' => 'vc_column_text', 'weight' => 98, 'icon' => 'fa fa-font', 'wrapper_class' => 'clearfix', 'php_class_name' => 'uncode_generic_admin', 'category' => esc_html__('Content', 'uncode') , 'description' => esc_html__('Basic block of text', 'uncode') , 'params' => array( array( 'type' => 'textarea_html', 'holder' => 'div', 'heading' => esc_html__('Text', 'uncode') , 'param_name' => 'content', 'value' => wp_kses(__('<p>I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.</p>', 'uncode'), array( 'p' => array())) ) , array( "type" => 'checkbox', "heading" => esc_html__("Text lead", 'uncode') , "param_name" => "text_lead", "description" => esc_html__("Transform the text to leading.", 'uncode') , "value" => Array( '' => 'yes' ) , ) , $add_css_animation, $add_animation_speed, $add_animation_delay, array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) , array( 'type' => 'css_editor', 'heading' => esc_html__('Css', 'uncode') , 'param_name' => 'css', 'group' => esc_html__('Custom', 'uncode') ), array( "type" => "dropdown", "heading" => esc_html__("Border color", 'uncode') , "param_name" => "border_color", "description" => esc_html__("Specify a border color.", 'uncode') , "group" => esc_html__("Custom", 'uncode') , "value" => $uncode_colors_w_transp, ) , array( "type" => "dropdown", "heading" => esc_html__("Border style", 'uncode') , "param_name" => "border_style", "description" => esc_html__("Specify a border style.", 'uncode') , "group" => esc_html__("Custom", 'uncode') , "value" => $border_style, ) , ) , 'js_view' => 'UncodeTextView' )); /* Separator (Divider) ---------------------------------------------------------- */ vc_map(array( 'name' => esc_html__('Divider', 'uncode') , 'base' => 'vc_separator', 'weight' => 82, 'icon' => 'fa fa-arrows-h', 'show_settings_on_create' => true, 'category' => esc_html__('Content', 'uncode') , 'description' => esc_html__('Horizontal divider', 'uncode') , 'params' => array( array( "type" => "dropdown", "heading" => esc_html__("Color", 'uncode') , "param_name" => "sep_color", "description" => esc_html__("Separator color.", 'uncode') , "value" => $uncode_colors, ) , array( 'type' => 'iconpicker', 'heading' => esc_html__('Icon', 'uncode') , 'param_name' => 'icon', 'description' => esc_html__('Specify icon from library.', 'uncode') , 'value' => '', 'settings' => array( 'emptyIcon' => true, 'iconsPerPage' => 1100, 'type' => 'uncode' ) , ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Icon position', 'uncode') , 'param_name' => 'icon_position', 'value' => array( esc_html__('Center', 'uncode') => '', esc_html__('Left', 'uncode') => 'left', esc_html__('Right', 'uncode') => "right" ) , 'description' => esc_html__('Specify title location.', 'uncode') ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Style', 'uncode') , 'param_name' => 'type', 'value' => getVcShared('separator styles') , 'description' => esc_html__('Separator style.', 'uncode') ) , array( 'type' => 'textfield', 'heading' => esc_html__('Custom width', 'uncode') , 'param_name' => 'el_width', 'description' => esc_html__('Insert the custom value in % or px.', 'uncode') ) , array( 'type' => 'textfield', 'heading' => esc_html__('Custom thickness', 'uncode') , 'param_name' => 'el_height', 'description' => esc_html__('Insert the custom value in em or px. This option can\'t be used with the separator with the icon.', 'uncode') , ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Activate scroll to top', 'uncode') , 'param_name' => 'scroll_top', 'description' => esc_html__('Activate if you want the scroll top function with the icon.', 'uncode') , 'value' => array( esc_html__('Yes, please', 'uncode') => 'yes' ) , 'dependency' => array( 'element' => 'icon', 'not_empty' => true ) , ) , array( 'type' => 'vc_link', 'heading' => esc_html__('URL (Link)', 'uncode') , 'param_name' => 'link', 'description' => esc_html__('Separator link.', 'uncode') , 'dependency' => array( 'element' => 'icon', 'not_empty' => true ) , ) , $add_css_animation, $add_animation_speed, $add_animation_delay, array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); /* Message box ---------------------------------------------------------- */ vc_map(array( 'name' => esc_html__('Message Box', 'uncode') , 'base' => 'vc_message', 'php_class_name' => 'uncode_message', 'icon' => 'fa fa-info', 'category' => esc_html__('Content', 'uncode') , 'description' => esc_html__('Notification element', 'uncode') , 'params' => array( array( 'type' => 'dropdown', 'heading' => esc_html__('Message box type', 'uncode') , 'param_name' => 'message_color', 'admin_label' => true, 'value' => $uncode_colors, 'description' => esc_html__('Specify message type.', 'uncode') , 'param_holder_class' => 'vc_message-type' ) , array( 'type' => 'textarea_html', 'class' => 'messagebox_text', 'param_name' => 'content', 'heading' => esc_html__('Message text', 'uncode') , 'value' => wp_kses(__('<p>I am message box. Click edit button to change this text.</p>', 'uncode'), array( 'p' => array())) ) , $add_css_animation, $add_animation_speed, $add_animation_delay, array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) , )); /* Single image */ vc_map(array( 'name' => esc_html__('Single Media', 'uncode') , 'base' => 'vc_single_image', 'icon' => 'fa fa-image', 'weight' => 101, 'php_class_name' => 'uncode_generic_admin', 'category' => esc_html__('Content', 'uncode') , 'description' => esc_html__('Simple media item', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('Enter text which will be used as widget title. Leave blank if no title is needed.', 'uncode') ) , array( "type" => "media_element", "heading" => esc_html__("Media", 'uncode') , "param_name" => "media", "value" => "", "description" => esc_html__("Specify a media from the media library.", 'uncode') , "admin_label" => true ) , array( "type" => 'checkbox', "heading" => esc_html__("Caption", 'uncode') , "param_name" => "caption", "description" => 'Activate to have the caption under the image.', "value" => array( '' => 'yes' ) ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Lightbox', 'uncode') , 'param_name' => 'media_lightbox', 'description' => esc_html__('Activate if you want to open the media in the lightbox.', 'uncode') , 'value' => array( esc_html__('Yes, please', 'uncode') => 'yes' ) ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Poster', 'uncode') , 'param_name' => 'media_poster', 'description' => esc_html__('Activate if you want to view the poster image instead (this is usefull for other media than images with the use of the lightbox).', 'uncode') , 'value' => array( esc_html__('Yes, please', 'uncode') => 'yes' ) ) , array( 'type' => 'vc_link', 'heading' => esc_html__('URL (Link)', 'uncode') , 'param_name' => 'media_link', 'description' => esc_html__('Enter URL if you want this image to have a link.', 'uncode') , 'dependency' => array( 'element' => 'media_link_large', 'is_empty' => true, ) ) , array( "type" => 'checkbox', "heading" => esc_html__("Width", 'uncode') , "param_name" => "media_width_use_pixel", "description" => 'Set this value if you want to constrain the media width.', "group" => esc_html__("Aspect", 'uncode') , "value" => array( '' => 'yes' ) ) , array( "type" => "type_numeric_slider", "heading" => '', "param_name" => "media_width_percent", "min" => 0, "max" => 100, "step" => 1, "value" => 100, "description" => esc_html__("Set the media width with a percent value.", 'uncode') , "group" => esc_html__("Aspect", 'uncode') , 'dependency' => array( 'element' => 'media_width_use_pixel', 'is_empty' => true, ) ) , array( 'type' => 'textfield', 'heading' => '', 'param_name' => 'media_width_pixel', 'description' => esc_html__("Insert the media width in pixel.", 'uncode') , "group" => esc_html__("Aspect", 'uncode') , 'dependency' => array( 'element' => 'media_width_use_pixel', 'value' => 'yes' ) ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Aspect ratio', 'uncode') , 'param_name' => 'media_ratio', 'description' => esc_html__('Specify the aspect ratio for the media.', 'uncode') , "value" => array( esc_html__('Regular', 'uncode') => '', esc_html__('1:1', 'uncode') => 'one-one', esc_html__('4:3', 'uncode') => 'four-three', esc_html__('3:2', 'uncode') => 'three-two', esc_html__('16:9', 'uncode') => 'sixteen-nine', esc_html__('21:9', 'uncode') => 'twentyone-nine', esc_html__('3:4', 'uncode') => 'three-four', esc_html__('2:3', 'uncode') => 'two-three', esc_html__('9:16', 'uncode') => 'nine-sixteen', ) , 'group' => esc_html__('Aspect', 'uncode') , 'admin_label' => true, ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Alignment', 'uncode') , 'param_name' => 'alignment', 'value' => array( esc_html__('Align left', 'uncode') => '', esc_html__('Align right', 'uncode') => 'right', esc_html__('Align center', 'uncode') => 'center' ) , 'description' => esc_html__('Specify image alignment.', 'uncode') , "group" => esc_html__("Aspect", 'uncode') , ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Shape', 'uncode') , 'param_name' => 'shape', 'value' => array( esc_html__('Select…', 'uncode') => '', esc_html__('Rounded', 'uncode') => 'img-round', esc_html__('Circular', 'uncode') => 'img-circle' ) , 'description' => esc_html__('Specify media shape.', 'uncode') , "group" => esc_html__("Aspect", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Thumbnail border", 'uncode') , "param_name" => "border", "description" => 'Activate to have a border around like a thumbnail.', "group" => esc_html__("Aspect", 'uncode') , "value" => array( '' => 'yes' ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Shadow", 'uncode') , "param_name" => "shadow", "description" => 'Activate to have a shadow.', "group" => esc_html__("Aspect", 'uncode') , "value" => array( '' => 'yes' ) ) , array( "type" => 'checkbox', "heading" => esc_html__("Activate advanced preset", 'uncode') , "param_name" => "advanced", "description" => 'Activate if you want to have advanced options.', "group" => esc_html__("Aspect", 'uncode') , "value" => array( '' => 'yes' ) ) , array( 'type' => 'sorted_list', 'heading' => esc_html__('Media', 'uncode') , 'param_name' => 'media_items', 'description' => esc_html__('Control teasers look. Enable blocks and place them in desired order. Note: This setting can be overridden on post to post basis.', 'uncode') , 'value' => 'media', "group" => esc_html__("Advanced", 'uncode') , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , 'options' => array( array( 'media', esc_html__('Media', 'uncode') , array( array( 'original', esc_html__('Original', 'uncode') ) , array( 'poster', esc_html__('Poster', 'uncode') ) ) ) , array( 'icon', esc_html__('Icon', 'uncode') , ) , array( 'title', esc_html__('Title', 'uncode') , ) , array( 'caption', esc_html__('Caption', 'uncode') , ) , array( 'description', esc_html__('Description', 'uncode') , ) , array( 'spacer', esc_html__('Spacer', 'uncode') , array( array( 'half', esc_html__('0.5x', 'uncode') ) , array( 'one', esc_html__('1x', 'uncode') ) , array( 'two', esc_html__('2x', 'uncode') ) ) ) , array( 'sep-one', esc_html__('Separator One', 'uncode') , array( array( 'full', esc_html__('Full width', 'uncode') ) , array( 'reduced', esc_html__('Reduced width', 'uncode') ) ) ) , array( 'sep-two', esc_html__('Separator Two', 'uncode') , array( array( 'full', esc_html__('Full width', 'uncode') ) , array( 'reduced', esc_html__('Reduced width', 'uncode') ) ) ) , array( 'team-social', esc_html__('Team socials', 'uncode') , ) , ) ) , array( "type" => 'dropdown', "heading" => esc_html__("Block layout", 'uncode') , "param_name" => "media_text", "description" => esc_html__("Specify the text positioning inside the box.", 'uncode') , "value" => array( esc_html__('Content overlay', 'uncode') => 'overlay', esc_html__('Content under image', 'uncode') => 'under' ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , 'group' => esc_html__('Advanced', 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Skin", 'uncode') , "param_name" => "media_style", "description" => esc_html__("Specify the skin inside the content box.", 'uncode') , "value" => array( esc_html__('Light', 'uncode') => 'light', esc_html__('Dark', 'uncode') => 'dark' ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , 'group' => esc_html__('Advanced', 'uncode') , ) , array( "type" => "dropdown", "heading" => esc_html__("Background color", 'uncode') , "param_name" => "media_back_color", "description" => esc_html__("Specify a background color for the box.", 'uncode') , "value" => $uncode_colors, 'group' => esc_html__('Advanced', 'uncode') , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , ) , array( "type" => "dropdown", "heading" => esc_html__("Overlay color", 'uncode') , "param_name" => "media_overlay_color", "description" => esc_html__("Specify a background color for the box.", 'uncode') , "value" => $uncode_colors, 'group' => esc_html__('Advanced', 'uncode') , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Overlay coloration", 'uncode') , "param_name" => "media_overlay_coloration", "description" => wp_kses(__("Specify the coloration style for the overlay.<br />N.B. For the gradient you can't customize the overlay color.", 'uncode'), array( 'br' => array( ) ) ) , "value" => array( esc_html__('Fully colored', 'uncode') => '', esc_html__('Gradient top', 'uncode') => 'top_gradient', esc_html__('Gradient bottom', 'uncode') => 'bottom_gradient', ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , 'group' => esc_html__('Advanced', 'uncode') , ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Overlay opacity", 'uncode') , "param_name" => "media_overlay_opacity", "min" => 1, "max" => 100, "step" => 1, "value" => 50, "description" => esc_html__("Set the overlay opacity.", 'uncode') , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , 'group' => esc_html__('Advanced', 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Overlay text visibility", 'uncode') , "param_name" => "media_text_visible", "description" => esc_html__("Activate this to show the text as starting point.", 'uncode') , "value" => array( esc_html__('Hidden', 'uncode') => 'no', esc_html__('Visible', 'uncode') => 'yes', ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , "group" => esc_html__("Advanced", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Overlay text animation", 'uncode') , "param_name" => "media_text_anim", "description" => esc_html__("Activate this to animate the text on mouse over.", 'uncode') , "value" => array( esc_html__('Animated', 'uncode') => 'yes', esc_html__('Static', 'uncode') => 'no', ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , "group" => esc_html__("Advanced", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Overlay text animation type", 'uncode') , "param_name" => "media_text_anim_type", "description" => esc_html__("Specify the animation type.", 'uncode') , "value" => array( esc_html__('Opacity', 'uncode') => '', esc_html__('Bottom to top', 'uncode') => 'btt', ) , "group" => esc_html__("Advanced", 'uncode') , 'dependency' => array( 'element' => 'media_text_anim', 'value' => 'yes', ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Overlay visibility", 'uncode') , "param_name" => "media_overlay_visible", "description" => esc_html__("Activate this to show the overlay as starting point.", 'uncode') , "value" => array( esc_html__('Hidden', 'uncode') => 'no', esc_html__('Visible', 'uncode') => 'yes', ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , "group" => esc_html__("Advanced", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Overlay animation", 'uncode') , "param_name" => "media_overlay_anim", "description" => esc_html__("Activate this to animate the overlay on mouse over.", 'uncode') , "value" => array( esc_html__('Animated', 'uncode') => 'yes', esc_html__('Static', 'uncode') => 'no', ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , "group" => esc_html__("Advanced", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Image coloration", 'uncode') , "param_name" => "media_image_coloration", "description" => esc_html__("Specify the image coloration mode.", 'uncode') , "value" => array( esc_html__('Standard', 'uncode') => '', esc_html__('Desaturated', 'uncode') => 'desaturated', ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , "group" => esc_html__("Advanced", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Image coloration animation", 'uncode') , "param_name" => "media_image_color_anim", "description" => esc_html__("Activate this to animate the image coloration on mouse over.", 'uncode') , "value" => array( esc_html__('Static', 'uncode') => '', esc_html__('Animated', 'uncode') => 'yes', ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , "group" => esc_html__("Advanced", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Image animation", 'uncode') , "param_name" => "media_image_anim", "description" => esc_html__("Activate this to animate the image on mouse over.", 'uncode') , "value" => array( esc_html__('Animated', 'uncode') => 'yes', esc_html__('Static', 'uncode') => 'no', ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , "group" => esc_html__("Advanced", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Text horizontal alignment", 'uncode') , "param_name" => "media_h_align", "description" => esc_html__("Specify the horizontal alignment.", 'uncode') , "value" => array( esc_html__('Left', 'uncode') => 'left', esc_html__('Center', 'uncode') => 'center', esc_html__('Right', 'uncode') => 'right', esc_html__('Justify', 'uncode') => 'justify' ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , 'group' => esc_html__('Advanced', 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Content vertical position", 'uncode') , "param_name" => "media_v_position", "description" => esc_html__("Specify the text vertical position.", 'uncode') , "value" => array( esc_html__('Middle', 'uncode') => '', esc_html__('Top', 'uncode') => 'top', esc_html__('Bottom', 'uncode') => 'bottom' ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , 'group' => esc_html__('Advanced', 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Content dimension reduced", 'uncode') , "param_name" => "media_reduced", "description" => esc_html__("Specify the text reduction amount to shrink the overlay content dimension.", 'uncode') , "value" => array( esc_html__('100%', 'uncode') => '', esc_html__('75%', 'uncode') => 'three_quarter', esc_html__('50%', 'uncode') => 'half', ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , "group" => esc_html__("Advanced", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Content horizontal position", 'uncode') , "param_name" => "media_h_position", "description" => esc_html__("Specify the text horizontal position.", 'uncode') , "value" => array( esc_html__('Left', 'uncode') => 'left', esc_html__('Center', 'uncode') => 'center', esc_html__('Right', 'uncode') => 'right' ) , 'group' => esc_html__('Advanced', 'uncode') , 'dependency' => array( 'element' => 'media_reduced', 'not_empty' => true, ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Padding around text", 'uncode') , "param_name" => "media_padding", "min" => 0, "max" => 5, "step" => 1, "value" => 2, "description" => esc_html__("Set the text padding", 'uncode') , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , "group" => esc_html__("Advanced", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Reduce space between elements", 'uncode') , "param_name" => "media_text_reduced", "description" => esc_html__("Activate this to have less space between all the text elements inside the box.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , "group" => esc_html__("Advanced", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Multiple click areas", 'uncode') , "param_name" => "media_elements_click", "description" => esc_html__("Activate this to make every single elements clickable instead of the whole block (when available).", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Advanced", 'uncode') , 'dependency' => array( 'element' => 'media_text', 'value' => 'overlay', ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Title text transform", 'uncode') , "param_name" => "media_title_transform", "description" => esc_html__("Specify the title text transformation.", 'uncode') , "value" => array( esc_html__('Default CSS', 'uncode') => '', esc_html__('Uppercase', 'uncode') => 'uppercase', esc_html__('Lowercase', 'uncode') => 'lowercase', esc_html__('Capitalize', 'uncode') => 'capitalize' ) , "group" => esc_html__("Advanced", 'uncode') , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Title dimension", 'uncode') , "param_name" => "media_title_dimension", "description" => esc_html__("Specify the title dimension.", 'uncode') , "value" => $heading_size, "group" => esc_html__("Advanced", 'uncode') , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Title font family", 'uncode') , "param_name" => "media_title_family", "description" => esc_html__("Specify the title font family.", 'uncode') , "value" => $heading_font, 'std' => '', "group" => esc_html__("Advanced", 'uncode') , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Title font weight", 'uncode') , "param_name" => "media_title_weight", "description" => esc_html__("Specify the title font weight.", 'uncode') , "value" =>$heading_weight, 'std' => '', "group" => esc_html__("Advanced", 'uncode') , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Title line height", 'uncode') , "param_name" => "media_title_height", "description" => esc_html__("Specify the title line height.", 'uncode') , "value" => $heading_height, "group" => esc_html__("Advanced", 'uncode') , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Title letter spacing", 'uncode') , "param_name" => "media_title_space", "description" => esc_html__("Specify the title letter spacing.", 'uncode') , "value" => $heading_space, "group" => esc_html__("Advanced", 'uncode') , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , ) , array( 'type' => 'iconpicker', 'heading' => esc_html__('Icon', 'uncode') , 'param_name' => 'media_icon', 'description' => esc_html__('Specify icon from library.', 'uncode') , 'value' => '', 'settings' => array( 'emptyIcon' => true, // default true, display an "EMPTY" icon? 'iconsPerPage' => 1100, // default 100, how many icons per/page to display 'type' => 'uncode' ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes' ) , 'group' => esc_html__('Advanced', 'uncode') , ) , $add_css_animation, $add_animation_speed, $add_animation_delay, array( 'type' => 'dropdown', 'heading' => 'Skin', 'param_name' => 'lbox_skin', 'value' => array( esc_html__('Dark', 'uncode') => '', esc_html__('Light', 'uncode') => 'white', ) , 'description' => esc_html__('Specify the lightbox skin color.', 'uncode') , 'group' => esc_html__('Lightbox', 'uncode') , ) , array( 'type' => 'dropdown', 'heading' => 'Direction', 'param_name' => 'lbox_dir', 'value' => array( esc_html__('Horizontal', 'uncode') => '', esc_html__('Vertical', 'uncode') => 'vertical', ) , 'description' => esc_html__('Specify the lightbox sliding direction.', 'uncode') , 'group' => esc_html__('Lightbox', 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Title", 'uncode') , "param_name" => "lbox_title", "description" => esc_html__("Activate this to add the media title.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Caption", 'uncode') , "param_name" => "lbox_caption", "description" => esc_html__("Activate this to add the media caption.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Social", 'uncode') , "param_name" => "lbox_social", "description" => esc_html__("Activate this for the social sharing buttons.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Deeplinking", 'uncode') , "param_name" => "lbox_deep", "description" => esc_html__("Activate this for the deeplinking of every slide.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("No thumbnails", 'uncode') , "param_name" => "lbox_no_tmb", "description" => esc_html__("Activate this for not showing the thumbnails.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("No arrows", 'uncode') , "param_name" => "lbox_no_arrows", "description" => esc_html__("Activate this for not showing the navigation arrows.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Connect to other media in page", 'uncode') , "param_name" => "lbox_connected", "description" => esc_html__("Activate this to connect the lightbox with other medias in the same page with this option active.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Remove double tap", 'uncode') , "param_name" => "no_double_tap", "description" => esc_html__("Remove the double tap action on mobile.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , 'dependency' => array( 'element' => 'advanced', 'value' => 'yes', ) , "group" => esc_html__("Mobile", 'uncode') , ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', "group" => esc_html__("Extra", 'uncode') , 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) , ) )); /* Tabs ---------------------------------------------------------- */ $tab_id_1 = time() . '-1-' . rand(0, 100); $tab_id_2 = time() . '-2-' . rand(0, 100); vc_map(array( "name" => esc_html__('Tabs', 'uncode') , 'base' => 'vc_tabs', 'show_settings_on_create' => false, 'is_container' => true, 'icon' => 'fa fa-folder', 'category' => esc_html__('Content', 'uncode') , 'description' => esc_html__('Tabbed contents', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('Enter text which will be used as widget title. Leave blank if no title is needed.', 'uncode') ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Vertical tabs', 'uncode') , 'param_name' => 'vertical', 'description' => esc_html__('Specify checkbox to allow all sections to be collapsible.', 'uncode') , 'value' => array( esc_html__("Yes, please", 'uncode') => 'yes' ) ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) , 'custom_markup' => ' <div class="wpb_tabs_holder wpb_holder vc_container_for_children"> <ul class="tabs_controls"> </ul> %content% </div>', 'default_content' => ' [vc_tab title="' . esc_html__('Tab 1', 'uncode') . '" tab_id="' . $tab_id_1 . '"][/vc_tab] [vc_tab title="' . esc_html__('Tab 2', 'uncode') . '" tab_id="' . $tab_id_2 . '"][/vc_tab] ', 'js_view' => 'VcTabsView' )); vc_map(array( 'name' => esc_html__('Tab', 'uncode') , 'base' => 'vc_tab', 'allowed_container_element' => 'vc_row', 'is_container' => true, 'content_element' => false, 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('Tab title.', 'uncode') ) , array( 'type' => 'tab_id', 'heading' => esc_html__('Tab ID', 'uncode') , 'param_name' => "tab_id" ), array( 'type' => 'checkbox', 'heading' => esc_html__('Remove top margin', 'uncode') , 'param_name' => 'no_margin', 'description' => esc_html__('Activate this to remove the top margin.', 'uncode') , 'value' => array( esc_html__("Yes, please", 'uncode') => 'yes' ) ) , ) , 'js_view' => 'VcTabView' )); /* Accordion block ---------------------------------------------------------- */ vc_map(array( 'name' => esc_html__('Accordion', 'uncode') , 'base' => 'vc_accordion', 'show_settings_on_create' => false, 'is_container' => true, 'icon' => 'fa fa-indent', 'category' => esc_html__('Content', 'uncode') , 'description' => esc_html__('Collapsible panels', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('Enter text which will be used as widget title. Leave blank if no title is needed.', 'uncode') ) , array( 'type' => 'textfield', 'heading' => esc_html__('Active section', 'uncode') , 'param_name' => 'active_tab', 'description' => esc_html__('Enter section number to be active on load.', 'uncode') ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) , 'custom_markup' => ' <div class="wpb_accordion_holder wpb_holder clearfix vc_container_for_children"> %content% </div> <div class="tab_controls"> <a class="add_tab" title="' . esc_html__('Add section', 'uncode') . '"><span class="vc_icon"></span> <span class="tab-label">' . esc_html__('Add section', 'uncode') . '</span></a> </div> ', 'default_content' => ' [vc_accordion_tab title="' . esc_html__('Section 1', 'uncode') . '"][/vc_accordion_tab] [vc_accordion_tab title="' . esc_html__('Section 2', 'uncode') . '"][/vc_accordion_tab] ', 'js_view' => 'VcAccordionView' )); vc_map(array( 'name' => esc_html__('Section', 'uncode') , 'base' => 'vc_accordion_tab', 'allowed_container_element' => 'vc_row', 'is_container' => true, 'content_element' => false, 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('Accordion section title.', 'uncode') ) , ) , 'js_view' => 'VcAccordionTabView' )); /* Widgetised sidebar ---------------------------------------------------------- */ vc_map(array( 'name' => esc_html__('Widgetised Sidebar', 'uncode') , 'base' => 'vc_widget_sidebar', 'weight' => 70, 'class' => 'wpb_widget_sidebar_widget', 'icon' => 'fa fa-tags', 'category' => esc_html__('Structure', 'uncode') , 'description' => esc_html__('Place widgetised sidebar', 'uncode') , 'params' => array( array( 'type' => 'widgetised_sidebars', 'heading' => esc_html__('Sidebar', 'uncode') , 'param_name' => 'sidebar_id', 'description' => esc_html__('Specify which widget area output.', 'uncode'), 'admin_label' => true, ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); /* Button ---------------------------------------------------------- */ $icons_arr = array( esc_html__('None', 'uncode') => 'none', esc_html__('Address book icon', 'uncode') => 'wpb_address_book', esc_html__('Alarm clock icon', 'uncode') => 'wpb_alarm_clock', esc_html__('Anchor icon', 'uncode') => 'wpb_anchor', esc_html__('Application Image icon', 'uncode') => 'wpb_application_image', esc_html__('Arrow icon', 'uncode') => 'wpb_arrow', esc_html__('Asterisk icon', 'uncode') => 'wpb_asterisk', esc_html__('Hammer icon', 'uncode') => 'wpb_hammer', esc_html__('Balloon icon', 'uncode') => 'wpb_balloon', esc_html__('Balloon Buzz icon', 'uncode') => 'wpb_balloon_buzz', esc_html__('Balloon Facebook icon', 'uncode') => 'wpb_balloon_facebook', esc_html__('Balloon Twitter icon', 'uncode') => 'wpb_balloon_twitter', esc_html__('Battery icon', 'uncode') => 'wpb_battery', esc_html__('Binocular icon', 'uncode') => 'wpb_binocular', esc_html__('Document Excel icon', 'uncode') => 'wpb_document_excel', esc_html__('Document Image icon', 'uncode') => 'wpb_document_image', esc_html__('Document Music icon', 'uncode') => 'wpb_document_music', esc_html__('Document Office icon', 'uncode') => 'wpb_document_office', esc_html__('Document PDF icon', 'uncode') => 'wpb_document_pdf', esc_html__('Document Powerpoint icon', 'uncode') => 'wpb_document_powerpoint', esc_html__('Document Word icon', 'uncode') => 'wpb_document_word', esc_html__('Bookmark icon', 'uncode') => 'wpb_bookmark', esc_html__('Camcorder icon', 'uncode') => 'wpb_camcorder', esc_html__('Camera icon', 'uncode') => 'wpb_camera', esc_html__('Chart icon', 'uncode') => 'wpb_chart', esc_html__('Chart pie icon', 'uncode') => 'wpb_chart_pie', esc_html__('Clock icon', 'uncode') => 'wpb_clock', esc_html__('Fire icon', 'uncode') => 'wpb_fire', esc_html__('Heart icon', 'uncode') => 'wpb_heart', esc_html__('Mail icon', 'uncode') => 'wpb_mail', esc_html__('Play icon', 'uncode') => 'wpb_play', esc_html__('Shield icon', 'uncode') => 'wpb_shield', esc_html__('Video icon', 'uncode') => "wpb_video" ); vc_map(array( 'name' => esc_html__('Button', 'uncode') , 'base' => 'vc_button', 'weight' => 97, 'icon' => 'fa fa-external-link', 'php_class_name' => 'uncode_generic_admin', 'category' => esc_html__('Content', 'uncode') , 'description' => esc_html__('Button element', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Text', 'uncode') , 'admin_label' => true, 'param_name' => 'content', 'value' => esc_html__('Text on the button', 'uncode') , 'description' => esc_html__('Text on the button.', 'uncode') ) , array( 'type' => 'vc_link', 'heading' => esc_html__('URL (Link)', 'uncode') , 'param_name' => 'link', 'description' => esc_html__('Button link.', 'uncode') ) , array( "type" => "dropdown", "heading" => esc_html__("Button color", 'uncode') , "param_name" => "button_color", "description" => esc_html__("Specify button color.", 'uncode') , "value" => $uncode_colors, ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Size', 'uncode') , 'param_name' => 'size', 'value' => $size_arr, 'admin_label' => true, 'description' => esc_html__('Button size.', 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Shape", 'uncode') , "param_name" => "radius", "description" => esc_html__("You can shape the button with the corners round, squared or circle.", 'uncode') , "value" => array( esc_html__('Default', 'uncode') => '', esc_html__('Round', 'uncode') => 'btn-round', esc_html__('Circle', 'uncode') => 'btn-circle', esc_html__('Square', 'uncode') => 'btn-square' ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Border animation", 'uncode') , "param_name" => "border_animation", "description" => esc_html__("Specify a button border animation.", 'uncode') , "value" => array( esc_html__('None', 'uncode') => '', esc_html__('Ripple Out', 'uncode') => 'btn-ripple-out', esc_html__('Ripple In', 'uncode') => 'btn-ripple-in', ) , ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Fluid', 'uncode') , 'param_name' => 'wide', 'description' => esc_html__('Fluid buttons has 100% width.', 'uncode') , 'value' => array( esc_html__('Yes, please', 'uncode') => 'yes' ) ) , array( "type" => 'textfield', "heading" => esc_html__("Fixed width", 'uncode') , "param_name" => "width", "description" => esc_html__("Add a fixed width in pixel.", 'uncode') , 'dependency' => array( 'element' => 'wide', 'is_empty' => true, ) ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Use skin text color', 'uncode') , 'param_name' => 'text_skin', 'description' => esc_html__("Keep the text color as the skin. NB. This option is only available when the button color is chosen.", 'uncode') , 'value' => array( esc_html__('Yes, please', 'uncode') => 'yes' ), ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Outlined', 'uncode') , 'param_name' => 'outline', 'description' => esc_html__("Outlined buttons doesn't have a full background color.", 'uncode') , 'value' => array( esc_html__('Yes, please', 'uncode') => 'yes' ) ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Shadow', 'uncode') , 'param_name' => 'shadow', 'description' => esc_html__('Button shadow.', 'uncode') , 'value' => array( esc_html__('Yes, please', 'uncode') => 'yes' ) ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Italic text', 'uncode') , 'param_name' => 'Italic', 'description' => esc_html__('Button with italic text style.', 'uncode') , 'value' => array( esc_html__('Yes, please', 'uncode') => 'yes' ) ) , array( 'type' => 'iconpicker', 'heading' => esc_html__('Icon', 'uncode') , 'param_name' => 'icon', 'description' => esc_html__('Specify icon from library.', 'uncode') , 'settings' => array( 'emptyIcon' => true, // default true, display an "EMPTY" icon? 'iconsPerPage' => 1100, // default 100, how many icons per/page to display 'type' => 'uncode' ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Icon position", 'uncode') , "param_name" => "icon_position", "description" => esc_html__("Choose the position of the icon.", 'uncode') , "value" => array( esc_html__('Left', 'uncode') => 'left', esc_html__('Right', 'uncode') => 'right', ) , 'dependency' => array( 'element' => 'icon', 'not_empty' => true, ) ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Layout display', 'uncode') , 'param_name' => 'display', 'description' => esc_html__('Specify the display mode.', 'uncode') , "value" => array( esc_html__('Block', 'uncode') => '', esc_html__('Inline', 'uncode') => 'inline', ) , ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Margin top', 'uncode') , 'param_name' => 'top_margin', 'description' => esc_html__('Activate to add the top margin.', 'uncode') , 'value' => array( esc_html__('Yes, please', 'uncode') => 'yes' ) , 'dependency' => array( 'element' => 'display', 'not_empty' => true, ) ) , array( 'type' => 'textfield', 'heading' => esc_html__('Rel attribute', 'uncode') , 'param_name' => 'rel', 'description' => wp_kses(__('Here you can add value for the rel attribute.<br>Example values: <b%value>nofollow</b>, <b%value>lightbox</b>.', 'uncode'), array( 'br' => array( ),'b' => array( ) ) ) ) , array( 'type' => 'textfield', 'heading' => esc_html__('onClick', 'uncode') , 'param_name' => 'onclick', 'description' => esc_html__('Advanced JavaScript code for onClick action.', 'uncode') ) , array( 'type' => 'media_element', 'heading' => esc_html__('Media lightbox', 'uncode') , 'param_name' => 'media_lightbox', 'description' => esc_html__('Specify a media from the lightbox.', 'uncode') , ) , $add_css_animation, $add_animation_speed, $add_animation_delay, array( 'type' => 'dropdown', 'heading' => 'Skin', 'param_name' => 'lbox_skin', 'value' => array( esc_html__('Dark', 'uncode') => '', esc_html__('Light', 'uncode') => 'white', ) , 'description' => esc_html__('Specify the lightbox skin color.', 'uncode') , 'group' => esc_html__('Lightbox', 'uncode') , 'dependency' => array( 'element' => 'media_lightbox', 'not_empty' => true, ) ) , array( 'type' => 'dropdown', 'heading' => 'Direction', 'param_name' => 'lbox_dir', 'value' => array( esc_html__('Horizontal', 'uncode') => '', esc_html__('Vertical', 'uncode') => 'vertical', ) , 'description' => esc_html__('Specify the lightbox sliding direction.', 'uncode') , 'group' => esc_html__('Lightbox', 'uncode') , 'dependency' => array( 'element' => 'media_lightbox', 'not_empty' => true, ) ) , array( "type" => 'checkbox', "heading" => esc_html__("Title", 'uncode') , "param_name" => "lbox_title", "description" => esc_html__("Activate this to add the media title.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , 'dependency' => array( 'element' => 'media_lightbox', 'not_empty' => true, ) ) , array( "type" => 'checkbox', "heading" => esc_html__("Caption", 'uncode') , "param_name" => "lbox_caption", "description" => esc_html__("Activate this to add the media caption.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , 'dependency' => array( 'element' => 'media_lightbox', 'not_empty' => true, ) ) , array( "type" => 'checkbox', "heading" => esc_html__("Social", 'uncode') , "param_name" => "lbox_social", "description" => esc_html__("Activate this for the social sharing buttons.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , 'dependency' => array( 'element' => 'media_lightbox', 'not_empty' => true, ) ) , array( "type" => 'checkbox', "heading" => esc_html__("Deeplinking", 'uncode') , "param_name" => "lbox_deep", "description" => esc_html__("Activate this for the deeplinking of every slide.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , 'dependency' => array( 'element' => 'media_lightbox', 'not_empty' => true, ) ) , array( "type" => 'checkbox', "heading" => esc_html__("No thumbnails", 'uncode') , "param_name" => "lbox_no_tmb", "description" => esc_html__("Activate this for not showing the thumbnails.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , 'dependency' => array( 'element' => 'media_lightbox', 'not_empty' => true, ) ) , array( "type" => 'checkbox', "heading" => esc_html__("No arrows", 'uncode') , "param_name" => "lbox_no_arrows", "description" => esc_html__("Activate this for not showing the navigation arrows.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , 'dependency' => array( 'element' => 'media_lightbox', 'not_empty' => true, ) ) , array( "type" => 'checkbox', "heading" => esc_html__("Connect to other media in page", 'uncode') , "param_name" => "lbox_connected", "description" => esc_html__("Activate this to connect the lightbox with other medias in the same page with this option active.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("Lightbox", 'uncode') , 'dependency' => array( 'element' => 'media_lightbox', 'not_empty' => true, ) ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'group' => esc_html__('Extra', 'uncode') , 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) , 'js_view' => 'VcButtonView' )); /* Google maps element ---------------------------------------------------------- */ vc_map(array( 'name' => esc_html__('Google Maps', 'uncode') , 'base' => 'vc_gmaps', 'weight' => 85, 'icon' => 'fa fa-map-marker', 'category' => esc_html__('Content', 'uncode') , 'description' => esc_html__('Map block', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('Enter text which will be used as widget title. Leave blank if no title is needed.', 'uncode') ) , array( 'type' => 'textfield', 'heading' => esc_html__('Latitude, Longitude', 'uncode') , 'param_name' => 'latlon', 'description' => sprintf(wp_kses(__('To extract the Latitude and Longitude of your address, follow the instructions %s. 1) Use the directions under the section "Get the coordinates of a place" 2) Copy the coordinates 3) Paste the coordinates in the field with the "comma" sign.', 'uncode'), array( 'a' => array( 'href' => array(),'target' => array() ) ) ) , '<a href="https://support.google.com/maps/answer/18539?source=gsearch&hl=en" target="_blank">here</a>') ) , array( 'type' => 'textfield', 'heading' => esc_html__('Map height', 'uncode') , 'param_name' => 'size', 'admin_label' => true, 'description' => esc_html__('Enter map height in pixels. Example: 200 or leave it empty to make map responsive (in this case you need to declare a minimun height for the row and the column equal height or expanded).', 'uncode') ) , array( 'type' => 'textarea_safe', 'heading' => esc_html__('Address', 'uncode') , 'param_name' => 'address', 'description' => esc_html__('Insert here the address in case you want it to be display on the bottom of the map.', 'uncode') , ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Map color', 'uncode') , 'param_name' => 'map_color', 'value' => $uncode_colors, 'description' => esc_html__('Specify the map base color.', 'uncode') , //'admin_label' => true, 'param_holder_class' => 'vc_colored-dropdown' ) , array( 'type' => 'dropdown', 'heading' => esc_html__('UI color', 'uncode') , 'param_name' => 'ui_color', 'value' => $uncode_colors, 'description' => esc_html__('Specify the UI color.', 'uncode') , //'admin_label' => true, 'param_holder_class' => 'vc_colored-dropdown' ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Zoom", 'uncode') , "param_name" => "zoom", "min" => 0, "max" => 19, "step" => 1, "value" => 14, "description" => esc_html__("Set map zoom level.", 'uncode') , ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Saturation", 'uncode') , "param_name" => "map_saturation", "min" => - 100, "max" => 100, "step" => 1, "value" => - 20, "description" => esc_html__("Set map color saturation.", 'uncode') , ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Brightness", 'uncode') , "param_name" => "map_brightness", "min" => - 100, "max" => 100, "step" => 1, "value" => 5, "description" => esc_html__("Set map color brightness.", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Mobile no draggable", 'uncode') , "param_name" => "mobile_no_drag", "description" => esc_html__("Deactivate the drag function on mobile devices.", 'uncode') , 'group' => esc_html__('Mobile', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'group' => esc_html__('Extra', 'uncode') , 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); /* Raw HTML ---------------------------------------------------------- */ vc_map(array( 'name' => esc_html__('Raw HTML', 'uncode') , 'base' => 'vc_raw_html', 'icon' => 'fa fa-code', 'category' => esc_html__('Structure', 'uncode') , 'wrapper_class' => 'clearfix', 'description' => esc_html__('Output raw html code', 'uncode') , 'params' => array( array( 'type' => 'textarea_raw_html', 'holder' => 'div', 'heading' => esc_html__('Raw HTML', 'uncode') , 'param_name' => 'content', 'value' => base64_encode('<p>I am raw html block.<br/>Click edit button to change this html</p>') , 'description' => esc_html__('Enter your HTML content.', 'uncode') ) , ) )); /* Raw JS ---------------------------------------------------------- */ vc_map(array( 'name' => esc_html__('Raw JS', 'uncode') , 'base' => 'vc_raw_js', 'icon' => 'fa fa-code', 'category' => esc_html__('Structure', 'uncode') , 'wrapper_class' => 'clearfix', 'description' => esc_html__('Output raw JavaScript code', 'uncode') , 'params' => array( array( 'type' => 'textarea_raw_html', 'holder' => 'div', 'heading' => esc_html__('Raw js', 'uncode') , 'param_name' => 'content', 'value' => esc_html__(base64_encode('<script type="text/javascript"> alert("Enter your js here!" ); </script>') , 'uncode') , 'description' => esc_html__('Enter your JS code.', 'uncode') ) , ) )); /* Flickr ---------------------------------------------------------- */ vc_map(array( 'base' => 'vc_flickr', 'name' => esc_html__('Flickr Widget', 'uncode') , 'icon' => 'fa fa-flickr', 'category' => esc_html__('Content', 'uncode') , 'description' => esc_html__('Image feed from Flickr', 'uncode') , "params" => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('Enter text which will be used as widget title. Leave blank if no title is needed.', 'uncode') ) , array( 'type' => 'textfield', 'heading' => esc_html__('Flickr ID', 'uncode') , 'param_name' => 'flickr_id', 'admin_label' => true, 'description' => sprintf(wp_kses(__('To find your flickID visit %s.', 'uncode'), array( 'a' => array( 'href' => array(),'target' => array() ) ) ) , '<a href="http://idgettr.com/" target="_blank">idGettr</a>') ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Number of photos', 'uncode') , 'param_name' => 'count', 'value' => array( 9, 8, 7, 6, 5, 4, 3, 2, 1 ) , 'description' => esc_html__('Number of photos.', 'uncode') ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Type', 'uncode') , 'param_name' => 'type', 'value' => array( esc_html__('User', 'uncode') => 'user', esc_html__('Group', 'uncode') => 'group' ) , 'description' => esc_html__('Photo stream type.', 'uncode') ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Display', 'uncode') , 'param_name' => 'display', 'value' => array( esc_html__('Latest', 'uncode') => 'latest', esc_html__('Random', 'uncode') => 'random' ) , 'description' => esc_html__('Photo order.', 'uncode') ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); /** * Pie chart */ vc_map(array( 'name' => esc_html__('Pie chart', 'vc_extend') , 'base' => 'vc_pie', 'class' => '', 'icon' => 'fa fa-pie-chart', 'category' => esc_html__('Content', 'uncode') , 'description' => esc_html__('Animated pie chart', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('Enter text which will be used as widget title. Leave blank if no title is needed.', 'uncode') , 'admin_label' => true ) , array( 'type' => 'textfield', 'heading' => esc_html__('Pie value', 'uncode') , 'param_name' => 'value', 'description' => esc_html__('Input graph value here. Choose range between 0 and 100.', 'uncode') , 'value' => '50', 'admin_label' => true ) , array( 'type' => 'textfield', 'heading' => esc_html__('Pie label value', 'uncode') , 'param_name' => 'label_value', 'description' => esc_html__('Input integer value for label. If empty "Pie value" will be used.', 'uncode') , 'value' => '' ) , array( 'type' => 'textfield', 'heading' => esc_html__('Units', 'uncode') , 'param_name' => 'units', 'description' => esc_html__('Enter measurement units (if needed) Eg. %, px, points, etc. Graph value and unit will be appended to the graph title.', 'uncode') ) , array( "type" => "type_numeric_slider", "heading" => esc_html__("Circle thickness", 'uncode') , "param_name" => "arc_width", "min" => 1, "max" => 30, "step" => 1, "value" => 5, "description" => esc_html__("Set the circle thickness.", 'uncode') , ) , array( 'type' => 'iconpicker', 'heading' => esc_html__('Icon', 'uncode') , 'param_name' => 'icon', 'description' => esc_html__('Specify icon from library.', 'uncode') , 'value' => '', 'admin_label' => true, 'settings' => array( 'emptyIcon' => true, 'iconsPerPage' => 1100, 'type' => 'uncode' ) , ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Bar color', 'uncode') , 'param_name' => 'bar_color', 'value' => $uncode_colors, 'description' => esc_html__('Specify pie chart color.', 'uncode') , ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Coloring icon', 'uncode') , 'param_name' => 'col_icon', 'value' => array( esc_html__('Yes, please', 'uncode') => 'yes' ) ) , $add_css_animation, $add_animation_speed, $add_animation_delay, array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) , ) )); /* Graph ---------------------------------------------------------- */ vc_map(array( 'name' => esc_html__('Progress Bar', 'uncode') , 'base' => 'vc_progress_bar', 'icon' => 'fa fa-tasks', 'category' => esc_html__('Content', 'uncode') , 'description' => esc_html__('Animated progress bar', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('Enter text which will be used as widget title. Leave blank if no title is needed.', 'uncode') ) , array( 'type' => 'param_group', 'heading' => esc_html__('Graphic values', 'uncode') , 'param_name' => 'values', 'description' => esc_html__( 'Enter values for graph - value, title and color.', 'uncode' ), 'value' => urlencode( json_encode( array( array( 'label' => esc_html__( 'Development', 'uncode' ), 'value' => '90', ), array( 'label' => esc_html__( 'Design', 'uncode' ), 'value' => '80', ), array( 'label' => esc_html__( 'Marketing', 'uncode' ), 'value' => '70', ), ) ) ), 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__( 'Label', 'uncode' ), 'param_name' => 'label', 'description' => esc_html__( 'Enter text used as title of bar.', 'uncode' ), 'admin_label' => true, ), array( 'type' => 'textfield', 'heading' => esc_html__( 'Value', 'uncode' ), 'param_name' => 'value', 'description' => esc_html__( 'Enter value of bar.', 'uncode' ), 'admin_label' => true, ), array( 'type' => 'dropdown', 'heading' => esc_html__('Bar color', 'uncode') , 'param_name' => 'bar_color', 'value' => $flat_uncode_colors, 'admin_label' => true, 'description' => esc_html__('Specify bar color.', 'uncode') , ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Background color', 'uncode') , 'param_name' => 'back_color', 'value' => $flat_uncode_colors, 'admin_label' => true, 'description' => esc_html__('Specify bar background color.', 'uncode') , ) , ), ), array( 'type' => 'textfield', 'heading' => esc_html__('Units', 'uncode') , 'param_name' => 'units', 'description' => esc_html__('Enter measurement units (if needed) Eg. %, px, points, etc. Graph value and unit will be appended to the graph title.', 'uncode') ) , $add_css_animation, $add_animation_speed, $add_animation_delay, array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); /* Support for 3rd Party plugins ---------------------------------------------------------- */ // Contact form 7 plugin include_once (ABSPATH . 'wp-admin/includes/plugin.php'); // Require plugin.php to use is_plugin_active() below if (is_plugin_active('contact-form-7/wp-contact-form-7.php')) { global $wpdb; $cf7 = $wpdb->get_results(" SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'wpcf7_contact_form' "); $contact_forms = array(esc_html__('Select a form…','uncode') => 0); if ($cf7) { foreach ($cf7 as $cform) { $contact_forms[$cform->post_title] = $cform->ID; } } else { $contact_forms[esc_html__('No contact forms found', 'uncode') ] = 0; } vc_map(array( 'base' => 'contact-form-7', 'name' => esc_html__('Contact Form 7', 'uncode') , 'icon' => 'fa fa-envelope', 'category' => esc_html__('Content', 'uncode') , 'description' => esc_html__('Place Contact Form7', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Form title', 'uncode') , 'param_name' => 'title', 'admin_label' => true, 'description' => esc_html__('What text use as form title. Leave blank if no title is needed.', 'uncode') ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Specify contact form', 'uncode') , 'param_name' => 'id', 'value' => $contact_forms, 'description' => esc_html__('Choose previously created contact form from the drop down list.', 'uncode') ), $add_css_animation, $add_animation_speed, $add_animation_delay, ) )); } // if contact form7 plugin active /* WordPress default Widgets (Appearance->Widgets) ---------------------------------------------------------- */ vc_map(array( 'name' => 'WP ' . esc_html__("Search", 'uncode') , 'base' => 'vc_wp_search', 'icon' => 'fa fa-wordpress', 'category' => esc_html__('WordPress Widgets', 'uncode') , 'class' => 'wpb_vc_wp_widget', 'weight' => - 50, 'description' => esc_html__('A search form for your site', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('What text use as a widget title. Leave blank to use default widget title.', 'uncode') ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Live search', 'uncode') , 'param_name' => 'live_search', 'value' => array( esc_html__('Yes, please', 'uncode') => 'yes' ) ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); vc_map(array( 'name' => 'WP ' . esc_html__('Meta', 'uncode') , 'base' => 'vc_wp_meta', 'icon' => 'fa fa-wordpress', 'category' => esc_html__('WordPress Widgets', 'uncode') , 'class' => 'wpb_vc_wp_widget', 'weight' => - 50, 'description' => esc_html__('Log in/out, admin, feed and WordPress links', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('What text use as a widget title. Leave blank to use default widget title.', 'uncode') ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); vc_map(array( 'name' => 'WP ' . esc_html__('Recent Comments', 'uncode') , 'base' => 'vc_wp_recentcomments', 'icon' => 'fa fa-wordpress', 'category' => esc_html__('WordPress Widgets', 'uncode') , 'class' => 'wpb_vc_wp_widget', 'weight' => - 50, 'description' => esc_html__('The most recent comments', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('What text use as a widget title. Leave blank to use default widget title.', 'uncode') ) , array( 'type' => 'textfield', 'heading' => esc_html__('Number of comments to show', 'uncode') , 'param_name' => 'number', 'admin_label' => true ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); vc_map(array( 'name' => 'WP ' . esc_html__('Calendar', 'uncode') , 'base' => 'vc_wp_calendar', 'icon' => 'fa fa-wordpress', 'category' => esc_html__('WordPress Widgets', 'uncode') , 'class' => 'wpb_vc_wp_widget', 'weight' => - 50, 'description' => esc_html__('A calendar of your sites posts', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('What text use as a widget title. Leave blank to use default widget title.', 'uncode') ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); vc_map(array( 'name' => 'WP ' . esc_html__('Pages', 'uncode') , 'base' => 'vc_wp_pages', 'icon' => 'fa fa-wordpress', 'category' => esc_html__('WordPress Widgets', 'uncode') , 'class' => 'wpb_vc_wp_widget', 'weight' => - 50, 'description' => esc_html__('Your sites WordPress Pages', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('What text use as a widget title. Leave blank to use default widget title.', 'uncode') ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Sort by', 'uncode') , 'param_name' => 'sortby', 'value' => array( esc_html__('Page title', 'uncode') => 'post_title', esc_html__('Page order', 'uncode') => 'menu_order', esc_html__('Page ID', 'uncode') => 'ID' ) , 'admin_label' => true ) , array( 'type' => 'textfield', 'heading' => esc_html__('Exclude', 'uncode') , 'param_name' => 'exclude', 'description' => esc_html__('Page IDs, separated by commas.', 'uncode') , 'admin_label' => true ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); $tag_taxonomies = array(); foreach (get_taxonomies() as $taxonomy) { $tax = get_taxonomy($taxonomy); if (!$tax->show_tagcloud || empty($tax->labels->name)) { continue; } $tag_taxonomies[$tax->labels->name] = esc_attr($taxonomy); } vc_map(array( 'name' => 'WP ' . esc_html__('Tag Cloud', 'uncode') , 'base' => 'vc_wp_tagcloud', 'icon' => 'fa fa-wordpress', 'category' => esc_html__('WordPress Widgets', 'uncode') , 'class' => 'wpb_vc_wp_widget', 'weight' => - 50, 'description' => esc_html__('Your most used tags in cloud format', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('What text use as a widget title. Leave blank to use default widget title.', 'uncode') ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Taxonomy', 'uncode') , 'param_name' => 'taxonomy', 'value' => $tag_taxonomies, 'admin_label' => true ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); $custom_menus = array(esc_html__('Select…','uncode') => ''); $menus = get_terms('nav_menu', array( 'hide_empty' => false )); if (is_array($menus)) { foreach ($menus as $single_menu) { $custom_menus[$single_menu->name] = $single_menu->term_id; } } vc_map(array( 'name' => 'WP ' . esc_html__("Custom Menu", 'uncode') , 'base' => 'vc_wp_custommenu', 'icon' => 'fa fa-wordpress', 'category' => esc_html__('WordPress Widgets', 'uncode') , 'class' => 'wpb_vc_wp_widget', 'weight' => - 50, 'description' => esc_html__('Use this widget to add one of your custom menus as a widget', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('What text use as a widget title. Leave blank to use default widget title.', 'uncode') ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Menu', 'uncode') , 'param_name' => 'nav_menu', 'value' => $custom_menus, 'description' => empty($custom_menus) ? esc_html__('Custom menus not found. Please visit <b>Appearance > Menus</b> page to create new menu.', 'uncode') : esc_html__('Specify menu', 'uncode') , 'admin_label' => true ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Horizontal menu', 'uncode') , 'param_name' => 'nav_menu_horizontal', 'value' => array( esc_html__('Yes, please', 'uncode') => true ) ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); vc_map(array( 'name' => 'WP ' . esc_html__('Text', 'uncode') , 'base' => 'vc_wp_text', 'icon' => 'fa fa-wordpress', 'category' => esc_html__('WordPress Widgets', 'uncode') , 'class' => 'wpb_vc_wp_widget', 'weight' => - 50, 'description' => esc_html__('Arbitrary text or HTML', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('What text use as a widget title. Leave blank to use default widget title.', 'uncode') ) , array( 'type' => 'textarea', 'heading' => esc_html__('Text', 'uncode') , 'param_name' => 'content', ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); vc_map(array( 'name' => 'WP ' . esc_html__('Recent Posts', 'uncode') , 'base' => 'vc_wp_posts', 'icon' => 'fa fa-wordpress', 'category' => esc_html__('WordPress Widgets', 'uncode') , 'class' => 'wpb_vc_wp_widget', 'weight' => - 50, 'description' => esc_html__('The most recent posts on your site', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('What text use as a widget title. Leave blank to use default widget title.', 'uncode') ) , array( 'type' => 'textfield', 'heading' => esc_html__('Number of posts to show', 'uncode') , 'param_name' => 'number', 'admin_label' => true ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Display post date?', 'uncode') , 'param_name' => 'show_date', 'value' => array( esc_html__('Yes, please', 'uncode') => true ) ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); $link_category = array( esc_html__('All Links', 'uncode') => '' ); $link_cats = get_terms('link_category'); if (is_array($link_cats)) { foreach ($link_cats as $link_cat) { $link_category[$link_cat->name] = $link_cat->term_id; } } vc_map(array( 'name' => 'WP ' . esc_html__('Links', 'uncode') , 'base' => 'vc_wp_links', 'icon' => 'fa fa-wordpress', 'category' => esc_html__('WordPress Widgets', 'uncode') , 'class' => 'wpb_vc_wp_widget', 'weight' => -50, 'description' => esc_html__('Your blogroll', 'uncode') , 'params' => array( array( 'type' => 'dropdown', 'heading' => esc_html__('Link Category', 'uncode') , 'param_name' => 'category', 'value' => $link_category, 'admin_label' => true ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Sort by', 'uncode') , 'param_name' => 'orderby', 'value' => array( esc_html__('Link title', 'uncode') => 'name', esc_html__('Link rating', 'uncode') => 'rating', esc_html__('Link ID', 'uncode') => 'id', esc_html__('Random', 'uncode') => 'rand' ) ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Options', 'uncode') , 'param_name' => 'options', 'value' => array( esc_html__('Show Link Image', 'uncode') => 'images', esc_html__('Show Link Name', 'uncode') => 'name', esc_html__('Show Link Description', 'uncode') => 'description', esc_html__('Show Link Rating', 'uncode') => 'rating' ) ) , array( 'type' => 'textfield', 'heading' => esc_html__('Number of links to show', 'uncode') , 'param_name' => 'limit' ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); vc_map(array( 'name' => 'WP ' . esc_html__('Categories', 'uncode') , 'base' => 'vc_wp_categories', 'icon' => 'fa fa-wordpress', 'category' => esc_html__('WordPress Widgets', 'uncode') , 'class' => 'wpb_vc_wp_widget', 'weight' => - 50, 'description' => esc_html__('A list or dropdown of categories', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('What text use as a widget title. Leave blank to use default widget title.', 'uncode') ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Options', 'uncode') , 'param_name' => 'options', 'value' => array( esc_html__('Display as dropdown', 'uncode') => 'dropdown', esc_html__('Show post counts', 'uncode') => 'count', esc_html__('Show hierarchy', 'uncode') => 'hierarchical' ) ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); vc_map(array( 'name' => 'WP ' . esc_html__('Archives', 'uncode') , 'base' => 'vc_wp_archives', 'icon' => 'fa fa-wordpress', 'category' => esc_html__('WordPress Widgets', 'uncode') , 'class' => 'wpb_vc_wp_widget', 'weight' => - 50, 'description' => esc_html__('A monthly archive of your sites posts', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('What text use as a widget title. Leave blank to use default widget title.', 'uncode') ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Options', 'uncode') , 'param_name' => 'options', 'value' => array( esc_html__('Display as dropdown', 'uncode') => 'dropdown', esc_html__('Show post counts', 'uncode') => 'count' ) ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); vc_map(array( 'name' => 'WP ' . esc_html__('RSS', 'uncode') , 'base' => 'vc_wp_rss', 'icon' => 'fa fa-wordpress', 'category' => esc_html__('WordPress Widgets', 'uncode') , 'class' => 'wpb_vc_wp_widget', 'weight' => - 50, 'description' => esc_html__('Entries from any RSS or Atom feed', 'uncode') , 'params' => array( array( 'type' => 'textfield', 'heading' => esc_html__('Widget title', 'uncode') , 'param_name' => 'title', 'description' => esc_html__('What text use as a widget title. Leave blank to use default widget title.', 'uncode') ) , array( 'type' => 'textfield', 'heading' => esc_html__('RSS feed URL', 'uncode') , 'param_name' => 'url', 'description' => esc_html__('Enter the RSS feed URL.', 'uncode') , 'admin_label' => true ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Items', 'uncode') , 'param_name' => 'items', 'value' => array( esc_html__('10 - Default', 'uncode') => '', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ) , 'description' => esc_html__('How many items would you like to display?', 'uncode') , 'admin_label' => true ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Options', 'uncode') , 'param_name' => 'options', 'value' => array( esc_html__('Display item content?', 'uncode') => 'show_summary', esc_html__('Display item author if available?', 'uncode') => 'show_author', esc_html__('Display item date?', 'uncode') => 'show_date' ) ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) ) )); /* Empty Space Element ---------------------------------------------------------- */ vc_map(array( 'name' => esc_html__('Empty Space', 'uncode') , 'base' => 'vc_empty_space', 'icon' => 'fa fa-arrows-v', 'weight' => 83, 'show_settings_on_create' => true, 'category' => esc_html__('Content', 'uncode') , 'description' => esc_html__('Vertical spacer', 'uncode') , 'params' => array( array( "type" => "type_numeric_slider", "heading" => esc_html__("Height", 'uncode') , "param_name" => "empty_h", "min" => 0, "max" => 5, "step" => 1, "value" => 2, "description" => esc_html__("Set the empty space height.", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Desktop", 'uncode') , "param_name" => "desktop_visibility", "description" => esc_html__("Choose the visibiliy of the element in desktop layout mode (960px >).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Tablet", 'uncode') , "param_name" => "medium_visibility", "description" => esc_html__("Choose the visibiliy of the element in tablet layout mode (570px > < 960px).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Mobile", 'uncode') , "param_name" => "mobile_visibility", "description" => esc_html__("Choose the visibiliy of the element in mobile layout mode (< 570px).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') , 'group' => esc_html__('Extra', 'uncode') , ) , ) , )); /* Custom Heading element ----------------------------------------------------------- */ vc_map(array( 'name' => esc_html__('Heading', 'uncode') , 'base' => 'vc_custom_heading', 'icon' => 'fa fa-header', 'php_class_name' => 'uncode_generic_admin', 'weight' => 100, 'show_settings_on_create' => true, 'category' => esc_html__('Content', 'uncode') , 'shortcode' => true, 'description' => esc_html__('Text heading', 'uncode') , 'params' => array( array( 'type' => 'textarea_html', 'heading' => esc_html__('Heading text', 'uncode') , 'param_name' => 'content', 'admin_label' => true, 'value' => esc_html__('This is a custom heading element.', 'uncode') , //'description' => esc_html__('Enter your content. If you are using non-latin characters be sure to activate them under Settings/Visual Composer/General Settings.', 'uncode') , 'group' => esc_html__('General', 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Automatic heading text", 'uncode') , "param_name" => "auto_text", "description" => esc_html__("Activate this to pull automatic text content when used as heading for categories.", 'uncode') , 'group' => esc_html__('General', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'dropdown', "heading" => esc_html__("Element semantic", 'uncode') , "param_name" => "heading_semantic", "description" => esc_html__("Specify element tag.", 'uncode') , "value" => $heading_semantic, 'std' => 'h2', 'group' => esc_html__('General', 'uncode') ) , array( "type" => 'dropdown', "heading" => esc_html__("Text size", 'uncode') , "param_name" => "text_size", "description" => esc_html__("Specify text size.", 'uncode') , 'std' => 'h2', "value" => $heading_size, 'group' => esc_html__('General', 'uncode') ) , array( "type" => 'dropdown', "heading" => esc_html__("Text line height", 'uncode') , "param_name" => "text_height", "description" => esc_html__("Specify text line height.", 'uncode') , "value" => $heading_height, 'group' => esc_html__('General', 'uncode') ) , array( "type" => 'dropdown', "heading" => esc_html__("Text letter spacing", 'uncode') , "param_name" => "text_space", "description" => esc_html__("Specify letter spacing.", 'uncode') , "value" => $heading_space, 'group' => esc_html__('General', 'uncode') ) , array( "type" => 'dropdown', "heading" => esc_html__("Text font family", 'uncode') , "param_name" => "text_font", "description" => esc_html__("Specify text font family.", 'uncode') , "value" => $heading_font, 'std' => '', "group" => esc_html__("General", 'uncode') , ) , array( "type" => 'dropdown', "heading" => esc_html__("Text weight", 'uncode') , "param_name" => "text_weight", "description" => esc_html__("Specify text weight.", 'uncode') , "value" => $heading_weight, 'std' => '', 'group' => esc_html__('General', 'uncode') ) , array( "type" => 'dropdown', "heading" => esc_html__("Text transform", 'uncode') , "param_name" => "text_transform", "description" => esc_html__("Specify the heading text transformation.", 'uncode') , "value" => array( esc_html__('Default CSS', 'uncode') => '', esc_html__('Uppercase', 'uncode') => 'uppercase', esc_html__('Lowercase', 'uncode') => 'lowercase', esc_html__('Capitalize', 'uncode') => 'capitalize' ) , "group" => esc_html__("General", 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Text italic", 'uncode') , "param_name" => "text_italic", "description" => esc_html__("Transform the text to italic.", 'uncode') , "value" => Array( '' => 'yes' ) , "group" => esc_html__("General", 'uncode') ) , array( "type" => "dropdown", "heading" => esc_html__("Text color", 'uncode') , "param_name" => "text_color", "description" => esc_html__("Specify text color.", 'uncode') , "value" => $uncode_colors, 'group' => esc_html__('General', 'uncode') ) , array( "type" => "dropdown", "heading" => esc_html__("Separator", 'uncode') , "param_name" => "separator", "description" => esc_html__("Activate the separator. This will appear under the text.", 'uncode') , "value" => array( esc_html__('None', 'uncode') => '', esc_html__('Under heading', 'uncode') => 'yes', esc_html__('Under subheading', 'uncode') => 'under', esc_html__('Over heading', 'uncode') => 'over' ) , "group" => esc_html__("General", 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Separator colored", 'uncode') , "param_name" => "separator_color", "description" => esc_html__("Color the separator with the accent color.", 'uncode') , "value" => Array( '' => 'yes' ) , 'dependency' => array( 'element' => 'separator', 'not_empty' => true, ) , "group" => esc_html__("General", 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Separator double space", 'uncode') , "param_name" => "separator_double", "description" => esc_html__("Activate to increase the separator space.", 'uncode') , "value" => Array( '' => 'yes' ) , 'dependency' => array( 'element' => 'separator', 'not_empty' => true, ) , "group" => esc_html__("General", 'uncode') ) , array( 'type' => 'textarea', 'heading' => esc_html__('Subheading', 'uncode') , "param_name" => "subheading", "description" => esc_html__("Add a subheading text.", 'uncode') , "group" => esc_html__("General", 'uncode') , 'admin_label' => true, ) , array( "type" => 'checkbox', "heading" => esc_html__("Text lead", 'uncode') , "param_name" => "sub_lead", "description" => esc_html__("Transform the text to leading.", 'uncode') , "value" => Array( '' => 'yes' ) , "group" => esc_html__("General", 'uncode') ) , array( "type" => 'checkbox', "heading" => esc_html__("Reduce subheading top space", 'uncode') , "param_name" => "sub_reduced", "description" => esc_html__("Activate this to reduce the subheading top margin.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , "group" => esc_html__("General", 'uncode') , ) , array( "type" => 'checkbox', "heading" => esc_html__("Desktop", 'uncode') , "param_name" => "desktop_visibility", "description" => esc_html__("Choose the visibiliy of the element in desktop layout mode (960px >).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Tablet", 'uncode') , "param_name" => "medium_visibility", "description" => esc_html__("Choose the visibiliy of the element in tablet layout mode (570px > < 960px).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Mobile", 'uncode') , "param_name" => "mobile_visibility", "description" => esc_html__("Choose the visibiliy of the element in mobile layout mode (< 570px).", 'uncode') , 'group' => esc_html__('Responsive', 'uncode') , "value" => Array( '' => 'yes' ) , ) , $add_css_animation, $add_animation_speed, $add_animation_delay, array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') , 'group' => esc_html__('Extra', 'uncode') ) , ) , )); /* Icon element ----------------------------------------------------------- */ vc_map(array( 'name' => esc_html__('Icon Box', 'uncode') , 'base' => 'vc_icon', 'icon' => 'fa fa-star', 'weight' => 97, 'php_class_name' => 'uncode_generic_admin', 'category' => esc_html__('Content', 'uncode') , 'description' => esc_html__('Icon box from icon library', 'uncode') , 'params' => array( array( "type" => 'dropdown', "heading" => esc_html__("Module position", 'uncode') , "param_name" => "position", 'admin_label' => true, "value" => array( esc_html__('Icon top', 'uncode') => '', esc_html__('Icon bottom', 'uncode') => 'bottom', esc_html__('Icon left', 'uncode') => 'left', esc_html__('Icon right', 'uncode') => 'right' ) , 'description' => esc_html__('Specify where the icon is positioned inside the module.', 'uncode') , ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Layout display', 'uncode') , 'param_name' => 'display', 'description' => esc_html__('Specify the display mode.', 'uncode') , "value" => array( esc_html__('Block', 'uncode') => '', esc_html__('Inline', 'uncode') => 'inline', ) , ) , array( 'type' => 'iconpicker', 'heading' => esc_html__('Icon', 'uncode') , 'param_name' => 'icon', 'description' => esc_html__('Specify icon from library.', 'uncode') , 'value' => '', 'admin_label' => true, 'settings' => array( 'emptyIcon' => true, 'iconsPerPage' => 1100, 'type' => 'uncode' ) , ) , array( "type" => "media_element", "heading" => esc_html__("Media icon", 'uncode') , "param_name" => "icon_image", "value" => "", "description" => esc_html__("Specify a media icon from the media library.", 'uncode') , ) , array( "type" => "dropdown", "heading" => esc_html__("Icon color", 'uncode') , "param_name" => "icon_color", "description" => esc_html__("Specify icon color. NB. This doesn't work for media icons.", 'uncode') , "value" => $uncode_colors, ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Icon background style', 'uncode') , 'param_name' => 'background_style', 'value' => array( esc_html__('None', 'uncode') => '', esc_html__('Circle', 'uncode') => 'fa-rounded', esc_html__('Square', 'uncode') => 'fa-squared', ) , 'description' => esc_html__("Background style for icon. NB. This doesn't work for media icons.", 'uncode') ) , array( 'type' => 'dropdown', 'heading' => esc_html__('Icon size', 'uncode') , 'param_name' => 'size', 'value' => $icon_sizes, 'std' => '', 'description' => esc_html__("Icon size. NB. This doesn't work for media icons.", 'uncode') ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Icon outlined', 'uncode') , 'param_name' => 'outline', 'description' => esc_html__("Outlined icon doesn't have a full background color.", 'uncode') , 'value' => array( esc_html__('Yes, please', 'uncode') => 'yes' ) , 'dependency' => array( 'element' => 'background_style', 'not_empty' => true, ) , ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Icon shadow', 'uncode') , 'param_name' => 'shadow', 'description' => esc_html__('Icon shadow.', 'uncode') , 'value' => array( esc_html__('Yes, please', 'uncode') => 'yes' ) , 'dependency' => array( 'element' => 'background_style', 'not_empty' => true, ) , ) , array( 'type' => 'textfield', 'heading' => esc_html__('Title', 'uncode') , 'param_name' => 'title', 'admin_label' => true, ) , array( "type" => 'dropdown', "heading" => esc_html__("Title semantic", 'uncode') , "param_name" => "heading_semantic", "description" => esc_html__("Specify element tag.", 'uncode') , "value" => $heading_semantic, 'std' => 'h3', ) , array( "type" => 'dropdown', "heading" => esc_html__("Title size", 'uncode') , "param_name" => "text_size", "description" => esc_html__("Specify title size.", 'uncode') , 'std' => 'h3', "value" => $heading_size, ) , array( "type" => 'dropdown', "heading" => esc_html__("Title font family", 'uncode') , "param_name" => "text_font", "description" => esc_html__("Specify title font family.", 'uncode') , "value" => $heading_font, 'std' => '', ) , array( "type" => 'dropdown', "heading" => esc_html__("Title weight", 'uncode') , "param_name" => "text_weight", "description" => esc_html__("Specify title weight.", 'uncode') , "value" => $heading_weight, 'std' => '', ) , array( "type" => 'dropdown', "heading" => esc_html__("Title line height", 'uncode') , "param_name" => "text_height", "description" => esc_html__("Specify text line height.", 'uncode') , "value" => $heading_height, ) , array( "type" => 'dropdown', "heading" => esc_html__("Title letter spacing", 'uncode') , "param_name" => "text_space", "description" => esc_html__("Specify letter spacing.", 'uncode') , "value" => $heading_space, ) , array( 'type' => 'textarea_html', 'heading' => esc_html__('Text', 'uncode') , 'param_name' => 'content', 'admin_label' => true, ) , array( "type" => 'checkbox', "heading" => esc_html__("Text lead", 'uncode') , "param_name" => "text_lead", "description" => esc_html__("Transform the text to leading.", 'uncode') , "value" => Array( '' => 'yes' ) , ) , array( "type" => 'checkbox', "heading" => esc_html__("Reduce text top space", 'uncode') , "param_name" => "text_reduced", "description" => esc_html__("Activate this to reduce the text top margin.", 'uncode') , "value" => Array( esc_html__("Yes, please", 'uncode') => 'yes' ) , 'dependency' => array( 'element' => 'position', 'value' => array( '', 'bottom' ) ) , ) , array( 'type' => 'checkbox', 'heading' => esc_html__('Add top margin', 'uncode') , 'param_name' => 'add_margin', 'description' => esc_html__('Add text top margin.', 'uncode') , 'value' => array( esc_html__('Yes, please', 'uncode') => 'yes' ) , 'dependency' => array( 'element' => 'position', 'value' => array( 'left', 'right' ) ) , ) , array( 'type' => 'vc_link', 'heading' => esc_html__('URL (Link)', 'uncode') , 'param_name' => 'link', 'description' => esc_html__('Add link to icon.', 'uncode') ) , array( 'type' => 'textfield', 'heading' => esc_html__('Link text', 'uncode') , 'param_name' => 'link_text', 'description' => esc_html__('Add a text link if you wish, this will be added under the text.', 'uncode') ) , array( 'type' => 'media_element', 'heading' => esc_html__('Media lightbox', 'uncode') , 'param_name' => 'media_lightbox', 'description' => esc_html__('Specify a media from the lightbox.', 'uncode') , ) , $add_css_animation, $add_animation_speed, $add_animation_delay, array( 'type' => 'textfield', 'heading' => esc_html__('Extra class name', 'uncode') , 'param_name' => 'el_class', 'group' => esc_html__('Extra', 'uncode') , 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'uncode') ) , ) , )); vc_remove_element( "add_to_cart" ); vc_remove_element( "add_to_cart_url" );
civiclee/Hack4Cause2017
src/rumrunners/public_html/wp-content/plugins/uncode-core/vc_extend/config/override_map.php
PHP
mit
191,548
#include <unistd.h> #include <string.h> #include <stdio.h> #include <iostream> using namespace std; void foo(char* p){ memcpy(p, "01234567890", 32); } void foo2(char *p) { for (int i = 0; i < 100; i++) { cout << "start p[" << i << "]" << endl; p[i] = 'a'; cout << "p[" << i << "] ok " << endl; } } int main(int argc, char** argv){ char* p = new char[10]; //foo(p); delete []p; foo2(p); printf("p=%s\n", p); return 0; }
houbin/recipes
tcmalloc/tcmalloc_debug.cc
C++
mit
467
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import os.path as osp import numpy as np # `pip install easydict` if you don't have it from easydict import EasyDict as edict __C = edict() # Consumers can get config by: # from fast_rcnn_config import cfg cfg = __C # # Training options # __C.TRAIN = edict() # Initial learning rate __C.TRAIN.LEARNING_RATE = 0.001 # Momentum __C.TRAIN.MOMENTUM = 0.9 # Weight decay, for regularization __C.TRAIN.WEIGHT_DECAY = 0.0005 # Factor for reducing the learning rate __C.TRAIN.GAMMA = 0.1 # Step size for reducing the learning rate, currently only support one step __C.TRAIN.STEPSIZE = 30000 __C.TRAIN.CACHE_PATH = None # Iteration intervals for showing the loss during training, on command line interface __C.TRAIN.DISPLAY = 10 # Whether to double the learning rate for bias __C.TRAIN.DOUBLE_BIAS = True # Whether to initialize the weights with truncated normal distribution __C.TRAIN.TRUNCATED = False # Whether to have weight decay on bias as well __C.TRAIN.BIAS_DECAY = False # Whether to add ground truth boxes to the pool when sampling regions __C.TRAIN.USE_GT = False # Whether to use aspect-ratio grouping of training images, introduced merely for saving # GPU memory __C.TRAIN.ASPECT_GROUPING = False # The number of snapshots kept, older ones are deleted to save space __C.TRAIN.SNAPSHOT_KEPT = 3 # The time interval for saving tensorflow summaries __C.TRAIN.SUMMARY_INTERVAL = 180 # Scale to use during training (can NOT list multiple scales) # The scale is the pixel size of an image's shortest side __C.TRAIN.SCALES = (600,) # Max pixel size of the longest side of a scaled input image __C.TRAIN.MAX_SIZE = 1000 # Images to use per minibatch __C.TRAIN.IMS_PER_BATCH = 1 # Minibatch size (number of regions of interest [ROIs]) __C.TRAIN.BATCH_SIZE = 128 # Fraction of minibatch that is labeled foreground (i.e. class > 0) __C.TRAIN.FG_FRACTION = 0.25 # Overlap threshold for a ROI to be considered foreground (if >= FG_THRESH) __C.TRAIN.FG_THRESH = 0.5 # Overlap threshold for a ROI to be considered background (class = 0 if # overlap in [LO, HI)) __C.TRAIN.BG_THRESH_HI = 0.5 __C.TRAIN.BG_THRESH_LO = 0.1 # Use horizontally-flipped images during training? __C.TRAIN.USE_FLIPPED = True # Train bounding-box regressors __C.TRAIN.BBOX_REG = True # Overlap required between a ROI and ground-truth box in order for that ROI to # be used as a bounding-box regression training example __C.TRAIN.BBOX_THRESH = 0.5 # Iterations between snapshots __C.TRAIN.SNAPSHOT_ITERS = 5000 # solver.prototxt specifies the snapshot path prefix, this adds an optional # infix to yield the path: <prefix>[_<infix>]_iters_XYZ.caffemodel __C.TRAIN.SNAPSHOT_PREFIX = 'res101_faster_rcnn' # __C.TRAIN.SNAPSHOT_INFIX = '' # Use a prefetch thread in roi_data_layer.layer # So far I haven't found this useful; likely more engineering work is required # __C.TRAIN.USE_PREFETCH = False # Normalize the targets (subtract empirical mean, divide by empirical stddev) __C.TRAIN.BBOX_NORMALIZE_TARGETS = True # Deprecated (inside weights) __C.TRAIN.BBOX_INSIDE_WEIGHTS = (1.0, 1.0, 1.0, 1.0) # Normalize the targets using "precomputed" (or made up) means and stdevs # (BBOX_NORMALIZE_TARGETS must also be True) __C.TRAIN.BBOX_NORMALIZE_TARGETS_PRECOMPUTED = True __C.TRAIN.BBOX_NORMALIZE_MEANS = (0.0, 0.0, 0.0, 0.0) __C.TRAIN.BBOX_NORMALIZE_STDS = (0.1, 0.1, 0.2, 0.2) # Train using these proposals __C.TRAIN.PROPOSAL_METHOD = 'gt' # Make minibatches from images that have similar aspect ratios (i.e. both # tall and thin or both short and wide) in order to avoid wasting computation # on zero-padding. # Use RPN to detect objects __C.TRAIN.HAS_RPN = True # IOU >= thresh: positive example __C.TRAIN.RPN_POSITIVE_OVERLAP = 0.7 # IOU < thresh: negative example __C.TRAIN.RPN_NEGATIVE_OVERLAP = 0.3 # If an anchor statisfied by positive and negative conditions set to negative __C.TRAIN.RPN_CLOBBER_POSITIVES = False # Max number of foreground examples __C.TRAIN.RPN_FG_FRACTION = 0.5 # Total number of examples __C.TRAIN.RPN_BATCHSIZE = 256 # NMS threshold used on RPN proposals __C.TRAIN.RPN_NMS_THRESH = 0.7 # Number of top scoring boxes to keep before apply NMS to RPN proposals __C.TRAIN.RPN_PRE_NMS_TOP_N = 12000 # Number of top scoring boxes to keep after applying NMS to RPN proposals __C.TRAIN.RPN_POST_NMS_TOP_N = 2000 # Proposal height and width both need to be greater than RPN_MIN_SIZE (at orig image scale) # __C.TRAIN.RPN_MIN_SIZE = 16 # Deprecated (outside weights) __C.TRAIN.RPN_BBOX_INSIDE_WEIGHTS = (1.0, 1.0, 1.0, 1.0) # Give the positive RPN examples weight of p * 1 / {num positives} # and give negatives a weight of (1 - p) # Set to -1.0 to use uniform example weighting __C.TRAIN.RPN_POSITIVE_WEIGHT = -1.0 # Whether to use all ground truth bounding boxes for training, # For COCO, setting USE_ALL_GT to False will exclude boxes that are flagged as ''iscrowd'' __C.TRAIN.USE_ALL_GT = True # # Testing options # __C.TEST = edict() # Scale to use during testing (can NOT list multiple scales) # The scale is the pixel size of an image's shortest side __C.TEST.SCALES = (600,) # Max pixel size of the longest side of a scaled input image __C.TEST.MAX_SIZE = 1000 # Overlap threshold used for non-maximum suppression (suppress boxes with # IoU >= this threshold) __C.TEST.NMS = 0.3 # Experimental: treat the (K+1) units in the cls_score layer as linear # predictors (trained, eg, with one-vs-rest SVMs). __C.TEST.SVM = False # Test using bounding-box regressors __C.TEST.BBOX_REG = True # Propose boxes __C.TEST.HAS_RPN = False # Test using these proposals __C.TEST.PROPOSAL_METHOD = 'gt' ## NMS threshold used on RPN proposals __C.TEST.RPN_NMS_THRESH = 0.7 ## Number of top scoring boxes to keep before apply NMS to RPN proposals __C.TEST.RPN_PRE_NMS_TOP_N = 6000 ## Number of top scoring boxes to keep after applying NMS to RPN proposals __C.TEST.RPN_POST_NMS_TOP_N = 300 # Proposal height and width both need to be greater than RPN_MIN_SIZE (at orig image scale) # __C.TEST.RPN_MIN_SIZE = 16 # Testing mode, default to be 'nms', 'top' is slower but better # See report for details __C.TEST.MODE = 'nms' # Only useful when TEST.MODE is 'top', specifies the number of top proposals to select __C.TEST.RPN_TOP_N = 5000 # # ResNet options # __C.RESNET = edict() # Option to set if max-pooling is appended after crop_and_resize. # if true, the region will be resized to a squre of 2xPOOLING_SIZE, # then 2x2 max-pooling is applied; otherwise the region will be directly # resized to a square of POOLING_SIZE __C.RESNET.MAX_POOL = False # Number of fixed blocks during finetuning, by default the first of all 4 blocks is fixed # Range: 0 (none) to 3 (all) __C.RESNET.FIXED_BLOCKS = 1 # Whether to tune the batch nomalization parameters during training __C.RESNET.BN_TRAIN = False # # MISC # # The mapping from image coordinates to feature map coordinates might cause # some boxes that are distinct in image space to become identical in feature # coordinates. If DEDUP_BOXES > 0, then DEDUP_BOXES is used as the scale factor # for identifying duplicate boxes. # 1/16 is correct for {Alex,Caffe}Net, VGG_CNN_M_1024, and VGG16 __C.DEDUP_BOXES = 1. / 16. # Pixel mean values (BGR order) as a (1, 1, 3) array # We use the same pixel mean for all networks even though it's not exactly what # they were trained with __C.PIXEL_MEANS = np.array([[[102.9801, 115.9465, 122.7717]]]) # For reproducibility __C.RNG_SEED = 3 # A small number that's used many times __C.EPS = 1e-14 # Root directory of project __C.ROOT_DIR = osp.abspath(osp.join(osp.dirname(__file__), '..', '..')) # Data directory __C.DATA_DIR = osp.abspath(osp.join(__C.ROOT_DIR, 'data')) # Name (or path to) the matlab executable __C.MATLAB = 'matlab' # Place outputs under an experiments directory __C.EXP_DIR = 'default' # Use GPU implementation of non-maximum suppression __C.USE_GPU_NMS = True # Default GPU device id __C.GPU_ID = 0 # Default pooling mode, only 'crop' is available __C.POOLING_MODE = 'crop' # Size of the pooled region after RoI pooling __C.POOLING_SIZE = 7 # Anchor scales for RPN __C.ANCHOR_SCALES = [8,16,32] # Anchor ratios for RPN __C.ANCHOR_RATIOS = [0.5,1,2] def get_output_dir(imdb, weights_filename): """Return the directory where experimental artifacts are placed. If the directory does not exist, it is created. A canonical path is built using the name from an imdb and a network (if not None). """ outdir = osp.abspath(osp.join(__C.ROOT_DIR, 'output', __C.EXP_DIR, imdb.name)) if weights_filename is None: weights_filename = 'default' outdir = osp.join(outdir, weights_filename) if not os.path.exists(outdir): os.makedirs(outdir) return outdir def get_output_tb_dir(imdb, weights_filename): """Return the directory where tensorflow summaries are placed. If the directory does not exist, it is created. A canonical path is built using the name from an imdb and a network (if not None). """ outdir = osp.abspath(osp.join(__C.ROOT_DIR, 'tensorboard', __C.EXP_DIR, imdb.name)) if weights_filename is None: weights_filename = 'default' outdir = osp.join(outdir, weights_filename) if not os.path.exists(outdir): os.makedirs(outdir) return outdir def _merge_a_into_b(a, b): """Merge config dictionary a into config dictionary b, clobbering the options in b whenever they are also specified in a. """ if type(a) is not edict: return for k, v in a.items(): # a must specify keys that are in b if k not in b: raise KeyError('{} is not a valid config key'.format(k)) # the types must match, too old_type = type(b[k]) if old_type is not type(v): if isinstance(b[k], np.ndarray): v = np.array(v, dtype=b[k].dtype) else: raise ValueError(('Type mismatch ({} vs. {}) ' 'for config key: {}').format(type(b[k]), type(v), k)) # recursively merge dicts if type(v) is edict: try: _merge_a_into_b(a[k], b[k]) except: print(('Error under config key: {}'.format(k))) raise else: b[k] = v def cfg_from_file(filename): """Load a config file and merge it into the default options.""" import yaml with open(filename, 'r') as f: yaml_cfg = edict(yaml.load(f)) _merge_a_into_b(yaml_cfg, __C) def cfg_from_list(cfg_list): """Set config keys via list (e.g., from command line).""" from ast import literal_eval assert len(cfg_list) % 2 == 0 for k, v in zip(cfg_list[0::2], cfg_list[1::2]): key_list = k.split('.') d = __C for subkey in key_list[:-1]: assert subkey in d d = d[subkey] subkey = key_list[-1] assert subkey in d try: value = literal_eval(v) except: # handle the case when v is a string literal value = v assert type(value) == type(d[subkey]), \ 'type {} does not match original type {}'.format( type(value), type(d[subkey])) d[subkey] = value
junranhe/tf-faster-rcnn
lib/model/config.py
Python
mit
11,161
<?php /* Uploadify Copyright (c) 2012 Reactive Apps, Ronnie Garcia Released under the MIT License <http://www.opensource.org/licenses/mit-license.php> */ // Define a destination $targetFolder = '/uploads'; // Relative to the root and should match the upload folder in the uploader script if (file_exists($_SERVER['DOCUMENT_ROOT'] ."/". $targetFolder . '/' . $_POST['filename'])) { echo "exists"; } else { echo 0; } ?>
juanluisT/if_file_exist_to_new_folder
check-exists.php
PHP
mit
424
# -*- coding: utf-8 -*- # #START_LICENSE########################################################### # # # This file is part of the Environment for Tree Exploration program # (ETE). http://ete.cgenomics.org # # ETE is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # ETE is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public # License for more details. # # You should have received a copy of the GNU General Public License # along with ETE. If not, see <http://www.gnu.org/licenses/>. # # # ABOUT THE ETE PACKAGE # ===================== # # ETE is distributed under the GPL copyleft license (2008-2011). # # If you make use of ETE in published work, please cite: # # Jaime Huerta-Cepas, Joaquin Dopazo and Toni Gabaldon. # ETE: a python Environment for Tree Exploration. Jaime BMC # Bioinformatics 2010,:24doi:10.1186/1471-2105-11-24 # # Note that extra references to the specific methods implemented in # the toolkit are available in the documentation. # # More info at http://ete.cgenomics.org # # # #END_LICENSE############################################################# __VERSION__="ete2-2.2rev1056" # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'open_newick.ui' # # Created: Tue Jan 10 15:56:56 2012 # by: PyQt4 UI code generator 4.7.2 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui class Ui_OpenNewick(object): def setupUi(self, OpenNewick): OpenNewick.setObjectName("OpenNewick") OpenNewick.resize(569, 353) self.comboBox = QtGui.QComboBox(OpenNewick) self.comboBox.setGeometry(QtCore.QRect(460, 300, 81, 23)) self.comboBox.setObjectName("comboBox") self.widget = QtGui.QWidget(OpenNewick) self.widget.setGeometry(QtCore.QRect(30, 10, 371, 321)) self.widget.setObjectName("widget") self.retranslateUi(OpenNewick) QtCore.QMetaObject.connectSlotsByName(OpenNewick) def retranslateUi(self, OpenNewick): OpenNewick.setWindowTitle(QtGui.QApplication.translate("OpenNewick", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
csc8630Spring2014/Clusterizer
ete2/treeview/_open_newick.py
Python
mit
2,493
// Copyright (c) 2015 fjz13. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. #include "MedusaCorePreCompiled.h" #include "SirenFieldAttribute.h" #include "Core/IO/Stream/IStream.h" #include "Core/Log/Log.h" MEDUSA_BEGIN; SirenFieldAttribute::~SirenFieldAttribute(void) { } bool SirenFieldAttribute::IsRequired() const { return !MEDUSA_FLAG_HAS(mMode, SirenFieldGenerateMode::Optional); } bool SirenFieldAttribute::OnLoaded() { StringPropertySet copy = mKeyValues; if (mKeyValues.RemoveKey("Optional")) { MEDUSA_FLAG_ADD(mMode, SirenFieldGenerateMode::Optional); } if (mKeyValues.RemoveKey("?")) { MEDUSA_FLAG_ADD(mMode, SirenFieldGenerateMode::Optional); } if (mKeyValues.RemoveKey("+")) { MEDUSA_FLAG_REMOVE(mMode, SirenFieldGenerateMode::Optional); } if (mKeyValues.RemoveKey("ForceKeyToPtr")) { MEDUSA_FLAG_ADD(mMode, SirenFieldGenerateMode::ForceKeyToPtr); } if (mKeyValues.RemoveKey("ForceValueToPtr")) { MEDUSA_FLAG_ADD(mMode, SirenFieldGenerateMode::ForceValueToPtr); } if (mKeyValues.RemoveKey("AddDictionaryMethods")) { MEDUSA_FLAG_ADD(mMode, SirenFieldGenerateMode::AddDictionaryMethods); } if (mKeyValues.RemoveKey("SuppressMethod")) { MEDUSA_FLAG_ADD(mMode, SirenFieldGenerateMode::SuppressMethod); } return true; } StringRef SirenFieldAttribute::Modifier() const { if (IsRequired()) { return "Required"; } return "Optional"; } bool SirenFieldAttribute::LoadFrom(IStream& stream) { RETURN_FALSE_IF_FALSE(ISirenAttribute::LoadFrom(stream)); mMode = stream.Read<SirenFieldGenerateMode>(); return true; } bool SirenFieldAttribute::SaveTo(IStream& stream) const { RETURN_FALSE_IF_FALSE(ISirenAttribute::SaveTo(stream)); stream.Write(mMode); return true; } MEDUSA_END;
fjz13/Medusa
Medusa/MedusaCore/Core/Siren/Schema/Attribute/SirenFieldAttribute.cpp
C++
mit
1,822
<?php $this->load->view('layouts/header');?> <?php $this->load->view('layouts/tablero');?> <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script> <div class="col-sm-9 col-md-10 affix-content"> <div class="container"> <div class="page-header"> <form class="row mrb-30 well" action="<?php echo base_url('index.php/trabajador/update/'.$dato_trabajador[0]->IdTrabajador); ?>" method="POST" onsubmit="return validar(this);"> <div class="form-group col-md-6"> <label>Tipo Trabajador</label> <select validate="selecbus" class="js-example-basic-single form-control" name="SelectTipo"> <?php foreach($tipos as $tipo){ $faiId=($tipo->IdTipoTrab==$dato_trabajador[0]->IdTipoTrab)? "selected":""; echo "<option value=". $tipo->IdTipoTrab ." ". $faiId .">". $tipo->NombreTP ."</option>"; }?> <!--echo "<option value=" .$proveedor->IdProveedor ." value=". $proveedor->Nombre ."</option>";--> </select> </div> <div class="form-group col-md-6 "> <label>Nombres</label> <input validate="texto" type="text" class="form-control" name="Nombre" placeholder="Nombres" maxlength="30"value="<?php echo $dato_trabajador[0]->NombreT?>"> </div> <div class="form-group col-md-6"> <label>Apellido Paterno</label> <input validate="texto" type="text" class="form-control" name="ApePat" placeholder="Apellido Paterno" maxlength="20"value="<?php echo $dato_trabajador[0]->ApePat?>"> </div> <div class="form-group col-md-6"> <label>Apellido Materno</label> <input validate="texto" type="text" class="form-control" name="ApeMat" placeholder="Apellido Materno" maxlength="20" value="<?php echo $dato_trabajador[0]->ApeMat?>"> </div> <div class="form-group col-md-6"> <label>Dirección</label> <input validate="direccion" type="text" class="form-control" name="Direccion" placeholder="Dirección" maxlength="30" value="<?php echo $dato_trabajador[0]->DireccionT?>"> </div> <div class="form-group col-md-3"> <label>Celular</label> <input validate="number" type="text" class="form-control" name="Telefono" placeholder="Celular" maxlength="9" value="<?php echo $dato_trabajador[0]->CelularT?>"> </div> <div class="form-group col-md-3"> <label>Operador</label> <select validate="seleccionar" type="text" class="form-control" name="Operador" placeholder="Operador"> <option value="Rpm" <?php echo ($dato_trabajador[0]->OperadorT=="Rpm" ? 'selected="selected"' : '');?>>Rpm</option> <option value="Movistar" <?php echo ($dato_trabajador[0]->OperadorT=="Movistar" ? 'selected="selected"' : '');?>>Movistar</option> <option value="Rpc" <?php echo ($dato_trabajador[0]->OperadorT=="Rpc" ? 'selected="selected"' : '');?>>Rpc</option> <option value="Claro" <?php echo ($dato_trabajador[0]->OperadorT=="Claro" ? 'selected="selected"' : '');?>>Claro</option> <option value="Bitel" <?php echo ($dato_trabajador[0]->OperadorT=="Bitel" ? 'selected="selected"' : '');?>>Bitel</option> <option value="Entel" <?php echo ($dato_trabajador[0]->OperadorT=="Entel" ? 'selected="selected"' : '');?>>Entel</option> <option value="Virgin" <?php echo ($dato_trabajador[0]->OperadorT=="Virgin" ? 'selected="selected"' : '');?>>Virgin</option> </select> </div> <div class="form-group col-md-6"> <label>Local</label> <select validate="selecbus" class="js-example-basic-single2 form-control" name="SelectLocal"> <?php foreach($local as $tipo){ // die($tipo->IdLocal==$dato_local[0]->IdLocal); $faiId=($tipo->IdLocal==$dato_trabajador[0]->IdLocal)? "selected":""; echo "<option value=". $tipo->IdLocal ." ". $faiId .">". $tipo->NombreL ."</option>"; }?> <!--echo "<option value=" .$proveedor->IdProveedor ." value=". $proveedor->Nombre ."</option>";--> </select> </div> <div class="form-group col-md-6"> <label>Estado</label> <select validate="seleccionar" type="text" class="form-control" name="EstadoT"> <option value="Habilitado" <?php echo ($dato_trabajador[0]->EstadoT=="Habilitado" ? 'selected="selected"' : '');?>>Habilitado</option> <option value="Expulsado" <?php echo ($dato_trabajador[0]->EstadoT=="Expulsado" ? 'selected="selected"' : '');?>>Expulsado</option> <option value="Retirado" <?php echo ($dato_trabajador[0]->EstadoT=="Retirado" ? 'selected="selected"' : '');?>>Retirado</option> </select> </div> <script type="text/javascript"> $(document).ready(function() { var fn = $(".js-example-basic-single").select2(); // $(".js-example-basic-single").select // fn.defaults.set("qwe","sdsd") }); </script> <script type="text/javascript"> $(document).ready(function() { var fn = $(".js-example-basic-single2").select2(); // $(".js-example-basic-single").select // fn.defaults.set("qwe","sdsd") }); </script> <div class="col-md-12"> <input type="hidden" name="Email" value="<?php echo $dato_trabajador[0]->Email?>"> <input type="hidden" name="Password" value="<?php echo $dato_trabajador[0]->Password?>"> <button type="submit" class="btn btn-primary ">Actualizar</button> </div> </form> </div> </div> </div> <script src="<?php echo base_url('public/main.js'); ?>"></script> <?php $this->load->view('layouts/footer.php');?>
javel20/vetjavi
application/views/trabajador/trabajador_editar_v.php
PHP
mit
6,457
package sword.langbook3.android; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.view.LayoutInflater; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import sword.collections.ImmutableHashSet; import sword.collections.ImmutableSet; import sword.langbook3.android.db.AcceptationId; import sword.langbook3.android.db.AcceptationIdBundler; import sword.langbook3.android.db.AlphabetId; import sword.langbook3.android.db.ConceptId; import sword.langbook3.android.db.ConceptIdParceler; import sword.langbook3.android.db.LangbookDbChecker; public final class DefinitionEditorActivity extends Activity implements View.OnClickListener { private static final int REQUEST_CODE_PICK_BASE = 1; private static final int REQUEST_CODE_PICK_COMPLEMENT = 2; private interface SavedKeys { String STATE = "state"; } public interface ResultKeys { String VALUES = "values"; } public static void open(Activity activity, int requestCode) { final Intent intent = new Intent(activity, DefinitionEditorActivity.class); activity.startActivityForResult(intent, requestCode); } private State _state; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.definition_editor_activity); if (savedInstanceState != null) { _state = savedInstanceState.getParcelable(SavedKeys.STATE); } else { _state = new State(); } findViewById(R.id.baseConceptChangeButton).setOnClickListener(this); findViewById(R.id.complementsAddButton).setOnClickListener(this); findViewById(R.id.saveButton).setOnClickListener(this); updateUi(); } private void updateUi() { final LangbookDbChecker checker = DbManager.getInstance().getManager(); final AlphabetId preferredAlphabet = LangbookPreferences.getInstance().getPreferredAlphabet(); final TextView baseConceptTextView = findViewById(R.id.baseConceptText); final String text = (_state.baseConcept == null)? null : checker.readConceptText(_state.baseConcept, preferredAlphabet); baseConceptTextView.setText(text); final LinearLayout complementsPanel = findViewById(R.id.complementsPanel); complementsPanel.removeAllViews(); final LayoutInflater inflater = LayoutInflater.from(this); for (ConceptId complementConcept : _state.complements) { inflater.inflate(R.layout.definition_editor_complement_entry, complementsPanel, true); final TextView textView = complementsPanel.getChildAt(complementsPanel.getChildCount() - 1).findViewById(R.id.text); textView.setText(checker.readConceptText(complementConcept, preferredAlphabet)); } } @Override public void onClick(View v) { switch (v.getId()) { case R.id.baseConceptChangeButton: AcceptationPickerActivity.open(this, REQUEST_CODE_PICK_BASE); return; case R.id.complementsAddButton: AcceptationPickerActivity.open(this, REQUEST_CODE_PICK_COMPLEMENT); return; case R.id.saveButton: saveAndFinish(); return; } } private void saveAndFinish() { if (_state.baseConcept == null) { Toast.makeText(this, R.string.baseConceptMissing, Toast.LENGTH_SHORT).show(); } else { final Intent intent = new Intent(); intent.putExtra(ResultKeys.VALUES, _state); setResult(RESULT_OK, intent); finish(); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_CODE_PICK_BASE && resultCode == RESULT_OK && data != null) { final LangbookDbChecker checker = DbManager.getInstance().getManager(); final AcceptationId pickedAcceptation = AcceptationIdBundler.readAsIntentExtra(data, AcceptationPickerActivity.ResultKeys.STATIC_ACCEPTATION); _state.baseConcept = (pickedAcceptation != null)? checker.conceptFromAcceptation(pickedAcceptation) : null; updateUi(); } else if (requestCode == REQUEST_CODE_PICK_COMPLEMENT && resultCode == RESULT_OK && data != null) { final LangbookDbChecker checker = DbManager.getInstance().getManager(); final AcceptationId pickedAcceptation = AcceptationIdBundler.readAsIntentExtra(data, AcceptationPickerActivity.ResultKeys.STATIC_ACCEPTATION); _state.complements = _state.complements.add(checker.conceptFromAcceptation(pickedAcceptation)); updateUi(); } } @Override public void onSaveInstanceState(Bundle outBundle) { outBundle.putParcelable(SavedKeys.STATE, _state); } public static final class State implements Parcelable { public ConceptId baseConcept; public ImmutableSet<ConceptId> complements = ImmutableHashSet.empty(); @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { ConceptIdParceler.write(dest, baseConcept); final int complementCount = (complements != null)? complements.size() : 0; dest.writeInt(complementCount); if (complementCount > 0) { for (ConceptId complement : complements) { ConceptIdParceler.write(dest, complement); } } } public static final Creator<State> CREATOR = new Creator<State>() { @Override public State createFromParcel(Parcel in) { final State state = new State(); state.baseConcept = ConceptIdParceler.read(in); final int complementCount = in.readInt(); for (int i = 0; i < complementCount; i++) { state.complements = state.complements.add(ConceptIdParceler.read(in)); } return state; } @Override public State[] newArray(int size) { return new State[size]; } }; } }
carlos-sancho-ramirez/android-java-langbook
app/src/main/java/sword/langbook3/android/DefinitionEditorActivity.java
Java
mit
6,567
import React from 'react' import { CLOSE_CHARACTER } from '../model/constants' import styles from './MessagesComp.module.css' export interface MessagesCompProps { _messages: readonly string[] _removeMessageByIndex: (index: number) => void } export function MessagesComp({ _messages, _removeMessageByIndex, }: MessagesCompProps) { return ( <> {_messages.map((message, index) => ( <div key={index} className={styles.message}> <div className={styles.content}>{message}</div> <button type='button' className={styles.button} onClick={() => { _removeMessageByIndex(index) }} > {CLOSE_CHARACTER} </button> </div> ))} </> ) }
andraaspar/mag
src/comp/MessagesComp.tsx
TypeScript
mit
701
import { NICKNAME_SET } from '../constants' export interface NicknameSetPayload { nickname: string userId: string } export interface NicknameSetAction { type: 'NICKNAME_SET' payload: NicknameSetPayload } export function setNickname(payload: NicknameSetPayload): NicknameSetAction { return { type: NICKNAME_SET, payload, } } export type NicknameActions = NicknameSetAction
jeremija/peer-calls
src/client/actions/NicknameActions.ts
TypeScript
mit
396
//filters.js eventsApp.filter('durations' 'use strict'; describe('durations', function(){ beforeEach(module("eventsApp")); it('should return "Half Hour" when given a 1', inject(function(durationFilter){ expect(durationFilter(1)).toEqual('Half Hour'); })) it('should return "1 Hour" when given a 2', inject(function(durationFilter){ expect(durationFilter(2)).toEqual('1 Hour'); })) it('should return "Half Day" when given a 3', inject(function(durationFilter){ expect(durationFilter(3)).toEqual('Half Day'); })) it('should return " Hour" when given a 4', inject(function(durationFilter){ expect(durationFilter(4)).toEqual('Full Day'); })) })
jhirley/Plurasight-Angular-Fundamentals
test/unit/filtersSpec.js
JavaScript
mit
651
 function SeamCarver(ctx) { var w = ctx.canvas.width; var h = ctx.canvas.height; var imgd = ctx.getImageData(0, 0, w, h); var pix = imgd.data; var img = []; for (var i = 0; i < h; i++) { img.push(new Uint32Array(w)); for (var j = 0; j < w; j++) { img[i][j] = (pix[4 * i * w + 4 * j] << 16) + (pix[4 * i * w + 4 * j + 1] << 8) + pix[4 * i * w + 4 * j + 2]; } } this._img = img; this._w = w; this._h = h; this._removedSeams = [] } SeamCarver.prototype.energy = function (x, y) { return this._energyInternal(x, y); } SeamCarver.prototype.imageData = function (ctx) { var w = this._w; var h = this._h; var id = ctx.createImageData(w, h); for (var i = 0; i < h; i++) { for (var j = 0; j < w; j++) { var color = this._img[i][j]; var r = color >> 16 & 0xFF; var g = color >> 8 & 0xFF; var b = color & 0xFF; var index = 4 * w * i + 4 * j; id.data[index] = r; id.data[index + 1] = g; id.data[index + 2] = b; id.data[index + 3] = 255; } } return id; } SeamCarver.prototype.findVerticalSeam = function () { var w = this._w; var h = this._h; var edgeTo = []; var distTo = []; distTo.push(new Float32Array(w)); edgeTo.push(new Int16Array(w).fill(-1)); for (var i = 1; i < h; i++) { distTo[i] = new Float32Array(w); edgeTo[i] = new Int16Array(w).fill(-1); for (var j = 0; j < w; j++) { distTo[i][j] = Number.MAX_VALUE; } } for (var i = 1; i < h; i++) { var prevRow = distTo[i - 1]; for (var j = 1; j < w - 1; j++) { var energy = this._energyInternal(j, i); var dleft = prevRow[j - 1]; var dcenter = prevRow[j]; var dright = prevRow[j + 1]; if (dleft < dcenter && dleft < dright) { distTo[i][j] = dleft + energy; edgeTo[i][j] = j - 1; } else if (dcenter < dright) { distTo[i][j] = dcenter + energy; edgeTo[i][j] = j; } else { distTo[i][j] = dright + energy; edgeTo[i][j] = j + 1; } } } var min = Number.MAX_VALUE; var minIndex = -1; for (var i = 0; i < w; i++) { if (distTo[h - 1][i] < min) { min = distTo[h - 1][i]; minIndex = i; } } distTo[h - 1][minIndex] = Number.MAX_VALUE; var path = [minIndex]; var curIndex = minIndex; for (var i = h - 1; i > 0; i--) { var curIndex = edgeTo[i][curIndex]; path.push(curIndex); } return path; } SeamCarver.prototype.removeVerticalSeam = function () { var seam = this.findVerticalSeam(); var h = this._h; var res = []; for (var i = 0; i < seam.length; i++) { var col = seam[i]; res.push({ col: col, color: this._img[h - i - 1][col] }); for (var j = col; j < this._w - 1; j++) { this._img[h - i - 1][j] = this._img[h - i - 1][j + 1]; } } this._w--; this._removedSeams.push(res); } SeamCarver.prototype.restoreVerticalSeam = function () { var w = this._w; var h = this._h; if (this._removedSeams.length == 0) { return; } var seam = this._removedSeams.pop(); for (var i = 0; i < seam.length; i++) { var row = this._img[h - i - 1]; var col = seam[i].col; var color = seam[i].color; for (var j = w - 1; j >= col; j--) { row[j + 1] = row[j]; } row[col] = color; } this._w++; } SeamCarver.prototype.width = function () { return this._w; } SeamCarver.prototype._energyInternal = function (col, row) { if (col == 0 || row == 0 || col == this._w - 1 || row == this._h - 1) { return 1000; } var x1 = this._img[row][col - 1]; var x1r = x1 >> 16 & 0xFF; var x1g = x1 >> 8 & 0xFF; var x1b = x1 & 0xFF; var x2 = this._img[row][col + 1]; var x2r = x2 >> 16 & 0xFF; var x2g = x2 >> 8 & 0xFF; var x2b = x2 & 0xFF; var y1 = this._img[row - 1][col]; var y1r = y1 >> 16 & 0xFF; var y1g = y1 >> 8 & 0xFF; var y1b = y1 & 0xFF; var y2 = this._img[row + 1][col]; var y2r = y2 >> 16 & 0xFF; var y2g = y2 >> 8 & 0xFF; var y2b = y2 & 0xFF; var dx = (x1r - x2r) * (x1r - x2r) + (x1g - x2g) * (x1g - x2g) + (x1b - x2b) * (x1b - x2b); var dy = (y1r - y2r) * (y1r - y2r) + (y1g - y2g) * (y1g - y2g) + (y1b - y2b) * (y1b - y2b); return Math.sqrt(dx + dy); }
znzbr/SeamCarver
js/seamcarver.js
JavaScript
mit
4,732
import Ember from 'ember'; export default Ember.Mixin.create({ getMailsFromMailThreadByThreadId: function getMailsFromMailThreadByThreadId(mailThreadId) { return this.store.find('mail-thread').then(function(mailThreads) { return mailThreads.filterBy('id', mailThreadId)[0]; }).then(function(mailThread) { return mailThread.get('mails'); }); }, getMailByIdFromMailThreads: function getMailByIdFromMailThreads(mailId){ return this.store.find('mail-thread').then(function(mailThreads){ var filteredMailToReturn; mailThreads.forEach(function(mailThread){ var filteredMail = mailThread.get('mails').filterBy('id', +mailId)[0]; if( filteredMail ) { filteredMailToReturn = filteredMail; } }); return filteredMailToReturn; }); } });
sivakumar-kailasam/orbitty-mail
app/mixins/mail-extractor.js
JavaScript
mit
776
<?php namespace Zazzam\Sapa\Domain\Model; /* * * This script belongs to the TYPO3 Flow package "Zazzam.Sapa". * * * * */ use TYPO3\Flow\Annotations as Flow; use Doctrine\ORM\Mapping as ORM; use Zazzam\Sapa\Domain\Model\User\Specialist; use Zazzam\Sapa\Domain\Model\Request; use Doctrine\Common\Collections\ArrayCollection; use DateTime; /** * @Flow\Entity */ class Queue { /** * @var string * @Flow\Validate(type="StringLength", options={ "minimum"=3, "maximum"=128 }) * @Flow\Validate(type="NotEmpty") */ protected $name; /** * @var string * @ORM\Column(nullable=true) */ protected $description; /** * @var \Doctrine\Common\Collections\Collection<\Zazzam\Sapa\Domain\Model\User\Specialist> * @ORM\ManyToMany(mappedBy="queues", cascade={"persist"}) */ protected $responsibleUsers; /** * @var \Doctrine\Common\Collections\Collection<\Zazzam\Sapa\Domain\Model\Request> * @ORM\ManyToMany(mappedBy="queues", cascade={"persist"}) * @ORM\OrderBy({"updatedAt" = "DESC"}) */ protected $requests; /** * @var \Zazzam\Sapa\Domain\Model\Request * @Flow\Transient */ protected $currentRequest; public function __construct() { $this->responsibleUsers = new \Doctrine\Common\Collections\ArrayCollection(); $this->requests = new \Doctrine\Common\Collections\ArrayCollection(); } /** * @param string $name * @return void */ public function setName($name) { $this->name = $name; } /** * @return string */ public function getName() { return $this->name; } /** * @param string $description * @return void */ public function setDescription($description) { $this->description = $description; } /** * @return string */ public function getDescription() { return $this->description; } /** * @param ArrayCollection $users * @return void */ public function setResponsibleUsers(ArrayCollection $users) { $this->responsibleUsers = $users; foreach($users as $user) { $user->addQueue($this); } } /** * @param Specialist $user * @return void */ public function addResponsibleUser(Specialist $user) { $user->addQueue($this); if(!$this->responsibleUsers->contains($user)) { $this->responsibleUsers->add($user); } } /** * @return ArrayCollection */ public function getResponsibleUsers() { return $this->responsibleUsers; } /** * @param Specialist $user * @return void */ public function removeResponsibleUser(Specialist $user) { $user->removeQueue($this); $this->responsibleUsers->removeElement($user); } /** * @param Request $request * @return void */ public function addRequest(Request $request) { if(!$this->requests->contains($request)) { $this->requests->add($request); } $request->addQueue($this); } /** * @return ArrayCollection */ public function getRequests() { return $this->requests; } /** * @return Request */ public function getFirstRequest() { return $this->requests->first(); } /** * @param \Zazzam\Sapa\Domain\Model\Request $request */ public function setCurrentRequest(Request $request) { $this->currentRequest = $request; } /** * @return \Zazzam\Sapa\Domain\Model\Request */ public function getPreviousRequest() { $currentIndex = $this->requests->indexOf($this->currentRequest); if(isset($this->requests[$currentIndex - 1])) { return $this->requests[$currentIndex - 1]; } } /** * @return \Zazzam\Sapa\Domain\Model\Request */ public function getNextRequest() { $currentIndex = $this->requests->indexOf($this->currentRequest); if(isset($this->requests[$currentIndex + 1])) { return $this->requests[$currentIndex + 1]; } } /** * @param Request $request * @return void */ public function removeRequest(\Zazzam\Sapa\Domain\Model\Request $request) { $this->requests->removeElement($request); $request->removeQueue($this); } /** * @return DateTime */ public function getUpdatedAt() { if($this->requests->count() > 0) { return $this->requests->first()->getUpdatedAt(); } else { return Null;//new DateTime('1970-01-01'); } } }
Radda/sapa
Classes/Zazzam/Sapa/Domain/Model/Queue.php
PHP
mit
4,924
package net.dirtyfilthy.bouncycastle.crypto.agreement; import java.math.BigInteger; import java.security.SecureRandom; import net.dirtyfilthy.bouncycastle.crypto.AsymmetricCipherKeyPair; import net.dirtyfilthy.bouncycastle.crypto.CipherParameters; import net.dirtyfilthy.bouncycastle.crypto.generators.DHKeyPairGenerator; import net.dirtyfilthy.bouncycastle.crypto.params.AsymmetricKeyParameter; import net.dirtyfilthy.bouncycastle.crypto.params.DHKeyGenerationParameters; import net.dirtyfilthy.bouncycastle.crypto.params.DHParameters; import net.dirtyfilthy.bouncycastle.crypto.params.DHPrivateKeyParameters; import net.dirtyfilthy.bouncycastle.crypto.params.DHPublicKeyParameters; import net.dirtyfilthy.bouncycastle.crypto.params.ParametersWithRandom; /** * a Diffie-Hellman key exchange engine. * <p> * note: This uses MTI/A0 key agreement in order to make the key agreement * secure against passive attacks. If you're doing Diffie-Hellman and both * parties have long term public keys you should look at using this. For * further information have a look at RFC 2631. * <p> * It's possible to extend this to more than two parties as well, for the moment * that is left as an exercise for the reader. */ public class DHAgreement { private DHPrivateKeyParameters key; private DHParameters dhParams; private BigInteger privateValue; private SecureRandom random; public void init( CipherParameters param) { AsymmetricKeyParameter kParam; if (param instanceof ParametersWithRandom) { ParametersWithRandom rParam = (ParametersWithRandom)param; this.random = rParam.getRandom(); kParam = (AsymmetricKeyParameter)rParam.getParameters(); } else { this.random = new SecureRandom(); kParam = (AsymmetricKeyParameter)param; } if (!(kParam instanceof DHPrivateKeyParameters)) { throw new IllegalArgumentException("DHEngine expects DHPrivateKeyParameters"); } this.key = (DHPrivateKeyParameters)kParam; this.dhParams = key.getParameters(); } /** * calculate our initial message. */ public BigInteger calculateMessage() { DHKeyPairGenerator dhGen = new DHKeyPairGenerator(); dhGen.init(new DHKeyGenerationParameters(random, dhParams)); AsymmetricCipherKeyPair dhPair = dhGen.generateKeyPair(); this.privateValue = ((DHPrivateKeyParameters)dhPair.getPrivate()).getX(); return ((DHPublicKeyParameters)dhPair.getPublic()).getY(); } /** * given a message from a given party and the corresponding public key, * calculate the next message in the agreement sequence. In this case * this will represent the shared secret. */ public BigInteger calculateAgreement( DHPublicKeyParameters pub, BigInteger message) { if (!pub.getParameters().equals(dhParams)) { throw new IllegalArgumentException("Diffie-Hellman public key has wrong parameters."); } BigInteger p = dhParams.getP(); return message.modPow(key.getX(), p).multiply(pub.getY().modPow(privateValue, p)).mod(p); } }
dirtyfilthy/dirtyfilthy-bouncycastle
net/dirtyfilthy/bouncycastle/crypto/agreement/DHAgreement.java
Java
mit
3,319
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2017 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <galaxycash.h> #include <chainparams.h> #include <hash.h> #include <memory> #include <pow.h> #include <uint256.h> #include <util.h> #include <stdint.h> CGalaxyCashStateRef g_galaxycash; CGalaxyCashDB::CGalaxyCashDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(GetDataDir() / "galaxycash" / "database", nCacheSize, fMemory, fWipe) { } class CGalaxyCashVM { public: CGalaxyCashVM(); ~CGalaxyCashVM(); }; CGalaxyCashVM::CGalaxyCashVM() { } CGalaxyCashState::CGalaxyCashState() : pdb(new CGalaxyCashDB((gArgs.GetArg("-gchdbcache", 128) << 20), false, gArgs.GetBoolArg("-reindex", false))) { } CGalaxyCashState::~CGalaxyCashState() { delete pdb; } void CGalaxyCashState::EvalScript() { } bool CGalaxyCashConsensus::CheckSignature() const { return true; }
galaxycash/galaxycash
src/galaxycash.cpp
C++
mit
1,037
/** * Super-Cache for Browser * * @author Zongmin Lei <leizongmin@gmail.com> */ var CacheManager = require('./lib/manager'); var MemoryStore = require('./lib/store/memory'); var LocalStore = require('./lib/store/local'); module.exports = exports = CacheManager; exports.MemoryStore = MemoryStore; exports.LocalStore = LocalStore; exports.create = function (options) { return new CacheManager(options); }; // ADM mode if (typeof define === 'function' && define.amd) { define(function () { return module.exports; }); } // Shim mode if (typeof window !== 'undefined') { window.SuperCache = module.exports; }
SuperID/super-cache
browser.js
JavaScript
mit
629
using OuiGui.Lib.Model; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace OuiGui.Lib.Services { public interface IChocolateyService { Task<IEnumerable<InstalledPackage>> ListInstalledPackages(bool allVersions, CancellationToken token); Task InstallPackage(string packageName, string version, Action<string> onDataReceived); Task UninstallPackage(string packageName, string version, Action<string> onDataReceived); Task UpdatePackage(string packageName, Action<string> onDataReceived); Task InstallPackage(string packageName, string version, Action<string> onDataReceived, CancellationToken cancelToken); Task UninstallPackage(string packageName, string version, Action<string> onDataReceived, CancellationToken cancelToken); Task UpdatePackage(string packageName, Action<string> onDataReceived, CancellationToken cancelToken); } }
cmc13/OuiGui
OuiGui.Lib/Services/IChocolateyService.cs
C#
mit
965
module.exports = { light: { background1: 'rgba(227,227,227,.95)', background2: 'rgba(204,204,204,.95)', background2hover: 'rgba(208,208,208,.95)', foreground1: 'rgba(105,105,105,.95)', text1: 'rgba(36,36,36,.95)', text2: 'rgba(87,87,87,.95)' }, dark: { background1: 'rgba(35,35,35,.95)', background2: 'rgba(54,54,54,.95)', background2hover: 'rgba(58,58,58,.95)', foreground1: 'rgba(112,112,112,.95)', text1: 'rgba(235,235,235,.95)', text2: 'rgba(161,161,161,.95)' } }
freeman-lab/control-panel
themes.js
JavaScript
mit
525
<?php declare(strict_types=1); /* * This file is part of gpupo/common-schema created by Gilmar Pupo <contact@gpupo.com> * For the information of copyright and license you should read the file LICENSE which is * distributed with this source code. For more information, see <https://opensource.gpupo.com/> */ namespace Gpupo\CommonSchema\ORM\EntityRepository\Trading\Payment; /** * PaymentRepository. * * This class was generated by the Doctrine ORM. Add your own custom * repository methods below. */ class PaymentRepository extends \Gpupo\CommonSchema\ORM\EntityRepository\AbstractEntityRepository { }
gpupo/common-schema
src/ORM/EntityRepository/Trading/Payment/PaymentRepository.php
PHP
mit
615
# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::Network::Mgmt::V2019_09_01 module Models # # City or town details. # class AvailableProvidersListCity include MsRestAzure # @return [String] The city or town name. attr_accessor :city_name # @return [Array<String>] A list of Internet service providers. attr_accessor :providers # # Mapper for AvailableProvidersListCity class as Ruby Hash. # This will be used for serialization/deserialization. # def self.mapper() { client_side_validation: true, required: false, serialized_name: 'AvailableProvidersListCity', type: { name: 'Composite', class_name: 'AvailableProvidersListCity', model_properties: { city_name: { client_side_validation: true, required: false, serialized_name: 'cityName', type: { name: 'String' } }, providers: { client_side_validation: true, required: false, serialized_name: 'providers', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'StringElementType', type: { name: 'String' } } } } } } } end end end end
Azure/azure-sdk-for-ruby
management/azure_mgmt_network/lib/2019-09-01/generated/azure_mgmt_network/models/available_providers_list_city.rb
Ruby
mit
1,791
<?php $this->response->setStatusCode(404); // ... return $this->response->setJSON(['foo' => 'bar']);
kenjis/CodeIgniter4
user_guide_src/source/installation/upgrade_responses/002.php
PHP
mit
104
from collections import Counter from os.path import splitext import matplotlib.pyplot as plt from arcapix.fs.gpfs import ListProcessingRule, ManagementPolicy def type_sizes(file_list): c = Counter() for f in file_list: c.update({splitext(f.name): f.filesize}) return c p = ManagementPolicy() r = p.rules.new(ListProcessingRule, 'types', type_sizes) result = p.run('mmfs1')['types'] plt.pie(list(result.values()), labels=list(result.keys()), autopct='%1.1f%%') plt.axis('equal') plt.show()
arcapix/gpfsapi-examples
type_sizes_piechart.py
Python
mit
519
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web; using System.Windows.Forms; using System.Xml; using System.Xml.Linq; using System.Xml.Xsl; using JsonXslt.HtmlExample.Properties; using Newtonsoft.Json.Linq; namespace JsonXslt.HtmlExample { public partial class HtmlExample : Form { private readonly JObject json = JObject.Parse("{ \"Sport\" : \"Football\", \"Scores\" : [ { \"Name\" : \"Eagles\", \"Score\" : 21 }, { \"Name\" : \"Hawks\", \"Score\" : 14 } ]}"); private readonly XslCompiledTransform transform = new XslCompiledTransform(true); public HtmlExample() { InitializeComponent(); using (StringReader sr = new StringReader(Resources.HtmlExample)) { using (XmlTextReader xr = new XmlTextReader(sr)) { transform.Load(xr, new XsltSettings(true, false), null); } } } private void ViewJsonButton_Click(object sender, EventArgs e) { WebBrowserControl.DocumentText = FormatAsWeb(json.ToString()); } private void ViewXsltButton_Click(object sender, EventArgs e) { WebBrowserControl.DocumentText = FormatAsWeb(Resources.HtmlExample); } private void ViewResultButton_Click(object sender, EventArgs e) { using (StringWriter sw = new StringWriter()) { using (XmlTextWriter tw = new XmlTextWriter(sw)) { transform.Transform(new JsonXPathNavigator(json), tw); } WebBrowserControl.DocumentText = sw.ToString(); } } private void ViewAsXmlButton_Click(object sender, EventArgs e) { WebBrowserControl.DocumentText = FormatAsWeb(XDocument.Load(new JsonXPathNavigator(json).ReadSubtree()).ToString()); } private string FormatAsWeb(string str) { return HttpUtility.HtmlEncode(str).Replace("\r\n", "<br/>").Replace(" ", "&nbsp;").Replace("\t", " "); } } }
kuhnboy/JsonXslt
JsonXslt/JsonXslt.HtmlExample/HtmlExample.cs
C#
mit
1,943
<?php namespace Joschi127\DoctrineEntityOverrideBundle\Tests\Functional\src\Entity; use FOS\UserBundle\Model\User as BaseUser; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity * @ORM\Table(name="test_user") */ class User extends BaseUser { /** * @var int * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @var string * @ORM\Column(type="string", length=255, nullable=true) */ protected $firstName; /** * @var string * @ORM\Column(type="string", length=255, nullable=true) */ protected $lastName; /** * Overridden property from FOS\UserBundle\Model\User. * * @var string * @ORM\Column(type="string", length=110, nullable=false) */ protected $username; /** * Overridden property from FOS\UserBundle\Model\User. * * @var string * @ORM\Column(type="string", length=120, nullable=true) */ protected $email; /** * @var ArrayCollection * @ORM\ManyToMany(targetEntity="Joschi127\DoctrineEntityOverrideBundle\Tests\Functional\src\Entity\Group", cascade={"persist"}) * @ORM\JoinTable(name="test_user_has_group", * joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="group_id", referencedColumnName="id", unique=true)} * ) */ protected $groups; /** * @var UserActivity * @ORM\OneToOne(targetEntity="Joschi127\DoctrineEntityOverrideBundle\Tests\Functional\src\Entity\UserActivity", mappedBy="user", cascade={"persist", "remove", "merge"}) */ protected $userActivity; public function __construct() { parent::__construct(); $this->groups = new ArrayCollection(); } /** * @return string */ public function getFirstName() { return $this->firstName; } /** * @param string $firstName */ public function setFirstName($firstName) { $this->firstName = $firstName; } /** * @return string */ public function getLastName() { return $this->lastName; } /** * @param string $lastName */ public function setLastName($lastName) { $this->lastName = $lastName; } /** * @return UserActivity */ public function getUserActivity() { return $this->userActivity; } /** * @param UserActivity $userActivity */ public function setUserActivity($userActivity) { $userActivity->setUser($this); $this->userActivity = $userActivity; } }
joschi127/doctrine-entity-override-bundle
Tests/Functional/src/Entity/User.php
PHP
mit
2,800
class MetaProperty { constructor (options) { this.type = 'MetaProperty' Object.assign(this, options) } } module.exports = MetaProperty
buxlabs/ast
src/nodes/MetaProperty.js
JavaScript
mit
148
//go:build go1.16 // +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. package armmachinelearningservices import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "reflect" ) // ComputeClientListNodesPager provides operations for iterating over paged responses. type ComputeClientListNodesPager struct { client *ComputeClient current ComputeClientListNodesResponse err error requester func(context.Context) (*policy.Request, error) advancer func(context.Context, ComputeClientListNodesResponse) (*policy.Request, error) } // Err returns the last error encountered while paging. func (p *ComputeClientListNodesPager) Err() error { return p.err } // NextPage returns true if the pager advanced to the next page. // Returns false if there are no more pages or an error occurred. func (p *ComputeClientListNodesPager) NextPage(ctx context.Context) bool { var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { if p.current.AmlComputeNodesInformation.NextLink == nil || len(*p.current.AmlComputeNodesInformation.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) } else { req, err = p.requester(ctx) } if err != nil { p.err = err return false } resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } if !runtime.HasStatusCode(resp, http.StatusOK) { p.err = runtime.NewResponseError(resp) return false } result, err := p.client.listNodesHandleResponse(resp) if err != nil { p.err = err return false } p.current = result return true } // PageResponse returns the current ComputeClientListNodesResponse page. func (p *ComputeClientListNodesPager) PageResponse() ComputeClientListNodesResponse { return p.current } // ComputeClientListPager provides operations for iterating over paged responses. type ComputeClientListPager struct { client *ComputeClient current ComputeClientListResponse err error requester func(context.Context) (*policy.Request, error) advancer func(context.Context, ComputeClientListResponse) (*policy.Request, error) } // Err returns the last error encountered while paging. func (p *ComputeClientListPager) Err() error { return p.err } // NextPage returns true if the pager advanced to the next page. // Returns false if there are no more pages or an error occurred. func (p *ComputeClientListPager) NextPage(ctx context.Context) bool { var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { if p.current.PaginatedComputeResourcesList.NextLink == nil || len(*p.current.PaginatedComputeResourcesList.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) } else { req, err = p.requester(ctx) } if err != nil { p.err = err return false } resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } if !runtime.HasStatusCode(resp, http.StatusOK) { p.err = runtime.NewResponseError(resp) return false } result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false } p.current = result return true } // PageResponse returns the current ComputeClientListResponse page. func (p *ComputeClientListPager) PageResponse() ComputeClientListResponse { return p.current } // QuotasClientListPager provides operations for iterating over paged responses. type QuotasClientListPager struct { client *QuotasClient current QuotasClientListResponse err error requester func(context.Context) (*policy.Request, error) advancer func(context.Context, QuotasClientListResponse) (*policy.Request, error) } // Err returns the last error encountered while paging. func (p *QuotasClientListPager) Err() error { return p.err } // NextPage returns true if the pager advanced to the next page. // Returns false if there are no more pages or an error occurred. func (p *QuotasClientListPager) NextPage(ctx context.Context) bool { var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { if p.current.ListWorkspaceQuotas.NextLink == nil || len(*p.current.ListWorkspaceQuotas.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) } else { req, err = p.requester(ctx) } if err != nil { p.err = err return false } resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } if !runtime.HasStatusCode(resp, http.StatusOK) { p.err = runtime.NewResponseError(resp) return false } result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false } p.current = result return true } // PageResponse returns the current QuotasClientListResponse page. func (p *QuotasClientListPager) PageResponse() QuotasClientListResponse { return p.current } // UsagesClientListPager provides operations for iterating over paged responses. type UsagesClientListPager struct { client *UsagesClient current UsagesClientListResponse err error requester func(context.Context) (*policy.Request, error) advancer func(context.Context, UsagesClientListResponse) (*policy.Request, error) } // Err returns the last error encountered while paging. func (p *UsagesClientListPager) Err() error { return p.err } // NextPage returns true if the pager advanced to the next page. // Returns false if there are no more pages or an error occurred. func (p *UsagesClientListPager) NextPage(ctx context.Context) bool { var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { if p.current.ListUsagesResult.NextLink == nil || len(*p.current.ListUsagesResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) } else { req, err = p.requester(ctx) } if err != nil { p.err = err return false } resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } if !runtime.HasStatusCode(resp, http.StatusOK) { p.err = runtime.NewResponseError(resp) return false } result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false } p.current = result return true } // PageResponse returns the current UsagesClientListResponse page. func (p *UsagesClientListPager) PageResponse() UsagesClientListResponse { return p.current } // WorkspaceFeaturesClientListPager provides operations for iterating over paged responses. type WorkspaceFeaturesClientListPager struct { client *WorkspaceFeaturesClient current WorkspaceFeaturesClientListResponse err error requester func(context.Context) (*policy.Request, error) advancer func(context.Context, WorkspaceFeaturesClientListResponse) (*policy.Request, error) } // Err returns the last error encountered while paging. func (p *WorkspaceFeaturesClientListPager) Err() error { return p.err } // NextPage returns true if the pager advanced to the next page. // Returns false if there are no more pages or an error occurred. func (p *WorkspaceFeaturesClientListPager) NextPage(ctx context.Context) bool { var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { if p.current.ListAmlUserFeatureResult.NextLink == nil || len(*p.current.ListAmlUserFeatureResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) } else { req, err = p.requester(ctx) } if err != nil { p.err = err return false } resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } if !runtime.HasStatusCode(resp, http.StatusOK) { p.err = runtime.NewResponseError(resp) return false } result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false } p.current = result return true } // PageResponse returns the current WorkspaceFeaturesClientListResponse page. func (p *WorkspaceFeaturesClientListPager) PageResponse() WorkspaceFeaturesClientListResponse { return p.current } // WorkspaceSKUsClientListPager provides operations for iterating over paged responses. type WorkspaceSKUsClientListPager struct { client *WorkspaceSKUsClient current WorkspaceSKUsClientListResponse err error requester func(context.Context) (*policy.Request, error) advancer func(context.Context, WorkspaceSKUsClientListResponse) (*policy.Request, error) } // Err returns the last error encountered while paging. func (p *WorkspaceSKUsClientListPager) Err() error { return p.err } // NextPage returns true if the pager advanced to the next page. // Returns false if there are no more pages or an error occurred. func (p *WorkspaceSKUsClientListPager) NextPage(ctx context.Context) bool { var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { if p.current.SKUListResult.NextLink == nil || len(*p.current.SKUListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) } else { req, err = p.requester(ctx) } if err != nil { p.err = err return false } resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } if !runtime.HasStatusCode(resp, http.StatusOK) { p.err = runtime.NewResponseError(resp) return false } result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false } p.current = result return true } // PageResponse returns the current WorkspaceSKUsClientListResponse page. func (p *WorkspaceSKUsClientListPager) PageResponse() WorkspaceSKUsClientListResponse { return p.current } // WorkspacesClientListByResourceGroupPager provides operations for iterating over paged responses. type WorkspacesClientListByResourceGroupPager struct { client *WorkspacesClient current WorkspacesClientListByResourceGroupResponse err error requester func(context.Context) (*policy.Request, error) advancer func(context.Context, WorkspacesClientListByResourceGroupResponse) (*policy.Request, error) } // Err returns the last error encountered while paging. func (p *WorkspacesClientListByResourceGroupPager) Err() error { return p.err } // NextPage returns true if the pager advanced to the next page. // Returns false if there are no more pages or an error occurred. func (p *WorkspacesClientListByResourceGroupPager) NextPage(ctx context.Context) bool { var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { if p.current.WorkspaceListResult.NextLink == nil || len(*p.current.WorkspaceListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) } else { req, err = p.requester(ctx) } if err != nil { p.err = err return false } resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } if !runtime.HasStatusCode(resp, http.StatusOK) { p.err = runtime.NewResponseError(resp) return false } result, err := p.client.listByResourceGroupHandleResponse(resp) if err != nil { p.err = err return false } p.current = result return true } // PageResponse returns the current WorkspacesClientListByResourceGroupResponse page. func (p *WorkspacesClientListByResourceGroupPager) PageResponse() WorkspacesClientListByResourceGroupResponse { return p.current } // WorkspacesClientListBySubscriptionPager provides operations for iterating over paged responses. type WorkspacesClientListBySubscriptionPager struct { client *WorkspacesClient current WorkspacesClientListBySubscriptionResponse err error requester func(context.Context) (*policy.Request, error) advancer func(context.Context, WorkspacesClientListBySubscriptionResponse) (*policy.Request, error) } // Err returns the last error encountered while paging. func (p *WorkspacesClientListBySubscriptionPager) Err() error { return p.err } // NextPage returns true if the pager advanced to the next page. // Returns false if there are no more pages or an error occurred. func (p *WorkspacesClientListBySubscriptionPager) NextPage(ctx context.Context) bool { var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { if p.current.WorkspaceListResult.NextLink == nil || len(*p.current.WorkspaceListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) } else { req, err = p.requester(ctx) } if err != nil { p.err = err return false } resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } if !runtime.HasStatusCode(resp, http.StatusOK) { p.err = runtime.NewResponseError(resp) return false } result, err := p.client.listBySubscriptionHandleResponse(resp) if err != nil { p.err = err return false } p.current = result return true } // PageResponse returns the current WorkspacesClientListBySubscriptionResponse page. func (p *WorkspacesClientListBySubscriptionPager) PageResponse() WorkspacesClientListBySubscriptionResponse { return p.current }
Azure/azure-sdk-for-go
sdk/resourcemanager/machinelearningservices/armmachinelearningservices/zz_generated_pagers.go
GO
mit
13,089
<?php namespace Faulancer\ORM\User; use Faulancer\ORM\Entity as BaseEntity; /** * Class Role * * @property string $roleName * * @author Florian Knapp <office@florianknapp.de> */ class Role extends BaseEntity { protected static $relations = [ 'users' => [Entity::class, ['id' => 'role_id'], 'roles', 'userrole'] ]; protected static $tableName = 'role'; }
FloKnapp/faulancer
src/ORM/User/Role.php
PHP
mit
386
<?php if (!defined('BASEPATH')) exit('No ingrese directamente es este script'); /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * Description of login * * @author jucactru */ class Login_model extends CI_Model { //constructor public function __construct() { parent::__construct(); } //fin del constructor /* * ------------------------------------------------------- * Método para obtener los datos del usuario * ------------------------------------------------------- * Párametros * No tiene variables de parámetros * ------------------------------------------------------ * Retorno * @valorRetorno | arreglo | Si se encuentran resultados en la base de datos. */ public function consultarDatos() { //creo la variable de retotno $valorRetorno = null; //creo la cadena de where manual $dataWhere = '( usu_correo = "' . $this->input->post('text_user', TRUE) . '" ' . 'OR usu_username = "' . $this->input->post('text_user', TRUE) . '") ' . 'AND usu_contrasena = "' . do_hash($this->input->post('text_contrasena', TRUE), 'md5') . '" ' . 'AND usuario.est_id = 1'; //preparo el select $this->db->select('usu_id, usu_nombre, usu_apellido, usu_correo, usuario_rol.usu_rol_id, usu_foto'); //preparo el join $this->db->join('usuario_rol', 'usuario_rol.usu_rol_id = usuario.usu_rol_id'); //ejecuto la consulta de los datos del usuario $usuarioLogin = $this->db->get_where('usuario', $dataWhere); //verifico los resultados de la consulta if ($usuarioLogin->num_rows() == 1): //retornamos el valor usuario login foreach ($usuarioLogin->result() as $filaTabla): $valorRetorno = $filaTabla; endforeach; endif; ////fin del if //devuelvo el valor retorno return $valorRetorno; } //fin del metodo }
YaraWebDeveloper/umradio
application/models/login/login_model.php
PHP
mit
2,220
"use strict"; var _getSert = require("../getsert"); var generateCode = require("../../../src/utils/code-generator"); class StorageDataUtil { getSert(input) { var ManagerType = require("../../../src/managers/master/storage-manager"); return _getSert(input, ManagerType, (data) => { return { code: data.code }; }); } getNewData() { var Model = require('bateeq-models').master.Storage; var data = new Model(); var code = generateCode(); data.code = code; data.name = `name[${code}]`; data.description = `storage description [${code}]`; return Promise.resolve(data); } getRandomTestData() { return this.getNewData() .then((data) => { return this.getSert(data); }); } getTestData() { var data = { code: 'UT/STO/01', name: 'Storage Unit Test', description: '' }; return this.getSert(data); } getPackingTestData() { var data = { code: 'GDG.07', name: 'Gudang Accesories', description: '' }; return this.getSert(data); } } module.exports = new StorageDataUtil();
danliris/bateeq-module
test/data-util/master/storage-data-util.js
JavaScript
mit
1,291
package com.sap.data.app.entity.system; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.GenericGenerator; import com.sap.data.app.entity.task.Task; @Entity //表名与类名不相同时重新定义表名. @Table(name = "DM_EVENT") //默认的缓存策略. @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class Event { private String eventId; private String eventName; /* private Task task; @ManyToOne(cascade=CascadeType.ALL) @JoinColumn(name="task_id") public Task getTask() { return task; } public void setTask(Task task) { this.task = task; }*/ public String getEventName() { return eventName; } public void setEventName(String eventName) { this.eventName = eventName; } private String eventDes; private String comments; @Id @GeneratedValue(generator = "system-uuid") @GenericGenerator(name = "system-uuid", strategy = "uuid") public String getEventId() { return eventId; } public void setEventId(String eventId) { this.eventId = eventId; } public String getEventDes() { return eventDes; } public void setEventDes(String eventDes) { this.eventDes = eventDes; } public String getComments() { return comments; } public void setComments(String comments) { this.comments = comments; } }
shangyantao/dmapp
data-app/src/main/java/com/sap/data/app/entity/system/Event.java
Java
mit
1,588
#region License // TableDependency, SqlTableDependency // Copyright (c) 2015-2020 Christian Del Bianco. All rights reserved. // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without // restriction, including without limitation the rights to use, // copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. #endregion using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; namespace TableDependency.SqlClient.Base.Abstracts { public interface IUpdateOfModel<T> where T : class { void Add(params Expression<Func<T, object>>[] expressions); int Count(); IList<PropertyInfo> GetPropertiesInfos(); } }
christiandelbianco/monitor-table-change-with-sqltabledependency
TableDependency.SqlClient/Base/Abstracts/IUpdateOfModel.cs
C#
mit
1,589
/* Copyright 2008-2009 University of Cambridge Copyright 2008-2009 University of Toronto Licensed under the Educational Community License (ECL), Version 2.0 or the New BSD license. You may not use this file except in compliance with one these Licenses. You may obtain a copy of the ECL 2.0 License and BSD License at https://source.fluidproject.org/svn/LICENSE.txt */ /*global jQuery*/ var fluid = fluid || {}; (function ($) { var selectOnFocus = false; // Private functions. var makeTabsSelectable = function (tablist) { var tabs = tablist.children("li"); // Put the tablist in the tab focus order. Take each tab *out* of the tab order // so that they can be navigated with the arrow keys instead of the tab key. fluid.tabbable(tablist); // When we're using the Windows style interaction, select the tab as soon as it's focused. var selectTab = function (tabToSelect) { if (selectOnFocus) { tablist.tabs('select', tabs.index(tabToSelect)); } }; // Make the tab list selectable with the arrow keys: // * Pass in the items you want to make selectable. // * Register your onSelect callback to make the tab actually selected. // * Specify the orientation of the tabs (the default is vertical) fluid.selectable(tablist, { selectableElements: tabs, onSelect: selectTab, direction: fluid.a11y.orientation.HORIZONTAL }); // Use an activation handler if we are using the "Mac OS" style tab interaction. // In this case, we shouldn't actually select the tab until the Enter or Space key is pressed. fluid.activatable(tablist, function (tabToSelect) { if (!selectOnFocus) { tablist.tabs('select', tabs.index(tabToSelect)); } }); }; var addARIA = function (tablist, panelsId) { var tabs = tablist.children("li"); var panels = $("#" + "panels" + " > div"); // Give the container a role of tablist tablist.attr("role", "tablist"); // Each tab should have a role of Tab, // and a "position in set" property describing its order within the tab list. tabs.each (function(i, tab) { $(tab).attr("role", "tab"); }); // Give each panel a role of tabpanel panels.attr("role", "tabpanel"); // And associate each panel with its tab using the labelledby relation. panels.each (function (i, panel) { $(panel).attr("aria-labelledby", panel.id.split("Panel")[0] + "Tab"); }); }; // Public API. fluid.accessibletabs = function (tabsId, panelsId) { var tablist = $("#" + tabsId); // Remove the anchors in the list from the tab order. fluid.tabindex(tablist.find("a"), -1); // Turn the list into a jQuery UI tabs widget. tablist.tabs(); // Make them accessible. makeTabsSelectable(tablist); addARIA(tablist, panelsId); }; // When the document is loaded, initialize our tabs. $(function () { selectOnFocus = false; // Instantiate the tabs widget. fluid.accessibletabs("tabs", "panels"); // Bind the select on focus link. $("#selectOnFocusLink").click(function (evt) { selectOnFocus = !selectOnFocus; if (selectOnFocus) { $(evt.target).text("Enabled"); } else { $(evt.target).text("Disabled"); } return false; }); }); }) (jQuery);
mediashelf/fluid-infusion
assets/infusion/standalone-demos/keyboard-a11y/js/jquery-ui-accessible-tabs.js
JavaScript
mit
3,738
import React from 'react'; import Examples from './Examples'; var node = document.getElementById('main'); window.render = function(){ React.render(<Examples />, node); }; window.unmount = function() { React.unmountComponentAtNode(node); }; window.render();
christiaanderidder/react-googlecharts
examples/main.js
JavaScript
mit
263
module ActiveRecord module Associations class BelongsToPolymorphicAssociation < AssociationProxy #:nodoc: def replace(record) if record.nil? @target = @owner[@reflection.primary_key_name] = @owner[@reflection.options[:foreign_type]] = nil else @target = (AssociationProxy === record ? record.target : record) unless record.new_record? @owner[@reflection.primary_key_name] = record.id @owner[@reflection.options[:foreign_type]] = ActiveRecord::Base.send(:class_name_of_active_record_descendant, record.class).to_s end @updated = true end loaded record end def updated? @updated end private def find_target return nil if association_class.nil? if @reflection.options[:conditions] association_class.find( @owner[@reflection.primary_key_name], :conditions => interpolate_sql(@reflection.options[:conditions]), :include => @reflection.options[:include] ) else association_class.find(@owner[@reflection.primary_key_name], :include => @reflection.options[:include]) end end def foreign_key_present !@owner[@reflection.primary_key_name].nil? end def association_class @owner[@reflection.options[:foreign_type]] ? @owner[@reflection.options[:foreign_type]].constantize : nil end end end end
mattrose/gullery
vendor/rails/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb
Ruby
mit
1,544
;(function() { 'use strict'; var listOfProgrammingLanguages = { restrict: 'E', templateUrl: '/directives/tpl/cd-programming-languages-list', bindings: { programmingLanguages: '<' }, controller: ['cdProgrammingLanguagesService', function (cdProgrammingLanguagesService) { var ctrl = this; cdProgrammingLanguagesService.get().then(function (data) { var programmingLanguagesJSON = data.data; _.each(ctrl.programmingLanguages, function (language, index) { var lLanguage = _.find(programmingLanguagesJSON, {text: language.text}); if (!_.isUndefined(lLanguage)) { ctrl.programmingLanguages[index].picture = lLanguage.image; ctrl.programmingLanguages[index].caption = lLanguage.text; ctrl.programmingLanguages[index].href = lLanguage.href; } }); }); }] }; angular .module('cpZenPlatform') .component('programmingLanguagesList', listOfProgrammingLanguages); }());
CoderDojo/cp-zen-platform
web/public/js/directives/cd-programming-languages-list/index.js
JavaScript
mit
1,006
function getDisplayName(WrappedComponent) { return WrappedComponent.displayName || WrappedComponent.name || "Component"; } export default getDisplayName;
trabe/simple-guards-react
src/get-display-name.js
JavaScript
mit
157
module API module APIHelpers PRIVATE_TOKEN_HEADER = "HTTP_PRIVATE_TOKEN" PRIVATE_TOKEN_PARAM = :private_token SUDO_HEADER ="HTTP_SUDO" SUDO_PARAM = :sudo def current_user private_token = (params[PRIVATE_TOKEN_PARAM] || env[PRIVATE_TOKEN_HEADER]).to_s @current_user ||= User.find_by(authentication_token: private_token) identifier = sudo_identifier() # If the sudo is the current user do nothing if (identifier && !(@current_user.id == identifier || @current_user.username == identifier)) render_api_error!('403 Forbidden: Must be admin to use sudo', 403) unless @current_user.is_admin? @current_user = User.by_username_or_id(identifier) not_found!("No user id or username for: #{identifier}") if @current_user.nil? end @current_user end def sudo_identifier() identifier ||= params[SUDO_PARAM] ||= env[SUDO_HEADER] # Regex for integers if (!!(identifier =~ /^[0-9]+$/)) identifier.to_i else identifier end end def set_current_user_for_thread Thread.current[:current_user] = current_user begin yield ensure Thread.current[:current_user] = nil end end def user_project @project ||= find_project(params[:id]) @project || not_found! end def find_project(id) project = Project.find_with_namespace(id) || Project.find_by(id: id) if project && can?(current_user, :read_project, project) project else nil end end def paginate(object) object.page(params[:page]).per(params[:per_page].to_i) end def authenticate! unauthorized! unless current_user end def authenticated_as_admin! forbidden! unless current_user.is_admin? end def authorize! action, subject unless abilities.allowed?(current_user, action, subject) forbidden! end end def authorize_admin_project authorize! :admin_project, user_project end def can?(object, action, subject) abilities.allowed?(object, action, subject) end # Checks the occurrences of required attributes, each attribute must be present in the params hash # or a Bad Request error is invoked. # # Parameters: # keys (required) - A hash consisting of keys that must be present def required_attributes!(keys) keys.each do |key| bad_request!(key) unless params[key].present? end end def attributes_for_keys(keys) attrs = {} keys.each do |key| attrs[key] = params[key] if params[key].present? or (params.has_key?(key) and params[key] == false) end attrs end # error helpers def forbidden! render_api_error!('403 Forbidden', 403) end def bad_request!(attribute) message = ["400 (Bad request)"] message << "\"" + attribute.to_s + "\" not given" render_api_error!(message.join(' '), 400) end def not_found!(resource = nil) message = ["404"] message << resource if resource message << "Not Found" render_api_error!(message.join(' '), 404) end def unauthorized! render_api_error!('401 Unauthorized', 401) end def not_allowed! render_api_error!('Method Not Allowed', 405) end def render_api_error!(message, status) error!({'message' => message}, status) end private def abilities @abilities ||= begin abilities = Six.new abilities << Ability abilities end end end end
pkallberg/tjenare
lib/api/helpers.rb
Ruby
mit
3,680
#if !UNITY_WINRT || UNITY_EDITOR || UNITY_WP8 #region License // Copyright (c) 2007 James Newton-King // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without // restriction, including without limitation the rights to use, // copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. #endregion using System; namespace Newtonsoft.Json { /// <summary> /// Instructs the <see cref="JsonSerializer"/> not to serialize the public field or public read/write property value. /// </summary> [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)] public sealed class JsonIgnoreAttribute : Attribute { } } #endif
Snogar/Imbo
Assets/JsonDotNet/Source/JsonIgnoreAttribute.cs
C#
mit
1,596
// Copyright 2012-2015 Oliver Eilhard. All rights reserved. // Use of this source code is governed by a MIT-license. // See http://olivere.mit-license.org/license.txt for details. package elastic import ( "encoding/json" "fmt" "net/url" "github.com/devacto/grobot/Godeps/_workspace/src/gopkg.in/olivere/elastic.v2/uritemplates" ) // GetTemplateService reads a search template. // It is documented at http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html. type GetTemplateService struct { client *Client pretty bool id string version interface{} versionType string } // NewGetTemplateService creates a new GetTemplateService. func NewGetTemplateService(client *Client) *GetTemplateService { return &GetTemplateService{ client: client, } } // Id is the template ID. func (s *GetTemplateService) Id(id string) *GetTemplateService { s.id = id return s } // Version is an explicit version number for concurrency control. func (s *GetTemplateService) Version(version interface{}) *GetTemplateService { s.version = version return s } // VersionType is a specific version type. func (s *GetTemplateService) VersionType(versionType string) *GetTemplateService { s.versionType = versionType return s } // buildURL builds the URL for the operation. func (s *GetTemplateService) buildURL() (string, url.Values, error) { // Build URL path, err := uritemplates.Expand("/_search/template/{id}", map[string]string{ "id": s.id, }) if err != nil { return "", url.Values{}, err } // Add query string parameters params := url.Values{} if s.version != nil { params.Set("version", fmt.Sprintf("%v", s.version)) } if s.versionType != "" { params.Set("version_type", s.versionType) } return path, params, nil } // Validate checks if the operation is valid. func (s *GetTemplateService) Validate() error { var invalid []string if s.id == "" { invalid = append(invalid, "Id") } if len(invalid) > 0 { return fmt.Errorf("missing required fields: %v", invalid) } return nil } // Do executes the operation and returns the template. func (s *GetTemplateService) Do() (*GetTemplateResponse, error) { // Check pre-conditions if err := s.Validate(); err != nil { return nil, err } // Get URL for request path, params, err := s.buildURL() if err != nil { return nil, err } // Get HTTP response res, err := s.client.PerformRequest("GET", path, params, nil) if err != nil { return nil, err } // Return result ret := new(GetTemplateResponse) if err := json.Unmarshal(res.Body, ret); err != nil { return nil, err } return ret, nil } type GetTemplateResponse struct { Template string `json:"template"` }
devacto/grobot
Godeps/_workspace/src/gopkg.in/olivere/elastic.v2/get_template.go
GO
mit
2,714
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DlBot4 { class Helper{ public static void changeWindow(dynamic windowFrom, dynamic windowTo) { windowTo.Top = windowFrom.Top; windowTo.Left = windowFrom.Left; windowTo.Height = windowFrom.Height; windowTo.Width = windowFrom.Width; windowTo.Show(); windowFrom.Hide(); } } }
iarwain8a/DlBot4
DlBot4/Helper.cs
C#
mit
507
package pl.grzeslowski.jsupla.protocoljava.api.parsers.cs; import pl.grzeslowski.jsupla.protocol.api.structs.cs.SuplaChannelNewValueB; import pl.grzeslowski.jsupla.protocoljava.api.entities.cs.ChannelNewValueB; public interface ChannelNewValueBParser extends ClientServerParser<ChannelNewValueB, SuplaChannelNewValueB> { }
magx2/jSupla
protocol-java/src/main/java/pl/grzeslowski/jsupla/protocoljava/api/parsers/cs/ChannelNewValueBParser.java
Java
mit
325
// Ember Extensions Ember.ArrayProxy.prototype.flatten = Array.prototype.flatten = function() { var r = []; this.forEach(function(el) { r.push.apply(r, Ember.isArray(el) ? el.flatten() : [el]); }); return r; }; // jQuery Additions jQuery.fn.exists = function() { return this.length > 0; };
Gowiem/Sisyphus
app/assets/javascripts/extensions.js
JavaScript
mit
305
package main.java.mergame.individuos; public interface Atacable { public void serAtacado(int danio); }
PuumPuumPuum/jrpg
dominio/src/main/java/mergame/individuos/Atacable.java
Java
mit
106
module Mousetrap class Customer < Resource attr_accessor \ :id, :code, :email, :first_name, :last_name, :company, :notes, :subscription, :charges, :items def update_tracked_item_quantity(item_code, quantity = 1) tracked_item_resource = if quantity == quantity.abs 'add-item-quantity' else 'remove-item-quantity' end attributes = { :itemCode => item_code, :quantity => quantity.abs } response = self.class.put_resource 'customers', tracked_item_resource, code, attributes raise response['error'] if response['error'] response end def add_item_quantity(item_code, quantity = 1) update_tracked_item_quantity(item_code, quantity) end def remove_item_quantity(item_code, quantity = 1) update_tracked_item_quantity(item_code, -quantity) end def add_custom_charge(item_code, amount = 1.0, quantity = 1, description = nil) attributes = { :chargeCode => item_code, :eachAmount => amount, :quantity => quantity, :description => description } response = self.class.put_resource 'customers', 'add-charge', code, attributes raise response['error'] if response['error'] response end def instant_bill_custom_charge(item_code, amount = 1.0, quantity = 1, description = nil) add_custom_charge(item_code, amount, quantity, description) bill_now end def subscription_attributes=(attributes) self.subscription = Subscription.new attributes end def attributes { :id => id, :code => code, :email => email, :first_name => first_name, :last_name => last_name, :company => company, :notes => notes, :charges => charges, :items => items } end def attributes_for_api # TODO: superclass? self.class.attributes_for_api(attributes, new_record?) end def attributes_for_api_with_subscription raise "Must have subscription" unless subscription a = attributes_for_api a[:subscription] = subscription.attributes_for_api a end def cancel member_action 'cancel' unless new_record? end def new? if api_customer = self.class[code] self.id = api_customer.id return false else return true end end def save new? ? create : update end def switch_to_plan(plan_code) raise "Can only call this on an existing CheddarGetter customer." unless exists? attributes = { :planCode => plan_code } self.class.put_resource('customers', 'edit-subscription', code, attributes) # TODO: Refresh self with reload here? end def bill_now raise "Can only call this on an existing CheddarGetter customer." unless exists? attributes = { :changeBillDate => 'now' } self.class.put_resource('customers', 'edit-subscription', code, attributes) end def self.all response = get_resources 'customers' if response['error'] if response['error'] =~ /No customers found/ return [] else raise response['error'] end end build_resources_from response end def self.create(attributes) object = new(attributes) object.send(:create) object end def self.new_from_api(attributes) customer = new(attributes_from_api(attributes)) subscription_attrs = attributes['subscriptions']['subscription'] customer.subscription = Subscription.new_from_api(subscription_attrs.kind_of?(Array) ? subscription_attrs.first : subscription_attrs) customer end def self.update(customer_code, attributes) customer = new(attributes) customer.code = customer_code customer.send :update end protected def self.plural_resource_name 'customers' end def self.singular_resource_name 'customer' end def self.attributes_for_api(attributes, new_record = true) mutated_hash = { :email => attributes[:email], :firstName => attributes[:first_name], :lastName => attributes[:last_name], :company => attributes[:company], :notes => attributes[:notes] } mutated_hash.merge!(:charges => attributes[:charges]) if attributes[:charges] mutated_hash.merge!(:items => attributes[:items]) if attributes[:items] mutated_hash.merge!(:code => attributes[:code]) if new_record mutated_hash end def self.attributes_from_api(attributes) { :id => attributes['id'], :code => attributes['code'], :first_name => attributes['firstName'], :last_name => attributes['lastName'], :company => attributes['company'], :email => attributes['email'], :notes => attributes['notes'] } end def create response = self.class.post_resource 'customers', 'new', attributes_for_api_with_subscription raise response['error'] if response['error'] returned_customer = self.class.build_resource_from response self.id = returned_customer.id response end def update if subscription response = self.class.put_resource 'customers', 'edit', code, attributes_for_api_with_subscription else response = self.class.put_resource 'customers', 'edit-customer', code, attributes_for_api end raise response['error'] if response['error'] end end end
sproutbox/mousetrap
lib/mousetrap/customer.rb
Ruby
mit
5,717
package com.icharge.api; import com.icharge.beans.KnowListBean; import com.icharge.beans.LocationListBean; import retrofit.Callback; import retrofit.http.GET; import retrofit.http.Path; /** * Created by Jinsen on 15/5/23. */ public interface IChargeServerAPI { @GET("/api/articles") void getArticles(Callback<KnowListBean> response); @GET("/api/chargers/{city}") void getChargers(@Path("city") String city, Callback<LocationListBean> response); }
jinsen47/iCharge
Client/app/src/main/java/com/icharge/api/IChargeServerAPI.java
Java
mit
470
# _*_ encoding: utf-8 _*_ import timeit def insertion_sort(nums): """Insertion Sort.""" for index in range(1, len(nums)): val = nums[index] left_index = index - 1 while left_index >= 0 and nums[left_index] > val: nums[left_index + 1] = nums[left_index] left_index -= 1 nums[left_index + 1] = val return nums def insertion_sort_tuples(nums): """Insertion Sort.""" for index in range(1, len(nums)): val = nums[index] left_index = index - 1 while left_index >= 0 and nums[left_index][1] > val[1]: nums[left_index + 1] = nums[left_index] left_index -= 1 nums[left_index + 1] = val return nums if __name__ == '__main__': print(""" The insertion sort algorithm sorts each item sequentially and compares its value to its neighbor, working its way to the end of the list and moving smaller items to the left. Here are the best and worst case scenarios: Input (Worst Case Scenario): lst_one = [x for x in range(0, 2000)] lst_one.reverse() """) lst_one = [x for x in range(0, 2000)] lst_one.reverse() time1 = timeit.timeit('insertion_sort(lst_one)', setup="from __main__ import insertion_sort, lst_one",number=500) print(""" Number of runs = 500 Average Time = {} Input (Best Case Scenario): lst_two = [x for x in range(0, 2000)] """.format(time1)) lst_two = [x for x in range(0, 2000)] time2 = timeit.timeit('insertion_sort(lst_two)', setup="from __main__ import insertion_sort, lst_two",number=500) print(""" Number of runs = 500 Average Time = {} """.format(time2))
palindromed/data-structures2
src/insertion_sort.py
Python
mit
1,651
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2012.06.29 at 10:15:17 AM BST // package org.purl.dc.terms; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import org.purl.dc.elements._1.SimpleLiteral; /** * <p>Java class for TGN complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="TGN"> * &lt;simpleContent> * &lt;restriction base="&lt;http://purl.org/dc/elements/1.1/>SimpleLiteral"> * &lt;/restriction> * &lt;/simpleContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "TGN") public class TGN extends SimpleLiteral { }
sussexcoursedata/course_data_project
src/main/java/org/purl/dc/terms/TGN.java
Java
mit
1,062
import * as pako from "pako" import {Point} from "./Utils" import {DrawHelper} from "./DrawHelper" import {InputManager} from "./InputManager" import {KeyBindings} from "./InputManager" import {Data, Entity} from "./Entity" import {Grid} from "./Grid" export const COLOR_SCHEME = { background: "#282c34", borders: "#4f5052", crosshair: "#e0e0e0", }; export const OPTIONS = { GRID_SIZE: 40, ENTITY_SCALEUP: 10, SQUARES_WIDE: 50, SQUARES_HIGH: 50, BORDER_WIDTH: 4, FONT_SIZE: 25, CAMERA_MOVE_SPEED: 10, CURRENT_SELECTED_ITEM_OPACITY: .5 } enum LINE_SNAP{ None, Vertical, Horizontal, } export class Editor{ /*static readonly GRID_SIZE = 40; static readonly ENTITY_SCALEUP = 10; static readonly SQUARES_WIDE = 30; static readonly SQUARES_HIGH = 30; static readonly BORDER_WIDTH = 4; static readonly FONT_SIZE = 25; static readonly CAMERA_MOVE_SPEED = 10; static readonly CURRENT_SELECTED_ITEM_OPACITY = .5;*/ private static _canvas: HTMLCanvasElement; private static _ctx: CanvasRenderingContext2D; private static _menu: HTMLDivElement; private static _menu_button: HTMLDivElement; private static _import_button: HTMLDivElement; private static _export_button: HTMLDivElement; private static _last_mouse_grid_position: Point = new Point(0,0); private static _mouse_grid_position: Point = new Point(0,0); static get mouse_grid_position(): Point{ return this._mouse_grid_position; } private static _current_selected_item: Entity; private static _line_snap_type: LINE_SNAP; private static _unused_ids: number[] = []; private static _entities: Entity[] = []; private static _global_animators: Animator[] = []; private static _grid: Grid; static grid: number[][]; static Init(){ this._canvas = document.getElementById("editorCanvas") as HTMLCanvasElement; this._ctx = this._canvas.getContext("2d"); this._menu_button = document.getElementById("menuButton") as HTMLDivElement; this._menu_button.onclick = function(){ Editor.ToggleMenu(); } //Setup any styling this._canvas.style.backgroundColor=COLOR_SCHEME.background; this._canvas.oncontextmenu = function (e) { e.preventDefault(); }; this._canvas.onclick = function(){ Editor.CloseMenu(); } //test var test = "0eNqV0ckKwjAQBuB3+c8p2LRUzKuISJdBAu0kJFFaSt7dLh4EA9LjbB/DzIymf5J1mgPUDN0a9lDXGV4/uO7XXJgsQUEHGiDA9bBGNFpH3mfB1eytcSFrqA+IApo7GqHyeBMgDjpo2sUtmO78HBpyS8M/S8Aav4wbXrdYyKwQmKBOMYofTR7X8o8m0GlH7V6SCbs4bCfpMkGXh+kiRVfrsbcHqa9/CrzI+b2hLGVVnWUuLzG+ARDGqi4="; this.LoadBlueprint(test); InputManager.AddKeyEvent(false, KeyBindings.DropItem, ()=>{ this._current_selected_item = undefined; }); InputManager.AddKeyEvent(false, KeyBindings.Rotate, ()=>{ if(this._current_selected_item){ this._current_selected_item.Rotate(); } }); this._grid = new Grid( OPTIONS.GRID_SIZE, new Point(OPTIONS.SQUARES_WIDE, OPTIONS.SQUARES_HIGH), OPTIONS.BORDER_WIDTH, COLOR_SCHEME.borders, COLOR_SCHEME.crosshair, COLOR_SCHEME.background, OPTIONS.FONT_SIZE ) this.CreateMenu(); this.Resize(); Data.LoadImages(); } static Update(){ //Handle line snap if(InputManager.IsKeyDown(KeyBindings.LineSnap)){ if(this._line_snap_type == LINE_SNAP.None){ let diff = this._mouse_grid_position.SubtractC(this._last_mouse_grid_position); if(diff.x != 0){ this._line_snap_type = LINE_SNAP.Horizontal; } if(diff.y != 0){ this._line_snap_type = LINE_SNAP.Vertical } } } else{ this._line_snap_type = LINE_SNAP.None; } this._last_mouse_grid_position = this._mouse_grid_position.Copy(); this._mouse_grid_position = this.ScreenToGridCoords(InputManager.mouse_position); this._mouse_grid_position.Clamp( {x: 1, y: 1}, {x: OPTIONS.SQUARES_WIDE, y: OPTIONS.SQUARES_HIGH} ) if(this._line_snap_type == LINE_SNAP.Horizontal){ this._mouse_grid_position.y = this._last_mouse_grid_position.y; } else if(this._line_snap_type == LINE_SNAP.Vertical){ this._mouse_grid_position.x = this._last_mouse_grid_position.x; } DrawHelper.ClearScreen(this._ctx); //Handle Camera Movement if(InputManager.IsKeyDown(KeyBindings.MoveRight)){ DrawHelper.camera_position.Add({x: OPTIONS.CAMERA_MOVE_SPEED, y:0}); } else if(InputManager.IsKeyDown(KeyBindings.MoveLeft)){ DrawHelper.camera_position.Add({x: -OPTIONS.CAMERA_MOVE_SPEED, y:0}); } if(InputManager.IsKeyDown(KeyBindings.MoveDown)){ DrawHelper.camera_position.Add({x: 0, y: OPTIONS.CAMERA_MOVE_SPEED}); } else if(InputManager.IsKeyDown(KeyBindings.MoveUp)){ DrawHelper.camera_position.Add({x: 0, y: -OPTIONS.CAMERA_MOVE_SPEED}); } DrawHelper.camera_position.Clamp( { x: 0, y: 0}, { x: OPTIONS.GRID_SIZE*OPTIONS.SQUARES_WIDE - this._canvas.width, y: OPTIONS.GRID_SIZE*OPTIONS.SQUARES_HIGH - this._canvas.height } ) //Handle Placement if(this._current_selected_item && InputManager.IsMouseDown(0)){ this.TryPlace(); } if(InputManager.IsMouseDown(2)){ this.TryRemove(); } if(InputManager.IsMouseDown(1)){ console.log(this._grid); } this._grid.DrawCrosshairs(this._ctx); this._grid.DrawGrid(this._ctx); for(let key in this._global_animators){ let animator = this._global_animators[key]; animator.Update(); } if(this._current_selected_item){ this._current_selected_item.position = this._mouse_grid_position.Copy(); this._current_selected_item.Draw(this._ctx, OPTIONS.CURRENT_SELECTED_ITEM_OPACITY); } this._grid.DrawRulers(this._ctx); } static TryRemove(){ this._grid.RemoveAtPos(this.mouse_grid_position.Copy()); } static TryPlace(){ if(this._menu.classList.contains("open")) return; // console.log("Trying place at "+ this.mouse_grid_position.x); // console.log(this.grid[this.mouse_grid_position.x][this.mouse_grid_position.y]); let is_clear = this._grid.IsClear(this.mouse_grid_position.Copy(), this._current_selected_item); if(is_clear.Empty){ console.log("-Space is empty"); this._grid.Place(this._current_selected_item, this._mouse_grid_position.Copy()); let entity_name = this._current_selected_item.properties.name; let direction = this._current_selected_item.GetDirection(); let grid_size = { x: this._current_selected_item.properties.grid_size.x, y: this._current_selected_item.properties.grid_size.y } let children = []; if(this._current_selected_item.properties.children){ children = this._current_selected_item.properties.children; } let new_id = this._grid.GetNextID(); this._current_selected_item = new Entity(new_id, this._mouse_grid_position.Copy()); this._current_selected_item.LoadFromData(entity_name); this._current_selected_item.SetDirection(direction); this._current_selected_item.properties.grid_size = new Point(grid_size.x, grid_size.y); for(let i = 0; i<children.length; i++){ this._current_selected_item.properties.children[i].offset = children[i].offset; } // console.log("placed"); // console.log(this.grid); } else if(is_clear.SameType){ console.log("same type"); this.TryRemove(); this.TryPlace(); } else{ console.log("-Space is FULL"); } //console.log(this.current_selected_item); } static SelectItem(value: string){ let id = this._grid.GetNextID(); let new_entity = new Entity(id, this._mouse_grid_position.Copy()); new_entity.LoadFromData(value); this._current_selected_item = new_entity; } static GetAnimator(anim: string): Animator{ return this._global_animators[anim]; } static AddAnimator(anim: Animator, name: string){ this._global_animators[name] = anim; } /* static DrawRulers(){ let text_centering_factor = (OPTIONS.GRID_SIZE - OPTIONS.FONT_SIZE)/2; DrawHelper.DrawRect( this._ctx, new Point(DrawHelper.camera_position.x,DrawHelper.camera_position.y), new Point(this._canvas.width, OPTIONS.GRID_SIZE), { color:COLOR_SCHEME.background } ) DrawHelper.DrawRect( this._ctx, new Point(DrawHelper.camera_position.x,DrawHelper.camera_position.y), new Point(OPTIONS.GRID_SIZE, this._canvas.height), { color:COLOR_SCHEME.background } ) //Draw Numbers horizontal for(let x = 1; x<OPTIONS.SQUARES_WIDE; x++){ let x_pos = x*OPTIONS.GRID_SIZE; DrawHelper.DrawText( this._ctx, new Point( x_pos+text_centering_factor, OPTIONS.FONT_SIZE+text_centering_factor - 5 + DrawHelper.camera_position.y ), ("0"+x).slice(-2), { color: COLOR_SCHEME.borders, font: "700 "+OPTIONS.FONT_SIZE+"px Share Tech Mono" } ); DrawHelper.DrawLine( this._ctx, new Point(x_pos+OPTIONS.GRID_SIZE, DrawHelper.camera_position.y), new Point(x_pos+OPTIONS.GRID_SIZE, DrawHelper.camera_position.y + OPTIONS.GRID_SIZE), { color: COLOR_SCHEME.borders, line_width: OPTIONS.BORDER_WIDTH } ) } //Draw Numbers vertical for(let y = 1; y<OPTIONS.SQUARES_HIGH; y++){ let y_pos = y*OPTIONS.GRID_SIZE; DrawHelper.DrawText( this._ctx, new Point( text_centering_factor + DrawHelper.camera_position.x, y_pos+OPTIONS.FONT_SIZE+text_centering_factor - 5 ), ("0"+y).slice(-2), { color: COLOR_SCHEME.borders, font: "700 "+OPTIONS.FONT_SIZE+"px Share Tech Mono" } ); DrawHelper.DrawLine( this._ctx, new Point(DrawHelper.camera_position.x, y_pos+OPTIONS.GRID_SIZE), new Point(DrawHelper.camera_position.x + OPTIONS.GRID_SIZE, y_pos+OPTIONS.GRID_SIZE), { color: COLOR_SCHEME.borders, line_width: OPTIONS.BORDER_WIDTH } ) } //Little square in top left to hide overlapping numbers DrawHelper.DrawRect( this._ctx, new Point(DrawHelper.camera_position.x,DrawHelper.camera_position.y), new Point(OPTIONS.GRID_SIZE, OPTIONS.GRID_SIZE), { color:COLOR_SCHEME.background } ) //Bottom border below numbers DrawHelper.DrawLine( this._ctx, new Point(DrawHelper.camera_position.x, DrawHelper.camera_position.y+OPTIONS.GRID_SIZE), new Point(DrawHelper.camera_position.x+this._canvas.width, DrawHelper.camera_position.y+OPTIONS.GRID_SIZE), { color:COLOR_SCHEME.borders, line_width: OPTIONS.BORDER_WIDTH } ) //Right border to the right of numbers DrawHelper.DrawLine( this._ctx, new Point(DrawHelper.camera_position.x+OPTIONS.GRID_SIZE, DrawHelper.camera_position.y), new Point(DrawHelper.camera_position.x+OPTIONS.GRID_SIZE, DrawHelper.camera_position.y+this._canvas.height), { color:COLOR_SCHEME.borders, line_width: OPTIONS.BORDER_WIDTH } ) } */ static CreateMenu(){ let accent_counter = 1;//Fancy tree colors InputManager.AddKeyEvent(false, KeyBindings.ToggleMenu, function(){ Editor.ToggleMenu(); }) this._menu = document.getElementById("menu") as HTMLDivElement; //create new ul for each menu type for(let type of Data.menu_types){ let new_link = document.createElement("div"); new_link.innerHTML = type.split("-").join(" "); let new_ul = document.createElement("ul"); new_ul.id = type; //Fancy tree colors new_ul.classList.add("accent"+accent_counter); accent_counter++; new_link.onclick = function(){ if(new_ul.classList.contains("open")){ new_ul.classList.remove("open"); } else{ new_ul.classList.add("open"); } } this._menu.appendChild(new_link); this._menu.appendChild(new_ul); } for(let entity of Data.entities){ let new_li = document.createElement("li"); new_li.innerHTML = "<span>"+entity.name+"</span>"; let value = entity.name; new_li.onclick = ()=>{ Editor.SelectItem(value); } document.getElementById(entity.menu_type).appendChild(new_li); } } static ToggleMenu(){ if(this._menu.classList.contains("open")){ this.CloseMenu(); } else{ this._menu.classList.add("open"); } } static CloseMenu(){ this._menu.classList.remove("open"); } static Resize(){ this._canvas.width = window.innerWidth; this._canvas.height = window.innerHeight; this._canvas.style.height = window.innerHeight+"px"; this._canvas.style.width = window.innerWidth+"px"; this._grid.Resize(new Point( this._canvas.width, this._canvas.height )); } static ScreenToCameraCoords(p: Point): Point{ return p.AddC(DrawHelper.camera_position); } static CameraToGridCoords(p: Point): Point{ return new Point( Math.round(p.x / OPTIONS.GRID_SIZE - .5), Math.round(p.y / OPTIONS.GRID_SIZE - .5) ); } static ScreenToGridCoords(p: Point): Point{ return this.CameraToGridCoords(this.ScreenToCameraCoords(p)); } static DecodeString(b64: string): any{ try{ let str_data = atob(b64.substr(1)); let char_data = str_data.split('').map(function(x){return x.charCodeAt(0);}); let bin_data = new Uint8Array(char_data); let data = pako.inflate(bin_data); let str = String.fromCharCode.apply(null, new Uint16Array(data)); let json_data = JSON.parse(str); console.log(json_data); return json_data; } catch (e){ console.log("Oops... tis borked"); } } static LoadBlueprint(b64: string){ let blueprint = this.DecodeString(b64).blueprint; for(let entity of blueprint.entities){ console.log(entity); } } } export class Animator{ private current_frame: number; private frame_count: number; private current_tick: number; private ticks_per_frame:number; constructor(frame_count:number, ticks_per_frame:number){ this.current_frame = 0; this.frame_count = frame_count; this.current_tick = 0; this.ticks_per_frame = ticks_per_frame; } public Update(){ if(this.current_tick < this.ticks_per_frame){ this.current_tick++; } else{ this.current_tick = 0; if(this.ticks_per_frame < 0){ this.current_frame+=Math.abs(this.ticks_per_frame); } else{ this.current_frame++; } if(this.current_frame >= this.frame_count){ this.current_frame = 0; } } } public CurrentFrame(): number{ return this.current_frame; } } window.onload = function(){ Editor.Init(); UpdateLoop(); } window.onresize = function(){ Editor.Resize(); } function UpdateLoop(){ //Do this so Editor can still use 'this' within the update function Editor.Update(); window.requestAnimationFrame(UpdateLoop); }
zachwood0s/Factoprint
js/index.ts
TypeScript
mit
17,492
/* * Glue - Robust Go and Javascript Socket Library * Copyright (C) 2015 Roland Singer <roland.singer[at]desertbit.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ var glue = function(host, options) { // Turn on strict mode. 'use strict'; // Include the dependencies. @@include('./emitter.js') @@include('./websocket.js') @@include('./ajaxsocket.js') /* * Constants */ var Version = "1.9.1", MainChannelName = "m"; var SocketTypes = { WebSocket: "WebSocket", AjaxSocket: "AjaxSocket" }; var Commands = { Len: 2, Init: 'in', Ping: 'pi', Pong: 'po', Close: 'cl', Invalid: 'iv', DontAutoReconnect: 'dr', ChannelData: 'cd' }; var States = { Disconnected: "disconnected", Connecting: "connecting", Reconnecting: "reconnecting", Connected: "connected" }; var DefaultOptions = { // The base URL is appended to the host string. This value has to match with the server value. baseURL: "/glue/", // Force a socket type. // Values: false, "WebSocket", "AjaxSocket" forceSocketType: false, // Kill the connect attempt after the timeout. connectTimeout: 10000, // If the connection is idle, ping the server to check if the connection is stil alive. pingInterval: 35000, // Reconnect if the server did not response with a pong within the timeout. pingReconnectTimeout: 5000, // Whenever to automatically reconnect if the connection was lost. reconnect: true, reconnectDelay: 1000, reconnectDelayMax: 5000, // To disable set to 0 (endless). reconnectAttempts: 10, // Reset the send buffer after the timeout. resetSendBufferTimeout: 10000 }; /* * Variables */ var emitter = new Emitter, bs = false, mainChannel, initialConnectedOnce = false, // If at least one successful connection was made. bsNewFunc, // Function to create a new backend socket. currentSocketType, currentState = States.Disconnected, reconnectCount = 0, autoReconnectDisabled = false, connectTimeout = false, pingTimeout = false, pingReconnectTimeout = false, sendBuffer = [], resetSendBufferTimeout = false, resetSendBufferTimedOut = false, isReady = false, // If true, the socket is initialized and ready. beforeReadySendBuffer = [], // Buffer to hold requests for the server while the socket is not ready yet. socketID = ""; /* * Include the dependencies */ // Exported helper methods for the dependencies. var closeSocket, send, sendBuffered; @@include('./utils.js') @@include('./channel.js') /* * Methods */ // Function variables. var reconnect, triggerEvent; // Sends the data to the server if a socket connection exists, otherwise it is discarded. // If the socket is not ready yet, the data is buffered until the socket is ready. send = function(data) { if (!bs) { return; } // If the socket is not ready yet, buffer the data. if (!isReady) { beforeReadySendBuffer.push(data); return; } // Send the data. bs.send(data); }; // Hint: the isReady flag has to be true before calling this function! var sendBeforeReadyBufferedData = function() { // Skip if empty. if (beforeReadySendBuffer.length === 0) { return; } // Send the buffered data. for (var i = 0; i < beforeReadySendBuffer.length; i++) { send(beforeReadySendBuffer[i]); } // Clear the buffer. beforeReadySendBuffer = []; }; var stopResetSendBufferTimeout = function() { // Reset the flag. resetSendBufferTimedOut = false; // Stop the timeout timer if present. if (resetSendBufferTimeout !== false) { clearTimeout(resetSendBufferTimeout); resetSendBufferTimeout = false; } }; var startResetSendBufferTimeout = function() { // Skip if already running or if already timed out. if (resetSendBufferTimeout !== false || resetSendBufferTimedOut) { return; } // Start the timeout. resetSendBufferTimeout = setTimeout(function() { // Update the flags. resetSendBufferTimeout = false; resetSendBufferTimedOut = true; // Return if already empty. if (sendBuffer.length === 0) { return; } // Call the discard callbacks if defined. var buf; for (var i = 0; i < sendBuffer.length; i++) { buf = sendBuffer[i]; if (buf.discardCallback && utils.isFunction(buf.discardCallback)) { try { buf.discardCallback(buf.data); } catch (err) { console.log("glue: failed to call discard callback: " + err.message); } } } // Trigger the event if any buffered send data is discarded. triggerEvent("discard_send_buffer"); // Reset the buffer. sendBuffer = []; }, options.resetSendBufferTimeout); }; var sendDataFromSendBuffer = function() { // Stop the reset send buffer tiemout. stopResetSendBufferTimeout(); // Skip if empty. if (sendBuffer.length === 0) { return; } // Send data, which could not be send... var buf; for (var i = 0; i < sendBuffer.length; i++) { buf = sendBuffer[i]; send(buf.cmd + buf.data); } // Clear the buffer again. sendBuffer = []; }; // Send data to the server. // This is a helper method which handles buffering, // if the socket is currently not connected. // One optional discard callback can be passed. // It is called if the data could not be send to the server. // The data is passed as first argument to the discard callback. // returns: // 1 if immediately send, // 0 if added to the send queue and // -1 if discarded. sendBuffered = function(cmd, data, discardCallback) { // Be sure, that the data value is an empty // string if not passed to this method. if (!data) { data = ""; } // Add the data to the send buffer if disconnected. // They will be buffered for a short timeout to bridge short connection errors. if (!bs || currentState !== States.Connected) { // If already timed out, then call the discard callback and return. if (resetSendBufferTimedOut) { if (discardCallback && utils.isFunction(discardCallback)) { discardCallback(data); } return -1; } // Reset the send buffer after a specific timeout. startResetSendBufferTimeout(); // Append to the buffer. sendBuffer.push({ cmd: cmd, data: data, discardCallback: discardCallback }); return 0; } // Send the data with the command to the server. send(cmd + data); return 1; }; var stopConnectTimeout = function() { // Stop the timeout timer if present. if (connectTimeout !== false) { clearTimeout(connectTimeout); connectTimeout = false; } }; var resetConnectTimeout = function() { // Stop the timeout. stopConnectTimeout(); // Start the timeout. connectTimeout = setTimeout(function() { // Update the flag. connectTimeout = false; // Trigger the event. triggerEvent("connect_timeout"); // Reconnect to the server. reconnect(); }, options.connectTimeout); }; var stopPingTimeout = function() { // Stop the timeout timer if present. if (pingTimeout !== false) { clearTimeout(pingTimeout); pingTimeout = false; } // Stop the reconnect timeout. if (pingReconnectTimeout !== false) { clearTimeout(pingReconnectTimeout); pingReconnectTimeout = false; } }; var resetPingTimeout = function() { // Stop the timeout. stopPingTimeout(); // Start the timeout. pingTimeout = setTimeout(function() { // Update the flag. pingTimeout = false; // Request a Pong response to check if the connection is still alive. send(Commands.Ping); // Start the reconnect timeout. pingReconnectTimeout = setTimeout(function() { // Update the flag. pingReconnectTimeout = false; // Trigger the event. triggerEvent("timeout"); // Reconnect to the server. reconnect(); }, options.pingReconnectTimeout); }, options.pingInterval); }; var newBackendSocket = function() { // If at least one successfull connection was made, // then create a new socket using the last create socket function. // Otherwise determind which socket layer to use. if (initialConnectedOnce) { bs = bsNewFunc(); return; } // Fallback to the ajax socket layer if there was no successful initial // connection and more than one reconnection attempt was made. if (reconnectCount > 1) { bsNewFunc = newAjaxSocket; bs = bsNewFunc(); currentSocketType = SocketTypes.AjaxSocket; return; } // Choose the socket layer depending on the browser support. if ((!options.forceSocketType && window.WebSocket) || options.forceSocketType === SocketTypes.WebSocket) { bsNewFunc = newWebSocket; currentSocketType = SocketTypes.WebSocket; } else { bsNewFunc = newAjaxSocket; currentSocketType = SocketTypes.AjaxSocket; } // Create the new socket. bs = bsNewFunc(); }; var initSocket = function(data) { // Parse the data JSON string to an object. data = JSON.parse(data); // Validate. // Close the socket and log the error on invalid data. if (!data.socketID) { closeSocket(); console.log("glue: socket initialization failed: invalid initialization data received"); return; } // Set the socket ID. socketID = data.socketID; // The socket initialization is done. // ################################## // Set the ready flag. isReady = true; // First send all data messages which were // buffered because the socket was not ready. sendBeforeReadyBufferedData(); // Now set the state and trigger the event. currentState = States.Connected; triggerEvent("connected"); // Send the queued data from the send buffer if present. // Do this after the next tick to be sure, that // the connected event gets fired first. setTimeout(sendDataFromSendBuffer, 0); }; var connectSocket = function() { // Set a new backend socket. newBackendSocket(); // Set the backend socket events. bs.onOpen = function() { // Stop the connect timeout. stopConnectTimeout(); // Reset the reconnect count. reconnectCount = 0; // Set the flag. initialConnectedOnce = true; // Reset or start the ping timeout. resetPingTimeout(); // Prepare the init data to be send to the server. var data = { version: Version }; // Marshal the data object to a JSON string. data = JSON.stringify(data); // Send the init data to the server with the init command. // Hint: the backend socket is used directly instead of the send function, // because the socket is not ready yet and this part belongs to the // initialization process. bs.send(Commands.Init + data); }; bs.onClose = function() { // Reconnect the socket. reconnect(); }; bs.onError = function(msg) { // Trigger the error event. triggerEvent("error", [msg]); // Reconnect the socket. reconnect(); }; bs.onMessage = function(data) { // Reset the ping timeout. resetPingTimeout(); // Log if the received data is too short. if (data.length < Commands.Len) { console.log("glue: received invalid data from server: data is too short."); return; } // Extract the command from the received data string. var cmd = data.substr(0, Commands.Len); data = data.substr(Commands.Len); if (cmd === Commands.Ping) { // Response with a pong message. send(Commands.Pong); } else if (cmd === Commands.Pong) { // Don't do anything. // The ping timeout was already reset. } else if (cmd === Commands.Invalid) { // Log. console.log("glue: server replied with an invalid request notification!"); } else if (cmd === Commands.DontAutoReconnect) { // Disable auto reconnections. autoReconnectDisabled = true; // Log. console.log("glue: server replied with an don't automatically reconnect request. This might be due to an incompatible protocol version."); } else if (cmd === Commands.Init) { initSocket(data); } else if (cmd === Commands.ChannelData) { // Obtain the two values from the data string. var v = utils.unmarshalValues(data); if (!v) { console.log("glue: server requested an invalid channel data request: " + data); return; } // Trigger the event. channel.emitOnMessage(v.first, v.second); } else { console.log("glue: received invalid data from server with command '" + cmd + "' and data '" + data + "'!"); } }; // Connect during the next tick. // The user should be able to connect the event functions first. setTimeout(function() { // Set the state and trigger the event. if (reconnectCount > 0) { currentState = States.Reconnecting; triggerEvent("reconnecting"); } else { currentState = States.Connecting; triggerEvent("connecting"); } // Reset or start the connect timeout. resetConnectTimeout(); // Connect to the server bs.open(); }, 0); }; var resetSocket = function() { // Stop the timeouts. stopConnectTimeout(); stopPingTimeout(); // Reset flags and variables. isReady = false; socketID = ""; // Clear the buffer. // This buffer is attached to each single socket. beforeReadySendBuffer = []; // Reset previous backend sockets if defined. if (bs) { // Set dummy functions. // This will ensure, that previous old sockets don't // call our valid methods. This would mix things up. bs.onOpen = bs.onClose = bs.onMessage = bs.onError = function() {}; // Reset everything and close the socket. bs.reset(); bs = false; } }; reconnect = function() { // Reset the socket. resetSocket(); // If no reconnections should be made or more than max // reconnect attempts where made, trigger the disconnected event. if ((options.reconnectAttempts > 0 && reconnectCount > options.reconnectAttempts) || options.reconnect === false || autoReconnectDisabled) { // Set the state and trigger the event. currentState = States.Disconnected; triggerEvent("disconnected"); return; } // Increment the count. reconnectCount += 1; // Calculate the reconnect delay. var reconnectDelay = options.reconnectDelay * reconnectCount; if (reconnectDelay > options.reconnectDelayMax) { reconnectDelay = options.reconnectDelayMax; } // Try to reconnect. setTimeout(function() { connectSocket(); }, reconnectDelay); }; closeSocket = function() { // Check if the socket exists. if (!bs) { return; } // Notify the server. send(Commands.Close); // Reset the socket. resetSocket(); // Set the state and trigger the event. currentState = States.Disconnected; triggerEvent("disconnected"); }; /* * Initialize section */ // Create the main channel. mainChannel = channel.get(MainChannelName); // Prepare the host string. // Use the current location if the host string is not set. if (!host) { host = window.location.protocol + "//" + window.location.host; } // The host string has to start with http:// or https:// if (!host.match("^http://") && !host.match("^https://")) { console.log("glue: invalid host: missing 'http://' or 'https://'!"); return; } // Merge the options with the default options. options = utils.extend({}, DefaultOptions, options); // The max value can't be smaller than the delay. if (options.reconnectDelayMax < options.reconnectDelay) { options.reconnectDelayMax = options.reconnectDelay; } // Prepare the base URL. // The base URL has to start and end with a slash. if (options.baseURL.indexOf("/") !== 0) { options.baseURL = "/" + options.baseURL; } if (options.baseURL.slice(-1) !== "/") { options.baseURL = options.baseURL + "/"; } // Create the initial backend socket and establish a connection to the server. connectSocket(); /* * Socket object */ var socket = { // version returns the glue socket protocol version. version: function() { return Version; }, // type returns the current used socket type as string. // Either "WebSocket" or "AjaxSocket". type: function() { return currentSocketType; }, // state returns the current socket state as string. // Following states are available: // - "disconnected" // - "connecting" // - "reconnecting" // - "connected" state: function() { return currentState; }, // socketID returns the socket's ID. // This is a cryptographically secure pseudorandom number. socketID: function() { return socketID; }, // send a data string to the server. // One optional discard callback can be passed. // It is called if the data could not be send to the server. // The data is passed as first argument to the discard callback. // returns: // 1 if immediately send, // 0 if added to the send queue and // -1 if discarded. send: function(data, discardCallback) { mainChannel.send(data, discardCallback); }, // onMessage sets the function which is triggered as soon as a message is received. onMessage: function(f) { mainChannel.onMessage(f); }, // on binds event functions to events. // This function is equivalent to jQuery's on method syntax. // Following events are available: // - "connected" // - "connecting" // - "disconnected" // - "reconnecting" // - "error" // - "connect_timeout" // - "timeout" // - "discard_send_buffer" on: function() { emitter.on.apply(emitter, arguments); }, // Reconnect to the server. // This is ignored if the socket is not disconnected. // It will reconnect automatically if required. reconnect: function() { if (currentState !== States.Disconnected) { return; } // Reset the reconnect count and the auto reconnect disabled flag. reconnectCount = 0; autoReconnectDisabled = false; // Reconnect the socket. reconnect(); }, // close the socket connection. close: function() { closeSocket(); }, // channel returns the given channel object specified by name // to communicate in a separate channel than the default one. channel: function(name) { return channel.get(name); } }; // Define the function body of the triggerEvent function. triggerEvent = function() { emitter.emit.apply(emitter, arguments); }; // Return the newly created socket. return socket; };
desertbit/glue
client/src/glue.js
JavaScript
mit
23,197
using System; namespace ThinkTel.uControl.Cdrs { public enum CdrUsageType { _411, canada, incoming, international, itc_canada, itc_usa, local, onnet, tfin, usa } }
ThinkTel/ThinkTel.uControl.Cdrs
ThinkTel.uControl.Cdrs/CdrUsageType.cs
C#
mit
190
module Tjadmin VERSION = "0.0.7" end
tonytonyjan/tjadmin
lib/tjadmin/version.rb
Ruby
mit
39
/** * Created by wangqi on 16/6/3. */ function ServiceValidationError(code, message, field) { Error.captureStackTrace(this, this.constructor); this.type = 'UserLevelServiceRequestError'; this.name = 'ServiceValidationError'; this.message = message || 'Unauthenticated Access Token'; this.code = code || 409; this.field = field || 'unknown_field'; this.status = 409; } ServiceValidationError.prototype = Object.create(Error.prototype); ServiceValidationError.prototype.constructor = ServiceValidationError; module.exports = ServiceValidationError;
jinwyp/expressjs-demo
backend/src/errors/ServiceValidationError.js
JavaScript
mit
581
package com.microsoft.bingads.v12.adinsight; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for KeywordCategory complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="KeywordCategory"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="Category" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="ConfidenceScore" type="{http://www.w3.org/2001/XMLSchema}double" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "KeywordCategory", propOrder = { "category", "confidenceScore" }) public class KeywordCategory { @XmlElement(name = "Category", nillable = true) protected String category; @XmlElement(name = "ConfidenceScore") protected Double confidenceScore; /** * Gets the value of the category property. * * @return * possible object is * {@link String } * */ public String getCategory() { return category; } /** * Sets the value of the category property. * * @param value * allowed object is * {@link String } * */ public void setCategory(String value) { this.category = value; } /** * Gets the value of the confidenceScore property. * * @return * possible object is * {@link Double } * */ public Double getConfidenceScore() { return confidenceScore; } /** * Sets the value of the confidenceScore property. * * @param value * allowed object is * {@link Double } * */ public void setConfidenceScore(Double value) { this.confidenceScore = value; } }
bing-ads-sdk/BingAds-Java-SDK
proxies/com/microsoft/bingads/v12/adinsight/KeywordCategory.java
Java
mit
2,193
var _ = require('underscore') , path = require('path') , passport = require('passport') , AuthCtrl = require('./controllers/auth') , UserCtrl = require('./controllers/user') , User = require('./models/User.js') , userRoles = require('../client/scripts/routingConfig').userRoles , accessLevels = require('../client/scripts/routingConfig').accessLevels; var routes = [ // Views { path: '/partials/*', httpMethod: 'GET', middleware: [function (req, res) { var requestedView = path.join('./', req.url); res.render(requestedView); }] }, // Auth { path: '/api/v1/register', httpMethod: 'POST', middleware: [AuthCtrl.register] }, { path: '/api/v1/login', httpMethod: 'POST', middleware: [AuthCtrl.login] }, { path: '/api/v1/logout', httpMethod: 'POST', middleware: [AuthCtrl.logout] }, // User resource { path: '/api/v1/users', httpMethod: 'GET', middleware: [UserCtrl.index], accessLevel: accessLevels.admin_level }, // All other get requests should be handled by AngularJS's client-side routing system { path: '/*', httpMethod: 'GET', middleware: [function(req, res) { var role = userRoles.guest_role , username = ''; if(req.user) { role = req.user.role; username = req.user.username; } res.cookie('user', JSON.stringify({ 'username': username, 'role': role })); res.render('index'); }] } ]; module.exports = function(app) { _.each(routes, function(route) { route.middleware.unshift(ensureAuthorized); var args = _.flatten([route.path, route.middleware]); switch(route.httpMethod.toUpperCase()) { case 'GET': app.get.apply(app, args); break; case 'POST': app.post.apply(app, args); break; case 'PUT': app.put.apply(app, args); break; case 'DELETE': app.delete.apply(app, args); break; default: throw new Error('Invalid HTTP method specified for route ' + route.path); break; } }); } function ensureAuthorized(req, res, next) { var role; if(!req.user) { role = userRoles.guest_role; } else { role = req.user.role; } var accessLevel = _.findWhere(routes, { path: req.route.path, httpMethod: req.route.stack[0].method.toUpperCase() }).accessLevel || accessLevels.public_level; if(!(accessLevel === "*") && !(accessLevel.indexOf(role) !== -1)) { return res.send(403); } return next(); }
mori-dev/angular-client-side-auth
server/routes.js
JavaScript
mit
2,962
package gui.main; /* // Author: Benjamin Wilcox // Project GNGH */ import java.awt.Dimension; import javax.swing.JTabbedPane; public class TabHolder extends JTabbedPane { private WorldTab world = new WorldTab(); private JobTab jobs = new JobTab(); private ResourcesTab resources = new ResourcesTab(); private ResearchTab research = new ResearchTab(); private DebugTab debug = new DebugTab(); //holds all the tabs public TabHolder() { new UpdateGUI().passTabHolder(this); setPreferredSize(new Dimension(390, 540)); addTab("World", world); addTab("Jobs", jobs); addTab("Resources", resources); addTab("Research", research); addTab("Debug", debug); } public void setSelected(int i) { setSelectedIndex(i); } }
Ben880/GNGH-2
src/gui/main/TabHolder.java
Java
mit
842
from django.db import models class Citizen(models.Model): """ The insurance users. """ name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) # Contact information email = models.EmailField() phone = models.CharField(max_length=50) # Citizen documents CC = 'CC' PASSPORT = 'PP' document_choices = ( (CC, 'cc'), (PASSPORT, 'Passport') ) document_type = models.CharField(max_length=5, choices=document_choices) document_number = models.BigIntegerField() created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True)
jaconsta/soat_cnpx
api/citizens/models.py
Python
mit
672
import datetime import typing from . import helpers from .tl import types, custom Phone = str Username = str PeerID = int Entity = typing.Union[types.User, types.Chat, types.Channel] FullEntity = typing.Union[types.UserFull, types.messages.ChatFull, types.ChatFull, types.ChannelFull] EntityLike = typing.Union[ Phone, Username, PeerID, types.TypePeer, types.TypeInputPeer, Entity, FullEntity ] EntitiesLike = typing.Union[EntityLike, typing.Sequence[EntityLike]] ButtonLike = typing.Union[types.TypeKeyboardButton, custom.Button] MarkupLike = typing.Union[ types.TypeReplyMarkup, ButtonLike, typing.Sequence[ButtonLike], typing.Sequence[typing.Sequence[ButtonLike]] ] TotalList = helpers.TotalList DateLike = typing.Optional[typing.Union[float, datetime.datetime, datetime.date, datetime.timedelta]] LocalPath = str ExternalUrl = str BotFileID = str FileLike = typing.Union[ LocalPath, ExternalUrl, BotFileID, bytes, typing.BinaryIO, types.TypeMessageMedia, types.TypeInputFile, types.TypeInputFileLocation ] # Can't use `typing.Type` in Python 3.5.2 # See https://github.com/python/typing/issues/266 try: OutFileLike = typing.Union[ str, typing.Type[bytes], typing.BinaryIO ] except TypeError: OutFileLike = typing.Union[ str, typing.BinaryIO ] MessageLike = typing.Union[str, types.Message] MessageIDLike = typing.Union[int, types.Message, types.TypeInputMessage] ProgressCallback = typing.Callable[[int, int], None]
expectocode/Telethon
telethon/hints.py
Python
mit
1,562
package de.laag.service; import org.mindrot.jbcrypt.BCrypt; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import de.laag.entities.User; import de.laag.repositories.UserRepository; @Service public class LoginService { private UserRepository userRepository; @Autowired public LoginService(UserRepository userRepository) { this.userRepository = userRepository; } public User login(String login, String passwordPlain) { final User user = userRepository.findByLogin(login); final boolean pwMatches = BCrypt.checkpw(passwordPlain, user.getPasswordHash()); if (!pwMatches) { throw new IllegalStateException("Incorrect password."); } return user; } }
sebastianlaag/caketastic
business/src/main/java/de/laag/service/LoginService.java
Java
mit
798
using Graphs.Library; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Graphs.Console { class Program { static void Main(string[] args) { Stack<int> stack = new Stack<int>(); stack.Push(1); stack.Push(2); stack.Push(3); stack.Push(4); stack.Push(5); stack.Push(6); stack.Push(7); stack.Push(8); foreach (int i in stack) { System.Console.WriteLine(i); } System.Console.WriteLine("stack.Count = " + stack.Count); LinkedList<int> parent = new LinkedList<int>(); parent.AddLast(1); parent.AddLast(2); parent.AddLast(6); parent.AddLast(7); parent.AddLast(8); LinkedList<int> child = new LinkedList<int>(); child.AddLast(3); child.AddLast(4); child.AddLast(5); LinkedListNode<int> temp = parent.Find(2); //parent.AddAfter(temp, child.First); foreach (int val in parent) { System.Console.Write("{0}, ", val); } System.Console.ReadKey(); // http://visualstudiomagazine.com/articles/2012/11/01/priority-queues-with-c.aspx SortedDictionary<Guid, Edge> sortedEdges = new SortedDictionary<Guid, Edge>(); sortedEdges.Add(Guid.NewGuid(), new Edge() { FromIndex = 0, ToIndex = 1, Weight = 0.5 }); sortedEdges.Add(Guid.NewGuid(), new Edge() { FromIndex = 0, ToIndex = 1, Weight = 0.6 }); sortedEdges.Add(Guid.NewGuid(), new Edge() { FromIndex = 0, ToIndex = 1, Weight = 0.2 }); sortedEdges.Add(Guid.NewGuid(), new Edge() { FromIndex = 0, ToIndex = 1, Weight = 0.9 }); sortedEdges.Add(Guid.NewGuid(), new Edge() { FromIndex = 0, ToIndex = 1, Weight = 0.1 }); sortedEdges.Add(Guid.NewGuid(), new Edge() { FromIndex = 0, ToIndex = 1, Weight = 0.1 }); sortedEdges.Add(Guid.NewGuid(), new Edge() { FromIndex = 0, ToIndex = 1, Weight = 0.6 }); sortedEdges.Add(Guid.NewGuid(), new Edge() { FromIndex = 0, ToIndex = 1, Weight = 0.7 }); sortedEdges.Add(Guid.NewGuid(), new Edge() { FromIndex = 0, ToIndex = 1, Weight = 0.5 }); sortedEdges.Add(Guid.NewGuid(), new Edge() { FromIndex = 0, ToIndex = 1, Weight = 0.5 }); sortedEdges.Add(Guid.NewGuid(), new Edge() { FromIndex = 0, ToIndex = 1, Weight = 0.5 }); Edge min = sortedEdges.Min().Value; } } }
bytefire/Graphs
src/Graphs.Console/Program.cs
C#
mit
2,700
/** * Copyright 2012-2018, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; module.exports = { moduleType: 'locale', name: 'gu', dictionary: {}, format: { days: ['રવિવાર', 'સોમવાર', 'મંગળવાર', 'બુધવાર', 'ગુરુવાર', 'શુક્રવાર', 'શનિવાર'], shortDays: ['રવિ', 'સોમ', 'મંગળ', 'બુધ', 'ગુરુ', 'શુક્ર', 'શનિ'], months: [ 'જાન્યુઆરી', 'ફેબ્રુઆરી', 'માર્ચ', 'એપ્રિલ', 'મે', 'જૂન', 'જુલાઈ', 'ઑગસ્ટ', 'સપ્ટેમ્બર', 'ઑક્ટોબર', 'નવેમ્બર', 'ડિસેમ્બર' ], shortMonths: [ 'જાન્યુ', 'ફેબ્રુ', 'માર્ચ', 'એપ્રિલ', 'મે', 'જૂન', 'જુલાઈ', 'ઑગસ્ટ', 'સપ્ટે', 'ઑક્ટો', 'નવે', 'ડિસે' ], date: '%d-%b-%Y' } };
iongroup/plotly.js
lib/locales/gu.js
JavaScript
mit
1,238
package example.spring.oktabs.restful; import example.Conversation; import example.ConversationRepository; import example.DomainObject; import example.DomainObjectRepository; import example.spring.PathBuilder; import example.spring.success.SuccessController; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.propertyeditors.StringTrimmerEditor; import org.springframework.stereotype.Controller; import org.springframework.validation.DataBinder; import org.springframework.web.bind.ServletRequestDataBinder; import org.springframework.web.bind.ServletRequestParameterPropertyValues; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.View; import org.springframework.web.servlet.view.RedirectView; import javax.servlet.ServletRequest; import static example.spring.PathBuilder.pathTo; @Controller @RequestMapping("/form/{id}") public class RestfulFormController { private final Logger log = LoggerFactory.getLogger(getClass()); private final ConversationRepository conversationRepository; private final DomainObjectRepository domainRepository; @Autowired public RestfulFormController(ConversationRepository conversationRepository, DomainObjectRepository domainRepository) { this.conversationRepository = conversationRepository; this.domainRepository = domainRepository; } @RequestMapping(method = RequestMethod.GET) public ModelAndView display(@PathVariable String id) { Conversation conversation = conversationRepository.getOrCreate(id); log.info("Displaying " + conversation); ModelAndView mv = new ModelAndView("form"); mv.addObject("title", "OK TABS (restful)"); mv.addObject("formAction", pathToSelf(conversation).POST().build()); mv.addAllObjects(conversation.createModel("conversation")); return mv; } @RequestMapping(method = RequestMethod.POST) public View process(@PathVariable String id, WebRequest request) { Conversation conversation = conversationRepository.getOrCreate(id); update(conversation, request); if (conversation.isCancelled()) { log.info("Cancelled " + conversation); conversationRepository.remove(conversation); return new RedirectView("/", true); } log.info("Processing " + conversation); if (conversation.validate()) { DomainObject object = conversation.createDomainObject(); domainRepository.set(object); conversationRepository.remove(conversation); return pathTo(SuccessController.class).withVar("id", object.getId()).redirect(); } conversationRepository.set(conversation); return pathToSelf(conversation).redirect(); } private PathBuilder pathToSelf(Conversation conversation) { return pathTo(getClass()).withVar("id", conversation.getId()); } private void update(Conversation conversation, WebRequest request) { DataBinder binder = new ServletRequestDataBinder(conversation); binder.registerCustomEditor(String.class, new StringTrimmerEditor(true)); ServletRequest servletRequest = (ServletRequest) request.resolveReference(WebRequest.REFERENCE_REQUEST); binder.bind(new ServletRequestParameterPropertyValues(servletRequest)); } }
tomcz/spring-conversations
src/main/java/example/spring/oktabs/restful/RestfulFormController.java
Java
mit
3,744
// Copyright 2015 Zhu.Jin Liang #ifndef CAFFE_UTIL_COORDS_H_ #define CAFFE_UTIL_COORDS_H_ #include <algorithm> #include <utility> #include <vector> #include "caffe/util/util_pre_define.hpp" namespace caffe { template <typename Dtype> class Net; template <typename Dtype> class DiagonalAffineMap { public: explicit DiagonalAffineMap(const vector<pair<Dtype, Dtype> > coefs) : coefs_(coefs) { } static DiagonalAffineMap identity(const int nd) { return DiagonalAffineMap(vector<pair<Dtype, Dtype> >(nd, make_pair(1, 0))); } inline DiagonalAffineMap compose(const DiagonalAffineMap& other) const { DiagonalAffineMap<Dtype> out; if (coefs_.size() == other.coefs_.size()) { transform(coefs_.begin(), coefs_.end(), other.coefs_.begin(), std::back_inserter(out.coefs_), &compose_coefs); } else { // 为了支持CropPatchFromMaxFeaturePositionLayer if ( (coefs_.size() == 2) && (other.coefs_.size() % coefs_.size() == 0) ) { for (int i = 0; i < other.coefs_.size(); i += 2) { out.coefs_.push_back(compose_coefs(coefs_[0], other.coefs_[i])); out.coefs_.push_back(compose_coefs(coefs_[1], other.coefs_[i + 1])); } } else if ( (other.coefs_.size() == 2) && (coefs_.size() % other.coefs_.size() == 0) ) { for (int i = 0; i < coefs_.size(); i += 2) { out.coefs_.push_back(compose_coefs(coefs_[i], other.coefs_[0])); out.coefs_.push_back(compose_coefs(coefs_[i + 1], other.coefs_[1])); } } else { LOG(FATAL) << "Attempt to compose DiagonalAffineMaps of different dimensions: " << coefs_.size() << " vs " << other.coefs_.size(); } } // 判断所有的coefs_是否相等,如果是,只返回一个 if (out.coefs_.size() > 2 && out.coefs_.size() % 2 == 0) { bool isOK = true; for (int i = 2; i < out.coefs_.size() && isOK; i += 2) { isOK = IsEqual(out.coefs_[0].first, out.coefs_[i].first) && IsEqual(out.coefs_[0].second, out.coefs_[i].second) && IsEqual(out.coefs_[1].first, out.coefs_[i + 1].first) && IsEqual(out.coefs_[1].second, out.coefs_[i + 1].second); } if (isOK) { out.coefs_.erase(out.coefs_.begin() + 2, out.coefs_.end()); } } return out; } inline DiagonalAffineMap inv() const { DiagonalAffineMap<Dtype> out; transform(coefs_.begin(), coefs_.end(), std::back_inserter(out.coefs_), &inv_coefs); return out; } inline vector<pair<Dtype, Dtype> > coefs() { return coefs_; } private: DiagonalAffineMap() { } static inline pair<Dtype, Dtype> compose_coefs(pair<Dtype, Dtype> left, pair<Dtype, Dtype> right) { return make_pair(left.first * right.first, left.first * right.second + left.second); } static inline pair<Dtype, Dtype> inv_coefs(pair<Dtype, Dtype> coefs) { return make_pair(1 / coefs.first, - coefs.second / coefs.first); } vector<pair<Dtype, Dtype> > coefs_; }; template <typename Dtype> DiagonalAffineMap<Dtype> FilterMap(const int kernel_h, const int kernel_w, const int stride_h, const int stride_w, const int pad_h, const int pad_w) { vector<pair<Dtype, Dtype> > coefs; coefs.push_back(make_pair(stride_h, static_cast<Dtype>(kernel_h - 1) / 2 - pad_h)); coefs.push_back(make_pair(stride_w, static_cast<Dtype>(kernel_w - 1) / 2 - pad_w)); return DiagonalAffineMap<Dtype>(coefs); } } // namespace caffe #endif // CAFFE_UTIL_COORDS_H_
zimenglan-sysu-512/pose_action_caffe
caffe/include/caffe/util/coords.hpp
C++
mit
3,486
package com.github.okapies.rx.process; import java.net.URI; import java.nio.ByteBuffer; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.TreeMap; import com.zaxxer.nuprocess.NuProcess; import com.zaxxer.nuprocess.NuProcessBuilder; import rx.Observer; public class ReactiveCommand<T> extends AbstractReactiveProcessBuilder<T> { private final List<String> command; private final Map<String, String> environment; private final Path directory; private final ReactiveDecoder<T> decoder; private ReactiveCommand( List<String> command, Map<String, String> environment, Path directory, ReactiveDecoder<T> decoder) { this.command = command; this.environment = environment; this.directory = directory; this.decoder = decoder; } public static ReactiveCommand<ByteBuffer> build(String... command) { return build(Arrays.asList(command)); } public static ReactiveCommand<ByteBuffer> build(List<String> command) { return new ReactiveCommand<>( command, new TreeMap<>(System.getenv()), null, RawDecoder.instance()); } public List<String> command() { return this.command; } public ReactiveCommand<T> command(List<String> command) { return new ReactiveCommand<>( command, this.environment, this.directory, this.decoder); } public ReactiveCommand<T> command(String... command) { return new ReactiveCommand<>( Arrays.asList(command), this.environment, this.directory, this.decoder); } public Map<String, String> environment() { return this.environment; } public ReactiveCommand environment(Map<String, String> environment) { return new ReactiveCommand<>( this.command, environment, this.directory, this.decoder); } public Path directory() { return this.directory; } public ReactiveCommand<T> directory(String first, String... more) { Path path = Paths.get(first, more); return directory(path); } public ReactiveCommand<T> directory(URI uri) { Path path = Paths.get(uri); return directory(path); } public ReactiveCommand<T> directory(Path directory) { return new ReactiveCommand<>(this.command, this.environment, directory, this.decoder); } public ReactiveDecoder decoder() { return this.decoder; } public <R> ReactiveCommand<R> decoder(ReactiveDecoder<R> decoder) { return new ReactiveCommand<>(this.command, this.environment, this.directory, decoder); } @Override public ReactiveProcess run() { return run(null); } @Override public ReactiveProcess run(ProcessObserver<T> observer) { ReactiveProcessHandler<T> handler; if (observer != null) { handler = new ReactiveProcessHandler<>(decoder, observer.stdout(), observer.stderr()); } else { handler = new ReactiveProcessHandler<>(decoder, null, null); } // run an observed process NuProcessBuilder builder = new NuProcessBuilder(handler, command); builder.environment().clear(); builder.environment().putAll(environment); builder.setCwd(directory); builder.start(); return handler.process(); } }
okapies/rx-process
src/main/java/com/github/okapies/rx/process/ReactiveCommand.java
Java
mit
3,480
import {TOGGLE_IS_VAT_PAYER} from '../actions'; export function isVATPayer(state = false, action) { switch (action.type) { case TOGGLE_IS_VAT_PAYER: return !state; default: return state; } }
jeckhummer/ebidding-commercial
src/reducers/isVATPayer.js
JavaScript
mit
239
#ifndef SKP_BOUNDING_BOX_HPP #define SKP_BOUNDING_BOX_HPP #include "common.hpp" #include <SketchUpAPI/geometry.h> #include "point3d.hpp" typedef struct { PyObject_HEAD SUBoundingBox3D bbox; } SkpBoundingBox; static void SkpBoundingBox_dealloc(SkpBoundingBox* self) { Py_TYPE(self)->tp_free((PyObject*)self); } static PyObject * SkpBoundingBox_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { PyObject *py_obj = type->tp_alloc(type, 0); SkpBoundingBox *self = (SkpBoundingBox*)py_obj; if (self != NULL) { //self->min_point->x = 0; } return py_obj; } static int SkpBoundingBox_init(SkpBoundingBox *self, PyObject *args, PyObject *kwds) { return 0; } static PyMemberDef SkpBoundingBox_members[] = { {NULL} /* Sentinel */ }; static PyObject* SkpBoundingBox_getmin(SkpBoundingBox *self, void *closure) { PyObject *py_pt = Skp_Helper_Make_Point3d(self->bbox.min_point); if (py_pt == NULL) { PyErr_SetString(PyExc_RuntimeError, "cannot get min"); return NULL; } return py_pt; } static PyObject* SkpBoundingBox_getmax(SkpBoundingBox *self, void *closure) { PyObject *py_pt = Skp_Helper_Make_Point3d(self->bbox.max_point); if (py_pt == NULL) { PyErr_SetString(PyExc_RuntimeError, "cannot get max"); return NULL; } return py_pt; } static PyGetSetDef SkpBoundingBox_getseters[] = { { "min", (getter)SkpBoundingBox_getmin, NULL, "min", NULL}, { "max", (getter)SkpBoundingBox_getmax, NULL, "max", NULL}, {NULL} /* Sentinel */ }; static PyMethodDef SkpBoundingBox_methods[] = { {NULL} /* Sentinel */ }; static PyTypeObject SkpBoundingBoxType = { PyVarObject_HEAD_INIT(NULL, 0) "skp.SkpBoundingBox", /* tp_name */ sizeof(SkpBoundingBox), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SkpBoundingBox_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags */ "SketchUp SkpBoundingBox", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ SkpBoundingBox_methods, /* tp_methods */ SkpBoundingBox_members, /* tp_members */ SkpBoundingBox_getseters, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)SkpBoundingBox_init, /* tp_init */ 0, /* tp_alloc */ SkpBoundingBox_new, /* tp_new */ }; #endif
ryanzyy/py-skp
src/klass/bounding_box.hpp
C++
mit
4,444
using System; namespace Utilities.Extensions { public static class ExceptionExtensions { public static Exception GetOriginalException(this Exception ex) { if (ex.InnerException == null) return ex; return ex.InnerException.GetOriginalException(); } public static string GetLogMessage(this Exception ex) { if (ex.InnerException == null) return ""; return string.Format("{0} > {1} ", ex.InnerException.Message, GetLogMessage(ex.InnerException)); } } }
nbouilhol/bouilhol-lib
Utilities/Utilities/Extensions/ExceptionExtensions.cs
C#
mit
562