/** * * Class constructor * * @param string $name * @access public */ public function __construct($name = 'sidebar') { parent::__construct($name); $images_uri = FileSystem::getDirectory('images_uri'); $sidebar_positions = array(array('value' => 0, 'label' => Translate::translate('None'), 'img' => $images_uri . 'admin/sidebar/icon_0_sidebar_off.png'), array('value' => 1, 'label' => Translate::translate('Left sidebar'), 'img' => $images_uri . 'admin/sidebar/icon_1_sidebar_off.png'), array('value' => 2, 'label' => Translate::translate('Right sidebar'), 'img' => $images_uri . 'admin/sidebar/icon_2_sidebar_off.png')); $this->setOptions($sidebar_positions); }
protected function setUp() { $this->setEnterTitleHearLabel(Translate::translate('Name')); $lead = new Textarea('lead'); $lead->setLabel(Translate::translate('Lead')); $this->addControl($lead); $keywords = new Text('keywords'); $keywords->setLabel(Translate::translate('Keywords')); $this->addControl($keywords); $abstract = new Textarea('abstract'); $abstract->setLabel(Translate::translate('Abstract')); $this->addControl($abstract); $text_area = new Textarea('additional_information'); $text_area->setLabel(Translate::translate('Additional information')); $this->addControl($text_area); $select = new Select('publication_year'); $select->setLabel(Translate::translate('Publication year')); $select->setStart(2005); $select->setEnd(date('Y')); $this->addFilterControl($select); $checkbox = new Checkbox('language'); $checkbox->setLabel(Translate::translate('Publication language')); $checkbox->setOptions(array(array('label' => Translate::translate('polish'), 'value' => 'pl'), array('label' => Translate::translate('english'), 'value' => 'en'))); $this->addFilterControl($checkbox); $attachment = new Upload('attachment'); $attachment->setLabel(Translate::translate('Main file')); $this->addControl($attachment); $attachments = new Attachments('attachments'); $this->addControl($attachments); $cover = new Upload('cover'); $cover->setLabel(Translate::translate('Cover')); $this->addControl($cover); }
protected function setUp() { $this->setEnterTitleHearLabel(Translate::translate('Name and last name')); $text = new Text('email'); $text->setLabel(Translate::translate('E-mail')); $text->setValidation('email'); $this->addControl($text); $text = new Text('affiliation'); $text->setLabel(Translate::translate('Affiliation')); $this->addControl($text); $text_area = new Textarea('contact'); $text_area->setLabel(Translate::translate('Contact')); $this->addControl($text_area); $checkbox = new Checkbox('show_in_team_page'); $checkbox->setLabel(Translate::translate('Show in Team page')); $this->addFilterControl($checkbox); $interests = new Textarea('interests'); $interests->setLabel(Translate::translate('Interests')); $this->addControl($interests); $attachment = new Upload('attachment'); $attachment->setLabel(Translate::translate('Curriculum Vitae')); $this->addControl($attachment); $iamge = new Upload('image'); $iamge->setLabel(Translate::translate('Picture with smile')); $this->addControl($iamge); }
/** * * Class constructor * * @param string $name control name * * @throws \SilverWp\Helper\Control\Exception */ public function __construct($name = 'el_class') { parent::__construct($name); $this->setLabel(Translate::translate('Extra class name')); $this->setDescription(Translate::translate('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.')); }
protected function setUp() { $realization_time = new Text('realization_time'); $realization_time->setLabel(Translate::translate('Realization time')); $this->addControl($realization_time); $partners = new Wpeditor('partners'); $partners->setLabel(Translate::translate('Partners')); $this->addControl($partners); $contact = new Textarea('contact'); $contact->setLabel(Translate::translate('Contact')); $this->addControl($contact); $external_url = new Text('external_url'); $external_url->setLabel(Translate::translate('External URL')); $external_url->setValidation('url'); $this->addControl($external_url); $group = new Group('persons'); $group->setLabel(Translate::translate('Persons engage in project')); $group->setSortable(true); $group->setRepeating(true); $label = new Text('label'); $label->setLabel(Translate::translate('Label')); $group->addControl($label); $name = new Text('person'); $name->setLabel(Translate::translate('Person')); $group->addControl($name); $this->addControl($group); $attachments = new Attachments('attachments'); $this->addControl($attachments); }
/** * * Get plugin name * * @return string * @throws \SilverWp\Exception * @access public */ public function getPluginName() { if (!$this->plugin_name) { throw new Exception(Translate::translate('Class property $plugin_name is required and can\'t be empty')); } return $this->plugin_name; }
protected function setUp() { $attachments = new Attachments('attachments'); $this->addControl($attachments); $checkbox = new Checkbox('main_page_promo'); $checkbox->setLabel(Translate::translate('Promotion on main page')); $this->addControl($checkbox); }
/** * * Class constructor * * @param string $name control name * * @throws \SilverWp\Helper\Control\Exception */ public function __construct($name = 'css_animation') { parent::__construct($name); $this->setLabel(Translate::translate('Css animation')); $animation_list = silverwp_get_button_css_animation(); $this->setOptions($animation_list); $this->setDescription(Translate::translate('Select type of animation if you want this element to be animated when it enters into the browsers viewport. Note: Works only in modern browsers.')); }
/** * Set widgets classes * * @param array $widgets_classes * * @return $this * @throws Exception * @access public */ public function setWidgets(array $widgets_classes) { foreach ($widgets_classes as $widget_class) { if (!$this->isImplemented($widget_class, 'SilverWp\\Widget\\WidgetInterface')) { throw new Exception(Translate::translate('Class %s is not valid widget class. Widget class have to implement SilverWp\\Widget\\WidgetInterface interface.')); } } $this->widgets = $widgets_classes; return $this; }
/** * Class constructor * * @param string $name * * @access public */ public function __construct($name) { parent::__construct($name); $this->setRepeating(true); $this->setSortable(true); $this->setLabel(Translate::translate('Gallery')); $upload = new Upload('image'); $upload->setLabel(Translate::translate('Image')); $this->addControl($upload); }
/** * Class constructor * * @param string $name * * @access public */ public function __construct($name) { parent::__construct($name); $this->setRepeating(true); $this->setSortable(true); $this->setLabel(Translate::translate('Attachments')); $upload = new Upload('attachment'); $upload->setLabel(Translate::translate('File')); $this->addControl($upload); }
/** * Set up taxonomy class labels etc. * * @since 0.2 * @access protected */ protected function setUp() { global $wp_rewrite; $this->add('types', array('public' => true, 'show_in_nav_menus' => true, 'show_ui' => true, 'show_tagcloud' => false, 'hierarchical' => false, 'query_var' => true, 'custom_meta_box' => array('control_type' => 'select', 'priority' => 'high', 'context' => 'normal', 'metabox_title' => Translate::translate('Select type'), 'force_selection' => true, 'indented' => false, 'allow_new_terms' => true))); $this->setLabels('types', array('name' => Translate::translate('Publications types'), 'singular_name' => Translate::translate('Publication type'), 'menu_name' => Translate::translate('Publications types'), 'all_items' => Translate::translate('All Publications types'), 'separate_items_with_commas' => Translate::translate('Separate Publications types with commas'), 'choose_from_most_used' => Translate::translate('Choose from the most often used Publications types'), 'add_new_item' => Translate::translate('Add new Type'))); $this->add('category', array('public' => true, 'show_in_nav_menus' => true, 'show_ui' => true, 'show_tagcloud' => false, 'hierarchical' => true, 'query_var' => true, 'display_column' => true)); $this->setLabels('category', array('name' => Translate::translate('Publications categories'), 'singular_name' => Translate::translate('Publication category'), 'menu_name' => Translate::translate('Publications categories'), 'all_items' => Translate::translate('All Publications categories'), 'separate_items_with_commas' => false, 'choose_from_most_used' => false, 'add_new_item' => Translate::translate('Add new Category'))); //TODO fix autocomplete $this->add('jel', array('public' => true, 'hierarchical' => false, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => false, 'query_var' => 'jel', 'rewrite' => array('hierarchical' => false, 'slug' => get_option('tag_base') ? get_option('tag_base') : 'jel', 'with_front' => !get_option('tag_base') || $wp_rewrite->using_index_permalinks(), 'ep_mask' => EP_TAGS), 'show_tagcloud' => true, '_builtin' => true)); $this->setLabels('jel', array('name' => Translate::translate('JEL codes'), 'singular_name' => Translate::translate('JEL code'), 'menu_name' => Translate::translate('JEL codes'), 'all_items' => Translate::translate('All JEL codes'), 'separate_items_with_commas' => Translate::translate('Separate JEL codes with commas'), 'choose_from_most_used' => Translate::translate('Choose from the most often used JEL codes'), 'add_new_item' => Translate::translate('Add new JEL code'), 'parent_item' => null, 'parent_item_colon' => null)); }
protected function setUp() { $this->setEnterTitleHearLabel(Translate::translate('Name and last name')); $text_area = new Textarea('affiliation'); $text_area->setLabel(Translate::translate('Affiliation')); $this->addControl($text_area); $text = new Text('email'); $text->setLabel(Translate::translate('E-mail')); $text->setValidation('email'); $this->addControl($text); }
protected function setUp() { $about = new Textarea('about'); $about->setLabel(Translate::translate('About')); $this->addControl($about); $title = new Text('title'); $title->setLabel(Translate::translate('Title')); $this->addControl($title); $attachments = new Attachments('attachments'); $attachments->setLabel(Translate::translate('Attachments')); $this->addControl($attachments); }
/** * Class constructor * * @param string $name * * @access public */ public function __construct($name) { parent::__construct($name); $this->setRepeating(true); $this->setSortable(true); $this->setLabel(Translate::translate('Video')); $url = new Text('url'); $url->setLabel(Translate::translate('URL'))->setValidation('url'); $this->addControl($url); $name = new Text('name'); $name->setLabel(Translate::translate('Name')); $this->addControl($name); }
/** * Class constructor setup control group * * @param string $name * @access public */ public function __construct($name = 'post_format') { parent::__construct($name); $this->setLabel(Translate::translate('Post format')); /*TODO implement dependency $format = new Select( 'format' ); $format->setLabel( Translate::translate( 'Post format' ) ); $format->setOptions( array( array( 'label' => Translate::translate( 'Standard' ), 'value' => false, ), array( 'label' => Translate::translate( 'Video' ), 'value' => 'video', ), array( 'label' => Translate::translate( 'Gallery' ), 'value' => 'gallery', ), array( 'label' => Translate::translate( 'Audio' ), 'value' => 'audio', ), ) ); $this->addControl( $format ); */ $group = new Group('video'); $group->setLabel(Translate::translate('Video')); $url = new Text('url'); $url->setLabel(Translate::translate('YouTube or Vimeo file URL')); $url->setValidation('url'); // $url->setDependency($format, 'silverwp_post_format_dep_boolean', 'video'); $group->addControl($url); $this->addControl($group); $group = new Gallery('gallery'); $group->setLabel(Translate::translate('Gallery')); $this->addControl($group); $group = new Group('audio'); $group->setLabel(Translate::translate('Audio')); $audio = new Text('url'); $audio->setLabel(Translate::translate('SoundCloud audio URL')); $audio->setValidation('url'); //$audio->setDependency($format, 'silverwp_post_format_dep_boolean', 'audio'); $group->addControl($audio); $this->addControl($group); }
/** * Register menu page * * @throws Exception * @access public */ public function registerMenuPage() { if (!isset($this->parent_slug)) { throw new Exception(Translate::translate('Property: ' . __CLASS__ . '::parent_slug is required and can\'t be empty.')); } if (!isset($this->page_title)) { throw new Exception(Translate::translate('Property: ' . __CLASS__ . '::page_title is required and can\'t be empty.')); } if (!isset($this->menu_title)) { throw new Exception(Translate::translate('Property: ' . __CLASS__ . '::menu_title is required and can\'t be empty.')); } if (!isset($this->capability)) { throw new Exception(Translate::translate('Property: ' . __CLASS__ . '::capability is required and can\'t be empty.')); } add_submenu_page($this->parent_slug, $this->page_title, $this->menu_title, $this->capability, $this->getSlug(), $this->callback); }
/** * Class constructor * * @throws Exception * @access protected */ public function __construct() { $child_class = get_called_class(); if (\is_null($this->tag_base)) { throw new Exception(Translate::translate('Property %s is required and can\'t be empty.', $child_class . '::tag_base')); } //if class implemetns SilverWp\Interfaces\EnqueueScripts enqueue scripts if (SingletonAbstract::isImplemented($child_class, 'SilverWp\\Interfaces\\EnqueueScripts')) { add_action('wp_enqueue_scripts', array($this, 'enqueueScripts')); } if (SingletonAbstract::isImplemented($child_class, 'SilverWp\\ShortCode\\SaveOccurencesInterface')) { //save short code occurennces in posts add_action('save_post', array($this, 'saveOccurrencesPostsIds'), 10, 1); } $this->register(); }
/** * * class constructor * * @throws Exception * @access protected */ protected function __construct() { if (\is_null($this->name)) { throw new Exception(Translate::translate('Variable name is requaied and can\'t be empty.')); } if (!is_null($this->ajax_js_file)) { \add_action('wp_loaded', array($this, 'scriptsRegister')); } # Could as well be: wp_enqueue_scripts or login_enqueue_scripts \add_action('wp_enqueue_scripts', array($this, 'scriptsEnqueue')); \add_action('wp_enqueue_scripts', array($this, 'scriptsLocalize')); # Guests: \add_action("wp_ajax_nopriv_{$this->name}", array($this, 'ajaxResponse')); # Logged in users: //TODO add iterface and method ajaxPrivResponse \add_action("wp_ajax_{$this->name}", array($this, 'ajaxResponse')); }
/** * Class constructor * * @param string $name * * @access public */ public function __construct($name) { parent::__construct($name); $this->setSortable(true); $this->setRepeating(true); //set up default configuration $this->setLabel(Translate::translate('Social Accounts')); $name = new Text('name'); $name->setLabel('Name'); $this->addControl($name); $url = new Text('url'); $url->setLabel('URL')->setValidation('url'); $this->addControl($url); $icon = new Fontello('icon'); $icon->setLabel(Translate::translate('Icon')); $this->addControl($icon); }
/** * Register Stylesheets templates files * * @param string $handle handle name * @param string $src path to stylesheets template file * @param array $dep An array of registered style handles this stylesheet depends on. Default empty array. * @param string|bool $ver String specifying the stylesheet version number. Used to ensure that the correct version * is sent to the client regardless of caching. Default 'false'. Accepts 'false', 'null', or 'string'. * @param string $media Optional. The media for which this stylesheet has been defined. * Default 'all'. Accepts 'all', 'aural', 'braille', 'handheld', 'projection', 'print', * 'screen', 'tty', or 'tv'. * @param bool|false $compress compress the target file * * @return WPScssStylesheet * @throws Exception */ protected function registerStylesheetsTemplates($handle, $src, array $dep = array(), $ver = false, $media = 'all', $compress = false) { if (class_exists('\\WPScssPlugin')) { $WPScssPlugin = \WPScssPlugin::getInstance(); $WPScssPlugin->dispatch(); $this->configDirs($WPScssPlugin); $variable = $this->variables; $WPScssPlugin->setVariables($variable); $WPScssPlugin->getCompiler()->setFormatter('scss_formatter_compressed'); if (!wp_style_is($handle, 'registered')) { wp_register_style($handle, $src, $dep, $ver, $media); wp_enqueue_style($handle); } return $WPScssPlugin->processStylesheet($handle, true); } else { throw new Exception(Translate::translate('Plugin WPScssPlugin not found!')); } }
protected function setUp() { $attachments = new Attachments('attachments'); $this->addControl($attachments); $checkbox = new Checkbox('main_page_promo'); $checkbox->setLabel(Translate::translate('Promotion on main page')); $this->addControl($checkbox); $place = new Text('place'); $place->setLabel(Translate::translate('Place')); $this->addControl($place); $address = new Text('address'); $address->setLabel(Translate::translate('Event address')); $this->addControl($address); $program = new Group('program'); $program->setLabel(Translate::translate('Program')); $program->setRepeating(true); $program->setSortable(true); $label = new Text('title'); $label->setLabel(Translate::translate('Title')); $program->addControl($label); $description = new Wpeditor('description'); $description->setLabel(Translate::translate('Description')); $program->addControl($description); $this->addControl($program); $start = new Group('start'); $start->setLabel(Translate::translate('Start')); $date = new Date('date_start'); $date->setLabel(Translate::translate('Date start')); $start->addControl($date); $time = new Text('time_start'); $time->setLabel(Translate::translate('Time start')); $start->addControl($time); $this->addControl($start); $end = new Group('end'); $end->setLabel(Translate::translate('End')); $date = new Date('date_end'); $date->setLabel(Translate::translate('Date end')); $end->addControl($date); $time = new Text('time_end'); $time->setLabel(Translate::translate('Time end')); $end->addControl($time); $this->addControl($end); }
/** * * Create menu * * @access protected * @return void */ protected function createMenu() { $this->setName('theme_update'); $this->setLabel(Translate::translate('Theme update')); $this->setIcon('font-awesome:fa-home'); $section = new Section('theme_api'); $note_box = new Notebox('note_box'); $note_box->setLabel(Translate::translate('Update your Theme from the WordPress Dashboard')); $note_box->setDescription(Translate::translate('If you want to get update notifications for your themes and if you want to be able to update your theme from your WordPress backend you need to enter your Themeforest account name as well as your Themeforest Secret API Key below:')); $section->addControl($note_box); $user_name = new Text('tf_user_name'); $user_name->setLabel(Translate::translate('Your Themeforest User Name')); $user_name->setDescription(Translate::translate('Enter the Name of the User you used to purchase this theme')); $section->addControl($user_name); $api_key = new Text('tf_api_key'); $api_key->setLabel(Translate::translate('Your Themeforest API Key')); $api_key->setDescription(Translate::translate('Enter the API Key of your Account here. <a href="">You can find your API Key here</a>')); $section->addControl($api_key); $this->addControl($section); }
/** * TODO implement this method before fire createControl should start init method * * @param $method_name * @param $attributes * * @throws Exception * @access public */ public function __call($method_name, $attributes) { if ($method_name == 'createControl') { //\SilverWp\Debug::dump( $method_name ); //\SilverWp\Debug::dump( $attributes ); $settings = $attributes[0]; $value = $attributes[1]; $this->init($settings, $value); $this->createControl($settings, $value); } else { throw new Exception(Translate::translate("Method {$method_name} des not exists!")); } }
/** * Set control Dependency * * @return $this * @throws \SilverWp\Customizer\Control\Exception * @access public */ public function setDependency() { list($parent_control, $operator, $parent_option) = func_get_args(); if (!$parent_control instanceof ControlInterface) { throw new Exception(Translate::translate('First arguments should by instance of \\SilverWp\\Customizer\\Control\\ControlInterface')); } $this->setting['required'][] = array('setting' => $parent_control->getName(), 'operator' => $operator, 'value' => $parent_option); return $this; }
public function __construct($control_name) { parent::__construct($control_name); $this->setOptions(array('normal' => Translate::translate('normal'), 'italic' => Translate::translate('italic'), 'oblique' => Translate::translate('oblique'), 'initial' => Translate::translate('initial'), 'inherit' => Translate::translate('inherit'))); }
/** * * Get list of edit columns displayed in lists of Post Type * * * list of columns displayed in dashboard list. Example * array( * 'cb' => array( * 'html' => '<input type="checkbox" />', * ), * 'title' => array( * 'label' => 'Title', * ), * 'category' => array( * 'label' => 'Categories', * ), * 'thumbnail' => array( * 'label' => 'Thumbnail', * ), * 'tag' => array( * 'label' => 'Tags', * ), * 'date' => array( * 'label' => 'Date', * ), * 'author' => array( * 'label' => 'Author', * ), * ); * * @access protected * @return array * @todo move to CustomColumn class */ protected function getEditColumns() { $columns_default = array('cb' => array('html' => '<input type="checkbox" />'), 'title' => array('label' => Translate::translate('Title')), 'thumbnail' => array('label' => Translate::translate('Thumbnail')), 'author' => array('label' => Translate::translate('Author')), 'date' => array('label' => Translate::translate('Date'))); $columns = UtlArray::array_remove_part($columns_default, $this->exclude_columns); return $columns; }
$team_to_research = $team->addRelationship('team_to_research', $research); $team_to_research->title = array('from' => Translate::translate('Research'), 'to' => Translate::translate('Persons from IBS')); $team_to_research->to_labels = array('create' => Translate::translate('Select research'), 'singular_name' => Translate::translate('Research'), 'search_items' => Translate::translate('Search researches'), 'not_found' => Translate::translate('No research found.')); $team_to_research->from_labels = array('create' => Translate::translate('Select Person'), 'singular_name' => Translate::translate('Person'), 'search_items' => Translate::translate('Search persons'), 'not_found' => Translate::translate('No person found.')); #end team_to_research #events_to_research $events_to_research = $events->addRelationship('events_to_research', $research); $events_to_research->admin_box = array('show' => 'from'); $events_to_research->title = Translate::translate('Research'); $events_to_research->to_labels = array('create' => Translate::translate('Select Research'), 'singular_name' => Translate::translate('Research'), 'search_items' => Translate::translate('Search Researches'), 'not_found' => Translate::translate('No research found.')); #end events_to_research #events_to_resources $events_to_resources = $events->addRelationship('events_to_resources', $resources); $events_to_resources->admin_box = array('show' => 'from'); $events_to_resources->title = Translate::translate('Resources'); $events_to_resources->to_labels = array('create' => Translate::translate('Select Resource'), 'singular_name' => Translate::translate('Resource'), 'search_items' => Translate::translate('Search Resources'), 'not_found' => Translate::translate('No Resource found.')); #end events_to_resources // \SilverWp\Ajax\Tweetie::getInstance(); #widgets //new Widget\Social(); #endwidgets if (is_plugin_active('sitepress-multilingual-cms/inc/wpml-api.php')) { new Import(); if (function_exists('icl_object_id')) { Wpml::getInstance(); } } } catch (Exception $ex) { echo $ex->catchException(); } }
/** * Display update information * * @access public */ public function backendHtml() { global $current_screen; $parent_string = is_child_theme() ? 'Parent Theme (' . ucfirst($this->theme_name) . ')' : 'Theme'; if (empty($this->user_name) || empty($this->api_key)) { echo Message::display(Translate::params('Once you have entered and saved your Username and API Key WordPress will check for updates every 12 Hours and notify you here, if one is available <br/><br/> Your current %s Version Number is <strong> %s </strong>', $parent_string, $this->version), 'updated'); UpdateNotifier::getInstance(); } else { if (($update = $this->isThemeUpdated()) !== false) { if ($current_screen->base != 'update-core') { $target = network_admin_url('update-core.php?action=do-theme-upgrade'); $data = array('new_version' => $update['new_version'], 'target' => $target, 'parent' => $parent_string, 'version' => $this->version, 'theme_name' => $this->theme_name); $view = View::render('Helper/auto-update', $data); echo $view; } } } }
/** * Set control Dependency * * @return $this * @throws \SilverWp\Helper\Control\Exception * @access public */ public function setDependency() { $args = func_get_args(); $parent_control = $args[0]; $callback_function = $args[1]; if (!$parent_control instanceof ControlInterface) { throw new Exception(Translate::translate('First arguments should by instance of \\SilverWp\\Helper\\Control\\ControlInterface')); } $this->setting['dependency'] = array('field' => $parent_control->getName(), 'function' => $callback_function); //TODO: this doesn't work yet if (isset($args[2])) { $this->setting['dependency']['value'] = $args[2]; } return $this; }