@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | load_plugin_textdomain( |
| 46 | 46 | $this->domain, |
| 47 | 47 | false, |
| 48 | - dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' |
|
| 48 | + dirname(dirname(plugin_basename(__FILE__))).'/languages/' |
|
| 49 | 49 | ); |
| 50 | 50 | |
| 51 | 51 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @since 1.0.0 |
| 57 | 57 | * @param string $domain The domain that represents the locale of this plugin. |
| 58 | 58 | */ |
| 59 | - public function set_domain( $domain ) { |
|
| 59 | + public function set_domain($domain) { |
|
| 60 | 60 | $this->domain = $domain; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | * @param int $priority Optional. he priority at which the function should be fired. Default is 10. |
| 64 | 64 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
| 65 | 65 | */ |
| 66 | - public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
| 67 | - $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
|
| 66 | + public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1) { |
|
| 67 | + $this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | * @param int $priority Optional. he priority at which the function should be fired. Default is 10. |
| 78 | 78 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1 |
| 79 | 79 | */ |
| 80 | - public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
| 81 | - $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); |
|
| 80 | + public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1) { |
|
| 81 | + $this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @param int $accepted_args The number of arguments that should be passed to the $callback. |
| 96 | 96 | * @return array The collection of actions and filters registered with WordPress. |
| 97 | 97 | */ |
| 98 | - private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
| 98 | + private function add($hooks, $hook, $component, $callback, $priority, $accepted_args) { |
|
| 99 | 99 | |
| 100 | 100 | $hooks[] = array( |
| 101 | 101 | 'hook' => $hook, |
@@ -116,12 +116,12 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function run() { |
| 118 | 118 | |
| 119 | - foreach ( $this->filters as $hook ) { |
|
| 120 | - add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
| 119 | + foreach ($this->filters as $hook) { |
|
| 120 | + add_filter($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - foreach ( $this->actions as $hook ) { |
|
| 124 | - add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
| 123 | + foreach ($this->actions as $hook) { |
|
| 124 | + add_action($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | } |
@@ -9,28 +9,28 @@ discard block |
||
| 9 | 9 | * @param array $atts An array of shortcode attributes. |
| 10 | 10 | * @return string A dom element with requested property value(s). |
| 11 | 11 | */ |
| 12 | -function wl_shortcode_field( $atts ) { |
|
| 12 | +function wl_shortcode_field($atts) { |
|
| 13 | 13 | |
| 14 | 14 | // Extract attributes and set default values. |
| 15 | - $field_atts = shortcode_atts( array( |
|
| 15 | + $field_atts = shortcode_atts(array( |
|
| 16 | 16 | 'id' => null, |
| 17 | 17 | 'name' => null |
| 18 | - ), $atts ); |
|
| 18 | + ), $atts); |
|
| 19 | 19 | |
| 20 | 20 | // Get id of the post |
| 21 | 21 | $entity_id = $field_atts['id']; |
| 22 | - if( is_null( $field_atts['id'] ) || !is_numeric( $field_atts['id'] ) ) { |
|
| 22 | + if (is_null($field_atts['id']) || ! is_numeric($field_atts['id'])) { |
|
| 23 | 23 | $entity_id = get_the_ID(); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | $property_name = $field_atts['name']; |
| 27 | - if( !is_null( $property_name ) ) { |
|
| 28 | - $values = wl_schema_get_value( $entity_id, $property_name ); |
|
| 27 | + if ( ! is_null($property_name)) { |
|
| 28 | + $values = wl_schema_get_value($entity_id, $property_name); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | // Return |
| 32 | - if( is_array( $values ) ) { |
|
| 33 | - return implode( ', ', $values ); |
|
| 32 | + if (is_array($values)) { |
|
| 33 | + return implode(', ', $values); |
|
| 34 | 34 | } else { |
| 35 | 35 | return null; |
| 36 | 36 | } |
@@ -40,5 +40,5 @@ discard block |
||
| 40 | 40 | add_shortcode('wl_field', 'wl_shortcode_field'); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | -add_action( 'init', 'wl_register_shortcode_field'); |
|
| 43 | +add_action('init', 'wl_register_shortcode_field'); |
|
| 44 | 44 | |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @return string The button HTML code. |
| 33 | 33 | */ |
| 34 | - public function get_button_html( $element_id, $label ) { |
|
| 34 | + public function get_button_html($element_id, $label) { |
|
| 35 | 35 | |
| 36 | - return sprintf( self::BUTTON_HTML, $element_id, esc_html( $label ) ); |
|
| 36 | + return sprintf(self::BUTTON_HTML, $element_id, esc_html($label)); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @return string The button HTML code. |
| 48 | 48 | */ |
| 49 | - public function print_button( $element_id, $label ) { |
|
| 49 | + public function print_button($element_id, $label) { |
|
| 50 | 50 | |
| 51 | - echo( $this->get_button_html( $element_id, $label ) ); |
|
| 51 | + echo($this->get_button_html($element_id, $label)); |
|
| 52 | 52 | |
| 53 | 53 | } |
| 54 | 54 | |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @return string The HTML code. |
| 64 | 64 | */ |
| 65 | - public function get_template_html( $element_id, $body ) { |
|
| 65 | + public function get_template_html($element_id, $body) { |
|
| 66 | 66 | |
| 67 | - return sprintf( self::TEMPLATE_HTML, $element_id, $body ); |
|
| 67 | + return sprintf(self::TEMPLATE_HTML, $element_id, $body); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @return string The HTML code. |
| 79 | 79 | */ |
| 80 | - public function print_template( $element_id, $body ) { |
|
| 80 | + public function print_template($element_id, $body) { |
|
| 81 | 81 | |
| 82 | - echo( $this->get_template_html( $element_id, $body ) ); |
|
| 82 | + echo($this->get_template_html($element_id, $body)); |
|
| 83 | 83 | |
| 84 | 84 | } |
| 85 | 85 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | // Tell WP (and PrimaShop) that we support the *prima-layout-settings*. This will display the Content Settings |
| 18 | 18 | // in the entity edit page. |
| 19 | - add_post_type_support( Wordlift_Entity_Service::TYPE_NAME, 'prima-layout-settings' ); |
|
| 19 | + add_post_type_support(Wordlift_Entity_Service::TYPE_NAME, 'prima-layout-settings'); |
|
| 20 | 20 | |
| 21 | 21 | } |
| 22 | 22 | |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @return array A meta array. |
| 33 | 33 | */ |
| 34 | - function prima_metabox_entity_header_args( $meta, $ype ) { |
|
| 34 | + function prima_metabox_entity_header_args($meta, $ype) { |
|
| 35 | 35 | |
| 36 | - return apply_filters( "prima_metabox_post_header_args", $meta, 'post' ); |
|
| 36 | + return apply_filters("prima_metabox_post_header_args", $meta, 'post'); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | } |
@@ -3,11 +3,11 @@ |
||
| 3 | 3 | // File created to manage some dynamic translation used in the code |
| 4 | 4 | // See http://keithdevon.com/using-variables-wordpress-translation-functions/ |
| 5 | 5 | |
| 6 | -__( 'There are no related posts for the current entity.', 'wordlift' ); |
|
| 7 | -__( 'This entity has not description.', 'wordlift' ); |
|
| 8 | -__( 'There are no related entities for the current entity.', 'wordlift' ); |
|
| 9 | -__( 'This entity is not published. It will not appear within analysis results.', 'wordlift' ); |
|
| 10 | -__( 'This entity has no featured image yet.', 'wordlift' ); |
|
| 11 | -__( 'There are no sameAs configured for this entity.', 'wordlift' ); |
|
| 12 | -__( 'Schema.org metadata for this entity are not completed.', 'wordlift' ); |
|
| 6 | +__('There are no related posts for the current entity.', 'wordlift'); |
|
| 7 | +__('This entity has not description.', 'wordlift'); |
|
| 8 | +__('There are no related entities for the current entity.', 'wordlift'); |
|
| 9 | +__('This entity is not published. It will not appear within analysis results.', 'wordlift'); |
|
| 10 | +__('This entity has no featured image yet.', 'wordlift'); |
|
| 11 | +__('There are no sameAs configured for this entity.', 'wordlift'); |
|
| 12 | +__('Schema.org metadata for this entity are not completed.', 'wordlift'); |
|
| 13 | 13 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function __construct() { |
| 23 | 23 | |
| 24 | - add_shortcode( static::SHORTCODE, array( $this, 'render' ) ); |
|
| 24 | + add_shortcode(static::SHORTCODE, array($this, 'render')); |
|
| 25 | 25 | |
| 26 | 26 | } |
| 27 | 27 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @return string The output html code. |
| 36 | 36 | */ |
| 37 | - public abstract function render( $atts ); |
|
| 37 | + public abstract function render($atts); |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Enqueue scripts. Called by the shortcode implementations in their render |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected function enqueue_scripts() { |
| 46 | 46 | |
| 47 | - wp_enqueue_script( 'angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' ); |
|
| 48 | - wp_enqueue_script( 'angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js', array( 'angularjs' ) ); |
|
| 49 | - wp_enqueue_script( 'wordlift-ui', dirname( plugin_dir_url( __FILE__ ) ) . '/js/wordlift-ui' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.js', array( |
|
| 47 | + wp_enqueue_script('angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js'); |
|
| 48 | + wp_enqueue_script('angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js', array('angularjs')); |
|
| 49 | + wp_enqueue_script('wordlift-ui', dirname(plugin_dir_url(__FILE__)).'/js/wordlift-ui'.( ! defined('SCRIPT_DEBUG') || ! SCRIPT_DEBUG ? '.min' : '').'.js', array( |
|
| 50 | 50 | 'jquery', |
| 51 | 51 | 'angularjs', |
| 52 | 52 | 'angularjs-touch' |
| 53 | - ) ); |
|
| 53 | + )); |
|
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @param \Wordlift_Property_Service $default_property_service |
| 31 | 31 | */ |
| 32 | - public function __construct( $default_property_service ) { |
|
| 32 | + public function __construct($default_property_service) { |
|
| 33 | 33 | |
| 34 | 34 | $this->default_property_service = $default_property_service; |
| 35 | 35 | |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | * @param string $meta_key WordPress' meta key. |
| 44 | 44 | * @param \Wordlift_Property_Service $property_service A {@link Wordlift_Property_Service} instance. |
| 45 | 45 | */ |
| 46 | - public function register( $meta_key, $property_service ) { |
|
| 46 | + public function register($meta_key, $property_service) { |
|
| 47 | 47 | |
| 48 | - $this->property_services[ $meta_key ] = $property_service; |
|
| 48 | + $this->property_services[$meta_key] = $property_service; |
|
| 49 | 49 | |
| 50 | 50 | } |
| 51 | 51 | |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @return \Wordlift_Property_Service The {@link Wordlift_Property_Service} which handles the specified meta key. |
| 60 | 60 | */ |
| 61 | - public function get( $meta_key ) { |
|
| 61 | + public function get($meta_key) { |
|
| 62 | 62 | |
| 63 | - return $this->property_services[ $meta_key ] ?: $this->default_property_service; |
|
| 63 | + return $this->property_services[$meta_key] ?: $this->default_property_service; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | } |
| 67 | 67 | \ No newline at end of file |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | function __construct() { |
| 28 | 28 | |
| 29 | 29 | // If we are not on the admin, run the get_term filter for entity type terms. |
| 30 | - add_filter( 'get_wl_entity_type', array( |
|
| 30 | + add_filter('get_wl_entity_type', array( |
|
| 31 | 31 | $this, |
| 32 | 32 | 'get_wl_entity_type', |
| 33 | - ), 10, 2 ); |
|
| 33 | + ), 10, 2); |
|
| 34 | 34 | |
| 35 | 35 | } |
| 36 | 36 | |
@@ -45,35 +45,35 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @return WP_Term The {@link WP_Term} with fields changed. |
| 47 | 47 | */ |
| 48 | - function get_wl_entity_type( $term, $taxonomy ) { |
|
| 48 | + function get_wl_entity_type($term, $taxonomy) { |
|
| 49 | 49 | |
| 50 | 50 | // Do nothing when in admin. |
| 51 | - if ( is_admin() ) { |
|
| 51 | + if (is_admin()) { |
|
| 52 | 52 | return $term; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // Get the terms' settings. |
| 56 | - $entity_settings = get_option( 'wl_entity_type_settings', array() ); |
|
| 56 | + $entity_settings = get_option('wl_entity_type_settings', array()); |
|
| 57 | 57 | |
| 58 | 58 | // If we have no settings for the specified term, then return the original |
| 59 | 59 | // term. |
| 60 | - if ( ! isset( $entity_settings[ $term->term_id ] ) ) { |
|
| 60 | + if ( ! isset($entity_settings[$term->term_id])) { |
|
| 61 | 61 | |
| 62 | 62 | return $term; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // Get the settings for the specified term. |
| 66 | - $settings = $entity_settings[ $term->term_id ]; |
|
| 66 | + $settings = $entity_settings[$term->term_id]; |
|
| 67 | 67 | |
| 68 | 68 | // Update the name. |
| 69 | - if ( ! empty( $settings['title'] ) ) { |
|
| 69 | + if ( ! empty($settings['title'])) { |
|
| 70 | 70 | |
| 71 | 71 | $term->name = $settings['title']; |
| 72 | 72 | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // Update the description. |
| 76 | - if ( ! empty( $settings['description'] ) ) { |
|
| 76 | + if ( ! empty($settings['description'])) { |
|
| 77 | 77 | |
| 78 | 78 | $term->description = $settings['description']; |
| 79 | 79 | |