Skip to content

Instantly share code, notes, and snippets.

@maisdesign
Created September 2, 2013 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maisdesign/6417409 to your computer and use it in GitHub Desktop.
Save maisdesign/6417409 to your computer and use it in GitHub Desktop.
MaisDesign event manager
MDstraptorEventManager
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectKey">
<option name="state" value="project://58d392ca-44a2-4f5c-aa62-95bf33c6277a" />
</component>
<component name="ProjectRootManager" version="2" />
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/MDstraptorEventManager.iml" filepath="$PROJECT_DIR$/.idea/MDstraptorEventManager.iml" />
</modules>
</component>
</project>
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="2cc5d384-1f28-430c-98cd-b0aeca9b8310" name="Default" comment="" />
<ignored path="MDstraptorEventManager.iws" />
<ignored path=".idea/workspace.xml" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="DaemonCodeAnalyzer">
<disable_hints />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager">
<favorites_list name="MDstraptorEventManager" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="init.php" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/init.php">
<provider selected="true" editor-type-id="text-editor">
<state line="108" column="1" selection-start="4857" selection-end="4857" vertical-scroll-proportion="0.9622302">
<folding>
<element signature="e#445#1167#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindManager">
<FindUsagesManager>
<setting name="OPEN_NEW_TAB" value="false" />
</FindUsagesManager>
</component>
<component name="IdeDocumentHistory">
<option name="changedFiles">
<list>
<option value="$PROJECT_DIR$/init.php" />
</list>
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="-8" />
<option name="y" value="-8" />
<option name="width" value="1382" />
<option name="height" value="754" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectReloadState">
<option name="STATE" value="0" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents ProjectPane="true" />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="MDstraptorEventManager" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="MDstraptorEventManager" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="MDstraptorEventManager" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="true" />
</component>
<component name="PublishConfig">
<servers>
<server id="0854185f-7f76-4033-96b8-fae9d02e6284">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" />
</mappings>
</serverdata>
</server>
<server id="4e85528d-5f6e-42ba-ac8c-0adfe8a7b9f6">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" />
</mappings>
</serverdata>
</server>
<server id="b520a9d4-adbf-4fd4-aab4-6e82877d0359">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" />
</mappings>
</serverdata>
</server>
<server id="fd1eb7e4-d78d-4224-9a28-148debeb7d73">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" />
</mappings>
</serverdata>
</server>
</servers>
</component>
<component name="RunManager">
<list size="0" />
</component>
<component name="ShelveChangesManager" show_recycled="false" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="2cc5d384-1f28-430c-98cd-b0aeca9b8310" name="Default" comment="" />
<created>1377527338579</created>
<updated>1377527338579</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1382" height="754" extended-state="7" />
<editor active="true" />
<layout>
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Remote Host" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24963397" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="VcsManagerConfiguration">
<option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
<option name="CHECK_NEW_TODO" value="true" />
<option name="myTodoPanelSettings">
<value>
<are-packages-shown value="false" />
<are-modules-shown value="false" />
<flatten-packages value="false" />
<is-autoscroll-to-source value="false" />
</value>
</option>
<option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
<option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
<option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
<option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
<option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
<option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
<option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" />
<option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
<option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
<option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
<option name="DEFAULT_PATCH_EXTENSION" value="patch" />
<option name="SHORT_DIFF_HORIZONTALLY" value="true" />
<option name="SHORT_DIFF_EXTRA_LINES" value="2" />
<option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" />
<option name="INCLUDE_TEXT_INTO_PATCH" value="false" />
<option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
<option name="SHOW_FILE_HISTORY_DETAILS" value="true" />
<option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="true" />
<option name="SHOW_DIRTY_RECURSIVELY" value="false" />
<option name="LIMIT_HISTORY" value="true" />
<option name="MAXIMUM_HISTORY_ROWS" value="1000" />
<option name="UPDATE_FILTER_SCOPE_NAME" />
<option name="USE_COMMIT_MESSAGE_MARGIN" value="false" />
<option name="COMMIT_MESSAGE_MARGIN_SIZE" value="72" />
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="false" />
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
<option name="LAST_COMMIT_MESSAGE" />
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
<option name="ACTIVE_VCS_NAME" />
<option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
<option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
<option name="UPDATE_FILTER_BY_SCOPE" value="false" />
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/init.php">
<provider selected="true" editor-type-id="text-editor">
<state line="108" column="1" selection-start="4857" selection-end="4857" vertical-scroll-proportion="0.9622302">
<folding>
<element signature="e#445#1167#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
</component>
</project>
�PNG

IHDRH-�tEXtSoftwareAdobe ImageReadyq�e<"iTXtXML:com.adobe.xmp<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?> <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27 "> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" xmp:CreatorTool="Adobe Photoshop CS6 (Windows)" xmpMM:InstanceID="xmp.iid:50C6DE3D0E6611E3B52DFABB3259D1B0" xmpMM:DocumentID="xmp.did:50C6DE3E0E6611E3B52DFABB3259D1B0"> <xmpMM:DerivedFrom stRef:instanceID="xmp.iid:50C6DE3B0E6611E3B52DFABB3259D1B0" stRef:documentID="xmp.did:50C6DE3C0E6611E3B52DFABB3259D1B0"/> </rdf:Description> </rdf:RDF> </x:xmpmeta> <?xpacket end="r"?>��IDATxڜRKR�@힙! ��Zn�h���^/� <�W��\��ʕ��*��U
 &���3��+�t�$y��{��s69�g��xy�D�$"H� ��T�=�5��ܫ��|x{�tc�����3�Pw��*�0�8�V�F-;?ٝ#�D��`ER��'+im�"U��p4lNq�ʆ�"}��h������1���`�6��v��T�׷J�u�Ԁ�2�,J��y����Utg��v�������%�|��yRk0��"�;]��� � me�PQTV�e~�.8�ڟ`kH $#��;$�!���
J)��ax�ll��+j�G����7I��.A�YE孺�2 �5oo�Q��}�}�\� �B'٪A�U�#���X�ǰHS�L&�q������+!D+�����fS��!aqӟ�W�pA-%�(�IEND�B`�
<?php
/*
Plugin Name: MDstraptor Event Manager
Plugin Script: mdstraptor_event_manager.php
Plugin URI: http://.../mdstraptor_event_manager (where should people go for this plugin?)
Description: This simple plugin will create a custom post type that will help you manage events and their template.
Version: 0.1
License: GPL
Author: maisdesign
Author URI: http://maisdesign.it
=== RELEASE NOTES ===
2013-08-26 - v1.0 - first version
*/
/*
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 2 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, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Online: http://www.gnu.org/licenses/gpl.txt
*/
/**
* Required functions
*/
if( !defined('YITH_FUNCTIONS') ) {
//require_once( 'yit-common/yit-functions.php' );
require_once('yit-common/google_fonts.php');
require_once('yit-common/yit-functions.php');
require_once('yit-common/yith-panel.php');
}
load_plugin_textdomain( 'mdeventor', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );
define('MD_EVENT', true );
define('MD_EVENT_ACTIVE', true);
define('MD_EVENT_URL', plugin_dir_url( __FILE__ ) );
define('MD_EVENT_URL_FUNCTIONS', MD_EVENT_URL.'/functions' );
define('MD_EVENT_DIR', plugin_dir_path( __FILE__ ) );
/* Load required classes and functions*/
/* Versione 1 */
require_once('MDEventManager_Base.php'); // Checks if plugin is enabled or not
require_once('MDEventManager_Enabler.php'); // Checks if plugin is enabled or not
require_once('MDEventManager_FrontEnd.php'); // Enqueues styles and templates
require_once('MDEventManager_Backend.php'); // Creates the custom post type
require_once('MDEventManager_Options.php'); // Creates the options
require_once('MDEventManager_Admin.php'); // Creates the options
/* Versione 2
foreach ( glob( plugin_dir_path( __FILE__ )."functions/*.php" ) as $file )
include_once $file;
/* Versione 3
foreach ( glob( MD_EVENT_URL_FUNCTIONS ) as $file )
require_once $file;
*/
global $MD_event_manager;
$MD_event_manager = new MDEventManager();
?>
<?php
/***************/
/* MaisDesign */
/***************/
/***********************************/
/* */
/* Main admin class */
/* Written on: 29/08/13 */
/* @ 13.47 */
/* For the project: mdstraptor */
/* By: marco@maisdesign.it */
/* */
/***********************************/
if (!defined('MD_EVENT')) {
exit;
} // Exit if accessed directly
if (!class_exists('MD_EVENT_admin')) {
/**
* MD_EVENT_admin
*
* @since 1.0.0
*/
class MD_EVENT_admin
{
/**
* Plugin version
*
* @var string
* @since 1.0.0
*/
public $version;
/**
* Parameters for add_submenu_page
*
* @var array
* @access public
* @since 1.0.0
*/
public $submenu = array();
/**
* Initial Options definition:
*
* @var array
* @access public
* @since 1.0.0
*/
public $options = array();
/**
* Panel instance
*
* @var MD_EVENT_PANEL
* @since 1.0.0
*/
public $panel;
/**
* Various links
*
* @var string
* @access public
* @since 1.0.0
*/
/* TODO Add Banner e Doc */
/*
public $banner_url = 'http://cdn.yithemes.com/plugins/yith_maintenance_mode.php?url';
public $banner_img = 'http://cdn.yithemes.com/plugins/yith_maintenance_mode.php';
public $doc_url = 'http://yithemes.com/docs-plugins/MD_event_manager/';
*/
/**
* Constructor
*
* @return MD_EVENT_admin
* @since 1.0.0
*/
public function __construct($version)
{
global $MD_event_manager_options;
$this->version = $version;
$this->submenu = apply_filters('MD_event_manager_submenu', array(
'themes.php',
__('MD Event Manager', 'yit'),
__('Event Manager', 'yit'),
'administrator',
'MD-event-manager'
));
$this->options = apply_filters('MD_event_manager_options', $MD_event_manager_options);
add_action('init', array(
$this,
'init_panel'
));
add_action('init', array(
$this,
'default_options'
));
add_filter('plugin_action_links_' . plugin_basename(dirname(__FILE__) . '/init.php'), array(
$this,
'action_links'
));
return $this;
}
/**
* Default options
*
* Sets up the default options used on the settings page
*
* @access public
* @return void
* @since 1.0.0
*/
public function default_options()
{
foreach ($this->options as $tab) {
foreach ($tab['sections'] as $section) {
foreach ($section['fields'] as $id => $value) {
if (isset($value['std']) && isset($id)) {
add_option($id, $value['std']);
} //isset($value['std']) && isset($id)
} //$section['fields'] as $id => $value
} //$tab['sections'] as $section
} //$this->options as $tab
}
/**
* Init the panel
*
* @return void
* @since 1.0.0
*
* Thank you guys of Yithemes :D
*/
public function init_panel()
{
$this->panel = new YITH_Panel($this->submenu, $this->options, array(
'url' => $this->banner_url,
'img' => $this->banner_img
), 'MD-event-manager-group', 'MD-event-manager');
}
/**
* action_links function.
*
* @access public
* @param mixed $links
* @return void
*/
public function action_links($links)
{
$plugin_links = array(
'<a href="' . admin_url($this->submenu[0] . '?page=' . $this->submenu[4]) . '">' . __('Settings', 'yit') . '</a>',
'<a href="' . $this->doc_url . '">' . __('Docs', 'yit') . '</a>'
);
return array_merge($plugin_links, $links);
}
}
} //!class_exists('MD_EVENT_admin')
<?php
/***************/
/* MaisDesign */
/***************/
/***********************************/
/* */
/* Written on: 27/08/13 */
/* @ 20.17 */
/* For the project: mdstraptor*/
/* By: marco@maisdesign.it */
/***********************************/
class MDEventManager_Backend{
}
<?php
/***************/
/* MaisDesign */
/***************/
/***********************************/
/* */
/* Written on: 30/08/13 */
/* @ 20.36 */
/* For the project: mdstraptor*/
/* By: marco@maisdesign.it */
/***********************************/
/**
* Main class
* @version 1.0.0
*/
if (!defined('MD_EVENT_URL')) {
echo 'not defined but... <br /><br />'.MD_EVENT_URL;
exit;
} // Exit if accessed directly
if (!class_exists('MDEventManager')) {
/**
* YITH Newsletter Popup
*
* @since 1.0.0
*/
class MDEventManager
{
/**
* Plugin version
*
* @var string
* @since 1.0.0
*/
public $version = '1.0.0';
/**
* Plugin object
*
* @var string
* @since 1.0.0
*/
public $obj = null;
/**
* Constructor
*
* @return mixed|MDEventManager_Admin|MDEventManager_Frontend
* @since 1.0.0
*/
public function __construct()
{
/* TODO parti da qui
if (is_admin()) {
$this->obj = new MDEventManager_Admin($this->version);
$this->obj = new MDEventManager_Cpost($this->version);
} //is_admin()
else {
$this->obj = new MDEventManager_Frontend($this->version);
}
return $this->obj;
*/
}
}
} //!class_exists('MD_EVENT')
<?php
/***************/
/* MaisDesign */
/***************/
/***********************************/
/* */
/* Written on: 02/09/13 */
/* @ 22.05 */
/* For the project: MdEventManager */
/* By: marco@maisdesign.it */
/***********************************/
class MDEventManager_Cpost {
}
<?php
/***************/
/* MaisDesign */
/***************/
/***********************************/
/* */
/* Written on: 27/08/13 */
/* @ 16.20 */
/* For the project: mdstraptor */
/* By: marco@maisdesign.it */
/* */
/***********************************/
if ( !defined( 'MD_EVENT' ) ) { exit; } // Exit if accessed directly
if( !function_exists( 'md_eventor_is_enabled' ) ) {
/**
* Locate the templates and return the path of the file found
*
* @param string $path
* @param array $var
* @return void
* @since 1.0.0
*/
function md_eventor_is_enabled() {
return get_option('md_eventor_enabled_plugin') == 'yes';
}
}
<?php
/***************/
/* MaisDesign */
/***************/
/***********************************/
/* */
/* Written on: 26/08/13 */
/* @ 21.12 */
/* For the project: mdstraptor*/
/* By: marco@maisdesign.it */
/***********************************/
if( !class_exists( 'MD_event_frontend' ) ) {
/**
* Admin class.
* The class manage all the Frontend behaviors.
*
* @since 1.0.0
*/
class MD_event_frontend {
/**
* Plugin version
*
* @var string
* @since 1.0.0
*/
public $version;
// uncomment next line if you need functions in external PHP script;
// include_once(dirname(__FILE__).'/some-library-in-same-folder.php');
public function __construct($version) {
mdstraptor_event_manager_add_options();
if ( ! function_exists('MD_event_manager') ) {// Hook into the 'init' action
add_action( 'init', 'MD_event_manager', 0 );}
add_filter( 'template_include', 'MDE_insert_my_template' );
}
// ------------------
// mdstraptor_event_manager parameters will be saved in the database
public function mdstraptor_event_manager_add_options() {
// mdstraptor_event_manager_add_options: add options to DB for this plugin
add_option('mdstraptor_event_manager_nb_widgets', '75');
// add_option('mdstraptor_event_manager_...','...');
}
// Register Custom Post Type
public function MD_event_manager() {
$labels = array(
'name' => _x( 'Events', 'Post Type General Name', 'md_event_manager' ),
'singular_name' => _x( 'Event', 'Post Type Singular Name', 'md_event_manager' ),
'menu_name' => __( 'Events', 'md_event_manager' ),
'parent_item_colon' => __( 'Parent Event:', 'md_event_manager' ),
'all_items' => __( 'All the Events', 'md_event_manager' ),
'view_item' => __( 'View Events', 'md_event_manager' ),
'add_new_item' => __( 'Add New Event', 'md_event_manager' ),
'add_new' => __( 'New Event', 'md_event_manager' ),
'edit_item' => __( 'Edit Event', 'md_event_manager' ),
'update_item' => __( 'Update Event', 'md_event_manager' ),
'search_items' => __( 'Search Event', 'md_event_manager' ),
'not_found' => __( 'No Events found', 'md_event_manager' ),
'not_found_in_trash' => __( 'No Events found in Trash', 'md_event_manager' ),
);
$args = array(
'label' => __( 'event', 'md_event_manager' ),
'description' => __( 'Event Organizing', 'md_event_manager' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields', 'page-attributes', 'post-formats', ),
'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'menu_icon' => plugins_url( 'assets/img/plan.png' , __FILE__ ),
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'event', $args );
}
/**
* Template Fix
*
* http://wordpress.stackexchange.com/questions/96660/custom-post-type-plugin-where-do-i-put-the-template
*/
/* Filter the single_template with our custom function
add_filter( 'template_include', 'MDE_insert_my_template' );
function MDE_insert_my_template( $template )
{
if ( 'event' === get_post_type() ){
return dirname( __FILE__ ) . '/pages/single-event.php';
return dirname( __FILE__ ) . '/pages/archive-event.php';
}
return $template;
}
*/
public function MDE_insert_my_template($template) {
$filename = 'single-event.php';
$template = dirname( __FILE__ ) . '/pages/single-event.php';
$plugin_path = array( 'path' => plugin_dir_path(__FILE__) . '/pages/single-event.php', 'url' => MD_EVENT_URL . 'assets/css/frontend.css' );
$template_path = array( 'path' => get_template_directory() . '/' . $filename, 'url' => get_template_directory_uri() . '/' . $filename );
$child_path = array( 'path' => get_stylesheet_directory() . '/' . $filename, 'url' => get_stylesheet_directory_uri() . '/' . $filename );
foreach ( array( 'child_path', 'template_path', 'plugin_path' ) as $var ) {
if ( file_exists( ${$var}['path'] ) ) {
return ${$var}['url'];
}
}
// exit();
} // MDE_insert_my_template
}// class MD_event_frontend
}//Closing IF
<?php
/***************/
/* MaisDesign */
/***************/
/***********************************/
/* */
/* Written on: 28/08/13 */
/* @ 13.46 */
/* For the project: mdstraptor */
/* By: marco@maisdesign.it */
/* */
/***********************************/
if ( !defined( 'MD_EVENT' ) ) { exit; } // Exit if accessed directly
global $MD_event_manager_options;
$MD_event_manager_options = array(
//tab general
'general' => array(
'label' => __('General', 'yit'),
'sections' => array(
'general' => array(
'title' => __('General Settings', 'yit'),
'description' => '',
'fields' => array(
'MD_event_manager_enable' => array(
'title' => __('Enable Newsletter Popup', 'yit'),
'description' => __( 'Enable the newsletter popup. (Default: Off)', 'yit' ),
'type' => 'checkbox',
'std' => false
),
'MD_event_manager_cookie_var' => array(
'title' => __('Cookie Variable', 'yit'),
'description' => __( 'Write here a name to be given to the cookie generated by the closing link of the popup, in this way, as soon as you\'ll change this value all your visitors will see it again even if they disabled it. Don\'t abuse of this function!', 'yit' ),
'type' => 'text',
'std' => __( 'yithpopup', 'yit' )
),
'MD_event_manager_title' => array(
'title' => __('Popup Title', 'yit'),
'description' => __( 'The title displayed. You can also use HTML code.', 'yit' ),
'type' => 'text',
'std' => __( 'Join our faboulous community today!', 'yit' )
),
'MD_event_manager_image' => array(
'title' => 'Popup Image',
'description' => __( 'Upload an image. (Tip: best viewed with a rectangular image sized like 315px X 225px)', 'yit' ),
'type' => 'upload',
'std' => MD_EVENT_URL . 'assets/images/popup.jpg'
),
'MD_event_manager_message' => array(
'title' => __('Popup Message', 'yit'),
'description' => __( 'The message displayed. You can also use HTML code.', 'yit' ),
'type' => 'textarea',
'std' => sprintf( __( "If you would like to be always informed about our latest templates, plugins and products, just fill the form with your name and email.We, Yithemes are here to help you succeed in your web based business.<a href='%s' title='Yithemes FREE WordPress themes download'>Yithemes FREE WordPress themes download.</a>", 'yit' ),'http://yithemes.com/?ap_id=yith-popup-newsletter'),
),
'MD_event_manager_hide_text' => array(
'title' => __('Hiding text', 'yit'),
'description' => __( 'The title displayed next to the checkbox that let users hide the popup forever. You can also use HTML code.', 'yit' ),
'type' => 'text',
'std' => __( 'Do not show it anymore.', 'yit' )
),
'MD_event_manager_custom_style' => array(
'title' => 'Custom style',
'description' => __( 'Insert here your custom CSS style.', 'yit' ),
'type' => 'textarea',
'std' => ''
),
)//fields
),//general
'typography' => array(
'title' => __('Typography', 'yit'),
'description' => '',
'fields' => array(
'MD_event_manager_title_font' => array(
'title' => __('Title font of message', 'yit'),
'description' => __('Choose the font type, size and color for the title.', 'yit'),
'type' => 'typography',
'std' => array(
'size' => 25,
'unit' => 'px',
'family' => 'Roboto',
'style' => 'bold',
'color' => '#373736',
),
),
'MD_event_manager_paragraph_font' => array(
'title' => __('Paragraph font of message', 'yit'),
'description' => __('Choose the font type, size and color for the message.', 'yit'),
'type' => 'typography',
'std' => array(
'size' => 12,
'unit' => 'px',
'family' => 'Roboto',
'style' => 'regular',
'color' => '#747373',
),
),
'MD_event_manager_hide_font' => array(
'title' => __('Hiding buttons fonts', 'yit'),
'description' => __('Choose the font type, size and color for the newsletter popup hiding buttons.', 'yit'),
'type' => 'typography',
'std' => array(
'size' => 10,
'unit' => 'px',
'family' => 'Roboto',
'style' => 'regular',
'color' => '#111111',
),
),
'MD_event_manager_submit_font' => array(
'title' => __('Newsletter Submit and Add to cart buttons font', 'yit'),
'description' => __('Choose the font type, size and color for the email submit button and Add to cart button.', 'yit'),
'type' => 'typography',
'std' => array(
'size' => 10,
'unit' => 'px',
'family' => 'Roboto',
'style' => 'bold',
'color' => '#ffffff',
),
),
'MD_event_manager_submit_font_hover' => array(
'title' => __('Newsletter Submit and Add to cart buttons font on hover status', 'yit'),
'description' => __('Choose the font type, size and color for the email submit button and Add to cart button on hover status.', 'yit'),
'type' => 'typography',
'std' => array(
'size' => 10,
'unit' => 'px',
'family' => 'Roboto',
'style' => 'bold',
'color' => '#eeeeee',
),
)
) // typography fields
), //typography
// Popup background
'background' => array(
'title' => __('Background Settings', 'yit'),
'description' => __('Customize the background of newsletter popup', 'yit'),
'fields' => array(
'MD_event_manager_background' => array(
'title' => __('Choose a color to be used as background', 'yit'),
'description' => __("Choose a color to be used as background.", 'yit'),
'type' => 'colorpicker',
'std' => '#FFFFFF',
),
)//fields
), // background
) //sections
), //general tab
//tab container
'newsletter' => array(
'label' => __('Newsletter', 'yit'),
'sections' => array(
'newsletter' => array(
'title' => __('Newsletter', 'yit'),
'description' => __('Add a newsletter form in your newsletter popup.', 'yit'),
'fields' => array(
'MD_event_manager_enable_newsletter_form' => array(
'title' => __('Enable Newsletter form', 'yit'),
'description' => __('Choose if you want to enable the newsletter form in the newsletter popup.', 'yit'),
'type' => 'checkbox',
'std' => true
),
'MD_event_manager_newsletter_email_font' => array(
'title' => __('Newsletter Name and Email Inputs Font', 'yit'),
'description' => __('Choose the font type, size and color for the name and email inputs field.', 'yit'),
'type' => 'typography',
'std' => array(
'size' => 10,
'unit' => 'px',
'family' => 'Roboto',
'style' => 'regular',
'color' => '#8f8f8f',
),
),
'MD_event_manager_custom_submit' => array(
'title' => __("Enable custom submit button's colors", 'yit'),
'description' => __("Choose if you want to use custom submit button's colors or your theme default ones.(Default: Custom)", 'yit'),
'type' => 'checkbox',
'std' => true
),
'MD_event_manager_submit_background' => array(
'title' => __('Newsletter submit background', 'yit'),
'description' => __('The submit button background.', 'yit'),
'type' => 'colorpicker',
'std' => '#C58408',
),
'MD_event_manager_submit_hover_background' => array(
'title' => __('Newsletter submit hover background', 'yit'),
'description' => __('The submit button hover background.', 'yit'),
'type' => 'colorpicker',
'std' => '#e79c0c',
)
)
),
'newsletter_configuration' => array(
'title' => __('Form configuration', 'yit'),
'description' => __('Configure the form and each field, to integrate the newsletter features of an external service.', 'yit'),
'fields' => array(
'MD_event_manager_action' => array(
'title' => __('Newsletter Action URL', 'yit'),
'description' => __('Set the action url of the form.', 'yit'),
'type' => 'text',
'std' => ''
),
'MD_event_manager_name_name' => array(
'title' => __('Name "name"', 'yit'),
'description' => __('The attribute "name" of the name field.', 'yit'),
'type' => 'text',
'std' => 'name',
),
'MD_event_manager_name_icon' => array(
'title' => __('Name icon', 'yit'),
'description' => __('Upload or select an icon to be shown in newsletter\'s name input field', 'yit'),
'type' => 'upload',
'std' => MD_EVENT_URL . 'assets/images/icon_name.png',
),
'MD_event_manager_name_label' => array(
'title' => __('Name field label', 'yit'),
'description' => __('The name field label', 'yit'),
'type' => 'text',
'std' => 'ENTER YOUR NAME',
),
'MD_event_manager_email_name' => array(
'title' => __('Email "name"', 'yit'),
'description' => __('The attribute "name" of the email address field.', 'yit'),
'type' => 'text',
'std' => 'email',
),
'MD_event_manager_email_icon' => array(
'title' => __('Email icon', 'yit'),
'description' => __('Upload or select an icon to be shown in newsletter\'s email input field', 'yit'),
'type' => 'upload',
'std' => MD_EVENT_URL . 'assets/images/mailwhite.png',
),
'MD_event_manager_email_label' => array(
'title' => __('Email field label', 'yit'),
'description' => __('The email field label', 'yit'),
'type' => 'text',
'std' => 'ENTER YOUR MAIL ADDRESS',
),
'MD_event_manager_submit_button_label' => array(
'title' => __('Submit button label', 'yit'),
'description' => __('Submit button label', 'yit'),
'type' => 'text',
'std' => 'ADD ME TO THE LIST',
),
'MD_event_manager_newsletter_hidden_fields' => array(
'title' => __('Newsletter Hidden fields', 'yit'),
'description' => __('Set the hidden fields to include in the form. Use the form: field1=value1&field2=value2&field3=value3', 'yit'),
'type' => 'text',
'std' => '',
),
'MD_event_manager_newsletter_method' => array(
'title' => __('Form method', 'yit'),
'description' => __('Set the method for the form request.', 'yit'),
'type' => 'select',
'options' => array(
'POST' => 'POST',
'GET' => 'GET',
),
'std' => 'POST'
)
) //fields
) //newsletter configuration
) //sections -> newsletter
), //newsletter
); //whole array
if( yit_is_woocommerce_active() ) {
$MD_event_manager_options['woocommerce'] = array(
'label' => __('WooCommerce Integration', 'yit'),
'sections' => array(
'woocommerce' => array(
'title' => __('WooCommerce Integration', 'yit'),
'description' => '',
'fields' => array(
'MD_event_manager_woocommerce_integration' => array(
'title' => __('Enable the WooCommerce integration', 'yit'),
'description' => __( 'If the option is enabled, the popup shows the informations about the WooCommerce products selected below. (Default: Off)', 'yit' ),
'type' => 'checkbox',
'std' => false
),
'MD_event_manager_woocommerce_product_id' => array(
'title' => __('WooCommerce Product ID', 'yit'),
'description' => sprintf( __( 'Write here the ID of the product that you would like to show in your popup. <a href="%s">More info</a>.', 'yit' ), 'http://yithemes.com/docs/MD_event_manager/index.html'),
'type' => 'text',
'std' => ''
),
'MD_event_manager_woocommerce_submit_text' => array(
'title' => __('WooCommerce Add to Cart Button Call to Action', 'yit'),
'description' => ('Write here the text that you would like to display in "Add to cart" button'),
'type' => 'text',
'std' => __('ADD TO CART','yit')
),
'MD_event_manager_woo_custom_submit' => array(
'title' => __("Enable custom submit button's colors", 'yit'),
'description' => __("Choose if you want to use custom submit button's colors or your theme default ones.(Default: Custom)", 'yit'),
'type' => 'checkbox',
'std' => true
),
'MD_event_manager_woo_submit_background' => array(
'title' => __('Newsletter submit background', 'yit'),
'description' => __('The submit button background.', 'yit'),
'type' => 'colorpicker',
'std' => '#C58408',
),
'MD_event_manager_woo_submit_hover_background' => array(
'title' => __('Newsletter submit hover background', 'yit'),
'description' => __('The submit button hover background.', 'yit'),
'type' => 'colorpicker',
'std' => '#e79c0c',
)
) //fields
) //woocommerce configuration
) //sections -> woocommerce
); //woocommerce
}
<?php
/***************/
/* MaisDesign */
/***************/
/***********************************/
/* */
/* Written on: 26/08/13 */
/* @ 16.46 */
/* For the project: mdstraptor*/
/* By: marco@maisdesign.it */
/***********************************/
<?php
/***************/
/* MaisDesign */
/***************/
/***********************************/
/* */
/* Written on: 26/08/13 */
/* @ 16.46 */
/* For the project: mdstraptor*/
/* By: marco@maisdesign.it */
/***********************************/
echo 'Ciao ci sono anche io!';
?>
=== MDstraptor Event Manager ===
Contributors: maisdesign
Tags: custom post type,event,event manager
Requires at least: 3.5
Tested up to: 3.6
Stable tag: trunk
MDstraptor Event Manager will create an event custom post and let you style it.
== Description ==
Have you ever wanted to have a custom post type named event with his own style and \'mood\' ? This is what MDstraptor Event Manager will do for you!
== Installation ==
Extract the zip file and just drop the contents in the wp-content/plugins/ directory of your WordPress installation and then activate the Plugin from Plugins page.
== Frequently Asked Questions ==
FAQ
== Screenshots ==
1. Screen1 Desc
2. Screen2 Desc
`[youtube http://url.youtube.com]` `[youtube http://url.youtube.com]`
== Changelog ==
2013-08-26 - v1.0 - first version
Arbitrary info
/* typography */
.typography_container {
padding-bottom:0px;
}
.typography_container .option {
width: 100%;
}
.typography_container input {
float:left;
margin-right:14px;
}
.typography_container .select-wrapper {
float: left;
width: 150px;
margin-right: 10px;
margin-bottom: 0px !important;
}
.typography_container .select-wrapper.font-unit {
width: 61px;
}
.typography_container .ui-spinner-buttons {
top: 0px !important;
}
.typography_container .select-wrapper.font-style {
width: 93px;
}
.typography_container .select-wrapper select {
width:100%;
}
.typography_container .font-preview {
border: 1px dashed #ddd;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
margin: 10px 0;
padding: 20px;
position: relative;
}
.typography_container .font-preview .refresh_container {
background: rgba(255,255,255,0.82);
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 0;
}
.typography_container button.refresh {
/*background: #F2F2F2 url(../images/white-grad.png) repeat-x scroll left top;*/
border: 1px solid #BBB;
-webkit-border-radius: 11px;
border-radius: 11px;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
color: #464646;
cursor: pointer;
font-size: 12px!important;
line-height: 6px;
margin: -16px 0px 0px -105px;
padding: 3px 8px;
position: absolute;
text-shadow: rgba(255, 255, 255, 1) 0 1px 0;
text-decoration: none;
top: 50%;
left: 50%;
width: auto;
height: 18px;
}
.typography_container button.refresh img {
margin-right: 5px;
vertical-align: middle;
}
{"items":["ABeeZee","Abel","Abril Fatface","Aclonica","Acme","Actor","Adamina","Advent Pro","Aguafina Script","Akronim","Aladin","Aldrich","Alef","Alegreya","Alegreya SC","Alex Brush","Alfa Slab One","Alice","Alike","Alike Angular","Allan","Allerta","Allerta Stencil","Allura","Almendra","Almendra Display","Almendra SC","Amarante","Amaranth","Amatic SC","Amethysta","Anaheim","Andada","Andika","Angkor","Annie Use Your Telescope","Anonymous Pro","Antic","Antic Didone","Antic Slab","Anton","Arapey","Arbutus","Arbutus Slab","Architects Daughter","Archivo Black","Archivo Narrow","Arimo","Arizonia","Armata","Artifika","Arvo","Asap","Asset","Astloch","Asul","Atomic Age","Aubrey","Audiowide","Autour One","Average","Average Sans","Averia Gruesa Libre","Averia Libre","Averia Sans Libre","Averia Serif Libre","Bad Script","Balthazar","Bangers","Basic","Battambang","Baumans","Bayon","Belgrano","Belleza","BenchNine","Bentham","Berkshire Swash","Bevan","Bigelow Rules","Bigshot One","Bilbo","Bilbo Swash Caps","Bitter","Black Ops One","Bokor","Bonbon","Boogaloo","Bowlby One","Bowlby One SC","Brawler","Bree Serif","Bubblegum Sans","Bubbler One","Buda:300","Buenard","Butcherman","Butterfly Kids","Cabin","Cabin Condensed","Cabin Sketch","Caesar Dressing","Cagliostro","Calligraffitti","Cambo","Candal","Cantarell","Cantata One","Cantora One","Capriola","Cardo","Carme","Carrois Gothic","Carrois Gothic SC","Carter One","Caudex","Cedarville Cursive","Ceviche One","Changa One","Chango","Chau Philomene One","Chela One","Chelsea Market","Chenla","Cherry Cream Soda","Cherry Swash","Chewy","Chicle","Chivo","Cinzel","Cinzel Decorative","Clicker Script","Coda","Coda Caption:800","Codystar","Combo","Comfortaa","Coming Soon","Concert One","Condiment","Content","Contrail One","Convergence","Cookie","Copse","Corben","Courgette","Cousine","Coustard","Covered By Your Grace","Crafty Girls","Creepster","Crete Round","Crimson Text","Croissant One","Crushed","Cuprum","Cutive","Cutive Mono","Damion","Dancing Script","Dangrek","Dawning of a New Day","Days One","Delius","Delius Swash Caps","Delius Unicase","Della Respira","Denk One","Devonshire","Didact Gothic","Diplomata","Diplomata SC","Domine","Donegal One","Doppio One","Dorsa","Dosis","Dr Sugiyama","Droid Sans","Droid Sans Mono","Droid Serif","Duru Sans","Dynalight","EB Garamond","Eagle Lake","Eater","Economica","Electrolize","Elsie","Elsie Swash Caps","Emblema One","Emilys Candy","Engagement","Englebert","Enriqueta","Erica One","Esteban","Euphoria Script","Ewert","Exo","Expletus Sans","Fanwood Text","Fascinate","Fascinate Inline","Faster One","Fasthand","Federant","Federo","Felipa","Fenix","Finger Paint","Fjalla One","Fjord One","Flamenco","Flavors","Fondamento","Fontdiner Swanky","Forum","Francois One","Freckle Face","Fredericka the Great","Fredoka One","Freehand","Fresca","Frijole","Fruktur","Fugaz One","GFS Didot","GFS Neohellenic","Gabriela","Gafata","Galdeano","Galindo","Gentium Basic","Gentium Book Basic","Geo","Geostar","Geostar Fill","Germania One","Gilda Display","Give You Glory","Glass Antiqua","Glegoo","Gloria Hallelujah","Goblin One","Gochi Hand","Gorditas","Goudy Bookletter 1911","Graduate","Grand Hotel","Gravitas One","Great Vibes","Griffy","Gruppo","Gudea","Habibi","Hammersmith One","Hanalei","Hanalei Fill","Handlee","Hanuman","Happy Monkey","Headland One","Henny Penny","Herr Von Muellerhoff","Holtwood One SC","Homemade Apple","Homenaje","IM Fell DW Pica","IM Fell DW Pica SC","IM Fell Double Pica","IM Fell Double Pica SC","IM Fell English","IM Fell English SC","IM Fell French Canon","IM Fell French Canon SC","IM Fell Great Primer","IM Fell Great Primer SC","Iceberg","Iceland","Imprima","Inconsolata","Inder","Indie Flower","Inika","Irish Grover","Istok Web","Italiana","Italianno","Jacques Francois","Jacques Francois Shadow","Jim Nightshade","Jockey One","Jolly Lodger","Josefin Sans","Josefin Slab","Joti One","Judson","Julee","Julius Sans One","Junge","Jura","Just Another Hand","Just Me Again Down Here","Kameron","Karla","Kaushan Script","Kavoon","Keania One","Kelly Slab","Kenia","Khmer","Kite One","Knewave","Kotta One","Koulen","Kranky","Kreon","Kristi","Krona One","La Belle Aurore","Lancelot","Lato","League Script","Leckerli One","Ledger","Lekton","Lemon","Libre Baskerville","Life Savers","Lilita One","Limelight","Linden Hill","Lobster","Lobster Two","Londrina Outline","Londrina Shadow","Londrina Sketch","Londrina Solid","Lora","Love Ya Like A Sister","Loved by the King","Lovers Quarrel","Luckiest Guy","Lusitana","Lustria","Macondo","Macondo Swash Caps","Magra","Maiden Orange","Mako","Marcellus","Marcellus SC","Marck Script","Margarine","Marko One","Marmelad","Marvel","Mate","Mate SC","Maven Pro","McLaren","Meddon","MedievalSharp","Medula One","Megrim","Meie Script","Merienda","Merienda One","Merriweather","Merriweather Sans","Metal","Metal Mania","Metamorphous","Metrophobic","Michroma","Milonga","Miltonian","Miltonian Tattoo","Miniver","Miss Fajardose","Modern Antiqua","Molengo","Molle:italic","Monda","Monofett","Monoton","Monsieur La Doulaise","Montaga","Montez","Montserrat","Montserrat Alternates","Montserrat Subrayada","Moul","Moulpali","Mountains of Christmas","Mouse Memoirs","Mr Bedfort","Mr Dafoe","Mr De Haviland","Mrs Saint Delafield","Mrs Sheppards","Muli","Mystery Quest","Neucha","Neuton","New Rocker","News Cycle","Niconne","Nixie One","Nobile","Nokora","Norican","Nosifer","Nothing You Could Do","Noticia Text","Noto Sans","Noto Serif","Nova Cut","Nova Flat","Nova Mono","Nova Oval","Nova Round","Nova Script","Nova Slim","Nova Square","Numans","Nunito","Odor Mean Chey","Offside","Old Standard TT","Oldenburg","Oleo Script","Oleo Script Swash Caps","Open Sans","Open Sans Condensed:300","Open Sans Condensed:300italic","Open Sans Condensed:700","Oranienbaum","Orbitron","Oregano","Orienta","Original Surfer","Oswald","Over the Rainbow","Overlock","Overlock SC","Ovo","Oxygen","Oxygen Mono","PT Mono","PT Sans","PT Sans Caption","PT Sans Narrow","PT Serif","PT Serif Caption","Pacifico","Paprika","Parisienne","Passero One","Passion One","Patrick Hand","Patrick Hand SC","Patua One","Paytone One","Peralta","Permanent Marker","Petit Formal Script","Petrona","Philosopher","Piedra","Pinyon Script","Pirata One","Plaster","Play","Playball","Playfair Display","Playfair Display SC","Podkova","Poiret One","Poller One","Poly","Pompiere","Pontano Sans","Port Lligat Sans","Port Lligat Slab","Prata","Preahvihear","Press Start 2P","Princess Sofia","Prociono","Prosto One","Puritan","Purple Purse","Quando","Quantico","Quattrocento","Quattrocento Sans","Questrial","Quicksand","Quintessential","Qwigley","Racing Sans One","Radley","Raleway","Raleway Dots","Rambla","Rammetto One","Ranchers","Rancho","Rationale","Redressed","Reenie Beanie","Revalia","Ribeye","Ribeye Marrow","Righteous","Risque","Roboto","Roboto Condensed","Roboto Slab","Rochester","Rock Salt","Rokkitt","Romanesco","Ropa Sans","Rosario","Rosarivo","Rouge Script","Ruda","Rufina","Ruge Boogie","Ruluko","Rum Raisin","Ruslan Display","Russo One","Ruthie","Rye","Sacramento","Sail","Salsa","Sanchez","Sancreek","Sansita One","Sarina","Satisfy","Scada","Schoolbell","Seaweed Script","Sevillana","Seymour One","Shadows Into Light","Shadows Into Light Two","Shanti","Share","Share Tech","Share Tech Mono","Shojumaru","Short Stack","Siemreap","Sigmar One","Signika","Signika Negative","Simonetta","Sintony","Sirin Stencil","Six Caps","Skranji","Slackey","Smokum","Smythe","Sniglet:800","Snippet","Snowburst One","Sofadi One","Sofia","Sonsie One","Sorts Mill Goudy","Source Code Pro","Source Sans Pro","Special Elite","Spicy Rice","Spinnaker","Spirax","Squada One","Stalemate","Stalinist One","Stardos Stencil","Stint Ultra Condensed","Stint Ultra Expanded","Stoke","Strait","Sue Ellen Francisco","Sunshiney","Supermercado One","Suwannaphum","Swanky and Moo Moo","Syncopate","Tangerine","Taprom","Tauri","Telex","Tenor Sans","Text Me One","The Girl Next Door","Tienne","Tinos","Titan One","Titillium Web","Trade Winds","Trocchi","Trochut","Trykker","Tulpen One","Ubuntu","Ubuntu Condensed","Ubuntu Mono","Ultra","Uncial Antiqua","Underdog","Unica One","UnifrakturCook:700","UnifrakturMaguntia","Unkempt","Unlock","Unna","VT323","Vampiro One","Varela","Varela Round","Vast Shadow","Vibur","Vidaloka","Viga","Voces","Volkhov","Vollkorn","Voltaire","Waiting for the Sunrise","Wallpoet","Walter Turncoat","Warnes","Wellfleet","Wendy One","Wire One","Yanone Kaffeesatz","Yellowtail","Yeseva One","Yesteryear","Zeyada"]}
jQuery(document).ready(function($){
//image uploader
var _custom_media = true,
_orig_send_attachment = wp.media.editor.send.attachment;
$('.uploader .button').click(function(e) {
var send_attachment_bkp = wp.media.editor.send.attachment;
var button = $(this);
var id = button.attr('id').replace('_button', '');
_custom_media = true;
wp.media.editor.send.attachment = function(props, attachment){
if ( _custom_media ) {
$("#"+id).val(attachment.url);
} else {
return _orig_send_attachment.apply( this, [props, attachment] );
};
}
wp.media.editor.open(button);
return false;
});
$('.add_media').on('click', function(){
_custom_media = false;
});
//color-picker
$('.panel-colorpicker').wpColorPicker({
change: function(event, ui){
$('#'+event.target.id).parents('.typography_container').find('.font-preview > p').css('color', ui.color.toString());
}
});
//typography
$('.typography_container').yit_panel_typography();
//datepicker
$('.panel-datepicker').datepicker({
showOtherMonths: true,
selectOtherMonths: true,
numberOfMonths: 2,
minDate: 0
});
});
// typography
(function( window, $, undefined ) {
$.yit_panel_typography = function( options, element ) {
this.element = $( element );
this._init( options );
};
$.yit_panel_typography.defaults = {
elements : {
size: '.typography_size',
unit: '.typography_unit',
family: '.typography_family',
style: '.typography_style',
color: '.typography_color',
preview: '.font-preview p',
refresh: '.refresh'
}
};
$.yit_panel_typography.prototype = {
_init : function( options ) {
this.options = $.extend( true, {}, $.yit_panel_typography.defaults, options );
//init the options string
if( yit_family_string == '' ) {
//web fonts
var web_fonts = $.parseJSON(yit_web_fonts);
yit_family_string += '<optgroup label="Web Fonts">';
$.each(web_fonts.items, function(i,v){
yit_family_string += '<option>' + v + '</option>';
});
yit_family_string += '</optgroup>';
//google fonts
var google_fonts = $.parseJSON(yit_google_fonts);
yit_family_string += '<optgroup label="Google Fonts">';
$.each(google_fonts.items, function(i,v){
yit_family_string += '<option>' + v + '</option>';
});
yit_family_string += '</optgroup>';
}
this._loadElements();
this._initEvents();
},
_loadElements : function() {
var elements = this.options.elements;
var container = this.element;
for( var el in elements) {
elements[el] = container.find( elements[el] );
}
},
_initEvents : function() {
var elements = this.options.elements;
var self = this;
//refresh
var refresh = elements.refresh;
refresh.on('click', function(e){
e.preventDefault();
$(this).parent().fadeOut( 'slow' );
//Set current value, before trigger change event
//Color
elements.preview.css( 'color', elements.color.val() );
//Font size
var size = elements.size.val();
var unit = elements.unit.val();
elements.preview.css( 'font-size', size + unit );
elements.preview.css( 'line-height', ( unit == 'em' || unit == 'rem' ? Number( size ) + 0.4 : Number ( size ) + 4 ) + unit );
//Font style
var style = elements.style.val();
if( style == 'italic' ) {
elements.preview.css({ 'font-weight' : 'normal', 'font-style' : 'italic' });
} else if( style == 'bold' ) {
elements.preview.css({ 'font-weight' : 'bold', 'font-style' : 'normal' });
} else if( style == 'extra-bold' ) {
elements.preview.css({ 'font-weight' : '800', 'font-style' : 'normal' });
} else if( style == 'bold-italic' ) {
elements.preview.css({ 'font-weight' : 'bold', 'font-style' : 'italic' });
} else {
elements.preview.css({ 'font-weight' : 'normal', 'font-style' : 'normal' });
}
//Font Family
var group = elements.family.find( 'option:selected' ).parent().attr( 'label' );
if( group == 'Web fonts' ) {
//Web font
elements.preview.css( 'font-family', elements.family.val() );
} else {
//Google font
WebFontConfig = {
google: {
families: [ elements.family.find('option:selected' ).text() ] },
fontactive: function( fontFamily, fontDescription ) {
elements.preview.css( 'font-family', fontFamily );
}
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
}
});
//font size, font unit
$([elements.size, elements.unit]).each(function(){
$(this).on('change', function(){
if( elements.refresh.is( ':visible' ) ) { return; }
var size = elements.size.val();
var unit = elements.unit.val();
elements.preview.css({
'font-size' : size + unit,
'line-height' : ( unit == 'em' || unit == 'rem' ? Number( size ) + 0.4 : Number ( size ) + 4 ) + unit
}).trigger( 'resize' );
});
});
//font family
var family = elements.family;
family.on('mousedown', function(e){
var t = $(this);
if(t.data('instance') == false) {
var currentElement = {
'value' : t.val(),
'text' : t.find('option:selected').text()
};
t.html(yit_family_string)
.find('option')
.filter(function(){
return $(this).text() == currentElement.text;
}).attr('selected', true);
t.data('instance', 'true');
}
});
family.on('change', function(){
if( elements.refresh.is( ':visible' ) ) { return; }
var group = $( this ).find( 'option:selected' ).parent().attr( 'label' );
if( group == 'Web fonts' ) {
//Web font
elements.preview.css( 'font-family', $( this ).val() );
} else {
//Google font
WebFontConfig = {
google: {
families: [ $( this ).val() ]
},
fontactive: function( fontFamily, fontDescription ) {
elements.preview.css( 'font-family', fontFamily );
}
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
}
elements.preview.trigger( 'resize' );
});
elements.style.on('change', function(){
if( elements.refresh.is( ':visible' ) ) { return; }
var style = $( this ).val();
if( style == 'italic' ) {
elements.preview.css({ 'font-weight' : 'normal', 'font-style' : 'italic' });
} else if( style == 'bold' ) {
elements.preview.css({ 'font-weight' : 'bold', 'font-style' : 'normal' });
} else if( style == 'extra-bold' ) {
elements.preview.css({ 'font-weight' : '800', 'font-style' : 'normal' });
} else if( style == 'bold-italic' ) {
elements.preview.css({ 'font-weight' : 'bold', 'font-style' : 'italic' });
} else {
elements.preview.css({ 'font-weight' : 'normal', 'font-style' : 'normal' });
}
elements.preview.trigger( 'resize' );
});
//preview
elements.preview.resize(function(){
var box = $(this).parents('.yit-box');
$(this).parents('form').height( box.height() );
});
}
};
$.fn.yit_panel_typography = function( options ) {
if ( typeof options === 'string' ) {
var args = Array.prototype.slice.call( arguments, 1 );
this.each(function() {
var instance = $.data( this, 'yit_panel_typography' );
if ( !instance ) {
console.error( "cannot call methods on yit_checkout prior to initialization; " +
"attempted to call method '" + options + "'" );
return;
}
if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
console.error( "no such method '" + options + "' for yit_panel_typography instance" );
return;
}
instance[ options ].apply( instance, args );
});
}
else {
this.each(function() {
var instance = $.data( this, 'yit_panel_typography' );
if ( !instance ) {
$.data( this, 'yit_panel_typography', new $.yit_panel_typography( options, this ) );
}
});
}
return this;
};
})( window, jQuery );
<?php /** * Google font management */ $yith_google_fonts = new Google_Font(); class Google_Font { /** * @var array The google fonts to include in the page */ public $google_fonts = array(); /** * Generate the url for the google fonts */ public function google_fonts_url() { $base_url = 'http://fonts.googleapis.com/css?family='; $fonts = array(); if ( empty( $this->google_fonts ) ) return; foreach ( $this->google_fonts as $font => $variants ) { $fonts[] = urlencode( $font . ':' . implode( ',', $variants ) ); } return $base_url . implode( '|', $fonts ); } /** * Add a new google font in queue * * @param $font The name of google font * @param array $variants The variatns for the google font to add */ public function add_google_font( $font, $variants = array() ) { if ( ! is_array( $variants ) ) $variants = array( $variants ); foreach ( $variants as $variant ) { if ( ! isset( $this->google_fonts[$font] ) ) $this->google_fonts[$font] = array( 300, 400 ); if ( ! in_array( $variant, $this->google_fonts[$font] ) ) $this->google_fonts[$font][] = $variant; } } } if ( ! function_exists( 'yith_add_google_font' ) ) { /** * Add a new google font in queue * * @param $font The name of google font * @param array $variant The variatns for the google font to add */ function yith_add_google_font( $font, $variant = array() ) { global $yith_google_fonts; $yith_google_fonts->add_google_font( $font, $variant ); } } if ( ! function_exists( 'yith_google_fonts_url' ) ) { /** * @return string The url with the google fonts to load */ function yith_google_fonts_url() { global $yith_google_fonts; return $yith_google_fonts->google_fonts_url(); } }
<?php /** * Your Inspiration Themes common functions * * @author Your Inspiration Themes * @version 0.0.1 */ if (!defined('YITH_FUNCTIONS')) { define('YITH_FUNCTIONS', true); } //!defined('YITH_FUNCTIONS') if (!function_exists('yit_is_woocommerce_active')) { /** * WC Detection */ function yit_is_woocommerce_active() { $active_plugins = (array) get_option('active_plugins', array()); if (is_multisite()) { $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array())); } //is_multisite() $woo = yit_get_plugin_basename_from_slug('woocommerce'); return in_array($woo, $active_plugins) || array_key_exists($woo, $active_plugins); } } //!function_exists('yit_is_woocommerce_active') if (!function_exists('yit_get_plugin_basename_from_slug')) { /** * Helper function to extract the file path of the plugin file from the * plugin slug, if the plugin is installed. * * @param string $slug Plugin slug (typically folder name) as provided by the developer * @return string Either file path for plugin if installed, or just the plugin slug */ function yit_get_plugin_basename_from_slug($slug) { include_once ABSPATH . '/wp-admin/includes/plugin.php'; $keys = array_keys(get_plugins()); foreach ($keys as $key) { if (preg_match('|^' . $slug . '|', $key)) return $key; } //$keys as $key return $slug; } } //!function_exists('yit_get_plugin_basename_from_slug') if (!function_exists('yith_debug')) { /** * Debug helper function. This is a wrapper for var_dump() that adds * the <pre /> tags, cleans up newlines and indents, and runs * htmlentities() before output. * * @param mixed $var The variable to dump. * @param mixed $var2 The second variable to dump * @param ... * @return string */ function yith_debug() { $args = func_get_args(); if (!empty($args)) { foreach ($args as $k => $arg) { // var_dump the variable into a buffer and keep the output ob_start(); var_dump($arg); $output = ob_get_clean(); // neaten the newlines and indents $output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output); if (!extension_loaded('xdebug')) { $output = htmlspecialchars($output, ENT_QUOTES); } //!extension_loaded('xdebug') $output = '<pre class="yit-debug">' . '<strong>$param_' . ($k + 1) . ": </strong>" . $output . '</pre>'; echo $output; } //$args as $k => $arg } //!empty($args) else { trigger_error("yit_debug() expects at least 1 parameter, 0 given.", E_USER_WARNING); } return $args; } } //!function_exists('yith_debug') if (!function_exists('yit_get_options_from_prefix')) { /** * Returns an array of all options that starts with a prefix * * @param string $prefix * @return array */ function yit_get_options_from_prefix($prefix) { if (!$prefix) return array(); global $wpdb; $sql = "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE '{$prefix}%'"; $options = $wpdb->get_col($sql); $return = array(); foreach ($options as $option) { $return[$option] = get_option($option); } //$options as $option return yit_debug($return); } } //!function_exists('yit_get_options_from_prefix') if (!function_exists('yit_wp_roles')) { /** * Returns the roles of the site. * * @return array * @since 1.0.0 */ function yit_wp_roles() { global $wp_roles; if (!isset($wp_roles)) $wp_roles = new WP_Roles(); $roles = array(); foreach ($wp_roles->roles as $k => $role) { $roles[$k] = $role['name']; } //$wp_roles->roles as $k => $role return $roles; } } //!function_exists('yit_wp_roles') if (!function_exists('yit_user_roles')) { /** * Returns the roles of the user * * @param int $user_id (Optional) The ID of a user. Defaults to the current user. * @return array() * @since 1.0.0 */ function yit_user_roles($user_id = null) { if (is_numeric($user_id)) $user = get_userdata($user_id); else $user = wp_get_current_user(); if (empty($user)) return false; return (array) $user->roles; } } //!function_exists('yit_user_roles') // ADMIN if (!function_exists('yit_typo_option_to_css')) { /** * Change the typography option saved in database to attributes for css * * @param array $option The option as saved in the database * @return string * @since 1.0.0 */ function yit_typo_option_to_css($option) { $attrs = $variant = array(); extract($option); $attrs[] = "color: $color;"; $attrs[] = "font-size: {$size}{$unit};"; $attrs[] = "font-family: '{$family}';"; switch ($style) { case 'regular': $attrs[] = 'font-weight: 400;'; $attrs[] = 'font-style: normal;'; $variant = 400; break; case 'bold': $attrs[] = 'font-weight: 700;'; $attrs[] = 'font-style: normal;'; $variant = 700; break; case 'extra-bold': $attrs[] = 'font-weight: 800;'; $attrs[] = 'font-style: normal;'; $variant = 800; break; case 'italic': $attrs[] = 'font-weight: 400;'; $attrs[] = 'font-style: italic;'; $variant = 400; break; case 'bold-italic': $attrs[] = 'font-weight: 700;'; $attrs[] = 'font-style: italic;'; $variant = 700; break; } //$style yith_add_google_font($family, $variant); return implode("\n", $attrs) . "\n"; } } //!function_exists('yit_typo_option_to_css')
<?php /** * Your Inspiration Themes Panel * * @author Your Inspiration Themes * @version 0.1.0 */ if( !class_exists('YITH_Panel') ) { /* * The class manages the theme options for the Plugin */ class YITH_Panel { /** * Class version * * @var string */ public $version = '0.1.0'; /** * Parameters for add_submenu_page * * add_submenu_page( * 'themes.php', // The file name of a standard WordPress admin page * 'Theme Options', // The text to be displayed in the title tags of the page when the menu is selected * 'Theme Options', // The text to be used for the menu * 'administrator', // The capability (or role) required for this menu to be displayed to the user. * 'theme-options', // The slug name to refer to this menu by (should be unique for this menu). * 'theme_options_display_page' // The function to be called to output the content for this page. * ); * * @access protected */ protected $_submenu = array(); /** * Initial Options definition: * 'tab' => array( * 'label', * 'sections' => array( * 'fields' => array( * 'option1', * 'option2', * ... * ) * ) * ) * * @var array * @access public */ public $options = array(); /** * Options group name * * @var string * @access public */ public $option_group = 'panel_group'; /** * Option name * * @var string * @access public */ public $option_name = 'panel_options'; /** * Banner links * * @var string * @access public */ public $banner_url = 'http://yithemes.com/?ap_id=plugin'; public $banner_img = ''; /** * Constructor * * @param array $submenu Parameters for add_submenu_page * @param array $options Array of plugin options * */ public function __construct( $submenu, $options, $banner = array(), $option_group = false, $option_name = false ) { $this->_submenu = apply_filters('yith_panel_submenu', $submenu); $this->options = apply_filters('yith_panel_options', $options); if( !empty($banner) ) { $this->banner_url = $banner['url']; $this->banner_img = $banner['img']; } if( $option_group ) { $this->option_group = $option_group; } if( $option_name ) { $this->option_name = $option_name; } //add new menu item //register new settings option group //include js and css files //print browser add_action( 'admin_menu', array( $this, 'add_submenu_page') ); add_action( 'admin_init', array( $this, 'panel_register_setting') ); add_action( 'admin_enqueue_scripts', array( $this, 'panel_enqueue') ); // add the typography javascript vars add_action( 'yith_panel_after_panel', array( $this, 'js_typo_vars' ) ); } /** * Create new submenu page * * @return void * @access public * @link http://codex.wordpress.org/Function_Reference/add_submenu_page */ public function add_submenu_page() { $submenu = $this->_submenu; add_submenu_page( $submenu[0], $submenu[1], $submenu[2], $submenu[3], $submenu[4], array( $this, isset($submenu[5]) ? $submenu[5] : 'display_panel_page' ) ); } /** * Print the Panel page * * @return void * @access public */ public function display_panel_page() { // Create a header in the default WordPress 'wrap' container $page = $this->_get_tab(); ?> <div id="icon-themes" class="icon32"><br /></div> <h2 class="nav-tab-wrapper"> <?php foreach( $this->options as $k=>$tab ): ?> <a class="nav-tab<?php if( $page == $k ): ?> nav-tab-active<?php endif ?>" href="<?php echo add_query_arg('panel_page', $k) ?>"><?php echo $tab['label'] ?></a> <?php endforeach ?> <?php do_action('yith_panel_after_tabs'); ?> </h2> <div class="wrap"> <?php $this->printBanner() ?> <?php do_action('yith_panel_before_panel'); ?> <form action="options.php" method="post"> <?php do_settings_sections( $this->option_name ); ?> <?php settings_fields( $this->option_group ) ?> <p class="submit"> <input type="hidden" name="panel_page" value="<?php echo $page ?>" /> <input class="button-primary" type="submit" name="save_options" value="Save Options" /> </p> </form> <?php do_action('yith_panel_after_panel'); ?> </div> <?php } /** * Add the vars for the typography options */ public function js_typo_vars() { global $yith_panel_if_typography; if ( ! isset( $yith_panel_if_typography ) || ! $yith_panel_if_typography ) return; $web_fonts = array( "Arial", "Arial Black", "Comic Sans MS", "Courier New", "Georgia", "Impact", "Lucida Console", "Lucida Sans Unicode", "Thaoma", "Trebuchet MS", "Verdana" ); // http://niubbys.altervista.org/google_fonts.php $google_fonts = file_get_contents( dirname(__FILE__) . '/assets/js/google_fonts.json' ); ?> <script type="text/javascript"> var yit_google_fonts = '<?php echo $google_fonts ?>', yit_web_fonts = '{"items":<?php echo json_encode( $web_fonts ) ?>}', yit_family_string = ''; </script> <?php } /** * Register a new settings option group * * @return void * @access public * @link http://codex.wordpress.org/Function_Reference/register_setting * @link http://codex.wordpress.org/Function_Reference/add_settings_section * @link http://codex.wordpress.org/Function_Reference/add_settings_field */ public function panel_register_setting() { $page = $this->_get_tab(); $tab = isset( $this->options[$page] ) ? $this->options[$page] : array(); if( !empty($tab['sections']) ) { //add sections and fields foreach( $tab['sections'] as $section_name => $section) { //add the section add_settings_section( $section_name, $section['title'], array( $this, 'panel_section_content'), $this->option_name ); //add the fields foreach( $section['fields'] as $option_name => $option ) { $option['id'] = $option_name; $option['label_for'] = $option_name; //register settings group register_setting( $this->option_group, $option_name, array( $this, 'panel_sanitize') ); add_settings_field( $option_name, $option['title'], array( $this, 'panel_field_content' ), $this->option_name, $section_name, $option ); } } } } /** * Display sections content * * @return void * @access public */ public function panel_section_content( $section ) { $page = $this->_get_tab(); if( isset( $this->options[$page]['sections'][ $section['id'] ]['description'] )) { echo "<p class='section-description'>" . $this->options[$page]['sections'][ $section['id'] ]['description'] . "</p>"; } } /** * Sanitize the option's value * * @param array $input * @return array * @access public */ public function panel_sanitize( $input ) { return apply_filters('yith_panel_sanitize', $input); } /** * Get the active tab. If the page isn't provided, the function * will return the first tab name * * @return string * @access protected */ public function _get_tab() { if( isset($_POST['panel_page']) && $_POST['panel_page'] != '' ) { return $_POST['panel_page']; } elseif( isset($_GET['panel_page']) && $_GET['panel_page'] != '' ) { return $_GET['panel_page']; } else { $tabs = array_keys( $this->options ); return $tabs[0]; } } /** * Enqueue scripts and styles * * @return void * @access public */ public function panel_enqueue( $hook ) { global $pagenow; if( $pagenow == $this->_submenu[0] && isset( $_GET['page'] ) && $_GET['page'] == $this->_submenu[4] ) { wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_style( 'jquery-ui', 'http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css' ); wp_enqueue_script( 'jquery-ui-datepicker' ); wp_enqueue_style( 'yith-panel-css', plugin_dir_url( __FILE__ ) . 'assets/css/yith-panel.css', array('wp-color-picker'), $this->version ); wp_enqueue_script( 'yith-panel-js', plugin_dir_url( __FILE__ ) . 'assets/js/yith-panel.js', array( 'jquery', 'wp-color-picker' ), $this->version, true ); wp_enqueue_media(); do_action( 'yith_panel_enqueue' ); } } /** * Display field content * * @return void * @access public */ public function panel_field_content( $field ) { $value = get_option( $field['id'], isset($field['std']) ? $field['std'] : '' ); $id = $field['id']; $name = $field['id']; $echo = ''; switch( $field['type'] ) { case 'text': $echo = "<input type='text' id='{$id}' name='{$name}' value='{$value}' class='regular-text code' />"; if( isset($field['description']) && $field['description'] != '' ) { $echo .= "<p class='description'>{$field['description']}</p>"; } break; case 'textarea': $echo = "<textarea name='{$name}' id='{$id}' class='large-text code' rows='10' cols='50'>{$value}</textarea>"; if( isset($field['description']) && $field['description'] != '' ) { $echo .= "<p class='description'>{$field['description']}</p>"; } break; case 'checkbox': $echo = "<input type='checkbox' id='{$id}' name='{$name}' value='1' ". checked($value, true, false) ." />"; if( isset($field['description']) && $field['description'] != '' ) { $echo .= " <label for='{$id}'><span class='description'>{$field['description']}</span></label>"; } break; case 'select': $echo = "<select name='{$name}' id='{$id}'>"; foreach( $field['options'] as $v=>$label ) { $echo .= "<option value='{$v}'". selected($value, $v, false) .">{$label}</option>"; } $echo .= "</select>"; if( isset($field['description']) && $field['description'] != '' ) { $echo .= "<p class='description'>{$field['description']}</p>"; } break; case 'number': $mms = ''; if( isset( $field['min'] ) ) { $mms .= " min='{$field['min']}'"; } if( isset( $field['max'] ) ) { $mms .= " max='{$field['max']}'"; } if( isset( $field['step'] ) ) { $mms .= " step='{$field['step']}'"; } $echo = "<input type='number' id='{$id}' name='{$name}' value='{$value}' class='small-text' {$mms} />"; if( isset($field['description']) && $field['description'] != '' ) { $echo .= "<p class='description'>{$field['description']}</p>"; } break; case 'colorpicker': $std = isset( $field['std'] ) ? $field['std'] : ''; $echo = "<input type='text' id='{$id}' name='{$name}' value='{$value}' class='medium-text code panel-colorpicker' data-default-color='{$std}' />"; if( isset($field['description']) && $field['description'] != '' ) { $echo .= "<p class='description'>{$field['description']}</p>"; } break; case 'datepicker': $std = isset( $field['std'] ) ? $field['std'] : array( 'date' => '', 'hh' => 0, 'mm' => 0, 'ss' => 0 ); $value = ! empty( $value ) ? $value : array( 'date' => '', 'hh' => 0, 'mm' => 0, 'ss' => 0 ); $echo = "<input type='text' id='{$id}_date' name='{$name}[date]' value='{$value['date']}' class='medium-text code panel-datepicker' colorpicker='" . __( 'Select a date', 'yit' ) . "' /> - "; $echo .= "<input type='text' id='{$id}_hh' name='{$name}[hh]' value='{$value['hh']}' class='small-text code' colorpicker='" . __( 'Hours', 'yit' ) . "' /> : "; $echo .= "<input type='text' id='{$id}_mm' name='{$name}[mm]' value='{$value['mm']}' class='small-text code' colorpicker='" . __( 'Minutes', 'yit' ) . "' /> : "; $echo .= "<input type='text' id='{$id}_ss' name='{$name}[ss]' value='{$value['ss']}' class='small-text code' colorpicker='" . __( 'Minutes', 'yit' ) . "' />"; if( isset($field['description']) && $field['description'] != '' ) { $echo .= "<p class='description'>{$field['description']}</p>"; } break; case 'upload': $echo = '<div class="uploader">'; $echo .= " <input type='text' id='{$id}' name='{$name}' value='{$value}' class='regular-text code' /> <input type='button' name='' id='{$id}_button' class='button' value='". __('Upload', 'yit') ."'>"; $echo .= '</div>'; if( isset($field['description']) && $field['description'] != '' ) { $echo .= "<p class='description'>{$field['description']}</p>"; } break; case 'checkboxes': $echo = '<div class="checkboxes">'; foreach ( $field['options'] as $check_value => $check_label ) { $echo .= "<label><input type='checkbox' id='{$id}_{$check_value}' name='{$name}[]' value='$check_value' ". checked( in_array( $check_value, $value ), true, false) ." /> {$check_label}</label><br />"; } $echo .= " <p class='description'>{$field['description']}</p>"; break; case 'typography': $value = wp_parse_args( $value, $field['std'] ); ?> <div class="typography_container typography"> <div class="option"> <!-- Size --> <div class="spinner_container"> <input class="typography_size number small-text" type="number" name="<?php echo $name ?>[size]" id="<?php echo $id ?>-size" value="<?php echo $value['size'] ?>" data-min="<?php if(isset( $field['min'] )) echo $field['min'] ?>" data-max="<?php if(isset( $field['max'] )) echo $field['max'] ?>" /> </div> <!-- Unit --> <div class="select-wrapper font-unit"> <select class="typography_unit" name="<?php echo $name ?>[unit]" id="<?php echo $id ?>-unit"> <option value="px" <?php selected( $value['unit'], 'px' ) ?>><?php _e( 'px', 'yit' ) ?></option> <option value="em" <?php selected( $value['unit'], 'em' ) ?>><?php _e( 'em', 'yit' ) ?></option> <option value="pt" <?php selected( $value['unit'], 'pt' ) ?>><?php _e( 'pt', 'yit' ) ?></option> <option value="rem" <?php selected( $value['unit'], 'rem' ) ?>><?php _e( 'rem', 'yit' ) ?></option> </select> </div> <!-- Family --> <div class="select-wrapper font-family"> <select class="typography_family" name="<?php echo $name ?>[family]" id="<?php echo $id ?>-family" data-instance="false"> <?php if( $value['family'] ): ?> <option value="<?php echo stripslashes( $value['family'] ) ?>"><?php echo $value['family'] ?></option> <?php else: ?> <option value=""><?php _e('Select a font family', 'yit') ?></option> <?php endif ?> </select> </div> <!-- Style --> <div class="select-wrapper font-style"> <select class="typography_style" name="<?php echo $name ?>[style]" id="<?php echo $id ?>-style"> <option value="regular" <?php selected( $value['style'], 'regular' ) ?>><?php _e( 'Regular', 'yit' ) ?></option> <option value="bold" <?php selected( $value['style'], 'bold' ) ?>><?php _e( 'Bold', 'yit' ) ?></option> <option value="extra-bold" <?php selected( $value['style'], 'extra-bold' ) ?>><?php _e( 'Extra bold', 'yit' ) ?></option> <option value="italic" <?php selected( $value['style'], 'italic' ) ?>><?php _e( 'Italic', 'yit' ) ?></option> <option value="bold-italic" <?php selected( $value['style'], 'bold-italic' ) ?>><?php _e( 'Italic bold', 'yit' ) ?></option> </select> </div> <!-- Color --> <input type='text' id='<?php echo $id ?>-color' name='<?php echo $name ?>[color]' value='<?php echo $value['color'] ?>' class='medium-text code panel-colorpicker typography_color' data-default-color='<?php echo $field['std']['color'] ?>' /> </div> <div class="clear"></div> <div class="font-preview"> <p>The quick brown fox jumps over the lazy dog</p> <!-- Refresh --> <div class="refresh_container"><button class="refresh"><?php _e( 'Click to preview', 'yit' ) ?></button></div> </div> </div> <?php global $yith_panel_if_typography; $yith_panel_if_typography = true; break; default: do_action('yith_panel_field_' . $field['type']); break; } echo $echo; } /** * Print the banner * * @access protected * @return void */ public function printBanner() { if( !$this->banner_url || !$this->banner_img ) return; ?> <div class="yith_banner"> <a href="<?php echo $this->banner_url ?>" target="_blank"> <img src="<?php echo $this->banner_img ?>" alt="" /> </a> </div> <?php } } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment